采购入库代码部分重写,回传bip调整,采购订单接收调整、小件移库到三层货架

This commit is contained in:
2024-09-29 18:10:14 +08:00
parent e6a0066616
commit 6517149d58
9 changed files with 396 additions and 230 deletions

View File

@@ -60,6 +60,7 @@ using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
using Org.BouncyCastle.Bcpg.OpenPgp;
using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Entitys.System;
namespace Tnb.ProductionMgr
{
@@ -716,11 +717,71 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
return;
}
#region
var carry_mats = await db_YCLInternalTransfer.Queryable<WmsCarryCode>()
.InnerJoin<BasMaterial>((a, b) => a.material_id == b.id)
.Where((a, b) => items.Select(r => r.id).Contains(a.carry_id)).Select((a, b) => new carry_matEntity
{
carry_id = a.carry_id,
material_code = b.code,
categorys = b.category_id
}).ToListAsync();
foreach (var row in carry_mats)
{
row.category_list = JsonConvert.DeserializeObject<List<string>>(row.categorys);
}
var basRegionMats = await db_YCLInternalTransfer.Queryable<BasRegionMat>()
.InnerJoin<DictionaryDataEntity>((a, b) => a.material_type == b.Id).Select((a, b) => new
{
region_id = a.region_id,
region_code = a.region_code,
category = b.EnCode
}).ToListAsync();
for (int carry_mat_index = 0; carry_mat_index < carry_mats.Count; carry_mat_index++)
{
var carry_mat = carry_mats[carry_mat_index];
foreach (var basRegionMat in basRegionMats)
{
if (!carry_mat.category_list.Contains(basRegionMat.category))
{
carry_mats.RemoveAt(carry_mat_index); carry_mat_index--;
}
else
{
carry_mat.category = basRegionMat.category;
carry_mat.region_id = basRegionMat.region_id;
carry_mat.region_code = basRegionMat.region_code;
}
}
}
#endregion
foreach (WmsCarryH wmsCarryH in items)
{
BasLocation startlocation = await db_YCLInternalTransfer.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).FirstAsync();
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = "1", Size = 1, passage = startlocation.passage, AvoidBusyPassage = true, Region_id = WmsWareHouseConst.REGION_Purchase_ID, PolicyCode = WmsWareHouseConst.POLICY_YCLINSTOCK };
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
InStockStrategyQuery inStockStrategyInput = null;
List<BasLocation> endLocations = new List<BasLocation>();
// 小件物料入外协存储区
var carry_mat = carry_mats.Where(r => r.carry_id == wmsCarryH.id).First();
if (carry_mat != null && !string.IsNullOrEmpty(carry_mat.category))
{
inStockStrategyInput = new() { warehouse_id = "1", Size = 1, passage = startlocation.passage, AvoidBusyPassage = true, Region_id = carry_mat.region_id, PolicyCode = WmsWareHouseConst.POLICY_YCLINSTOCK };
endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
LoggerYCLInternalTransfer.LogInformation($"【ScanInStockByRedis】托盘物料{carry_mat.material_code} 物料类型为{carry_mat.category} 配置的入库区域为{carry_mat.region_code} 巷道{startlocation.passage} 托盘{wmsCarryH.carry_code}在检查外协存储区库存时找到可入库位数量为{endLocations.Count}");
}
if (endLocations?.Count == 0)
{
inStockStrategyInput = new() { warehouse_id = "1", Size = 1, passage = startlocation.passage, AvoidBusyPassage = true, Region_id = WmsWareHouseConst.REGION_Purchase_ID, PolicyCode = WmsWareHouseConst.POLICY_YCLINSTOCK };
endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
LoggerYCLInternalTransfer.LogInformation($"【ScanInStockByRedis】托盘{wmsCarryH.carry_code} 巷道{startlocation.passage} 在检查采购存储区库存时找到可入库位数量为{endLocations.Count}");
}
if (endLocations.Count() == 0)
{
LoggerYCLInternalTransfer.LogWarning($"【YCLInternalTransfer】 当前巷道没有空库位可以入库或者有任务正在执行");
@@ -3636,5 +3697,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
public decimal? codeqty { get; set; }
public string unit_code { get; set; }
}
public class carry_matEntity
{
public string carry_id { get; set; }
public string material_code { get; set; }
public string region_id { get; set; }
public string region_code { get; set; }
public string categorys { get; set; }
public string category { get; set; }
public List<string> category_list { get; set; }
}
}
}