自动生产提报

This commit is contained in:
2024-06-25 14:23:53 +08:00
parent 43d6647bb0
commit 1906fc9ad3
4 changed files with 106 additions and 11 deletions

View File

@@ -1699,7 +1699,16 @@ namespace Tnb.ProductionMgr
}
report.warehouse_id = WmsWareHouseConst.WAREHOUSE_JXK_ID;
report.location_code = "ZZ-01-01";//TODO 组装工单库位先写死
Dictionary<string, string> worklineWarehouseDic = new Dictionary<string, string>()
{
[WmsWareHouseConst.XUELUGUAN1XIAN] = "ZZ-01-01",
[WmsWareHouseConst.XUELUGUAN2XIAN] = "ZZ-01-02",
};
report.location_code = worklineWarehouseDic.GetOrDefault(prdMoTask.workline_id);
if (string.IsNullOrEmpty(report.location_code))
{
report.location_code = "ZZ-01-01";
}
}
else
{
@@ -1732,7 +1741,7 @@ namespace Tnb.ProductionMgr
// report.location_code = input.location_code;
report.create_id = _userManager.UserId;
report.create_id = _userManager?.UserId ?? WmsWareHouseConst.AdministratorUserId;
report.create_time = DateTime.Now;
report.batch = batch;
report.barcode = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
@@ -1970,6 +1979,23 @@ namespace Tnb.ProductionMgr
{
throw Oops.Bah(x2ServerResult.Msg);
}
Dictionary<string, string> dicCommand4 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = "外包装箱码垛线",
["token"] = _eleCtlCfg.token,
["TagName"] = "WBZX_x1_Enquantity",
["Value"] = "0",
};
Log.Information($"清除提报码垛数参数:{JsonConvert.SerializeObject(dicCommand4)}");
string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand4);
Log.Information($"清除提报码垛数成返回结果:{responseresult2}");
X2ServerResult x2ServerResult2 = JsonConvert.DeserializeObject<X2ServerResult>(responseresult2);
if (x2ServerResult2.Result != X2ServerResult.Ok)
{
throw Oops.Bah(x2ServerResult2.Msg);
}
}
if (basMaterial.category_id.Contains("ZSJ") || basMaterial.category_id.Contains("DGJCJ"))
@@ -2025,6 +2051,7 @@ namespace Tnb.ProductionMgr
bindCarryCodeInput.location_id = location.id;
bindCarryCodeInput.location_code = location.location_code;
bindCarryCodeInput.code_batch = prdMoTask.batch;
bindCarryCodeInput.create_id = _userManager?.UserId ?? WmsWareHouseConst.AdministratorUserId;
Log.Information($"载具绑定参数:${JsonConvert.SerializeObject(bindCarryCodeInput)}");
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result1 = await _wmsCarryService.BindCarryMaterial(bindCarryCodeInput);
@@ -2045,6 +2072,7 @@ namespace Tnb.ProductionMgr
wmsPrdInstockInput.type = prdMo.mo_type;
wmsPrdInstockInput.create_id = report.create_id;
wmsPrdInstockInput.prdInstockDs = new List<WmsPrdInstockDInput>();
wmsPrdInstockInput.prdInstockCodes = new List<WmsPrdInstockCodeInput>();
wmsPrdInstockInput.prdInstockDs.Add(new WmsPrdInstockDInput()
{
task_bill_code = prdMoTask.mo_task_code,
@@ -2052,16 +2080,43 @@ namespace Tnb.ProductionMgr
startlocation_id = location.id,
carry_id = wmsCarryH.id,
});
wmsPrdInstockInput.prdInstockCodes = new List<WmsPrdInstockCodeInput>();
wmsPrdInstockInput.prdInstockCodes.Add(new WmsPrdInstockCodeInput()
if (prdMoTask.schedule_type == 1)
{
planqty = prdMoTask.scheduled_qty.Value,
pqty = input.reported_qty,
code_batch = batch,
code = report.barcode,
unit_id = prdMoTask.unit_id,
carry_id = wmsCarryH.id,
});
wmsPrdInstockInput.prdInstockCodes.Add(new WmsPrdInstockCodeInput()
{
planqty = prdMoTask.scheduled_qty.Value,
pqty = input.reported_qty,
code_batch = batch,
code = report.barcode,
unit_id = prdMoTask.unit_id,
carry_id = wmsCarryH.id,
});
}
else
{
List<PrdVisionResultRecord> prdVisionResultRecords = await _db.Queryable<PrdVisionResultRecord>()
.Where(x => x.status == 0 && x.result.ToUpper()=="OK").OrderByDescending(x => x.create_time).Take(report.reported_qty.Value).ToListAsync();
List<string> ids = prdVisionResultRecords.Select(x => x.id).ToList();
foreach (var record in prdVisionResultRecords)
{
wmsPrdInstockInput.prdInstockCodes.Add(new WmsPrdInstockCodeInput()
{
planqty = prdMoTask.scheduled_qty.Value,
pqty = 1,
code_batch = batch,
code = record.info,
unit_id = prdMoTask.unit_id,
carry_id = wmsCarryH.id,
});
}
await db.Updateable<PrdVisionResultRecord>()
.SetColumns(x => x.status == 1).Where(x => ids.Contains(x.id)).ExecuteCommandAsync();
}
Log.Information($"生产入库参数:${JsonConvert.SerializeObject(wmsPrdInstockInput)}");
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result2 = await _wmsPrdInstockHService.PrdInstock(wmsPrdInstockInput, _db);
@@ -3399,6 +3454,7 @@ namespace Tnb.ProductionMgr
reocrd.result = input.result;
reocrd.create_time = DateTime.Now;
reocrd.num = int.Parse(input.station_id);
reocrd.status = 0;
await _db.Insertable(reocrd).ExecuteCommandAsync();
return $"接收到参数:{JsonConvert.SerializeObject(input)}";
}