| | |
| | | // 判断Success的值 |
| | | if (!response.Success) |
| | | { |
| | | WriteLog.Write_Log("API", "SMOM立库回传给WMS", "请求失败", new { 请求报文 = houseInboundPassBack, 接收报文 = response }); |
| | | throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}"); |
| | | } |
| | | WriteLog.Write_Log("API", "SMOM立库入库回传WMS", "请求成功", new { 请求报文 = houseInboundPassBack, 接收报文 = response }); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "调拨入库数量回传WMS"); |
| | | if (!response.Success) |
| | | { |
| | | WriteLog.Write_Log("API", "SMOM调拨入库数量回传WMS", "请求失败", new { 请求报文 = inventoryAllocate, 接收报文 = response }); |
| | | throw new Exception($"操作失败:{response.Message ?? "未提供错误信息"}"); |
| | | } |
| | | WriteLog.Write_Log("API", "SMOM调拨入库数量回传WMS", "请求成功", new { 请求报文 = inventoryAllocate, 接收报文 = response }); |
| | | |
| | | } |
| | | } |
| | | else if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 5 && inboundOrder.System.Equals("SMOM")) |
| | |
| | | { |
| | | OrderNo = inboundOrder.OrderNo, |
| | | Details = StockInfos.SelectMany(stockInfo => |
| | | |
| | | stockInfo.Details.Select(g => |
| | | { |
| | | //var InboundOrderde1=dt_InboundOrder.Details.FirstOrDefault; |
| | |
| | | TargetLocName = stockInfo.LocationCode, // 添加null检查 |
| | | TargetLpn = stockInfo.PalletCode, // 添加null检查 |
| | | }; |
| | | |
| | | |
| | | })).ToList() |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | }; |
| | |
| | | var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, houseSyncretism, "立库入库数量回传WMS"); |
| | | if (!response.Success) |
| | | { |
| | | WriteLog.Write_Log("API", "SMOM立库入库数量回传WMS", "请求失败", new { 请求报文 = houseSyncretism, 接收报文 = response }); |
| | | throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}"); |
| | | } |
| | | WriteLog.Write_Log("API", "SMOM立库入库数量回传WMS", "请求成功", new { 请求报文 = houseSyncretism, 接收报文 = response }); |
| | | |
| | | } |
| | | |
| | |
| | | if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 0 && inboundOrder.System.Equals("SMOM")) |
| | | { |
| | | //SendInboundInfoToWMS(task, inboundOrder, stockInfo); |
| | | SendInboundInfoToWMS(task, inboundOrder, dt_StockInfo); |
| | | |
| | | } |
| | | else if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 2 && inboundOrder.System.Equals("SMOM")) |
| | | { |
| | |
| | | // 判断Success的值 |
| | | if (response.Success) |
| | | { |
| | | WriteLog.Write_Log("API", "SMOM立库入库回传WMS", "请求成功", new { 请求报文 = houseInboundPassBack, 接收报文 = response }); |
| | | // 如果Success为true,返回需要的值(这里以返回整个响应对象为例) |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.Write_Log("API", "SMOM立库入库回传WMS", "请求失败", new { 请求报文 = houseInboundPassBack, 接收报文 = response }); |
| | | // 如果Success为false,抛出异常并包含错误信息 |
| | | throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}"); |
| | | } |
| | |
| | | // 判断Success的值 |
| | | if (response.Success) |
| | | { |
| | | WriteLog.Write_Log("API", "取消发货后立库反拣入库回传WMS", "请求成功", new { 请求报文 = houseReturnOrders, 接收报文 = response }); |
| | | |
| | | // 如果Success为true,返回需要的值(这里以返回整个响应对象为例) |
| | | return WebResponseContent.Instance.OK(); |
| | | |
| | | } |
| | | else |
| | | { |
| | | WriteLog.Write_Log("API", "取消发货后立库反拣入库回传WMS", "请求失败", new { 请求报文 = houseReturnOrders, 接收报文 = response }); |
| | | |
| | | // 如果Success为false,抛出异常并包含错误信息 |
| | | throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}"); |
| | | } |
| | |
| | | }; |
| | | |
| | | HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "调拨入库数量回传WMS"); |
| | | WriteLog.Write_Log("API", "调拨入库数量回传WMS", "请求", new { 请求报文 = inventoryAllocate, 接收报文 = inventoryAllocate }); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | foreach (var orderDetail in outboundOrderDetails1.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())) |
| | | { |
| | | FeedBackOutERP(outboundOrder.OrderNo, orderDetail.LinId); |
| | | |
| | | } |
| | | |
| | | // 如果有完成的明细,下载报表 |
| | |
| | | var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "立库出库数量回传WMS"); |
| | | if (!response.Success) |
| | | { |
| | | WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求失败", new { 请求报文 = passBack, 接收报文 = response }); |
| | | |
| | | throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}"); |
| | | } |
| | | WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求成功", new { 请求报文 = passBack, 接收报文 = response }); |
| | | } |
| | | } |
| | | |
| | |
| | | var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "立库入库数量回传WMS"); |
| | | if (!response.Success) |
| | | { |
| | | WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求失败", new { 请求报文 = allocate, 接收报文 = response }); |
| | | |
| | | throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}"); |
| | | } |
| | | WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求成功", new { 请求报文 = allocate, 接收报文 = response }); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "立库出库数量回传WMS"); |
| | | if (!response.Success) |
| | | { |
| | | WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求失败", new { 请求报文 = passBack, 接收报文 = response }); |
| | | |
| | | throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}"); |
| | | } |
| | | WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求成功", new { 请求报文 = passBack, 接收报文 = response }); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "立库入库数量回传WMS"); |
| | | if (!response.Success) |
| | | { |
| | | WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求失败", new { 请求报文 = allocate, 接收报文 = response }); |
| | | |
| | | throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}"); |
| | | } |
| | | WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求成功", new { 请求报文 = allocate, 接收报文 = response }); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | if(outboundOrderDetail != null) |
| | | { |
| | | outboundOrderDetails.Add(outboundOrderDetail); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | for (var i = 0; i < outboundOrderDetails.Count; i++) |
| | |
| | | { "InvOrgId", authResult.InvOrgId } |
| | | }; |
| | | |
| | | var response = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskin, allocate, "立库入库数量回传WMS"); |
| | | WriteLog.Write_Log("API", "SMOM立库入库数量回传WMS", "请求", new { 请求报文 = allocate, 接收报文 = response }); |
| | | |
| | | HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskin, allocate, "立库入库数量回传WMS"); |
| | | } |
| | | } |
| | | |
| | |
| | | var matchedStockDetail = stockInfoDetails.FirstOrDefault(x => x.MaterielCode == outDetail.MaterielCode && x.BatchNo == outDetail.BatchNo); |
| | | if (matchedStockDetail == null) |
| | | { |
| | | matchedStockDetail = stockInfoDetails.FirstOrDefault(x =>x.MaterielCode == outDetail.MaterielCode); |
| | | matchedStockDetail = stockInfoDetails.FirstOrDefault(x => |
| | | x.MaterielCode == outDetail.MaterielCode); |
| | | |
| | | if (matchedStockDetail == null) |
| | | { |
| | |
| | | |
| | | result = response.Content.ReadAsStringAsync() |
| | | .ConfigureAwait(false).GetAwaiter().GetResult(); |
| | | WriteLog.Write_Log("API", "单据明细出库完成回调ERP", "请求成功", new { 请求报文 = postContent, 接收报文 = response }); |
| | | |
| | | } |
| | | |
| | | // 假设ERP返回成功时返回成功响应 |
| | |
| | | } |
| | | catch (HttpRequestException ex) |
| | | { |
| | | WriteLog.Write_Log("API", "单据明细出库完成回调ERP", "请求失败", new { 请求报文 = postContent, 接收报文 = ex.Message }); |
| | | |
| | | // 处理HTTP请求相关异常 |
| | | return WebResponseContent.Instance.Error($"HTTP请求错误: {ex.Message}"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteLog.Write_Log("API", "单据明细出库完成回调ERP", "请求失败", new { 请求报文 = postContent, 接收报文 = ex.Message }); |
| | | |
| | | // 处理其他异常 |
| | | return WebResponseContent.Instance.Error($"处理失败: {ex.Message}"); |
| | | } |
| | |
| | | // 判断Success的值 |
| | | if (response.Code == 0) |
| | | { |
| | | WriteLog.Write_Log("API", "任务回传给erp", "请求成功", new { 请求报文 = feedbackInboundOrder, 接收报文 = response }); |
| | | |
| | | // 如果Success为true,返回需要的值(这里以返回整个响应对象为例) |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.Write_Log("API", "任务回传给erp", "请求失败", new { 请求报文 = feedbackInboundOrder, 接收报文 = response }); |
| | | |
| | | // 如果Success为false,抛出异常并包含错误信息 |
| | | throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}"); |
| | | } |