原材料转库逻辑变更
This commit is contained in:
@@ -269,4 +269,9 @@ public partial class BasMaterial : BaseEntity<string>
|
||||
/// </summary>
|
||||
public int? deleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
public string? material_specification { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -212,26 +212,22 @@ namespace Tnb.ProductionMgr
|
||||
coderesult = coderesult.Replace("\r", "");
|
||||
|
||||
|
||||
Logger.LogInformation($@"【定时任务CheckGet】 成功取到{strs[2]}值:{coderesult}");
|
||||
var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.carry_code == coderesult && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID && string.IsNullOrEmpty(p.extras)).First();
|
||||
|
||||
|
||||
if (DistaskH != null)
|
||||
{
|
||||
Logger.LogInformation($@"【定时任务CheckGet】 DistaskH != null");
|
||||
Logger.LogInformation($@"【定时任务CheckGet】 成功找到载具:{coderesult} 对应的任务执行单{DistaskH.bill_code}");
|
||||
dynamic reqBody = new ExpandoObject();
|
||||
reqBody.taskCode = DistaskH.bill_code;
|
||||
reqBody.slotCode = key;
|
||||
reqBody.containerCode = coderesult;
|
||||
CancellationTokenSource Ctu = new();
|
||||
if (strs[0] == "东面提升机输送线")
|
||||
{
|
||||
Logger.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo 载具:{coderesult}");
|
||||
}
|
||||
Logger.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo 载具:{coderesult}");
|
||||
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||
if (strs[0] == "东面提升机输送线")
|
||||
{
|
||||
Logger.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
|
||||
}
|
||||
|
||||
Logger.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
|
||||
DistaskH.extras = respBody;
|
||||
_repository.AsSugarClient().Updateable(DistaskH).ExecuteCommand();
|
||||
Ctu.Dispose();
|
||||
@@ -248,22 +244,22 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation($@"【定时任务CheckGet】 DistaskH == null");
|
||||
var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.startlocation_code == key && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID && string.IsNullOrEmpty(p.extras)).First();
|
||||
if (DistaskH != null)
|
||||
{
|
||||
dynamic reqBody = new ExpandoObject();
|
||||
reqBody.taskCode = DistaskH.bill_code;
|
||||
reqBody.slotCode = key;
|
||||
reqBody.containerCode = DistaskH.carry_code;
|
||||
CancellationTokenSource Ctu = new();
|
||||
Logger.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo ");
|
||||
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||
Logger.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
|
||||
DistaskH.extras = respBody;
|
||||
_repository.AsSugarClient().Updateable(DistaskH).ExecuteCommand();
|
||||
Ctu.Dispose();
|
||||
}
|
||||
Logger.LogInformation($@"【定时任务CheckGet】 strs[2]信号为空 {strs[2]}");
|
||||
//var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.startlocation_code == key && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID && string.IsNullOrEmpty(p.extras)).First();
|
||||
//if (DistaskH != null)
|
||||
//{
|
||||
// dynamic reqBody = new ExpandoObject();
|
||||
// reqBody.taskCode = DistaskH.bill_code;
|
||||
// reqBody.slotCode = key;
|
||||
// reqBody.containerCode = DistaskH.carry_code;
|
||||
// CancellationTokenSource Ctu = new();
|
||||
// Logger.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo ");
|
||||
// dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||
// Logger.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
|
||||
// DistaskH.extras = respBody;
|
||||
// _repository.AsSugarClient().Updateable(DistaskH).ExecuteCommand();
|
||||
// Ctu.Dispose();
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1095,6 +1091,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
{"上升降机请求送空托1","二楼上升降机机械臂左"},
|
||||
{"上升降机请求送空托2","二楼上升降机机械臂右"},
|
||||
{"下升降机请求送满托1","二楼下升降机机械臂左"},
|
||||
{"下升降机请求送满托2","二楼下升降机机械臂右"},
|
||||
{"上升降机请求取满托1","二楼上升降机机械臂左"},
|
||||
{"上升降机请求取满托2","二楼上升降机机械臂右"},
|
||||
{"下升降机请求取空托1","二楼下升降机机械臂左"},
|
||||
{"下升降机请求取空托2","二楼下升降机机械臂右"},
|
||||
};
|
||||
/// <summary>
|
||||
/// 送空托到上升降区
|
||||
@@ -1104,12 +1106,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
#region 检查信号
|
||||
List<string> configs_upMachine = new List<string>();
|
||||
bool 上升降机请求送空托1 = await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求送空托1");
|
||||
bool 上升降机请求送空托2 = await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求送空托2");
|
||||
if (await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求送空托1"))
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError($"【送空托到上升降区】上升降机请求送空托1 true");
|
||||
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求送空托1"]);
|
||||
}
|
||||
if (await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求送空托2"))
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError($"【送空托到上升降区】上升降机请求送空托2 true");
|
||||
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求送空托2"]);
|
||||
}
|
||||
|
||||
// 没有有效信号
|
||||
if (configs_upMachine.Count == 0)
|
||||
@@ -1224,10 +1230,27 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// <returns></returns>
|
||||
public async Task<bool> 送满托到下升降区()
|
||||
{
|
||||
#region 检查信号
|
||||
List<string> configs_upMachine = new List<string>();
|
||||
if (await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求送满托1"))
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】下升降机请求送满托1 true");
|
||||
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求送满托1"]);
|
||||
}
|
||||
if (await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求送满托2"))
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】下升降机请求送满托2 true");
|
||||
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求送满托2"]);
|
||||
}
|
||||
|
||||
// 没有有效信号
|
||||
if (configs_upMachine.Count == 0)
|
||||
return false;
|
||||
#endregion
|
||||
|
||||
|
||||
using (var db = _repository.AsSugarClient().CopyNew())
|
||||
{
|
||||
string[] configs_upMachine = new string[2] { "二楼下升降机机械臂左", "二楼下升降机机械臂右" };
|
||||
|
||||
// 找到没有绑定料架的且库位未锁定的料架区
|
||||
ISugarQueryable<WmsMechanicalArmH> WmsMechanicalArmHsuagar = db.Queryable<WmsMechanicalArmH>().
|
||||
InnerJoin<WmsPointH>((a, b) => a.point_id == b.id)
|
||||
@@ -1245,14 +1268,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
// 料架区
|
||||
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
|
||||
{
|
||||
|
||||
bool 下升降机请求送满托 = await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求送满托{wmsMechanicalArmH.stackingposition}");
|
||||
if (!下升降机请求送满托)
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogWarning($"【送满托到下升降区】 料架区 {wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 下升降机请求送满托{wmsMechanicalArmH.stackingposition}信号不为true");
|
||||
return false;
|
||||
}
|
||||
|
||||
//bool 下升降机请求送满托 = await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求送满托{wmsMechanicalArmH.stackingposition}");
|
||||
//if (!下升降机请求送满托)
|
||||
//{
|
||||
// LoggerFloor2RackDelivery.LogWarning($"【送满托到下升降区】 料架区 {wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 下升降机请求送满托{wmsMechanicalArmH.stackingposition}信号不为true");
|
||||
// return false;
|
||||
//}
|
||||
|
||||
// 找到占用且未锁定的库位上的满料架且料架中的料箱是空的
|
||||
List<BasLocation> rackStartLocations =
|
||||
@@ -1337,11 +1358,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
is_lock = 1
|
||||
}).Where(r => r.id == endPoint.location_id).ExecuteCommandAsync();
|
||||
//await _repository.AsSugarClient().Updateable<WmsPointH>().SetColumns(r => new WmsPointH
|
||||
//{
|
||||
// is_lock = 1
|
||||
//}).Where(r => r.id == endPoint.id).ExecuteCommandAsync();
|
||||
|
||||
|
||||
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startPoint.point_code} 终点{endPoint.point_code} 料架 {targetCarry.carry_code}");
|
||||
List<WmsPointH> points = new List<WmsPointH>();
|
||||
@@ -1365,9 +1381,26 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// <returns></returns>
|
||||
public async Task<bool> 移走上升降区未生成预任务且满托的料架()
|
||||
{
|
||||
#region 检查信号
|
||||
List<string> configs_upMachine = new List<string>();
|
||||
if (await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求取满托1"))
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError($"【移走上升降区未生成预任务且满托的料架】上升降机请求取满托1 true");
|
||||
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求取满托1"]);
|
||||
}
|
||||
if (await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求取满托2"))
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError($"【移走上升降区未生成预任务且满托的料架】上升降机请求取满托2 true");
|
||||
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求取满托2"]);
|
||||
}
|
||||
|
||||
// 没有有效信号
|
||||
if (configs_upMachine.Count == 0)
|
||||
return false;
|
||||
#endregion
|
||||
|
||||
using (var db = _repository.AsSugarClient().CopyNew())
|
||||
{
|
||||
string[] configs_upMachine = new string[2] { "二楼上升降机机械臂左", "二楼上升降机机械臂右" };
|
||||
// 读取上升降机的左右料架区配置
|
||||
|
||||
List<WmsMechanicalArmH> WmsMechanicalArmHs = db.Queryable<WmsMechanicalArmH>().Where(r => r.stackingcount == r.maxnum && r.maxnum != 0 && !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name) && r.mechanicalconfirm == 1).ToList();
|
||||
@@ -1378,13 +1411,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 开始执行预任务生成 {wmsMechanicalArmH.point_code} {wmsMechanicalArmH.outbill} {wmsMechanicalArmH.barcodes}");
|
||||
try
|
||||
{
|
||||
// 判断是否 上升降机请求取满托
|
||||
bool 上升降机请求取满托 = await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求取满托{wmsMechanicalArmH.stackingposition}");
|
||||
LoggerFloor2RackDelivery.LogError($"【移走上升降区满托的料架】上升降机请求取满托{wmsMechanicalArmH.stackingposition} {上升降机请求取满托}");
|
||||
if (!上升降机请求取满托)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//// 判断是否 上升降机请求取满托
|
||||
//bool 上升降机请求取满托 = await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求取满托{wmsMechanicalArmH.stackingposition}");
|
||||
//LoggerFloor2RackDelivery.LogError($"【移走上升降区满托的料架】上升降机请求取满托{wmsMechanicalArmH.stackingposition} {上升降机请求取满托}");
|
||||
//if (!上升降机请求取满托)
|
||||
//{
|
||||
// continue;
|
||||
//}
|
||||
|
||||
await db.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
||||
{
|
||||
@@ -1471,9 +1504,26 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// <returns></returns>
|
||||
public async Task<bool> 移走下升降区未生成预任务且空托的料架()
|
||||
{
|
||||
#region 检查信号
|
||||
List<string> configs_upMachine = new List<string>();
|
||||
if (await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求取空托1"))
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托1 true");
|
||||
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求取空托1"]);
|
||||
}
|
||||
|
||||
if (await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求取空托2"))
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托2 true");
|
||||
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求取空托2"]);
|
||||
}
|
||||
|
||||
// 没有有效信号
|
||||
if (configs_upMachine.Count == 0)
|
||||
return false;
|
||||
#endregion
|
||||
using (var db = _repository.AsSugarClient().CopyNew())
|
||||
{
|
||||
string[] configs_upMachine = new string[2] { "二楼下升降机机械臂左", "二楼下升降机机械臂右" };
|
||||
// 读取下升降机的左右料架区配置
|
||||
|
||||
List<WmsMechanicalArmH> WmsMechanicalArmHs = db.Queryable<WmsMechanicalArmH>().Where(r => !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name)).ToList();
|
||||
@@ -1482,13 +1532,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
try
|
||||
{
|
||||
// 判断是否 上升降机请求取满托
|
||||
bool 下升降机请求取空托 = await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求取空托{wmsMechanicalArmH.stackingposition}");
|
||||
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托{wmsMechanicalArmH.stackingposition} {下升降机请求取空托}" );
|
||||
if (!下升降机请求取空托)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//// 判断是否 上升降机请求取满托
|
||||
//bool 下升降机请求取空托 = await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求取空托{wmsMechanicalArmH.stackingposition}");
|
||||
//LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托{wmsMechanicalArmH.stackingposition} {下升降机请求取空托}" );
|
||||
//if (!下升降机请求取空托)
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 开始执行预任务生成 {wmsMechanicalArmH.point_code} {wmsMechanicalArmH.outbill} {wmsMechanicalArmH.barcodes}");
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
{
|
||||
public class WmsWareHouseConst
|
||||
{
|
||||
/// <summary>
|
||||
/// 集中供料仓
|
||||
/// </summary>
|
||||
public const string WAREHOUSE_JZGL_ID = "34377195181845";
|
||||
/// <summary>
|
||||
/// 原材料仓ID
|
||||
/// </summary>
|
||||
@@ -303,29 +307,29 @@
|
||||
public const string CHECKSTATUS_PDJZ_ID = "27584597303317";
|
||||
|
||||
/// <summary>
|
||||
/// 一楼成品出库工位
|
||||
/// 一楼供料三工位库位
|
||||
/// </summary>
|
||||
public const string FinishproductOutstockStation1 = "30018211902485";
|
||||
public const string Floor1GLSGWOutstockStation1 = "30773146852476";
|
||||
/// <summary>
|
||||
/// 一楼成品出库工位
|
||||
/// 一楼供料三工位库位
|
||||
/// </summary>
|
||||
public const string FinishproductOutstockStation2 = "30018225923349";
|
||||
public const string Floor1GLSGWOutstockStation2 = "30773146852477";
|
||||
/// <summary>
|
||||
/// 一楼成品出库工位
|
||||
/// 一楼供料三工位库位
|
||||
/// </summary>
|
||||
public const string FinishproductOutstockStation3 = "30018217822229";
|
||||
public const string Floor1GLSGWOutstockStation3 = "30773146852478";
|
||||
/// <summary>
|
||||
/// 一楼三工位库位
|
||||
/// todo 一楼外协三工位库位
|
||||
/// </summary>
|
||||
public const string Floor1SGWOutstockStation1 = "30773146852476";
|
||||
public const string Floor1WXSGWOutstockStation1 = "111";
|
||||
/// <summary>
|
||||
/// 一楼三工位库位
|
||||
/// todo 一楼外协三工位库位
|
||||
/// </summary>
|
||||
public const string Floor1SGWOutstockStation2 = "30773146852477";
|
||||
public const string Floor1WXSGWOutstockStation2 = "222";
|
||||
/// <summary>
|
||||
/// 一楼三工位库位
|
||||
/// todo 一楼外协三工位库位
|
||||
/// </summary>
|
||||
public const string Floor1SGWOutstockStation3 = "30773146852478";
|
||||
public const string Floor1WXSGWOutstockStation3 = "333";
|
||||
/// <summary>
|
||||
/// 分拣任务生成Encode
|
||||
/// </summary>
|
||||
|
||||
@@ -13,13 +13,25 @@
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; }
|
||||
///// <summary>
|
||||
///// 物料数量
|
||||
///// </summary>
|
||||
//public decimal qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据id
|
||||
/// </summary>
|
||||
public string? source_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料数量
|
||||
/// </summary>
|
||||
public decimal qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 托盘数
|
||||
/// </summary>
|
||||
public int palletCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string? code_batch { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,4 +86,10 @@ public partial class WmsMaterialTransferD : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? bill_id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 物料描述
|
||||
/// </summary>
|
||||
public string? material_ex { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -48,11 +48,18 @@ namespace Tnb.WarehouseMgr.Interfaces
|
||||
string[] GetFloor1OutstockLocation();
|
||||
|
||||
/// <summary>
|
||||
/// 是否为三工位库位
|
||||
/// 是否为供料三工位库位
|
||||
/// </summary>
|
||||
/// <param name="location_id"></param>
|
||||
/// <returns></returns>
|
||||
string[] GetFloor1SGWOutstockLocation();
|
||||
string[] GetFloor1GLSGWOutstockLocation();
|
||||
|
||||
/// <summary>
|
||||
/// 是否为外协三工位库位
|
||||
/// </summary>
|
||||
/// <param name="location_id"></param>
|
||||
/// <returns></returns>
|
||||
string[] GetFloor1WXSGWOutstockLocation();
|
||||
|
||||
/// <summary>
|
||||
/// 生成预任务
|
||||
|
||||
@@ -233,21 +233,34 @@ namespace Tnb.WarehouseMgr
|
||||
/// <returns></returns>
|
||||
public string[] GetFloor1OutstockLocation()
|
||||
{
|
||||
return new string[3] { WmsWareHouseConst.FinishproductOutstockStation1 , WmsWareHouseConst.FinishproductOutstockStation2
|
||||
, WmsWareHouseConst.FinishproductOutstockStation3 };
|
||||
return new string[23] { "30018211902485", "34355463261205", "34355450098709", "34355446145813"
|
||||
, "34355443336981", "34355440377365", "34355436327189", "34355432397077", "34355428852501", "34355424568341"
|
||||
, "34355421064213", "34355416966165", "34355407509269", "34355402216469", "34355397484565", "34355394965013"
|
||||
, "34355391740181", "34355387110933", "34355383562005", "34355377989397", "34355374481173", "34355369617173"
|
||||
, "30018211902485"};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否为三工位库位
|
||||
/// 是否为供料三工位库位
|
||||
/// </summary>
|
||||
/// <param name="location_id"></param>
|
||||
/// <returns></returns>
|
||||
public string[] GetFloor1SGWOutstockLocation()
|
||||
public string[] GetFloor1GLSGWOutstockLocation()
|
||||
{
|
||||
return new string[3] { WmsWareHouseConst.Floor1SGWOutstockStation1 , WmsWareHouseConst.Floor1SGWOutstockStation2
|
||||
, WmsWareHouseConst.Floor1SGWOutstockStation3 };
|
||||
return new string[3] { WmsWareHouseConst.Floor1GLSGWOutstockStation1 , WmsWareHouseConst.Floor1GLSGWOutstockStation2
|
||||
, WmsWareHouseConst.Floor1GLSGWOutstockStation3 };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否为外协三工位库位
|
||||
/// </summary>
|
||||
/// <param name="location_id"></param>
|
||||
/// <returns></returns>
|
||||
public string[] GetFloor1WXSGWOutstockLocation()
|
||||
{
|
||||
return new string[3] { WmsWareHouseConst.Floor1WXSGWOutstockStation1 , WmsWareHouseConst.Floor1WXSGWOutstockStation2
|
||||
, WmsWareHouseConst.Floor1WXSGWOutstockStation3 };
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 出库策略-销售出库下发
|
||||
@@ -310,7 +323,7 @@ namespace Tnb.WarehouseMgr
|
||||
public async Task<List<WmsCarryH>> OutStockStrategy([FromQuery] OutStockStrategyQuery input)
|
||||
{
|
||||
Expressionable<WmsCarryH, WmsCarryCode, BasLocation> whereExprable = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
||||
.And((a, b, c) => a.is_lock == 0)
|
||||
.And((a, b, c) => a.is_lock == 0 && c.is_lock == 0)
|
||||
.And((a, b, c) => !string.IsNullOrEmpty(a.location_id))
|
||||
.And((a, b, c) => c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.And((a, b, c) => a.out_status == "0")
|
||||
@@ -2526,6 +2539,21 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.LogInformation($"【CommonCreatePretask】 GenPreTask 结果 {result}");
|
||||
if (result)
|
||||
{
|
||||
GenPreTaskUpInput preTaskUpInput = new()
|
||||
{
|
||||
RquireId = input.require_id,
|
||||
CarryId = carry_id,
|
||||
CarryStartLocationId = points.FirstOrDefault()!.location_id!,
|
||||
CarryStartLocationCode = points.FirstOrDefault()!.location_code!,
|
||||
LocationIds = points.Select(x => x.location_id).ToList()!
|
||||
};
|
||||
|
||||
//根据载具移入Id,回更单据状态
|
||||
_ = await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
|
||||
await GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
Logger.LogInformation($"【CommonCreatePretask】 成功生成预任务:{preTasks.First().bill_code}");
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using JNPF.Common.Enums;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
@@ -73,6 +76,34 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
SqlSugarPagedList<WmsMaterialTransfer> result = await _db.Queryable<WmsMaterialTransfer>()
|
||||
.InnerJoin<DictionaryDataEntity>((a, b) => a.status == b.Id)
|
||||
.InnerJoin<UserEntity>((a, b, c) => c.Id == a.create_id)
|
||||
.InnerJoin<BasWarehouse>((a, b, c, d) => d.id == a.warehouse_outstock)
|
||||
.InnerJoin<BasWarehouse>((a, b, c, d, e) => e.id == a.warehouse_instock)
|
||||
.Select((a, b, c, d, e) => new WmsMaterialTransfer
|
||||
{
|
||||
id = a.id,
|
||||
create_id = c.RealName,
|
||||
create_time = a.create_time,
|
||||
modify_id = a.modify_id,
|
||||
modify_time = a.modify_time,
|
||||
org_id = a.org_id,
|
||||
tenant_id = a.tenant_id,
|
||||
timestamp = a.timestamp,
|
||||
bill_code = a.bill_code,
|
||||
status = b.FullName,
|
||||
bill_date = a.bill_date,
|
||||
warehouse_outstock = d.whname,
|
||||
warehouse_instock = d.whname,
|
||||
type = a.type,
|
||||
biller_out = a.biller_out,
|
||||
depart_out = a.depart_out,
|
||||
biller_in = a.biller_in,
|
||||
depart_in = a.depart_in,
|
||||
deliver_date = a.deliver_date,
|
||||
arrival_date = a.arrival_date,
|
||||
order_code = a.order_code,
|
||||
})
|
||||
.ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
var _data = PageResult<WmsMaterialTransfer>.SqlSugarPageResult(result);
|
||||
@@ -82,15 +113,38 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
foreach (dynamic row in mainTable)
|
||||
{
|
||||
row.deliver_date = row.deliver_date.Value.ToString("yyyy-MM-dd");
|
||||
row.arrival_date = row.arrival_date.Value.ToString("yyyy-MM-dd");
|
||||
row.create_time = row.create_time.Value.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
ISugarQueryable<WmsMaterialTransferD> wmsTransferInstockDs = _db.Queryable<WmsMaterialTransferD>()
|
||||
.Where(r => mainTable.Select(r => r["id"].ToString()).ToList().Contains(r.bill_id));
|
||||
List<WmsMaterialTransferD> wmsTransferInstockDs = _db.Queryable<WmsMaterialTransferD, BasMaterial>((a, b) =>
|
||||
new JoinQueryInfos(JoinType.Left, a.material_id == b.id)
|
||||
)
|
||||
.Select((a, b) => new WmsMaterialTransferD
|
||||
{
|
||||
id = a.id,
|
||||
material_id = a.material_id,
|
||||
material_code = b.code,
|
||||
material_ex = b.name,
|
||||
material_specification = b.material_specification,
|
||||
unit_id = a.unit_id,
|
||||
unit_code = a.unit_code,
|
||||
code_batch = a.code_batch,
|
||||
station_code = a.station_code,
|
||||
qty = a.qty,
|
||||
yxfqty = a.yxfqty,
|
||||
yzqty = a.yzqty,
|
||||
bill_id = a.bill_id,
|
||||
lineno = a.lineno,
|
||||
f_flowtaskid = a.f_flowtaskid,
|
||||
f_flowid = a.f_flowid,
|
||||
})
|
||||
.Where(a => mainTable.Select(r => r["id"].ToString()).ToList().Contains(a.bill_id)).ToList();
|
||||
|
||||
foreach (JObject wmsTransferInstockH in mainTable)
|
||||
{
|
||||
wmsTransferInstockH["tablefield121"] = JArray.Parse(JsonConvert.SerializeObject(wmsTransferInstockDs.Where(r => r.bill_id == wmsTransferInstockH["id"].ToString()).ToList()));
|
||||
wmsTransferInstockH["tablefield121"] = JArray.Parse(JsonConvert.SerializeObject(wmsTransferInstockDs.Where(r => r.bill_id == wmsTransferInstockH["id"].ToString())));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -100,8 +154,59 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 下发
|
||||
/// 获取物料库存
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> MaterialInventory(MaterialTransferGetMaterialInventoryInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (input.palletCount <= 0)
|
||||
{
|
||||
throw new AppFriendlyException("托盘数必须大于0", 500);
|
||||
}
|
||||
if (string.IsNullOrEmpty(input.material_id))
|
||||
{
|
||||
throw new AppFriendlyException("物料id不可为空", 500);
|
||||
}
|
||||
if (string.IsNullOrEmpty(input.code_batch))
|
||||
{
|
||||
throw new AppFriendlyException("批号不可为空", 500);
|
||||
}
|
||||
|
||||
//入库取终点 //出库起点
|
||||
OutStockStrategyQuery inStockStrategyInput = new()
|
||||
{
|
||||
warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID,
|
||||
material_id = input.material_id,
|
||||
code_batch = input.code_batch,
|
||||
Size = input.palletCount
|
||||
};
|
||||
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(inStockStrategyInput);
|
||||
|
||||
decimal qty = _db.Queryable<WmsCarryCode>().Where(r => items.Select(a => a.id).Contains(r.carry_id) && r.material_id == input.material_id).Sum(r => r.codeqty);
|
||||
|
||||
JObject keyValuePairs = new JObject();
|
||||
keyValuePairs["realPalletCount"] = items.Count;
|
||||
keyValuePairs["realInvQty"] = qty;
|
||||
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功", keyValuePairs);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 按托下发
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
@@ -111,20 +216,30 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
try
|
||||
{
|
||||
//if (input.qty <= 0)
|
||||
//{
|
||||
// throw new AppFriendlyException("数量必须大于0", 500);
|
||||
//}
|
||||
if (string.IsNullOrEmpty(input.source_id))
|
||||
{
|
||||
throw new AppFriendlyException("来源单据id不可为空", 500);
|
||||
}
|
||||
if (input.palletCount <= 0)
|
||||
{
|
||||
throw new AppFriendlyException("托盘数必须大于0", 500);
|
||||
}
|
||||
if (input.qty <= 0)
|
||||
{
|
||||
throw new AppFriendlyException("数量必须大于0", 500);
|
||||
}
|
||||
if (string.IsNullOrEmpty(input.code_batch))
|
||||
{
|
||||
throw new AppFriendlyException("批号不可为空", 500);
|
||||
}
|
||||
|
||||
WmsMaterialTransferD wmsMaterialTransferD = await _db.Queryable<WmsMaterialTransferD>().FirstAsync(it => it.id == input.source_id);
|
||||
WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable<WmsMaterialTransfer>().FirstAsync(it => it.id == wmsMaterialTransferD.bill_id);
|
||||
await s_taskExecuteSemaphore.WaitAsync();
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
//入库取终点 //出库起点
|
||||
OutStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID, material_id = wmsMaterialTransferD.material_id, code_batch = wmsMaterialTransferD.code_batch, Size = 1 };
|
||||
OutStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID, material_id = wmsMaterialTransferD.material_id, code_batch = wmsMaterialTransferD.code_batch, Size = input.palletCount };
|
||||
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(inStockStrategyInput);
|
||||
|
||||
if (items.Count == 0)
|
||||
@@ -132,30 +247,53 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"没有可以出库的载具", 500);
|
||||
}
|
||||
|
||||
WmsCarryCode wmsCarryCode = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == items[0].id).FirstAsync();
|
||||
BasLocation startLocation = await _db.Queryable<BasLocation>().Where(r => r.location_code == items[0].location_code).FirstAsync();
|
||||
// 根据三工位任务数平均分配任务
|
||||
BasLocation endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1SGWOutstockLocation().Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
decimal qty = _db.Queryable<WmsCarryCode>().Where(r => items.Select(a => a.id).Contains(r.carry_id) && r.material_id == wmsMaterialTransferD.material_id).Sum(r => r.codeqty);
|
||||
|
||||
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
||||
commonCreatePretaskInput.startlocation_id = startLocation.id;
|
||||
commonCreatePretaskInput.endlocation_id = endLocation.id;
|
||||
commonCreatePretaskInput.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
commonCreatePretaskInput.biz_type = WmsWareHouseConst.BIZTYPE_WMSMATERIALTRANSFER_ID;
|
||||
commonCreatePretaskInput.require_id = input.source_id;
|
||||
|
||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput);
|
||||
if (res.code == HttpStatusCode.OK)
|
||||
// 暂定PDA上查询到的物料批次和库存数量与提交时获取的不一致时,需要前台重新获取库存接口
|
||||
if (input.palletCount != items.Count || input.qty != qty)
|
||||
{
|
||||
// 更新子表已下发数量
|
||||
await _db.Updateable<WmsMaterialTransferD>().SetColumns(r => r.yxfqty == r.yxfqty + wmsCarryCode.codeqty).Where(r => r.id == input.source_id).ExecuteCommandAsync();
|
||||
throw new AppFriendlyException($@"当前实际托盘数量为{input.palletCount} 实际库存数量为{qty},与前台数据不一致,请重新获取库存", HttpStatusCode.InternalServerError);
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
else
|
||||
foreach(var wmsCarryH in items)
|
||||
{
|
||||
throw new AppFriendlyException($@"生成预任务失败", 500);
|
||||
WmsCarryCode wmsCarryCode = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).FirstAsync();
|
||||
BasLocation startLocation = await _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.location_code).FirstAsync();
|
||||
|
||||
BasLocation endLocation = null;
|
||||
// 集中供料区三工位
|
||||
if (wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_JZGL_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1GLSGWOutstockLocation().Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
}
|
||||
// 中储仓三工位
|
||||
else if(wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1WXSGWOutstockLocation().Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
}
|
||||
|
||||
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
||||
commonCreatePretaskInput.startlocation_id = startLocation.id;
|
||||
commonCreatePretaskInput.endlocation_id = endLocation.id;
|
||||
commonCreatePretaskInput.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
commonCreatePretaskInput.biz_type = WmsWareHouseConst.BIZTYPE_WMSMATERIALTRANSFER_ID;
|
||||
commonCreatePretaskInput.require_id = input.source_id;
|
||||
|
||||
Entities.Dto.Outputs.Result res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput);
|
||||
|
||||
if (res.code != HttpStatusCode.OK)
|
||||
{
|
||||
Logger.LogInformation($@"生成预任务失败");
|
||||
throw new AppFriendlyException($@"生成预任务失败", 500);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新子表已下发数量
|
||||
await _db.Updateable<WmsMaterialTransferD>().SetColumns(r => r.yxfqty == r.yxfqty + input.qty).Where(r => r.id == input.source_id).ExecuteCommandAsync();
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -171,5 +309,19 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
WmsCarryCode wmsCarryCode = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == input.carryIds[0]).SingleAsync();
|
||||
bool isOk = await _db.Updateable<WmsMaterialTransferD>().SetColumns(it => new WmsMaterialTransferD { yzqty = it.yzqty + wmsCarryCode.codeqty })
|
||||
.Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk)
|
||||
{
|
||||
throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user