From 7397a0286b766a6007e82f9816878e71e145c39f Mon Sep 17 00:00:00 2001 From: chenwenkai <1084072318@qq.com> Date: Tue, 12 Nov 2024 17:57:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=85=A5=E5=BA=93=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E5=90=8C=E6=AD=A5?= =?UTF-8?q?bip=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=B9=B6=E4=B8=94=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=96=B0=E5=A2=9E=E7=94=9F=E4=BA=A7=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.BasicData/ThirdApiRecordService.cs | 25 ++--------- .../PrdManage/PrdInstockRecordUpListOutPut.cs | 1 + .../Entity/PrdInstockH.cs | 5 ++- .../PrdInstockRecordUpServicecs.cs | 17 ++++---- .../Tnb.WarehouseMgr/WmsPrdInstockHService.cs | 41 +++++++++++++++++++ 5 files changed, 59 insertions(+), 30 deletions(-) diff --git a/BasicData/Tnb.BasicData/ThirdApiRecordService.cs b/BasicData/Tnb.BasicData/ThirdApiRecordService.cs index 789647f9..3816d32e 100644 --- a/BasicData/Tnb.BasicData/ThirdApiRecordService.cs +++ b/BasicData/Tnb.BasicData/ThirdApiRecordService.cs @@ -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().SingleAsync(r => r.id == report_id); - #region 生成入库记录主表数据 + #region 修改生成入库记录主表数据为已同步bip var wmsPrdInstockD = await db.Queryable().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().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; diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdInstockRecordUpListOutPut.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdInstockRecordUpListOutPut.cs index ed30be2b..2d0464f6 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdInstockRecordUpListOutPut.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdInstockRecordUpListOutPut.cs @@ -31,6 +31,7 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 起始库位编号 /// public string location_code { get; set; } = string.Empty; + public int is_sync_bip { get; set; } } public class PrdInstockRecordUpListDownOutPut diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs index 488366d5..c0d7f834 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs @@ -85,5 +85,8 @@ public partial class PrdInstockH : BaseEntity /// 入库单编号 /// public string? code { get; set; } - + /// + /// 是否同步bip + /// + public int? is_sync_bip { get; set; } = 0; } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockRecordUpServicecs.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockRecordUpServicecs.cs index 77524018..bb27408d 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockRecordUpServicecs.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockRecordUpServicecs.cs @@ -82,14 +82,14 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b, c, d) => a.mo_id == d.id) .LeftJoin((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode) .LeftJoin((a, b, c, d, e, f) => a.workline_id == f.Id) - .LeftJoin((a,b,c,d,e,f,g)=>a.eqp_id==g.id) + .LeftJoin((a, b, c, d, e, f, g) => a.eqp_id == g.id) .WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code)) .WhereIF(!string.IsNullOrEmpty(mo_code), (a, b, c, d, e) => d.mo_code.Contains(mo_code)) - .WhereIF(!string.IsNullOrEmpty(mo_type),(a,b,c,d,e)=>d.mo_type==mo_type) - .WhereIF(!string.IsNullOrEmpty(name),(a,b,c,d,e)=>b.name.Contains(name)) + .WhereIF(!string.IsNullOrEmpty(mo_type), (a, b, c, d, e) => d.mo_type == mo_type) + .WhereIF(!string.IsNullOrEmpty(name), (a, b, c, d, e) => b.name.Contains(name)) .Where(a => a.act_start_date != null) .OrderBy($"{input.sidx} {input.sort}") - .Select((a, b, c, d, e, f,g) => new PrdInstockRecordUpListOutPut() + .Select((a, b, c, d, e, f, g) => new PrdInstockRecordUpListOutPut() { id = a.id, mo_task_code = a.mo_task_code, @@ -98,15 +98,15 @@ namespace Tnb.ProductionMgr workstation_id = c.FullName, mo_task_status = e.FullName, workline_id = f.FullName, - eqp_code=g.code, + eqp_code = g.code, act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS), create_time = a.create_time.HasValue ? a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", tablefield102 = SqlFunc.Subqueryable() .LeftJoin((x, y) => x.create_id == y.Id) .LeftJoin((x, y, z) => x.bill_type == z.Id) - .LeftJoin((x,y,z,j)=>x.carry_code==j.id) - .LeftJoin((x,y,z,j,k)=>x.location_code==k.id) - .Where(x => x.mo_task_id == a.id).ToList((x, y, z,j,k) => new PrdInstockRecordUpListChildOutPut() + .LeftJoin((x, y, z, j) => x.carry_code == j.id) + .LeftJoin((x, y, z, j, k) => x.location_code == k.id) + .Where(x => x.mo_task_id == a.id).ToList((x, y, z, j, k) => new PrdInstockRecordUpListChildOutPut() { id = x.id, code = x.code, @@ -115,6 +115,7 @@ namespace Tnb.ProductionMgr location_code = k.location_code, create_id = y.RealName, bill_date = x.bill_date == null ? "" : x.bill_date.ToString(DbTimeFormat.SS), + is_sync_bip = x.is_sync_bip.HasValue ? x.is_sync_bip.Value : 0 }), }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs index 62cecd9f..ad4b9e1d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs @@ -362,6 +362,46 @@ namespace Tnb.WarehouseMgr if (prdReport == null) return; PrdMoTask prdMoTask = await _db.Queryable().SingleAsync(x => x.id == prdReport.mo_task_id); PrdMo prdMo = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); + + #region 新增生产入库记录 + + var prdInstockH = new PrdInstockH(); + + prdInstockH = await _db.Queryable().Where(r => r.mo_task_id == prdReport.mo_task_id).FirstAsync(); + if (prdInstockH != null) + { + prdInstockH.bill_type = instock.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 = instock.org_id; + prdInstockH.station_id = prdMoTask?.workstation_id; + prdInstockH.workline_id = prdMoTask?.workline_id; + prdInstockH.mo_task_id = prdReport?.mo_task_id; + prdInstockH.code = instock.bill_code; + prdInstockH.is_sync_bip = 0; + await _db.Updateable(prdInstockH).ExecuteCommandAsync(); + } + else + { + prdInstockH.id = SnowflakeIdHelper.NextId(); + prdInstockH.bill_type = instock.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 = instock.org_id; + prdInstockH.station_id = prdMoTask?.workstation_id; + prdInstockH.workline_id = prdMoTask?.workline_id; + prdInstockH.mo_task_id = prdReport?.mo_task_id; + prdInstockH.code = instock.bill_code; + prdInstockH.is_sync_bip = 0; + + await _db.Insertable(prdInstockH).ExecuteCommandAsync(); + } + + #endregion //来源erp才产成品入库 if (prdMo.mo_source != "1") { @@ -428,6 +468,7 @@ namespace Tnb.WarehouseMgr erpRequestData.Add("vtrantypecode", "46-01"); erpRequestData.Add("csourcebillhid", prdReport?.erp_pk_wr ?? ""); erpRequestData.Add("report_id", prdReport?.id ?? ""); + erpRequestData.Add("prd_instock_h_id", prdInstockH.id); List> erpRequestDataDetails = new List>();