From b7796f5e4d6594976ea948905af769eca863f27c Mon Sep 17 00:00:00 2001 From: helongyang <647556386@qq.com> Date: 星期一, 07 七月 2025 15:28:15 +0800 Subject: [PATCH] 代码更新 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs | 90 ++++++++++++++++++++++++++++++++------------- 1 files changed, 64 insertions(+), 26 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs" index a2e1a4c..0fb7cf1 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs" @@ -20,6 +20,7 @@ using System.Text.RegularExpressions; using WIDESEA_Common.CommonEnum; using WIDESEA_Core.CodeConfigEnum; +using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; namespace WIDESEA_TaskInfoService { @@ -78,12 +79,10 @@ { return content.Error(inProRespone.Message); } + _proInStatisticsService.SaveStatic(bagInfoModel); return content.OK(inProRespone.Message); } - else if (isValid) - { - - } + foreach (var item in bagInfoModel.BagDetails) { if (proDetailsExists.Contains(item.BagNo)) @@ -164,24 +163,26 @@ TaskType = TaskTypeEnum.InProduct.ObjToInt(), TaskStatus = TaskStatusEnum.New.ObjToInt(), WarehouseId = warehouse.WarehouseId, - PalletType = proStockInfo.PalletType + PalletType = proStockInfo.PalletType, + MaterielCode = proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).FirstOrDefault()?.ProductCode, + Quantity = (float)proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).Sum(x => x.StockPcsQty) }; _unitOfWorkManage.BeginTran(); int taskId = BaseDal.AddData(newTask); newTask.TaskId = taskId; Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); - //涓婁紶ERP - WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder); - if (!responseContent.Status) - { - mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); - mesProInOrder.Remark = responseContent.Message; - } - else - { + //WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder); + _proInStatisticsService.SaveStatic(bagInfoModel); + //if (!responseContent.Status) + //{ + // mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); + // mesProInOrder.Remark = responseContent.Message; + //} + //else + //{ mesProInOrder.UpErpStatus = WhetherEnum.True.ObjToInt(); - } + //} Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand(); _unitOfWorkManage.CommitTran(); //鎺ㄩ�佷换鍔� @@ -281,17 +282,17 @@ _unitOfWorkManage.BeginTran(); Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); - //涓婁紶ERP - WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder); - if (!responseContent.Status) - { - mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); - mesProInOrder.Remark = responseContent.Message; - } - else - { + ////涓婁紶ERP + //WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder); + //if (!responseContent.Status) + //{ + // mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); + // mesProInOrder.Remark = responseContent.Message; + //} + //else + //{ mesProInOrder.UpErpStatus = WhetherEnum.True.ObjToInt(); - } + //} Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand(); _unitOfWorkManage.CommitTran(); return WebResponseContent.Instance.OK("鎺ユ敹鎴愬姛"); @@ -480,7 +481,44 @@ } return content; } - + /// <summary> + /// WMS鍚屾鎴愬搧鍑哄簱鑷矼ES澶栧寘瑁呮満 + /// </summary> + public WebResponseContent ShipmentOrderMESSync(MesShipmentOrderSync model) + { + WebResponseContent content = new WebResponseContent(); + try + { + Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.AnhuaitcShipmentOrderSync.ToString()); + MESRoot<MesShipmentOrderSync> root = new MESRoot<MesShipmentOrderSync>() + { + From = "WMS", + DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + Content = model + }; + JsonSerializerSettings settings = new JsonSerializerSettings + { + ContractResolver = new CamelCasePropertyNamesContractResolver() + }; + string request = JsonConvert.SerializeObject(root, settings); + string response = HttpMesHelper.Post(apiInfo.ApiAddress, request); + MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); + //璋冪敤鎺ュ彛 + if (mesResponseContent.BSucc == true) + { + content.OK(mesResponseContent.StrMsg); + } + else + { + content.Error(mesResponseContent.StrMsg); + } + } + catch (Exception ex) + { + content.Error(ex.Message); + } + return content; + } /// <summary> /// MES鎴愬搧杩斿伐鎻愬簱 /// </summary> -- Gitblit v1.9.3