Switch warehouse matching to use IDs
This commit is contained in:
@@ -13,7 +13,10 @@ namespace BLL
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string WarehouseId = Base_WarehouseService.GetWarehouseList(projectid).Where(x => x.WarehouseName == WarehouseCode).Select(x => x.WarehouseId).FirstOrDefault();
|
||||
string WarehouseId = Base_WarehouseService.GetWarehouseList(projectid)
|
||||
.Where(x => x.WarehouseId == WarehouseCode || x.WarehouseName == WarehouseCode)
|
||||
.Select(x => x.WarehouseId)
|
||||
.FirstOrDefault();
|
||||
///所需材料数量列表
|
||||
var NeedOutMateriaList = from x in db.HJGL_PipeLineMat
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
@@ -30,7 +33,7 @@ namespace BLL
|
||||
var RealInMateriaList = (from x in db.Tw_InputDetail
|
||||
join master in db.Tw_InputMaster on x.InputMasterId equals master.Id
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
where master.ProjectId == projectid && master.WarehouseCode == WarehouseCode
|
||||
where master.ProjectId == projectid && master.WarehouseId == WarehouseId
|
||||
group x by x.MaterialCode
|
||||
into g
|
||||
where (string.IsNullOrEmpty(materialCode) || g.Key.Contains(materialCode))
|
||||
@@ -41,7 +44,7 @@ namespace BLL
|
||||
}).ToList();
|
||||
//库存数量
|
||||
var tw_MaterialStock = (from x in db.Tw_MaterialStock
|
||||
where x.WarehouseCode == WarehouseCode && x.ProjectId == projectid
|
||||
where x.WarehouseId == WarehouseId && x.ProjectId == projectid
|
||||
select x).ToList();
|
||||
|
||||
var needMateriaList = NeedOutMateriaList.ToList();
|
||||
@@ -98,7 +101,7 @@ namespace BLL
|
||||
{
|
||||
Tw_MaterialStockOutput twMaterialStockOutput = new Tw_MaterialStockOutput
|
||||
{
|
||||
WarehouseCode = warehouseCode,
|
||||
WarehouseId = warehouseCode,
|
||||
ProjectId = projectId
|
||||
};
|
||||
var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStockOutput).ToList();//获取库存列表
|
||||
@@ -110,7 +113,7 @@ namespace BLL
|
||||
join master in db.Tw_InOutPlanMaster on detail.InOutPlanMasterId equals master.Id
|
||||
where master.InOutType == (int)TwConst.InOutType.出库
|
||||
&& (master.State == (int)TwConst.State.待审核 || master.State == (int)TwConst.State.已审核)
|
||||
&& master.WarehouseCode == warehouseCode
|
||||
&& master.WarehouseId == warehouseCode
|
||||
&& master.ProjectId == projectId
|
||||
group detail by detail.MaterialCode into g
|
||||
select new
|
||||
@@ -178,7 +181,7 @@ namespace BLL
|
||||
List<string> pipelineIds = new List<string>();
|
||||
pipelineIds.Add(pipelineId);
|
||||
var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId);
|
||||
string warehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(pipelineModel.PipelineId).WarehouseId).WarehouseName;
|
||||
string warehouseCode = PipelineService.GetPipelineByPipelineId(pipelineModel.PipelineId).WarehouseId;
|
||||
var PipeMatMatch = GetPipeMatMatch(pipelineModel.ProjectId, pipelineIds, warehouseCode);
|
||||
var pipeMatchRate = GetPipeMatch(PipeMatMatch).FirstOrDefault(x => x.PipelineId == pipelineId);
|
||||
return pipeMatchRate?.MatchRate;
|
||||
@@ -240,7 +243,7 @@ namespace BLL
|
||||
}
|
||||
|
||||
var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
|
||||
results = GetMatMatchOutput(requiredMaterials, masterModle.WarehouseCode, masterModle.ProjectId);
|
||||
results = GetMatMatchOutput(requiredMaterials, masterModle.WarehouseId, masterModle.ProjectId);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user