生产入库接口
This commit is contained in:
@@ -11,6 +11,7 @@ using JNPF.Common.Cache;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
@@ -61,7 +62,10 @@ namespace Tnb.ProductionMgr
|
||||
// 二楼上升降机
|
||||
private Timer? Floor2UpMachinecodetimer;
|
||||
// 二楼料架配送
|
||||
private Timer? Floor2RackDeliverytimer;
|
||||
private Timer? Floor2timer送空托到上升降区;
|
||||
private Timer? Floor2timer送满托到下升降区;
|
||||
private Timer? Floor2timer移走上升降区未生成预任务且满托的料架;
|
||||
private Timer? Floor2timer移走下升降区未生成预任务且空托的料架;
|
||||
|
||||
public static SemaphoreSlim s_taskExecuteFloor2UpMachinecodetimer = new(1);
|
||||
public static SemaphoreSlim s_task送空托到上升降区 = new(1);
|
||||
@@ -93,7 +97,7 @@ namespace Tnb.ProductionMgr
|
||||
_wmsCarryBindService = wmsCarryBindService;
|
||||
}
|
||||
//获取redis数据
|
||||
private void GetRedisData(object state)
|
||||
private void GetRedisData(object? state)
|
||||
{
|
||||
var _redisReadConfigs = _repository.AsQueryable().Where(p => p.enabled == 1).ToList();
|
||||
foreach (var config in _redisReadConfigs)
|
||||
@@ -173,7 +177,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
}
|
||||
//ctu取货
|
||||
private void CheckGet(object state)
|
||||
private void CheckGet(object? state)
|
||||
{
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("SSX-021-005", new string[] { "YTCS", "AllowFullOut_CS05", "LiftCode" });
|
||||
@@ -424,7 +428,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
#region 八工位
|
||||
|
||||
//扫码入库
|
||||
private void ScanInStock(object state)
|
||||
private void ScanInStock(object? state)
|
||||
{
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("BGWRKYCL02", new string[] { "CP8", "AllowGetFullBox1", "code1", "PutDoneEmptyBox", "false" });
|
||||
@@ -506,7 +510,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// <summary>
|
||||
/// 八工位空托盘补充
|
||||
/// </summary>
|
||||
private async void BGWCarrySupplement(object state)
|
||||
private async void BGWCarrySupplement(object? state)
|
||||
{
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("YCLCKBGW", new string[] { "CP8", "AllowPutEmptyBox1" });
|
||||
@@ -597,7 +601,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// <summary>
|
||||
/// 供料叠盘机空托盘自动入库
|
||||
/// </summary>
|
||||
private async void YCLGLDPJInstock(object state)
|
||||
private async void YCLGLDPJInstock(object? state)
|
||||
{
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("SGW-YCL", new string[] { "CP3-3", "AllowGetFullBox" });
|
||||
@@ -682,7 +686,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// <summary>
|
||||
/// 外协叠盘机空托盘自动入库
|
||||
/// </summary>
|
||||
private async void YCLWXDPJInstock(object state)
|
||||
private async void YCLWXDPJInstock(object? state)
|
||||
{
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("未定", new string[] { "CP3-3", "AllowGetFullBox" });
|
||||
@@ -769,7 +773,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
#region 中储仓
|
||||
|
||||
private void SSXcode(object state)
|
||||
private void SSXcode(object? state)
|
||||
{
|
||||
Dictionary<string, string[]> dic = new Dictionary<string, string[]>();
|
||||
dic.Add("东面提升机输送线", new string[] { "下升降机判断请求", "下升降机判断条码", "下升降机判断完毕", "下升降机判断结果" });
|
||||
@@ -868,7 +872,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
Scantimer?.Dispose();
|
||||
SSXcodetimer?.Dispose();
|
||||
Floor2UpMachinecodetimer?.Dispose();
|
||||
Floor2RackDeliverytimer?.Dispose();
|
||||
Floor2timer送空托到上升降区?.Dispose();
|
||||
Floor2timer送满托到下升降区?.Dispose();
|
||||
Floor2timer移走上升降区未生成预任务且满托的料架?.Dispose();
|
||||
Floor2timer移走下升降区未生成预任务且空托的料架?.Dispose();
|
||||
|
||||
BGWCarrySupplementtimer?.Dispose();
|
||||
YCLGLDPJInstocktimer?.Dispose();
|
||||
YCLWXDPJInstocktimer?.Dispose();
|
||||
@@ -876,7 +884,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
#region 二楼上升降机机械臂
|
||||
// 上升降机
|
||||
private async void Floor2UpMachinecode(object args)
|
||||
private async void Floor2UpMachinecode(object? args)
|
||||
{
|
||||
string barcode = await Floor2UpDownMachinecode_GetTag<string>(MechanicalArmConsts.上升降机条码);
|
||||
if (string.IsNullOrEmpty(barcode))
|
||||
@@ -968,7 +976,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
// 尝试写入空托送到信号
|
||||
bool result上升降机空托送到 = await Floor2UpDownMachinecode_SetTag($"上升降机空托{target.stackingposition}送到", "true");
|
||||
LoggerFloor2UpDownMachine.LogInformation($@"【送空托到上升降区】回写 上升降机空托{target.stackingposition}送到 结果为{result上升降机空托送到}");
|
||||
LoggerFloor2UpDownMachine.LogInformation($@"【上升降机】回写 上升降机空托{target.stackingposition}送到 结果为{result上升降机空托送到}");
|
||||
if (!result上升降机空托送到)
|
||||
{
|
||||
return;
|
||||
@@ -1056,7 +1064,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// 送空托到上升降区
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> 送空托到上升降区()
|
||||
public async void 送空托到上升降区(object? args)
|
||||
{
|
||||
#region 检查信号
|
||||
List<string> configs_upMachine = new List<string>();
|
||||
@@ -1073,7 +1081,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
// 没有有效信号
|
||||
if (configs_upMachine.Count == 0)
|
||||
return false;
|
||||
return;
|
||||
#endregion
|
||||
|
||||
using (var db = _repository.AsSugarClient().CopyNew())
|
||||
@@ -1086,13 +1094,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
InnerJoin<WmsPointH>((a, b) => a.point_id == b.id)
|
||||
.InnerJoin<BasLocation>((a, b, c) => b.location_id == c.id)
|
||||
.Where((a, b, c) => string.IsNullOrEmpty(a.rackcode) && c.is_lock == 0 && configs_upMachine.Contains(a.name));
|
||||
|
||||
|
||||
List<WmsMechanicalArmH> WmsMechanicalArmHs = WmsMechanicalArmHsuagar.ToList();
|
||||
|
||||
if (WmsMechanicalArmHs.Count() == 0)
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogWarning($"【送空托到上升降区】 无需补充料架区 {WmsMechanicalArmHsuagar.ToSqlString()}");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 料架区
|
||||
@@ -1171,15 +1179,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_task送空托到上升降区.Release();
|
||||
_wareHouseService.GenTaskExecute();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1188,7 +1197,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// 送满托到下升降区
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> 送满托到下升降区()
|
||||
public async void 送满托到下升降区(object? args)
|
||||
{
|
||||
#region 检查信号
|
||||
List<string> configs_upMachine = new List<string>();
|
||||
@@ -1205,7 +1214,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
// 没有有效信号
|
||||
if (configs_upMachine.Count == 0)
|
||||
return false;
|
||||
return;
|
||||
#endregion
|
||||
|
||||
using (var db = _repository.AsSugarClient().CopyNew())
|
||||
@@ -1224,7 +1233,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
if (WmsMechanicalArmHs.Count() == 0)
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogWarning($"【送满托到下升降区】 无需补充料架区 {WmsMechanicalArmHsuagar.ToSqlString()}");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 料架区
|
||||
@@ -1326,15 +1335,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_task送满托到下升降区.Release();
|
||||
_wareHouseService.GenTaskExecute();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1344,7 +1352,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// 移走上升降区未生成预任务且满托的料架
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> 移走上升降区未生成预任务且满托的料架()
|
||||
public async void 移走上升降区未生成预任务且满托的料架(object? args)
|
||||
{
|
||||
#region 检查信号
|
||||
List<string> configs_upMachine = new List<string>();
|
||||
@@ -1361,7 +1369,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
// 没有有效信号
|
||||
if (configs_upMachine.Count == 0)
|
||||
return false;
|
||||
return;
|
||||
#endregion
|
||||
|
||||
using (var db = _repository.AsSugarClient().CopyNew())
|
||||
@@ -1435,15 +1443,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 成功生成预任务 {result.Item2}");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_task移走上升降区未生成预任务且满托的料架.Release();
|
||||
_wareHouseService.GenTaskExecute();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1453,7 +1460,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
/// 移走下升降区未生成预任务且空托的料架
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> 移走下升降区未生成预任务且空托的料架()
|
||||
public async void 移走下升降区未生成预任务且空托的料架(object? args)
|
||||
{
|
||||
#region 检查信号
|
||||
List<string> configs_upMachine = new List<string>();
|
||||
@@ -1471,7 +1478,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
// 没有有效信号
|
||||
if (configs_upMachine.Count == 0)
|
||||
return false;
|
||||
return;
|
||||
#endregion
|
||||
using (var db = _repository.AsSugarClient().CopyNew())
|
||||
{
|
||||
@@ -1551,47 +1558,20 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError(ex.ToString());
|
||||
LoggerFloor2RackDelivery.LogError(ex.StackTrace);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_task移走下升降区未生成预任务且空托的料架.Release();
|
||||
_wareHouseService.GenTaskExecute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 料架配送
|
||||
private async void Floor2RackDelivery(object args)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 送空托到上升降区
|
||||
await 送空托到上升降区();
|
||||
|
||||
// 送满托到下升降区
|
||||
await 送满托到下升降区();
|
||||
|
||||
// 移走上升降区未生成预任务且满托的料架
|
||||
await 移走上升降区未生成预任务且满托的料架();
|
||||
|
||||
// 移走下升降区未生成预任务且空托的料架
|
||||
await 移走下升降区未生成预任务且空托的料架();
|
||||
|
||||
_ = _wareHouseService.GenTaskExecute();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError(ex.ToString());
|
||||
LoggerFloor2RackDelivery.LogError(ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
// 上下升降机生成预任务(补充料架、上升降机取货到料架、上升降机满托运走,下升降机拿货到输送线、下升降机空托运走)
|
||||
private async Task<Tuple<bool, WmsPretaskH>> createPretask(List<WmsPointH> points, string carry_id, string carry_code, ILogger logger)
|
||||
{
|
||||
@@ -1695,8 +1675,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
// 二楼上升降机
|
||||
Floor2UpMachinecodetimer = new Timer(Floor2UpMachinecode, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
|
||||
|
||||
// 二楼料架配送
|
||||
Floor2RackDeliverytimer = new Timer(Floor2RackDelivery, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
|
||||
Floor2timer送空托到上升降区 = new Timer(送空托到上升降区, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
|
||||
Floor2timer送满托到下升降区 = new Timer(送满托到下升降区, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
|
||||
Floor2timer移走上升降区未生成预任务且满托的料架 = new Timer(移走上升降区未生成预任务且满托的料架, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
|
||||
Floor2timer移走下升降区未生成预任务且空托的料架 = new Timer(移走下升降区未生成预任务且空托的料架, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -222,8 +222,12 @@ public class ModuleConsts
|
||||
/// </summary>
|
||||
public const string MODULE_WMSTRANSFERINSTOCKH_ID = "34154749548053";
|
||||
/// <summary>
|
||||
/// 模块标识-原材料转库单 TODO
|
||||
/// 模块标识-原材料转库单
|
||||
/// </summary>
|
||||
public const string MODULE_WMSMATERIALTRANSFER_ID = "34354738929685";
|
||||
/// <summary>
|
||||
/// 模块标识-生产入库单 todo
|
||||
/// </summary>
|
||||
public const string MODULE_WMSPRDINSTOCK_ID = "MODULE_WMSPRDINSTOCK_ID";
|
||||
|
||||
}
|
||||
@@ -228,6 +228,11 @@
|
||||
/// </summary>
|
||||
public const string BIZTYPE_WMSTRANSFERINSTOCK_ID = "34154749548053";
|
||||
|
||||
/// <summary>
|
||||
/// 生产入库 todo
|
||||
/// </summary>
|
||||
public const string BIZTYPE_WMSPRDINSTOCK_ID = "BIZTYPE_WMSPRDINSTOCK_ID";
|
||||
|
||||
/// <summary>
|
||||
/// 条码打印状态-已完成
|
||||
/// </summary>
|
||||
@@ -273,6 +278,12 @@
|
||||
/// 单据类型-来料入库单
|
||||
/// </summary>
|
||||
public const string BILLTYPE_MATERIALINSTOCK_ID = "25103338755861";
|
||||
|
||||
/// <summary>
|
||||
/// 单据类型-生产入库单
|
||||
/// </summary>
|
||||
public const string BILLTYPE_PRDINSTOCK_ID = "27410834411541";
|
||||
|
||||
/// <summary>
|
||||
/// 管理员Id(天益4厂管理员)
|
||||
/// </summary>
|
||||
@@ -346,5 +357,8 @@
|
||||
/// 料箱id
|
||||
/// </summary>
|
||||
public const string LIAOXIANGID = "26037262680357";
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,9 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
public string require_id { get; set; }
|
||||
|
||||
public string require_code { get; set; }
|
||||
|
||||
|
||||
public string moduleConsts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 如果要生成业务表,传入此对象以及对应业务表单的自定义字段
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
{
|
||||
public class WmsPrdInstockCodeInput
|
||||
{
|
||||
public decimal planqty { get; set; }
|
||||
public decimal pqty { get; set; }
|
||||
public string code_batch { get; set; }
|
||||
public string code { get; set; }
|
||||
public string unit_id { get; set; }
|
||||
public string carry_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
{
|
||||
public class WmsPrdInstockDInput
|
||||
{
|
||||
public string task_bill_code { get; set; }
|
||||
|
||||
public string warehouse_id { get; set; }
|
||||
|
||||
public string startlocation_id { get; set; }
|
||||
public string carry_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
{
|
||||
public class WmsPrdInstockInput
|
||||
{
|
||||
public string prd_bill_code { get; set; }
|
||||
public string material_id { get; set; }
|
||||
public string material_code { get; set; }
|
||||
public string material_name { get; set; }
|
||||
public string material_spec { get; set; }
|
||||
public decimal planqty { get; set; }
|
||||
public decimal pqty { get; set; }
|
||||
public decimal rqty { get; set; }
|
||||
public string type { get; set; }
|
||||
public string create_id { get; set; }
|
||||
public List<WmsPrdInstockDInput> prdInstockDs { get; set; }
|
||||
public List<WmsPrdInstockCodeInput> prdInstockCodes { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// 载具条码表
|
||||
/// </summary>
|
||||
[SugarTable("wms_prd_instock_code")]
|
||||
public partial class WmsPrdInstockCode : BaseEntity<string>
|
||||
{
|
||||
public WmsPrdInstockCode()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 计划数
|
||||
/// </summary>
|
||||
public decimal? planqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 合格数
|
||||
/// </summary>
|
||||
public decimal? pqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string? code_batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码信息
|
||||
/// </summary>
|
||||
public string? code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string? unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父表ID
|
||||
/// </summary>
|
||||
public string? prd_instock_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具ID
|
||||
/// </summary>
|
||||
public string? carry_id { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// 生产入库子表
|
||||
/// </summary>
|
||||
[SugarTable("wms_prd_instock_d")]
|
||||
public partial class WmsPrdInstockD : BaseEntity<string>
|
||||
{
|
||||
public WmsPrdInstockD()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产任务单号
|
||||
/// </summary>
|
||||
public string? task_bill_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库仓库
|
||||
/// </summary>
|
||||
public string? warehouse_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 起始库位
|
||||
/// </summary>
|
||||
public string? startlocation_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具
|
||||
/// </summary>
|
||||
public string? carry_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表ID
|
||||
/// </summary>
|
||||
public string? prd_instock_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public string? status { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// 生产入库主表
|
||||
/// </summary>
|
||||
[SugarTable("wms_prd_instock_h")]
|
||||
public partial class WmsPrdInstockH : BaseEntity<string>
|
||||
{
|
||||
public WmsPrdInstockH()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产工单
|
||||
/// </summary>
|
||||
public string? prd_bill_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库单号
|
||||
/// </summary>
|
||||
public string? bill_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public string? material_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
public string? material_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
public string? material_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
public string? material_spec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划入库数
|
||||
/// </summary>
|
||||
public decimal? planqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 合格数
|
||||
/// </summary>
|
||||
public decimal? pqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 不合格数
|
||||
/// </summary>
|
||||
public decimal? rqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单类型
|
||||
/// </summary>
|
||||
public string? type { get; set; }
|
||||
|
||||
}
|
||||
@@ -2353,9 +2353,10 @@ namespace Tnb.WarehouseMgr
|
||||
commonCreatePretaskInput.endlocation_id = endLocation.id;
|
||||
commonCreatePretaskInput.carry_id = wmsCarryD.membercarry_id;
|
||||
commonCreatePretaskInput.carry_code = wmsCarryD.membercarry_code;
|
||||
commonCreatePretaskInput.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
commonCreatePretaskInput.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||
commonCreatePretaskInput.biz_type = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID;
|
||||
commonCreatePretaskInput.isExcuteMission = false;
|
||||
commonCreatePretaskInput.moduleConsts = ModuleConsts.MODULE_WMSEMPTYINSTOCK_ID;
|
||||
|
||||
VisualDevModelDataCrInput visualDevInput = new VisualDevModelDataCrInput();
|
||||
visualDevInput.data = new Dictionary<string, object>();
|
||||
@@ -2465,34 +2466,22 @@ namespace Tnb.WarehouseMgr
|
||||
else if (!string.IsNullOrEmpty(input.carry_id))
|
||||
{
|
||||
wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.id == input.carry_id).First();
|
||||
carry_id = wmsCarryH.id;
|
||||
carry_code = wmsCarryH.carry_code;
|
||||
}
|
||||
// carry_code
|
||||
else if (!string.IsNullOrEmpty(input.carry_code))
|
||||
{
|
||||
wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
|
||||
}
|
||||
// 如果carry_id和carry_code都没有指定,随机取库位上载具记录的一条
|
||||
else
|
||||
{
|
||||
wmsCarryH = _db.Queryable<BasLocation>().InnerJoin<WmsCarryH>((a, b) => a.id == b.location_id)
|
||||
.Where((a, b) => a.id == sPoint.location_id).Select((a, b) => b).First();
|
||||
}
|
||||
|
||||
if (wmsCarryH != null)
|
||||
{
|
||||
carry_id = wmsCarryH.id;
|
||||
carry_code = wmsCarryH.carry_code;
|
||||
}
|
||||
|
||||
//if (string.IsNullOrEmpty(carry_id))
|
||||
//{
|
||||
// throw new AppFriendlyException("起点库位上没有载具", 500);
|
||||
//}
|
||||
|
||||
if (input.visualDevInput != null)
|
||||
{
|
||||
//在线开发
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYINSTOCK_ID, true);
|
||||
//在线开发moduleConsts
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(input.moduleConsts, true);
|
||||
await _runService.Create(templateEntity, input.visualDevInput);
|
||||
input.require_id = input.visualDevInput.data["ReturnIdentity"].ToString() ?? "";
|
||||
input.require_code = input.visualDevInput.data["bill_code"].ToString() ?? "";
|
||||
|
||||
220
WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs
Normal file
220
WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs
Normal file
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Entity;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSPRDINSTOCK_ID)]
|
||||
public class WmsPrdInstockHService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
|
||||
public WmsPrdInstockHService(ISqlSugarRepository<WmsCarryH> repository, IRunService runService,
|
||||
IVisualDevService visualDevService, IWareHouseService wareHouseService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_wareHouseService = wareHouseService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单提报 第一次主表所有参数全传,后续主表只需要传工单号prd_bill_code和更新后的合格数pqty、不合格数rqty
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Entities.Dto.Outputs.Result> PrdInstock(WmsPrdInstockInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
WmsPrdInstockH prdInstockH = _db.Queryable<WmsPrdInstockH>().Where(r => r.prd_bill_code == input.prd_bill_code).First();
|
||||
|
||||
string prd_instock_code_id = "";
|
||||
// 新建主表
|
||||
if (prdInstockH == null)
|
||||
{
|
||||
VisualDevModelDataCrInput visualDevInput = new VisualDevModelDataCrInput();
|
||||
visualDevInput.data = new Dictionary<string, object>();
|
||||
visualDevInput.data.Add("bill_code", "");
|
||||
|
||||
visualDevInput.data.Add("status", WmsWareHouseConst.BILLSTATUS_ADD_ID);
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSPRDINSTOCK_ID, true);
|
||||
await _runService.Create(templateEntity, visualDevInput);
|
||||
|
||||
prd_instock_code_id = visualDevInput.data["ReturnIdentity"].ToString() ?? "";
|
||||
}
|
||||
else
|
||||
{
|
||||
prd_instock_code_id = prdInstockH.id;
|
||||
|
||||
await _db.Updateable<WmsPrdInstockH>(r => new WmsPrdInstockH
|
||||
{
|
||||
pqty = input.pqty,
|
||||
rqty = input.rqty
|
||||
}).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
List<WmsPrdInstockD> WmsPrdInstockDs = new List<WmsPrdInstockD>();
|
||||
foreach (WmsPrdInstockDInput prdInstockDInput in input.prdInstockDs)
|
||||
{
|
||||
WmsPrdInstockDs.Add(new WmsPrdInstockD()
|
||||
{
|
||||
task_bill_code = prdInstockDInput.task_bill_code,
|
||||
warehouse_id = prdInstockDInput.warehouse_id,
|
||||
startlocation_id = prdInstockDInput.startlocation_id,
|
||||
carry_id = prdInstockDInput.carry_id,
|
||||
create_id = input.create_id,
|
||||
create_time = DateTime.Now,
|
||||
prd_instock_id = prd_instock_code_id,
|
||||
status = WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID
|
||||
});
|
||||
}
|
||||
|
||||
List<WmsPrdInstockCode> WmsPrdInstockCodes = new List<WmsPrdInstockCode>();
|
||||
foreach (WmsPrdInstockCodeInput prdInstockCodeInput in input.prdInstockCodes)
|
||||
{
|
||||
|
||||
WmsPrdInstockCodes.Add(new WmsPrdInstockCode()
|
||||
{
|
||||
planqty = prdInstockCodeInput.planqty,
|
||||
pqty = prdInstockCodeInput.pqty,
|
||||
code_batch = prdInstockCodeInput.code_batch,
|
||||
code = prdInstockCodeInput.code,
|
||||
unit_id = prdInstockCodeInput.unit_id,
|
||||
carry_id = prdInstockCodeInput.carry_id,
|
||||
prd_instock_id = prd_instock_code_id
|
||||
});
|
||||
}
|
||||
|
||||
await _db.Insertable(WmsPrdInstockDs).ExecuteCommandAsync();
|
||||
|
||||
await _db.Insertable(WmsPrdInstockCodes).ExecuteCommandAsync();
|
||||
|
||||
foreach (WmsPrdInstockD wmsPrdInstockD in WmsPrdInstockDs)
|
||||
{
|
||||
//入库取终点
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = wmsPrdInstockD.warehouse_id, Size = 1 };
|
||||
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
if (endLocations?.Count == 0)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的中储仓库位", 500);
|
||||
}
|
||||
BasLocation endLocation = endLocations[0];
|
||||
|
||||
BasLocation startLocation = _db.Queryable<BasLocation>().Where(r => r.id == wmsPrdInstockD.startlocation_id).First();
|
||||
if (startLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException("系统中找不到起点ID的库位信息", 500);
|
||||
}
|
||||
|
||||
BasLocation endlocation_ssx = null;
|
||||
string startlocation_id_ssx = null;
|
||||
// 注塑线边库到2,4输送线
|
||||
if (startLocation.wh_id == "32604516180501")
|
||||
{
|
||||
// 根据ZSSSXCTU01 ZSSSXCTU02任务数平均分配任务
|
||||
endlocation_ssx = await _db.Queryable<BasLocation>().Where(r => new string[2] { "32624148726549", "32624157608981" }.Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => endlocation_ssx.id == it.id).ExecuteCommandAsync();
|
||||
|
||||
// ZSSSXCTU01 对应 SSX-011-002
|
||||
if (endlocation_ssx.location_code == "ZSSSXCTU01")
|
||||
{
|
||||
startlocation_id_ssx = "32609073591317";
|
||||
}
|
||||
// ZSSSXCTU02 对应 SSX-011-004
|
||||
else if (endlocation_ssx.location_code == "ZSSSXCTU02")
|
||||
{
|
||||
startlocation_id_ssx = "32609093546005";
|
||||
}
|
||||
}
|
||||
|
||||
// 生成到输送线任务
|
||||
CommonCreatePretaskInput commonCreatePretaskInput1 = new CommonCreatePretaskInput();
|
||||
commonCreatePretaskInput1.startlocation_id = startLocation.id;
|
||||
commonCreatePretaskInput1.endlocation_id = endlocation_ssx.id;
|
||||
commonCreatePretaskInput1.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||
commonCreatePretaskInput1.biz_type = "";
|
||||
commonCreatePretaskInput1.require_id = wmsPrdInstockD.id;
|
||||
commonCreatePretaskInput1.isExcuteMission = false;
|
||||
Entities.Dto.Outputs.Result res1 = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput1);
|
||||
|
||||
// 生成到中储仓任务
|
||||
CommonCreatePretaskInput commonCreatePretaskInput2 = new CommonCreatePretaskInput();
|
||||
commonCreatePretaskInput2.startlocation_id = startlocation_id_ssx;
|
||||
commonCreatePretaskInput2.endlocation_id = endLocation.id;
|
||||
commonCreatePretaskInput2.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||
commonCreatePretaskInput2.biz_type = WmsWareHouseConst.BIZTYPE_WMSPRDINSTOCK_ID;
|
||||
commonCreatePretaskInput2.require_id = wmsPrdInstockD.id;
|
||||
commonCreatePretaskInput2.isExcuteMission = false;
|
||||
|
||||
Entities.Dto.Outputs.Result res2 = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput2);
|
||||
}
|
||||
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex.Message);
|
||||
Logger.Error(ex.StackTrace);
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_wareHouseService.GenTaskExecute();
|
||||
}
|
||||
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
|
||||
bool isOk = true;
|
||||
// 如果生产入库 输送线到仓库这条任务完成,反写单据数据
|
||||
if (input.bizTypeId == WmsWareHouseConst.BIZTYPE_WMSPRDINSTOCK_ID)
|
||||
{
|
||||
isOk = await _db.Updateable<WmsPrdInstockD>().SetColumns(it => new WmsPrdInstockD { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID })
|
||||
.Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!isOk)
|
||||
{
|
||||
throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user