Switch warehouse matching to use IDs
This commit is contained in:
@@ -31,12 +31,15 @@ namespace BLL
|
||||
from warehouseperson in warehousepersons.DefaultIfEmpty()
|
||||
join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units
|
||||
from unit in units.DefaultIfEmpty()
|
||||
join warehouse in Funs.DB.Base_Warehouse on x.WarehouseId equals warehouse.WarehouseId into warehouses
|
||||
from warehouse in warehouses.DefaultIfEmpty()
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) &&
|
||||
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
||||
(string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) &&
|
||||
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) &&
|
||||
(string.IsNullOrEmpty(table.WarehouseId) || x.WarehouseId == table.WarehouseId) &&
|
||||
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode) || x.WarehouseId.Contains(table.WarehouseCode)) &&
|
||||
(string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) &&
|
||||
(string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
|
||||
(table.TypeInt == null || x.TypeInt == table.TypeInt) &&
|
||||
@@ -48,7 +51,9 @@ namespace BLL
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
WarehouseId = x.WarehouseId,
|
||||
WarehouseCode = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
|
||||
WarehouseName = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
|
||||
Source = x.Source,
|
||||
Category = x.Category,
|
||||
TypeInt = x.TypeInt,
|
||||
@@ -93,7 +98,9 @@ namespace BLL
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseId = x.WarehouseId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
WarehouseName = x.WarehouseName,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
@@ -133,7 +140,9 @@ namespace BLL
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseId = x.WarehouseId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
WarehouseName = x.WarehouseName,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
@@ -172,7 +181,8 @@ namespace BLL
|
||||
ProjectId = newtable.ProjectId,
|
||||
InOutPlanMasterId = newtable.InOutPlanMasterId,
|
||||
CusBillCode = newtable.CusBillCode,
|
||||
WarehouseCode = newtable.WarehouseCode,
|
||||
WarehouseId = newtable.WarehouseId,
|
||||
WarehouseCode = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId) ?? newtable.WarehouseCode,
|
||||
Category = newtable.Category,
|
||||
Source = newtable.Source,
|
||||
TypeInt = newtable.TypeInt,
|
||||
@@ -200,7 +210,8 @@ namespace BLL
|
||||
table.ProjectId = newtable.ProjectId;
|
||||
table.InOutPlanMasterId = newtable.InOutPlanMasterId;
|
||||
table.CusBillCode = newtable.CusBillCode;
|
||||
table.WarehouseCode = newtable.WarehouseCode;
|
||||
table.WarehouseId = newtable.WarehouseId;
|
||||
table.WarehouseCode = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId) ?? newtable.WarehouseCode;
|
||||
table.Category = newtable.Category;
|
||||
table.Source = newtable.Source;
|
||||
table.TypeInt = newtable.TypeInt;
|
||||
@@ -258,6 +269,7 @@ namespace BLL
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
InOutPlanMasterId = plan.Id,
|
||||
ProjectId = plan.ProjectId,
|
||||
WarehouseId = plan.WarehouseId,
|
||||
WarehouseCode = plan.WarehouseCode,
|
||||
Source = plan.Source,
|
||||
TypeInt = plan.TypeInt,
|
||||
@@ -289,7 +301,7 @@ namespace BLL
|
||||
};
|
||||
TwInputdetailService.Add(detailTable);
|
||||
TwInputdetailBarCodeService.AddByInputDetail(master, detailTable);
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detailTable.ActNum);
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseId, TwConst.InOutType.入库, detailTable.ActNum);
|
||||
|
||||
}
|
||||
var planTable = TwInOutplanmasterService.GetById(plan.Id);
|
||||
@@ -330,7 +342,7 @@ namespace BLL
|
||||
{
|
||||
TwInputdetailService.DeleteById(detail.Id);
|
||||
//撤销入库,即减去库存
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.出库, detail.ActNum);
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseId, TwConst.InOutType.出库, detail.ActNum);
|
||||
}
|
||||
plan.State = (int)TwConst.State.已审核;
|
||||
TwInOutplanmasterService.Update(plan);
|
||||
|
||||
Reference in New Issue
Block a user