| | |
| | | { |
| | | return content.Error($"çæä»»å¡å¤±è´¥"); |
| | | } |
| | | tasks.ForEach(x => |
| | | { |
| | | x.Grade = 99; |
| | | }); |
| | | stockInfos.ForEach(x => |
| | | { |
| | | x.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | //çæä»»å¡ãåºåçä¿¡æ¯ |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutSGTaskDataHandle(keys); |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) result = OutSGTaskDataHandle(keys); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | stockInfos.AddRange(result.Item2); |
| | |
| | | { |
| | | tasks.AddRange(result.Item1); |
| | | } |
| | | content.Message = result.Item6; |
| | | //å¤çåºåºæ°æ® |
| | | return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos); |
| | | } |
| | |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutSGTaskDataHandle(int[] keys) |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) OutSGTaskDataHandle(int[] keys) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_OutSGOrderDetail> outSGOrderDetails = _outboundRepository.OutSGOrderDetailRepository.QueryData(x => keys.Contains(x.Id)); |
| | |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | |
| | | //åé
åºå |
| | | (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails); |
| | | (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | //è·åä»»å¡ |
| | |
| | | throw new Exception("æ åºå"); |
| | | } |
| | | |
| | | return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos); |
| | | return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos, result.Item5); |
| | | } |
| | | /// <summary> |
| | | /// å¤çåºåºæ°æ® |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | List<Dt_OutLineView> outLineViewsDel = _outboundRepository.OutLineViewRepository.QueryData(x => stockInfos.Select(x=>x.PalletCode).Contains(x.PalletCode)); |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfos); |
| | | _outboundRepository.OutStockLockInfoRepository.UpdateData(outStockLockInfos); |
| | | _outboundRepository.OutSGOrderRepository.UpdateData(outSGOrders); |
| | | _outboundRepository.OutSGOrderDetailRepository.UpdateData(orderDetails); |
| | | _outboundRepository.OutLineViewRepository.DeleteData(outLineViewsDel); |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK(ExistNoCodes.Count>0 ? string.Join(",", ExistNoCodes)+"èå坿£åºåä¸åå¨" : ""); |
| | | } |
| | |
| | | public WebResponseContent ReceiveOutBound(List<OutMESOrderDTO> outMESOrderDTOs) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | string ErrorMsg = ""; |
| | | try |
| | | { |
| | | if (outMESOrderDTOs == null || outMESOrderDTOs.Count <= 0) |
| | |
| | | //è·åææå å·¥ä¸å¿ |
| | | List<Dt_MakeCenterInfo> makeCenterInfos = _basicRepository.MakeCenterInfoRepository.QueryData(); |
| | | |
| | | OutMESOrderDTO? CheckMaterialCode = outMESOrderDTOs.FirstOrDefault(x => !materielInfos.Select(x => x.MaterielCode).Contains(x.MaterialCode)); |
| | | if (CheckMaterialCode != null) |
| | | { |
| | | return content.Error($"ç©æç¼ç {nameof(OutMESOrderDTO.MaterialCode)}:{CheckMaterialCode.MaterialCode}ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | //OutMESOrderDTO? CheckMaterialCode = outMESOrderDTOs.FirstOrDefault(x => !materielInfos.Select(x => x.MaterielCode).Contains(x.MaterialCode)); |
| | | //if (CheckMaterialCode != null) |
| | | //{ |
| | | // return content.Error($"ç©æç¼ç {nameof(OutMESOrderDTO.MaterialCode)}:{CheckMaterialCode.MaterialCode}ä¿¡æ¯ä¸åå¨"); |
| | | //} |
| | | OutMESOrderDTO? CheckMakeCenterCode = outMESOrderDTOs.FirstOrDefault(x => !makeCenterInfos.Select(x => x.MakeCode).Contains(x.MakeCode)); |
| | | if (CheckMakeCenterCode!=null) |
| | | { |
| | |
| | | { |
| | | return content.Error($"é¢æè®¡å{nameof(OutMESOrderDTO.OutDetailId)}:{OldoutMESOrder.OutDetailId}ä¿¡æ¯å·²åå¨"); |
| | | } |
| | | List<Dt_OutMESOrder> AddoutMESOrders = outMESOrderDTOs.Select(x => _mapper.Map<Dt_OutMESOrder>(x)).ToList(); |
| | | foreach (var item in AddoutMESOrders) |
| | | List<Dt_OutMESOrder> AddoutMESOrders = new List<Dt_OutMESOrder>(); |
| | | foreach (var item in outMESOrderDTOs) |
| | | { |
| | | Dt_MaterielInfo materielInfo = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterialCode); |
| | | Dt_MakeCenterInfo makeCenterInfo=makeCenterInfos.FirstOrDefault(x => x.MakeCode == item.MakeCode); |
| | | item.MakeArea = makeCenterInfo.MakeArea; |
| | | item.WarehouseId = materielInfo.WarehouseId; |
| | | item.MaterielUnit = materielInfo.MaterielUnit; |
| | | item.AssistUnitCode = materielInfo.AssistUnitCode; |
| | | Dt_MaterielInfo? materielInfo = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterialCode); |
| | | if (materielInfo==null) |
| | | { |
| | | ErrorMsg += $"ç©æç¼ç :{item.MaterialCode}ä¿¡æ¯ä¸åå¨;"; |
| | | continue; |
| | | } |
| | | Dt_MakeCenterInfo makeCenterInfo = makeCenterInfos.FirstOrDefault(x => x.MakeCode == item.MakeCode); |
| | | Dt_OutMESOrder outMESOrder = _mapper.Map<Dt_OutMESOrder>(item); |
| | | outMESOrder.MakeArea = makeCenterInfo.MakeArea; |
| | | outMESOrder.WarehouseId = materielInfo.WarehouseId; |
| | | outMESOrder.MaterielUnit = materielInfo.MaterielUnit; |
| | | outMESOrder.AssistUnitCode = materielInfo.AssistUnitCode; |
| | | AddoutMESOrders.Add(outMESOrder); |
| | | } |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æä½æ°æ®ï¼å¹¶åé
éæ±åºå |
| | | _outboundRepository.OutMESOrderRepository.AddData(AddoutMESOrders); |
| | |
| | | // } |
| | | //} |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | return content.OK("æ¥æ¶æå"); |
| | | return content.OK(ErrorMsg.IsNullOrEmpty()? "æ¥æ¶æå" : $"ä¿¡æ¯ï¼{ErrorMsg}"); |
| | | } |
| | | catch (Exception ex) |
| | | { |