From ac8813cde64f7bf9882657416a1d102191aae960 Mon Sep 17 00:00:00 2001 From: helongyang <647556386@qq.com> Date: 星期六, 19 七月 2025 17:32:59 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs | 117 ++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 89 insertions(+), 28 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 0fb7cf1..d96efaa 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" @@ -172,17 +172,18 @@ newTask.TaskId = taskId; Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); //涓婁紶ERP - //WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder); + WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder); _proInStatisticsService.SaveStatic(bagInfoModel); - //if (!responseContent.Status) - //{ - // mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); - // mesProInOrder.Remark = responseContent.Message; - //} - //else - //{ + if (!responseContent.Status) + { + //mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); + //mesProInOrder.Remark = responseContent.Message; + throw new Exception(responseContent.Message); + } + else + { mesProInOrder.UpErpStatus = WhetherEnum.True.ObjToInt(); - //} + } Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand(); _unitOfWorkManage.CommitTran(); //鎺ㄩ�佷换鍔� @@ -281,18 +282,19 @@ }; _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; + return WebResponseContent.Instance.Error($"{responseContent.Message}"); + } + else + { mesProInOrder.UpErpStatus = WhetherEnum.True.ObjToInt(); - //} + } + Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand(); _unitOfWorkManage.CommitTran(); return WebResponseContent.Instance.OK("鎺ユ敹鎴愬姛"); @@ -529,7 +531,7 @@ MesResponseContent content = new MesResponseContent(); try { - Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString()); + Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == model.WarehouseCode); if (warehouse == null) { return content.Error($"灏炬暟浠撲俊鎭湭閰嶇疆"); @@ -539,25 +541,68 @@ { return content.Error($"鎻愬簱浠诲姟鍗晎model.TaskNo}宸插瓨鍦�"); } + //鐢熸垚鎻愬簱鍗� Dt_MesRworkOutboundOrder mesRworkOutboundOrder = new Dt_MesRworkOutboundOrder() { WarehouseId = warehouse.WarehouseId, TaskNo = model.TaskNo, - OrderStatus = OutOrderStatusEnum.鏈紑濮�.ObjToInt(), + OrderStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt(), CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), ProductCode = model.ProductCode, - ProductName = model.ProductName, + ProductName = model.ProductCode, ProductVersion = model.ProductVersion, DateCode = model.DateCode, RequiredQuantity = model.RequiredQuantity, + RequiredSetCount=model.RequiredSetCount, FactoryCode = model.FactoryCode, - SaleOrder = model.SaleOrder, + SaleOrder = model.SaleOrder ?? "", OrderType = model.InventoryType }; + if (model.DateCode.IndexOf("骞冲簱")>0 || warehouse.WarehouseCode==WarehouseEnum.HA101.ToString()) + { + Dt_Warehouse warehousePing = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); + mesRworkOutboundOrder.WarehouseId = warehousePing.WarehouseId; + mesRworkOutboundOrder.OrderStatus = OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt(); + _unitOfWorkManage.BeginTran(); + _outboundService.RworkOutboundOrderService.Repository.AddData(mesRworkOutboundOrder); + MesInventoryInfo mesInventoryInfo = new MesInventoryInfo() + { + Warhouseno = warehousePing.WarehouseCode, + InternalPackageNumber = model.ProductCode, + SetCount = (int)model.RequiredSetCount, + EligiblePcsCount = (int)model.RequiredQuantity + }; + + MesProductOutBound mesProductOutBound = new MesProductOutBound() + { + TaskNo = mesRworkOutboundOrder.TaskNo, + ProductCode = mesRworkOutboundOrder.ProductCode, + ProductVersion = mesRworkOutboundOrder.ProductVersion, + DateCode = mesRworkOutboundOrder.DateCode, + SaleOrder = mesRworkOutboundOrder.SaleOrder, + InventoryInfo = new List<MesInventoryInfo> { mesInventoryInfo } + }; + if (model.ReceiveDown==EnableEnum.Enable.ObjToInt()) + { + _unitOfWorkManage.RollbackTran(); + } + else + { + //MES鎴愬搧搴撳瓨鏉垮嚭搴撳悓姝� + WebResponseContent responseContentPing = _outboundService.RworkOutboundOrderService.ProductOutBoundSync(mesProductOutBound); + if (!responseContentPing.Status) + { + throw new Exception("鍚屾MES搴撳瓨鏉垮嚭搴撳け璐�,閿欒:" + responseContentPing.Message); + } + _unitOfWorkManage.CommitTran(); + } + return content.OK($"鎻愪緵杩斿簱鍗曟帴鏀舵垚鍔�,ReceiveDown:{model.ReceiveDown}"); + } List<Dt_Task> tasks = new List<Dt_Task>(); List<Dt_ProStockInfo>? proStockInfos = null; List<Dt_OutProStockInfo>? outProStockInfos = null; List<Dt_LocationInfo>? locationInfos = null; + List<Dt_ProStockInfoDetail> proStockInfoDetails = new List<Dt_ProStockInfoDetail>(); //鍒嗛厤搴撳瓨鐢熸垚鎻愬簱浠诲姟 (List<Dt_ProStockInfo>?, Dt_MesRworkOutboundOrder?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>) result = _outboundService.RworkOutboundOrderService.AssignMesStocks(mesRworkOutboundOrder); if (result.Item1 != null && result.Item1.Count > 0) @@ -583,6 +628,10 @@ x.TargetAddress = "5236"; x.OrderNo = mesRworkOutboundOrder.TaskNo; }); + proStockInfos.ForEach(x => + { + proStockInfoDetails.AddRange(x.proStockInfoDetails); + }); _unitOfWorkManage.BeginTran(); int id = BaseDal.AddData(tasks); @@ -597,13 +646,25 @@ if (!updateContent.Status) { - _unitOfWorkManage.RollbackTran(); - return content.Error(updateContent.Message); + throw new Exception(updateContent.Message); } } _outboundService.RworkOutboundOrderService.Repository.AddData(mesRworkOutboundOrder); - _unitOfWorkManage.CommitTran(); - return content.OK("鎻愪緵杩斿簱鍗曟帴鏀舵垚鍔�"); + if (model.ReceiveDown == EnableEnum.Enable.ObjToInt()) + { + _unitOfWorkManage.RollbackTran(); + } + else + { + //MES鎴愬搧搴撳瓨鏉垮嚭搴撳悓姝� + WebResponseContent responseContent = _outboundService.RworkOutboundOrderService.ProductOutBoundSync(_outboundService.RworkOutboundOrderService.MesProOutBound(mesRworkOutboundOrder, proStockInfoDetails)); + if (!responseContent.Status) + { + throw new Exception("鍚屾MES搴撳瓨鏉垮嚭搴撳け璐�,閿欒:" + responseContent.Message); + } + _unitOfWorkManage.CommitTran(); + } + return content.OK($"鎻愪緵杩斿簱鍗曟帴鏀舵垚鍔�,ReceiveDown:{model.ReceiveDown}"); } catch (Exception ex) { -- Gitblit v1.9.3