Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -13,5 +13,9 @@ namespace Tnb.ProductionMgr.Entities
|
||||
public string result { get; set; }
|
||||
public int num { get; set; }
|
||||
public DateTime create_time { get; set; }
|
||||
/// <summary>
|
||||
/// 0 未入库 1 已入库
|
||||
/// </summary>
|
||||
public int status { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
|
||||
namespace Tnb.ProductionMgr.Interfaces
|
||||
{
|
||||
@@ -50,5 +51,7 @@ namespace Tnb.ProductionMgr.Interfaces
|
||||
/// <returns></returns>
|
||||
Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input);
|
||||
|
||||
Task<dynamic> PrdReport(PrdReportCrInput input);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)}";
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.WarehouseMgr;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -42,6 +45,7 @@ namespace Tnb.ProductionMgr
|
||||
private readonly RedisData _redisData;
|
||||
private readonly IWmsEmptyOutstockService _wmsEmptyOutstockService;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
private readonly IPrdMoTaskService _prdMoTaskService;
|
||||
|
||||
public TimeWorkService(
|
||||
RedisData redisData,
|
||||
@@ -49,6 +53,7 @@ namespace Tnb.ProductionMgr
|
||||
IBillRullService billRullService,
|
||||
IOrganizeService organizeService,
|
||||
IWmsEmptyOutstockService wmsEmptyOutstockService,
|
||||
IPrdMoTaskService prdMoTaskService,
|
||||
IWareHouseService wareHouseService
|
||||
)
|
||||
{
|
||||
@@ -59,6 +64,7 @@ namespace Tnb.ProductionMgr
|
||||
_billRullService = billRullService;
|
||||
_wmsEmptyOutstockService = wmsEmptyOutstockService;
|
||||
_wareHouseService = wareHouseService;
|
||||
_prdMoTaskService = prdMoTaskService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -333,6 +339,32 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<String> AutoPrdReport()
|
||||
{
|
||||
string carryCode = await _redisData.TryGetValueByKeyField<string>("外包装箱码垛线", "WBZX_x1_take_tp");
|
||||
int num = await _redisData.TryGetValueByKeyField<int>("外包装箱码垛线", "WBZX_x1_Enquantity");
|
||||
if (string.IsNullOrEmpty(carryCode) || num<=0)
|
||||
{
|
||||
return "无载具或数量为0";
|
||||
}
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.workline_id == WmsWareHouseConst.XUELUGUAN1XIAN && x.mo_task_status == DictConst.InProgressEnCode && x.parent_id == null).FirstAsync();
|
||||
if (prdMoTask == null)
|
||||
{
|
||||
return "血路管1线没有进行中的任务单";
|
||||
}
|
||||
|
||||
PrdReportCrInput input = new PrdReportCrInput();
|
||||
input.mo_task_code = prdMoTask.mo_task_code;
|
||||
input.mo_task_id = prdMoTask.id;
|
||||
input.reported_qty = num;
|
||||
input.station = "";
|
||||
input.material_box_code = carryCode;
|
||||
await _prdMoTaskService.PrdReport(input);
|
||||
return "true";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user