1
647556386
2026-03-19 55f28b389b801e033b1315aa95389fc50d3be479
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -390,9 +390,11 @@
                            var response = responseModel(inboundOrder, 3, null, allocatefeedmodel);
                            if (response != null && response.IsSuccess)
                            {
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                                .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                                bool isAll = inboundOrder.Details.All(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
                                int isAllReturnToMESStatus = isAll ? 1 : 3;
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = isAllReturnToMESStatus })
                                .Where(it => it.Id == inboundOrder.Id ).ExecuteCommand();
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = isAllReturnToMESStatus })
                                .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                                //回传成功库存才可用
                                _stockRepository.Db.Updateable<Dt_StockInfoDetail>().SetColumns(it => new Dt_StockInfoDetail
@@ -402,9 +404,11 @@
                            }
                            else
                            {
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 2, Remark = response.ErrorMessage })
                                bool isAll = inboundOrder.Details.All(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
                                int isAllReturnToMESStatus = isAll ? 2 : 4;
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = isAllReturnToMESStatus, Remark = response.ErrorMessage })
                                .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 })
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = isAllReturnToMESStatus })
                               .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                            }
                        }
@@ -457,9 +461,11 @@
                            if (response != null && response.IsSuccess)
                            {
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1, Remark = "" })
                                bool isAll = inboundOrder.Details.All(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
                                int isAllReturnToMESStatus = isAll ? 1 : 3;
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = isAllReturnToMESStatus, Remark = "" })
                                .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = isAllReturnToMESStatus })
                                .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                                //回传成功库存才可用
                                _stockRepository.Db.Updateable<Dt_StockInfoDetail>().SetColumns(it => new Dt_StockInfoDetail
@@ -469,9 +475,11 @@
                            }
                            else
                            {
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 2, Remark = response.ErrorMessage })
                                bool isAll = inboundOrder.Details.All(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
                                int isAllReturnToMESStatus = isAll ? 2 : 4;
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = isAllReturnToMESStatus, Remark = response.ErrorMessage })
                                .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 })
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = isAllReturnToMESStatus })
                               .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                            }
                        }
@@ -604,7 +612,7 @@
                        .Where(x => x.OrderNo == stockLockInfo.OrderNo)
                        .Includes(x => x.Details)
                        .First();
                    string Operator = outboundOrder.Modifier;
                    if (outboundOrder != null)
                    {
                        var allocatInfo =_allocateMaterialInfo.Db.Queryable<Dt_AllocateMaterialInfo>().Where(x => x.OrderNo == outboundOrder.OrderNo).ToList();
@@ -622,8 +630,14 @@
                            }
                        }
                        if (outboundOrder.Details.All(x => x.OrderDetailStatus == (int)OrderDetailStatusEnum.Over) && !allocatInfo.Any())
                        {
                            outboundOrder.OrderStatus = (int)InOrderStatusEnum.入库完成;
                            _outboundOrderService.UpdateData(outboundOrder);
                        }
                        // 7. å›žè°ƒMES
                        string Operator = outboundOrder.Modifier;
                        HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>();
                        string reqCode = Guid.NewGuid().ToString();
                        string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@@ -1017,7 +1031,8 @@
                }
                Dt_OutboundOrder outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x=>x.Details).First();
                if(outboundOrder != null)
                string Operator = outboundOrder.Modifier;
                if (outboundOrder != null)
                {
                    foreach (var item in stockInfo.Details.Where(x => x.OrderNo == outboundOrder.OrderNo).ToList())
                    {
@@ -1031,8 +1046,14 @@
                            }
                        }
                    }
                    var allocateMaterialInfos = _allocateMaterialInfo.QueryData(x => x.OrderNo == outboundOrder.OrderNo);
                    if (outboundOrder.Details.All(x => x.OrderDetailStatus == (int)OrderDetailStatusEnum.Over) && !allocateMaterialInfos.Any())
                    {
                        outboundOrder.OrderStatus = (int)InOrderStatusEnum.入库完成;
                        _outboundOrderService.UpdateData(outboundOrder);
                    }
                }
                string Operator = outboundOrder.Modifier;
                ///回调MES
                HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>();
                string reqCode = Guid.NewGuid().ToString();
@@ -1052,7 +1073,7 @@
                    {
                        return WebResponseContent.Instance.Error($"构建回调对象失败");
                    }
                    string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl"); ;
                    string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl");
                    returnDTO.ReqCode = reqCode;
                    returnDTO.ReqTime = reqTime;
                    JsonSerializerSettings settings = new JsonSerializerSettings