Switch warehouse matching to use IDs

This commit is contained in:
2026-06-24 23:25:06 +08:00
parent 4670220614
commit bd9b5a6f4d
27 changed files with 776 additions and 419 deletions
+19 -7
View File
@@ -39,12 +39,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)) &&
(string.IsNullOrEmpty(table.UnitWorkId) || y.WeldTaskId.Contains(table.UnitWorkId)) &&
@@ -58,7 +61,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,
Category = x.Category,
Source = x.Source,
TypeInt = x.TypeInt,
@@ -105,7 +110,9 @@ namespace BLL
Id = x.Id,
ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode,
WarehouseId = x.WarehouseId,
WarehouseCode = x.WarehouseCode,
WarehouseName = x.WarehouseName,
InOutPlanMasterId = x.InOutPlanMasterId,
Source = x.Source,
TypeInt = x.TypeInt,
@@ -152,7 +159,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,
@@ -197,7 +206,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,
@@ -226,7 +236,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;
@@ -285,6 +296,7 @@ namespace BLL
InOutPlanMasterId = plan.Id,
ProjectId = plan.ProjectId,
CusBillCode = GetCusBillCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt, (BLL.TwConst.Category)plan.Category, plan.CusBillCode),
WarehouseId = plan.WarehouseId,
WarehouseCode = plan.WarehouseCode,
Category = plan.Category,
Source = plan.Source,
@@ -314,7 +326,7 @@ namespace BLL
ActNum = detail.ActNum,
};
TwOutputdetailService.Add(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);
}
plan.State = (int)TwConst.State.;
@@ -344,7 +356,7 @@ namespace BLL
{
TwOutputdetailService.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);
}
var planModel = TwInOutplanmasterService.GetById(planId);
planModel.State = (int)TwConst.State.;
@@ -402,4 +414,4 @@ namespace BLL
}
}
}