bug
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -111,7 +111,7 @@ namespace Tnb.WarehouseMgr.Interfaces
|
||||
/// // 二楼机械臂
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<bool> Floor2MechanicalComplete(WmsDistaskH disTask, string action);
|
||||
Task Floor2MechanicalComplete(WmsDistaskH disTask, string action);
|
||||
|
||||
/// <summary>
|
||||
/// 二楼kiva把料架送到下升降机后生成中储仓入库任务
|
||||
|
||||
@@ -50,25 +50,39 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
protected IEventPublisher? EventPublisher { set; get; }
|
||||
|
||||
protected ILogger Logger => LoggerFactory.Create(builder => builder.AddFile($"{AppContext.BaseDirectory}/logs/custom{DateTime.Now:yyyyMMdd}.log", cfgOpts =>
|
||||
protected string _LoggerFileName = "";
|
||||
protected ILogger _Logger;
|
||||
protected ILogger Logger
|
||||
{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
get
|
||||
{
|
||||
var logLevel = s_logLevelMap[logMsg.LogLevel];
|
||||
var sb = new StringBuilder();
|
||||
_ = sb.Append($"[{logLevel}] ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/custom{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
|
||||
})).CreateLogger(this.GetType());
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
{
|
||||
var logLevel = s_logLevelMap[logMsg.LogLevel];
|
||||
var sb = new StringBuilder();
|
||||
_ = sb.Append($"[{logLevel}] ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
|
||||
}));
|
||||
_Logger = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerFileName = newFileName;
|
||||
}
|
||||
return _Logger;
|
||||
}
|
||||
}
|
||||
|
||||
static BaseWareHouseService()
|
||||
{
|
||||
|
||||
@@ -427,11 +427,10 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> TaskCallback(TaskCallBackInput input)
|
||||
{
|
||||
|
||||
Logger.Information($"【TaskCallback】 接收到WCS信号 任务状态上报->接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
var disTask = await _db.Queryable<WmsDistaskH>().FirstAsync(it => it.bill_code == input.taskCode);
|
||||
Logger.Information($"【TaskCallback】 【接收】{input.taskCode} WCS信号 任务状态上报->接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
try
|
||||
{
|
||||
var disTask = await _db.Queryable<WmsDistaskH>().FirstAsync(it => it.bill_code == input.taskCode);
|
||||
List<WmsDistaskH> disTasks = new() { disTask };
|
||||
if (input.action == "LOAD")
|
||||
{
|
||||
@@ -513,7 +512,9 @@ namespace Tnb.WarehouseMgr
|
||||
await _wareHouseService.SsxControl(disTask, "UNLOAD");
|
||||
// 二楼机械臂
|
||||
await _wareHouseService.Floor2MechanicalComplete(disTask, "UNLOAD");
|
||||
Logger.Information($"【TaskCallback】 Agv放货完成,任务编号:{string.Join(",", disTasks.Select(x => x.bill_code))}");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -526,6 +527,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
_ = InvokeGenPretaskExcute();
|
||||
}
|
||||
Logger.Information($"【TaskCallback】 【成功】{input.taskCode} WCS信号 任务状态上报->接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly IRunService _runService;
|
||||
|
||||
public static SemaphoreSlim s_floor2CreatePretask = new(1);
|
||||
public SemaphoreSlim s_taskCommonCreatePretask = new(1);
|
||||
|
||||
public Func<string, int, Task> AddUnExecuteTask { get; set; }
|
||||
|
||||
@@ -418,12 +419,13 @@ namespace Tnb.WarehouseMgr
|
||||
getdic.Add("ZSSSXCTU01", new string[] { "YTCS", "AllowAgvEmptyOut_CS01" });
|
||||
getdic.Add("ZSSSXCTU02", new string[] { "YTCS", "AllowAgvEmptyOut_CS03" });
|
||||
|
||||
#region 注塑车间点位
|
||||
putdic.Add("ZS-C01-1", new string[] { "hxjC", "A2允许入空箱", });
|
||||
getdic.Add("ZS-C01-2", new string[] { "hxjC", "A2允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C02-1", new string[] { "hxjC", "A3允许入空箱", });
|
||||
getdic.Add("ZS-C02-2", new string[] { "hxjC", "A3允许取满箱" });
|
||||
|
||||
|
||||
putdic.Add("ZS-C03-1", new string[] { "hxjC", "A4允许入空箱", });
|
||||
getdic.Add("ZS-C03-2", new string[] { "hxjC", "A4允许取满箱" });
|
||||
|
||||
@@ -435,6 +437,69 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
putdic.Add("ZS-C06-1", new string[] { "hxjC", "A7允许入空箱", });
|
||||
getdic.Add("ZS-C06-2", new string[] { "hxjC", "A7允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C07-1", new string[] { "hxjC", "A8允许入空箱", });
|
||||
getdic.Add("ZS-C07-2", new string[] { "hxjC", "A8允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C08-1", new string[] { "hxjC", "A9允许入空箱", });
|
||||
getdic.Add("ZS-C08-2", new string[] { "hxjC", "A9允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C09-1", new string[] { "hxjC", "A10允许入空箱", });
|
||||
getdic.Add("ZS-C09-2", new string[] { "hxjC", "A10允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C10-1", new string[] { "hxjC", "A11允许入空箱", });
|
||||
getdic.Add("ZS-C10-2", new string[] { "hxjC", "A11允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C11-1", new string[] { "hxjC", "A12允许入空箱", });
|
||||
getdic.Add("ZS-C11-2", new string[] { "hxjC", "A12允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C12-1", new string[] { "hxjC", "A13允许入空箱", });
|
||||
getdic.Add("ZS-C12-2", new string[] { "hxjC", "A13允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C13-1", new string[] { "hxjC", "A14允许入空箱", });
|
||||
getdic.Add("ZS-C13-2", new string[] { "hxjC", "A14允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C14-1", new string[] { "hxjC", "A1允许入空箱", });
|
||||
getdic.Add("ZS-C14-2", new string[] { "hxjC", "A1允许取满箱" });
|
||||
|
||||
|
||||
putdic.Add("ZS-A01-1", new string[] { "hxjA", "A3允许入空箱", });
|
||||
getdic.Add("ZS-A01-2", new string[] { "hxjA", "A3允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A02-1", new string[] { "hxjA", "A4允许入空箱", });
|
||||
getdic.Add("ZS-A02-2", new string[] { "hxjA", "A4允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A03-1", new string[] { "hxjA", "A5允许入空箱", });
|
||||
getdic.Add("ZS-A03-2", new string[] { "hxjA", "A5允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A04-1", new string[] { "hxjA", "A6允许入空箱", });
|
||||
getdic.Add("ZS-A04-2", new string[] { "hxjA", "A6允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A05-1", new string[] { "hxjA", "A7允许入空箱", });
|
||||
getdic.Add("ZS-A05-2", new string[] { "hxjA", "A7允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A06-1", new string[] { "hxjA", "A8允许入空箱", });
|
||||
getdic.Add("ZS-A06-2", new string[] { "hxjA", "A8允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A07-1", new string[] { "hxjA", "A9允许入空箱", });
|
||||
getdic.Add("ZS-A07-2", new string[] { "hxjA", "A9允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A08-1", new string[] { "hxjA", "A10允许入空箱", });
|
||||
getdic.Add("ZS-A08-2", new string[] { "hxjA", "A10允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A09-1", new string[] { "hxjA", "A11允许入空箱", });
|
||||
getdic.Add("ZS-A09-2", new string[] { "hxjA", "A11允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A10-1", new string[] { "hxjA", "A12允许入空箱", });
|
||||
getdic.Add("ZS-A10-2", new string[] { "hxjA", "A12允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A11-1", new string[] { "hxjA", "A13允许入空箱", });
|
||||
getdic.Add("ZS-A11-2", new string[] { "hxjA", "A13允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-A12-1", new string[] { "hxjA", "A14允许入空箱", });
|
||||
getdic.Add("ZS-A12-2", new string[] { "hxjA", "A14允许取满箱" });
|
||||
#endregion
|
||||
|
||||
var strs = new string[] { };
|
||||
|
||||
if (action == "LOAD")//取货
|
||||
@@ -548,7 +613,7 @@ namespace Tnb.WarehouseMgr
|
||||
["TagName"] = strarr[1],
|
||||
["Value"] = strarr[2],
|
||||
};
|
||||
Logger.Information($"SsxControlUNLOAD:{dicCommand}");
|
||||
Logger.Information($"SsxControlUNLOAD:{JsonConvert.SerializeObject(dicCommand)}");
|
||||
var str = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand);
|
||||
Logger.Information($"SsxControlUNLOAD:{str}");
|
||||
}
|
||||
@@ -560,7 +625,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// 二楼机械臂
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> Floor2MechanicalComplete(WmsDistaskH disTask, string action)
|
||||
public async Task Floor2MechanicalComplete(WmsDistaskH disTask, string action)
|
||||
{
|
||||
List<string> rackAreaPointsUp = new List<string>();
|
||||
List<string> rackAreaPointsDown = new List<string>();
|
||||
@@ -573,10 +638,10 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
try {
|
||||
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
if (disTask.area_code == "E")
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】收到到货完成信号 传入参数: {disTask.bill_code} {action}");
|
||||
SqlSugarClient db = _db.CopyNew();
|
||||
|
||||
@@ -589,7 +654,7 @@ namespace Tnb.WarehouseMgr
|
||||
if (WmsMechanicalArmHs.Count() == 0)
|
||||
{
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行终点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
return false;
|
||||
throw new Exception($"【二楼机械臂Floor2MechanicalComplete】 任务执行终点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
}
|
||||
WmsMechanicalArmH target = WmsMechanicalArmHs.First();
|
||||
|
||||
@@ -611,7 +676,7 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.LogInformation($@"【送满托到下升降区】设定下升降机满托{target.stackingposition}满托数量为 {LXCount} 结果为 {result}");
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
throw new Exception($"下升降机满托{target.stackingposition}数量 写入失败");
|
||||
}
|
||||
|
||||
// 尝试写入满托送到信号
|
||||
@@ -619,7 +684,7 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.LogInformation($@"【送满托到下升降区】回写 下升降机满托{target.stackingposition}送到 结果为{result下升降机空托送到}");
|
||||
if (!result下升降机空托送到)
|
||||
{
|
||||
return false;
|
||||
throw new Exception($"下升降机满托{target.stackingposition}送到 写入失败");
|
||||
}
|
||||
|
||||
// 绑定料架
|
||||
@@ -671,7 +736,7 @@ namespace Tnb.WarehouseMgr
|
||||
if (WmsMechanicalArmHs.Count() == 0)
|
||||
{
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行起点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
return false;
|
||||
throw new Exception($"【二楼机械臂Floor2MechanicalComplete】 任务执行起点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
}
|
||||
WmsMechanicalArmH target = WmsMechanicalArmHs.First();
|
||||
|
||||
@@ -719,17 +784,15 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】{disTask.bill_code} AGV在料架区取货完成");
|
||||
}
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
return true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Logger.LogError("【Floor2MechanicalComplete】" + ex.ToString());
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return false;
|
||||
throw;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private async Task<bool> Floor2UpDownMachinecode_SetTag(string tag, string value)
|
||||
@@ -1808,8 +1871,6 @@ namespace Tnb.WarehouseMgr
|
||||
locIts.Add(loc);
|
||||
}
|
||||
|
||||
Logger.Information($@"TaskComplate 更新carryIts: {JsonConvert.SerializeObject(carryIts)}");
|
||||
Logger.Information($@"TaskComplate 更新carryCodeIts: {JsonConvert.SerializeObject(carryCodeIts)}");
|
||||
_ = await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync();
|
||||
//更新条码的库位和仓库信息
|
||||
_ = await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync();
|
||||
@@ -1869,9 +1930,10 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.Information($"【TaskComplate】 任务操作完成提交事务 {string.Join(",", input.disTaskIds)}");
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
Logger.Information("任务操作完成");
|
||||
Logger.Information($"【TaskComplate】 任务操作完成 {string.Join(",", input.disTaskIds)}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -2470,8 +2532,9 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> CommonCreatePretask(CommonCreatePretaskInput input)
|
||||
{
|
||||
using (var db = _db.CopyNew())
|
||||
//using (var db = _db.CopyNew())
|
||||
{
|
||||
await s_taskCommonCreatePretask.WaitAsync();
|
||||
Logger.LogInformation($"【createPretask】 接收到请求 参数:{JsonConvert.SerializeObject(input)}");
|
||||
try
|
||||
{
|
||||
@@ -2481,11 +2544,11 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (!string.IsNullOrEmpty(input.startlocation_id))
|
||||
{
|
||||
sPoint = await db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.startlocation_id);
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.startlocation_id);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.endlocation_id))
|
||||
{
|
||||
ePoint = await db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.endlocation_id);
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.endlocation_id);
|
||||
}
|
||||
|
||||
List<WmsPointH> points = new List<WmsPointH>();
|
||||
@@ -2520,14 +2583,14 @@ namespace Tnb.WarehouseMgr
|
||||
// 如果指定了carry_id
|
||||
else if (!string.IsNullOrEmpty(input.carry_id))
|
||||
{
|
||||
wmsCarryH = db.Queryable<WmsCarryH>().Where(r => r.id == input.carry_id).First();
|
||||
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();
|
||||
wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
|
||||
carry_id = wmsCarryH.id;
|
||||
carry_code = wmsCarryH.carry_code;
|
||||
}
|
||||
@@ -2596,7 +2659,7 @@ namespace Tnb.WarehouseMgr
|
||||
};
|
||||
|
||||
//根据载具移入Id,回更单据状态
|
||||
_ = await db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
_ = await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
|
||||
|
||||
Expression<Func<WmsCarryH, WmsCarryH>> wmsCarryHChangeExp = a => new WmsCarryH { is_lock = 1 };
|
||||
@@ -2625,6 +2688,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_taskCommonCreatePretask.Release();
|
||||
if (input.isExcuteMission)
|
||||
{
|
||||
GenTaskExecute();
|
||||
|
||||
@@ -13,6 +13,7 @@ using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using Senparc.Weixin.MP.AdvancedAPIs.Card;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
@@ -165,14 +166,25 @@ namespace Tnb.WarehouseMgr
|
||||
WmsCarryCode.is_out = 0;
|
||||
WmsCarryCodes.Add(WmsCarryCode);
|
||||
}
|
||||
int rows = 0;
|
||||
if (WmsCarryCodes.Count > 0)
|
||||
await _db.Insertable(WmsCarryCodes).ExecuteCommandAsync();
|
||||
rows = await _db.Insertable(WmsCarryCodes).ExecuteCommandAsync();
|
||||
if (rows == 0)
|
||||
{
|
||||
throw new Exception($"接收到{input.details.Count}个条码 但是成功绑定的条码数量为0个!");
|
||||
}
|
||||
}
|
||||
catch (PostgresException ex)
|
||||
{
|
||||
Logger.LogError(ex.Message);
|
||||
Logger.LogError(ex.StackTrace);
|
||||
throw new AppFriendlyException($"绑定失败(1.可能是存在已被绑定的条码 2.存在与此载具编号相同的载具 3.存在字段传了空值) {ex.Message}", 500);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex.Message);
|
||||
Logger.LogError(ex.StackTrace);
|
||||
throw new AppFriendlyException("绑定失败", 500);
|
||||
throw new AppFriendlyException($"绑定失败 {ex.Message}", 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using Mapster;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Npgsql;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.Common.Utils;
|
||||
@@ -305,7 +306,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 载具绑定物料
|
||||
/// 载具绑定物料(MES用)
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
@@ -314,7 +315,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
try
|
||||
{
|
||||
WmsCarryCode wmsCarryCode = new WmsCarryCode();
|
||||
WmsCarryCode wmsCarryCode = input.Adapt<WmsCarryCode>();
|
||||
wmsCarryCode.org_id = WmsWareHouseConst.AdministratorOrgId;
|
||||
wmsCarryCode.create_time = DateTime.Now;
|
||||
wmsCarryCode.carry_id = input.carry_id;
|
||||
@@ -329,13 +330,23 @@ namespace Tnb.WarehouseMgr
|
||||
wmsCarryCode.unit_id = input.unit_id;
|
||||
wmsCarryCode.unit_code = input.unit_code;
|
||||
wmsCarryCode.create_id = input.create_id;
|
||||
await _db.Insertable<WmsCarryCode>(wmsCarryCode).ExecuteCommandAsync();
|
||||
int rows = await _db.Insertable<WmsCarryCode>(wmsCarryCode).ExecuteCommandAsync();
|
||||
if (rows == 0)
|
||||
{
|
||||
throw new Exception($"接收到1个条码 但是成功绑定的条码数量为0个!");
|
||||
}
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => r.carry_status == ((int)EnumCarryStatus.占用).ToString()).Where(r => r.id == input.carry_id).ExecuteCommandAsync();
|
||||
|
||||
// todo 绑定记录表
|
||||
|
||||
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
catch (PostgresException ex)
|
||||
{
|
||||
Logger.LogError(ex.Message);
|
||||
Logger.LogError(ex.StackTrace);
|
||||
throw new AppFriendlyException($"绑定失败(1.可能是存在已被绑定的条码 2.存在与此载具编号相同的载具 3.存在字段传了空值) {ex.Message}", 500);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogInformation(ex.Message);
|
||||
|
||||
Reference in New Issue
Block a user