生产入库记录增加是否同步bip字段,并且修改新增生产入库记录逻辑

This commit is contained in:
2024-11-12 17:57:58 +08:00
parent 69d700d23c
commit 7397a0286b
5 changed files with 59 additions and 30 deletions

View File

@@ -380,6 +380,7 @@ namespace Tnb.BasicData
foreach (var reqData in requestDatas)
{
var report_id = reqData["report_id"].ToString();
var prd_instock_h_id = reqData["prd_instock_h_id"].ToString();
if (string.IsNullOrEmpty(report_id))
{
Log.Error($"请求记录id{record.id}生产提报记录id为空");
@@ -387,7 +388,7 @@ namespace Tnb.BasicData
}
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(r => r.id == report_id);
#region
#region bip
var wmsPrdInstockD = await db.Queryable<WmsPrdInstockD>().SingleAsync(r => r.prd_report_id == report_id);
if(wmsPrdInstockD==null)
{
@@ -404,25 +405,7 @@ namespace Tnb.BasicData
continue;
}
var prdInstockH = new PrdInstockH();
prdInstockH.id = SnowflakeIdHelper.NextId();
prdInstockH.bill_type = wmsPrdInstockH.type;
prdInstockH.warehouse_id = wmsPrdInstockD.warehouse_id;
prdInstockH.carry_code = wmsPrdInstockD.carry_id;
prdInstockH.location_code = wmsPrdInstockD.startlocation_id;
prdInstockH.create_id = prdReport?.create_id ?? wmsPrdInstockD.create_id;
prdInstockH.org_id = wmsPrdInstockH.org_id;
prdInstockH.station_id = prdMoTask?.workstation_id;
prdInstockH.workline_id = prdMoTask?.workline_id;
//prdInstockH.workshop_id=
//prdInstockH.is_check=
//prdInstockH.status =
prdInstockH.mo_task_id = prdReport?.mo_task_id;
prdInstockH.code = wmsPrdInstockH.bill_code;
await db.Insertable(prdInstockH).ExecuteCommandAsync();
await db.Updateable<PrdInstockH>().SetColumns(r => r.is_sync_bip == 1).Where(r => r.id == prd_instock_h_id).ExecuteCommandAsync();
#endregion
#region
@@ -433,7 +416,7 @@ namespace Tnb.BasicData
{
PrdInstockD prdInstockD = new PrdInstockD();
prdInstockD.id = SnowflakeIdHelper.NextId();
prdInstockD.instock_id = prdInstockH.id;
prdInstockD.instock_id = prd_instock_h_id;
prdInstockD.material_id = wmsPrdInstockH.material_id;
prdInstockD.material_code= wmsPrdInstockH.material_code;
prdInstockD.unit_id = _detail.unit_id;