From e16a2dfe37dce003a4ed470b674ad8ed6a23b6cf Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Wed, 17 Jul 2024 17:22:31 +0800 Subject: [PATCH] bug --- .../Tnb.ProductionMgr/PrdMoTaskService.cs | 34 +++++++-------- .../ProductionReportRecordService.cs | 42 ++++++++++--------- .../Tnb.ProductionMgr/TimeWorkService.cs | 16 ++++++- .../Consts/WmsWareHouseConst.cs | 4 -- .../Tnb.WarehouseMgr/WareHouseService.cs | 4 +- .../WmsMaterialTransferService.cs | 4 +- 6 files changed, 58 insertions(+), 46 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 822847eb..67cc6407 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1724,7 +1724,7 @@ namespace Tnb.ProductionMgr // } // report.warehouse_id = WmsWareHouseConst.WAREHOUSE_JXK_ID; - report.warehouse_id = WmsWareHouseConst.WAREHOUSE_SLDMJC_ID; + report.warehouse_id = WmsWareHouseConst.WAREHOUSE_DMJC_ID; Dictionary worklineWarehouseDic = new Dictionary() { [WmsWareHouseConst.XUELUGUAN1XIAN] = "ZZ-01-02", @@ -2129,22 +2129,22 @@ namespace Tnb.ProductionMgr // throw Oops.Bah(x2ServerResult.Msg); // } - Dictionary dicCommand4 = new(StringComparer.OrdinalIgnoreCase) - { - ["DevName"] = "外包装箱码垛线", - ["token"] = _eleCtlCfg.token, - ["TagName"] = dic2[prdMoTask.workline_id], - ["Value"] = "0", - }; - - Log.Information($"清除提报码垛数参数:{JsonConvert.SerializeObject(dicCommand4)}"); - string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand4); - Log.Information($"清除提报码垛数成返回结果:{responseresult2}"); - X2ServerResult x2ServerResult2 = JsonConvert.DeserializeObject(responseresult2); - if (x2ServerResult2.Result != X2ServerResult.Ok) - { - throw Oops.Bah(x2ServerResult2.Msg); - } + // Dictionary dicCommand4 = new(StringComparer.OrdinalIgnoreCase) + // { + // ["DevName"] = "外包装箱码垛线", + // ["token"] = _eleCtlCfg.token, + // ["TagName"] = dic2[prdMoTask.workline_id], + // ["Value"] = "0", + // }; + // + // Log.Information($"清除提报码垛数参数:{JsonConvert.SerializeObject(dicCommand4)}"); + // string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand4); + // Log.Information($"清除提报码垛数返回结果:{responseresult2}"); + // X2ServerResult x2ServerResult2 = JsonConvert.DeserializeObject(responseresult2); + // if (x2ServerResult2.Result != X2ServerResult.Ok) + // { + // throw Oops.Bah(x2ServerResult2.Msg); + // } } if (basMaterial.category_id.Contains("ZSJ") || basMaterial.category_id.Contains("DGJCJ")) diff --git a/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs index 770a91cc..d6083aef 100644 --- a/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs @@ -13,6 +13,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SqlSugar; using Tnb.BasicData; +using Tnb.BasicData.Entities; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto; using Tnb.ProductionMgr.Interfaces; @@ -89,27 +90,28 @@ namespace Tnb.ProductionMgr } } ISqlSugarClient db = _repository.AsSugarClient(); - SqlSugarPagedList result = await db.Queryable() - .LeftJoin((a, b) => a.mo_task_type == b.Id) - .LeftJoin((a, b, c) => a.status == c.EnCode) - .LeftJoin((a, b, c, d) => a.mo_task_id == d.id) + SqlSugarPagedList result = await db.Queryable() + .LeftJoin((a,b)=>a.mo_id==b.id) + .LeftJoin((a, b,c) => b.mo_type == c.Id) + .LeftJoin((a, b, c,d) => a.mo_task_status == d.EnCode && d.DictionaryTypeId==DictConst.PrdTaskStatusTypeId) + .LeftJoin((a,b,c,d,e)=>a.material_id==e.id) .WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c) => a.mo_task_code.Contains(moTaskCode)) - .Select((a, b, c, d) => new ReportRecordListOutput + .Select((a, b, c, d,e) => new ReportRecordListOutput { id = a.id, - masterial_code = a.masterial_code, - mo_code = a.mo_code, - masterial_name = a.masterial_name, + masterial_code = e.code, + mo_code = b.mo_code, + masterial_name = e.name, mo_task_code = a.mo_task_code, mo_task_id = a.mo_task_code, - mo_task_id_id = a.mo_task_id, - mo_task_type = b.FullName, - plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString("yyyy-mm-dd"), - plan_start_date = a.plan_start_date == null ? "" : a.plan_start_date.Value.ToString("yyyy-mm-dd"), - plan_qty = d.scheduled_qty, + mo_task_id_id = a.id, + mo_task_type = c.FullName, + plan_end_date = a.estimated_end_date == null ? "" : a.estimated_end_date.Value.ToString("yyyy-mm-dd"), + plan_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString("yyyy-mm-dd"), + plan_qty = a.scheduled_qty, reported_work_qty = a.reported_work_qty, - completed_qty = SqlFunc.IsNull(d.reported_work_qty, 0) + SqlFunc.IsNull(d.scrap_qty, 0), - status = c.FullName, + completed_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0), + status = d.FullName, tablefield107 = SqlFunc.Subqueryable() .LeftJoin((x, y) => x.create_id == y.Id) .Where(x => x.mo_task_code == a.mo_task_code).ToList((x, y) => new ReportRecordListChildrenOutput @@ -149,11 +151,11 @@ namespace Tnb.ProductionMgr _ = await db.Insertable(prdReports).ExecuteCommandAsync(); - int? sum = prdReports.Sum(x => x.reported_qty); - _ = await db.Updateable() - .SetColumns(x => x.completed_qty == x.completed_qty + sum) - .SetColumns(x => x.reported_work_qty == x.reported_work_qty + sum) - .Where(x => x.id == input.data["id"].ToString()).ExecuteCommandAsync(); + // int? sum = prdReports.Sum(x => x.reported_qty); + // _ = await db.Updateable() + // .SetColumns(x => x.completed_qty == x.completed_qty + sum) + // .SetColumns(x => x.reported_work_qty == x.reported_work_qty + sum) + // .Where(x => x.id == input.data["id"].ToString()).ExecuteCommandAsync(); }); diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs index 51079787..8956602b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs @@ -513,7 +513,10 @@ namespace Tnb.ProductionMgr return msg; } - + /// + /// 自动提报 + /// + /// [HttpGet] [AllowAnonymous] public async Task AutoPrdReport() @@ -655,6 +658,17 @@ namespace Tnb.ProductionMgr return "true"; } + + /// + /// 同步基础数据 + /// + /// + [HttpGet] + [AllowAnonymous] + public async Task SyncBaseData() + { + return "true"; + } } } \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index da13a785..8b3242dc 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -27,10 +27,6 @@ /// public const string WAREHOUSE_ZCC_ID = "33780009364245"; /// - /// 四楼待灭菌仓 - /// - public const string WAREHOUSE_SLDMJC_ID = "35412479754517"; - /// /// 四楼解析库 /// public const string WAREHOUSE_JXK_ID = "26103367464997"; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 2fa300cd..651104eb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -2396,8 +2396,8 @@ namespace Tnb.WarehouseMgr ["cbodytranstypecode"] = "4A-01", ["cbodywarehouseid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "", ["cgeneralbid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "", - ["cgeneralbid"] = item.erp_line_pk ?? "", - ["cgeneralhid"] = wmsMaterialTransfer.erp_pk ?? "", + ["cgeneralbid"] = item.erp_line_pk, + ["cgeneralhid"] = wmsMaterialTransfer.erp_pk, ["cmaterialoid"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialoid ?? "", ["cmaterialvid"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialvid ?? "", ["corpoid"] = erpOrg.corpoid, diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs index 17e3d2d4..5ff9d083 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs @@ -678,8 +678,8 @@ namespace Tnb.WarehouseMgr ["corpoid"] = erpOrg.corpoid, ["corpvid"] = erpOrg.corpvid, ["crowno"] = (dList.FindIndex(x=>x.id==wmsMaterialTransferd.id)+1) * 10, - ["csourcebillbid"] = wmsMaterialTransferd.erp_line_pk ?? "", - ["csourcebillhid"] = wmsMaterialTransfer.erp_pk ?? "", + ["csourcebillbid"] = wmsMaterialTransferd.erp_line_pk, + ["csourcebillhid"] = wmsMaterialTransfer.erp_pk, ["cunitid"] = erpExtendFields.Find(x=>x.table_id==unitData.Id)?.cunitid ?? "", ["cvendorid"] = "", ["cvendorvid"] = "",