| | |
| | | if (proStockInfo != null && proStockInfo.StockStatus==StockStatusEmun.åºåºéå®.ObjToInt()) |
| | | { |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | //è·åææåºåºè¯¦æ
æ°æ® |
| | | List<Dt_OutStockLockInfo>? outStockLockInfos = _outboundRepository.OutStockLockInfoRepository.QueryData(x => x.TaskNum == task.TaskNum); |
| | | _unitOfWorkManage.BeginTran(); |
| | | proStockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | _stockRepository.ProStockInfoRepository.DeleteAndMoveIntoHty(proStockInfo,App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | | if (proStockInfo.proStockInfoDetails!=null && proStockInfo.proStockInfoDetails.Count>0) |
| | | { |
| | | _stockRepository.ProStockInfoDetailRepository.DeleteAndMoveIntoHty(proStockInfo.proStockInfoDetails, App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | | } |
| | | if (outStockLockInfos != null && outStockLockInfos.Count > 0) |
| | | { |
| | | outStockLockInfos.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | }); |
| | | List<Dt_OutStockLockInfo> outStockLockInfosMES = outStockLockInfos.Where(x => x.OrderType == OutOrderTypeEnum.OutMESPick.ObjToInt()).ToList(); |
| | | if (outStockLockInfosMES != null && outStockLockInfosMES.Count() > 0) |
| | | { |
| | | Dt_AGVStationInfo aGVStationInfo = _basicRepository.AGVStationInfoRepository.QueryFirst(x => x.AGVStationCode == task.TargetAddress); |
| | | MESDeliveryModel mESDeliveryModel = MESDeliveryUp(outStockLockInfosMES, aGVStationInfo.MESPointCode); |
| | | MESResponse response = _invokeMESService.MESDelivery(mESDeliveryModel).DeserializeObject<MESResponse>() ?? throw new Exception("æªè·åå°è¿åä¿¡æ¯"); |
| | | if (!response.Result) |
| | | { |
| | | throw new Exception($"MESé
éåºåæ¥å£è°ç¨æ¥é,MESè¿åä¿¡æ¯{DecodeUnicode(response.Msg)}"); |
| | | } |
| | | } |
| | | } |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, proStockInfo.PalletType, LocationStatusEnum.Free, proStockInfo.WarehouseId); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | |
| | | return tasks; |
| | | } |
| | | /// <summary> |
| | | /// åºåæ°æ®è½¬åºåºä»»å¡(MESå·¥å) |
| | | /// åºåæ°æ®è½¬åºåºä»»å¡(MESå·¥åæå) |
| | | /// </summary> |
| | | /// <param name="stockInfos"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_Task> GetTasks(List<Dt_ProStockInfo> stockInfos, List<Dt_OutStockLockInfo> outStockLockInfos, TaskTypeEnum taskType = new TaskTypeEnum()) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | | { |
| | | Dt_ProStockInfo stockInfo = stockInfos[i]; |
| | | |
| | | if (stockInfo != null) |
| | | { |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | if (!tasks.Exists(x => x.PalletCode == stockInfo.PalletCode)) |
| | | { |
| | | Dt_OutStockLockInfo outStockLockInfo = outStockLockInfos.FirstOrDefault(x => x.PalletCode == stockInfo.PalletCode); |
| | | taskType = outStockLockInfo.MachineName.ObjToInt() switch |
| | | { |
| | | (int)StationAreaEnum.äºæ¥¼çº¸è¢ or |
| | | (int)StationAreaEnum.äºæ¥¼æ 纺å¸è¢ or |
| | | (int)StationAreaEnum.äºæ¥¼çº¸æ¯ => TaskTypeEnum.OutCarton, |
| | | (int)StationAreaEnum.䏿¥¼æ 纺ç»å¸ => TaskTypeEnum.OutWFB, |
| | | _ => throw new Exception($"æªæ¾å°å å·¥ä¸å¿ä»»å¡ç±»ååé
") |
| | | }; |
| | | Dt_Task task = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = "", |
| | | TaskStatus = TaskStatusEnum.CallPending.ObjToInt(), |
| | | TaskType = taskType.ObjToInt(), |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | MaterielCode = stockInfo.proStockInfoDetails?.FirstOrDefault().ProductCode ??"", |
| | | Quantity = stockInfo.proStockInfoDetails?.Sum(x=>x.StockQty) ?? 0, |
| | | OrderNo = outStockLockInfo.OrderNo, |
| | | DispatchPlanId = outStockLockInfo.OrderDetailId, |
| | | WorkCentreCode = outStockLockInfo.MakeCode |
| | | }; |
| | | tasks.Add(task); |
| | | } |
| | | } |
| | | } |
| | | return tasks; |
| | | } |
| | | /// <summary> |
| | | /// åºåæ°æ®è½¬åºåºä»»å¡(MESå·¥ååæ) |
| | | /// </summary> |
| | | /// <param name="stockInfos"></param> |
| | | /// <returns></returns> |
| | |
| | | { |
| | | (int)StationAreaEnum.äºæ¥¼çº¸è¢ => TaskTypeEnum.PaperYLOutZDGL, |
| | | (int)StationAreaEnum.䏿¥¼å°å· => TaskTypeEnum.PrintYLOutbound, |
| | | (int)StationAreaEnum.䏿¥¼åå => TaskTypeEnum.OutFenQie, |
| | | _ => throw new Exception($"æªæ¾å°å å·¥ä¸å¿ä»»å¡ç±»ååé
") |
| | | }; |
| | | Dt_Task task = new() |
| | |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | MaterielCode= stockInfo.proStockInfoDetails?.FirstOrDefault().ProductCode ?? "" , |
| | | Quantity = 0, |
| | | Quantity = stockInfo.proStockInfoDetails?.Sum(x=>x.StockQty) ?? 0, |
| | | }; |
| | | tasks.Add(task); |
| | | } |
| | |
| | | nameof(StationAreaEnum.䏿¥¼åå) => TaskTypeEnum.OutFenQie, |
| | | nameof(StationAreaEnum.䏿¥¼æ¨¡å) => TaskTypeEnum.OutMoQie, |
| | | nameof(StationAreaEnum.䏿¥¼å²å) => TaskTypeEnum.OutChongQie, |
| | | nameof(StationAreaEnum.䏿¥¼æå) => TaskTypeEnum.OutProduct, |
| | | nameof(StationAreaEnum.äºæ¥¼çº¸è¢) or |
| | | nameof(StationAreaEnum.äºæ¥¼æ 纺å¸è¢) or |
| | | nameof(StationAreaEnum.äºæ¥¼çº¸æ¯) => TaskTypeEnum.OutCarton, |
| | |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | //è·åä»»å¡ |
| | | tasks = GetTasks(result.Item1, TaskTypeEnum.OldYLOutbound); |
| | | tasks = GetTasks(result.Item1.Where(x=> !x.LocationCode.IsNullOrEmpty()).ToList(), TaskTypeEnum.OldYLOutbound); |
| | | result.Item2.ForEach(x => |
| | | { |
| | | if (result.Item3.FirstOrDefault(t=>t.OrderDetailId==x.Id)!=null) |
| | |
| | | }); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | if (x.LocationCode== "èåç¼ååº") |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | } |
| | | }); |
| | | |
| | | stockInfos = result.Item1; |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //æ°å¢ |
| | | List<BSTPickInfoDTO> bSTPickInfosAdd = bSTPickInfoDTOs.Where(x => x.Way == 1).ToList(); |
| | | //è·åæ°å¢æç»é¢æ |
| | | List<PaperMattakeDetailItem>? paperMattakeDetailItemsAdd = null; |
| | | //ä¿®æ¹ |
| | | List<BSTPickInfoDTO> bSTPickInfosUp = bSTPickInfoDTOs.Where(x => x.Way == 2).ToList(); |
| | | //è·åæ°å¢æç»é¢æ |
| | | List<PaperMattakeDetailItem>? paperMattakeDetailItemsUp = null; |
| | | if (bSTPickInfosAdd != null && bSTPickInfosAdd.Count > 0) |
| | | { |
| | | paperMattakeDetailItemsAdd = bSTPickInfosAdd.SelectMany(x => x.PaperMattakeDetails).ToList(); |
| | | } |
| | | if (bSTPickInfosUp != null && bSTPickInfosUp.Count > 0) |
| | | { |
| | | paperMattakeDetailItemsUp = bSTPickInfosUp.SelectMany(x => x.PaperMattakeDetails).ToList(); |
| | | } |
| | | //è·åææå¾
颿çåºåºè¯¦æ
|
| | | List<Dt_OutStockLockInfo> outStockLockInfos = _outboundRepository.OutStockLockInfoRepository.QueryData(x => x.OrderType == OutOrderTypeEnum.OutSGPick.ObjToInt() && x.Status==OutLockStockStatusEnum.åºåºå®æ.ObjToInt()); |
| | | #region 颿é»è¾ |
| | | if (paperMattakeDetailItemsAdd != null && paperMattakeDetailItemsAdd.Count > 0) |
| | | { |
| | | foreach (var item in paperMattakeDetailItemsAdd) |
| | | { |
| | | //è·å对åºç |
| | | } |
| | | } |
| | | |
| | | if (paperMattakeDetailItemsUp != null && paperMattakeDetailItemsUp.Count > 0) |
| | | //è·å颿æ¡ç ååºå |
| | | List<string> lockCodes = bSTPickInfoDTOs.SelectMany(x => x.PaperMattakeDetails).Select(x=>x.Barcode).Distinct().ToList(); |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.QueryData(x => lockCodes.Contains(x.PalletCode) && x.WarehouseId == WarehouseEnum.LLDOldCache.ObjToInt()); |
| | | List<string> ExistNoCodes = lockCodes.Where(x => !stockInfos.Select(x=>x.PalletCode).Contains(x)).ToList(); |
| | | //è·åå¾
颿çåºåºè¯¦æ
|
| | | List<Dt_OutStockLockInfo> outStockLockInfos = _outboundRepository.OutStockLockInfoRepository.QueryData(x => x.OrderType == OutOrderTypeEnum.OutSGPick.ObjToInt() && x.Status==OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && lockCodes.Distinct().ToList().Contains(x.PalletCode)); |
| | | //åºåºè¯¦æ
ç¶ææ´æ° |
| | | if (outStockLockInfos.Count > 0) |
| | | { |
| | | foreach (var item in paperMattakeDetailItemsUp) |
| | | outStockLockInfos.ForEach(x => |
| | | { |
| | | |
| | | x.Status = OutLockStockStatusEnum.å
³é.ObjToInt(); |
| | | }); |
| | | } |
| | | List<int> BSTPickDetailsId = outStockLockInfos.Select(x => x.OrderDetailId).Distinct().ToList(); |
| | | //è·åå¯¹åºæç¨ |
| | | List<Dt_OutSGOrder> outSGOrders = BaseDal.Db.Queryable<Dt_OutSGOrder>().Where(x => x.OutSGOrderStatus < OutOrderStatusEnum.åºåºå®æ.ObjToInt()).Includes(x => x.Details) |
| | | .Where(x => x.Details |
| | | .Any(v => |
| | | BSTPickDetailsId.Contains(v.Id)) |
| | | ).OrderBy(x => x.CreateDate).ToList(); |
| | | List<Dt_OutSGOrderDetail> orderDetails = new List<Dt_OutSGOrderDetail>(); |
| | | //å¤çæç¨ |
| | | if (outSGOrders.Count>0) |
| | | { |
| | | orderDetails = outSGOrders.SelectMany(x=>x.Details).Where(x=> BSTPickDetailsId.Contains(x.Id)).ToList(); |
| | | orderDetails.ForEach(x => |
| | | { |
| | | x.OutSGOrderDetailStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); |
| | | }); |
| | | foreach (var item in outSGOrders) |
| | | { |
| | | int overCount = item.Details.Where(x=>x.OutSGOrderDetailStatus==OutLockStockStatusEnum.åºåºå®æ.ObjToInt()).Count(); |
| | | int thisCount = orderDetails.Where(x => x.OutSGOrderId == item.Id).Count(); |
| | | if ((overCount + thisCount) == item.Details.Count) |
| | | { |
| | | item.OutSGOrderStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | //è·åææå¾
颿çåºå |
| | | #region 颿é»è¾ |
| | | foreach (var item in stockInfos) |
| | | { |
| | | if (item.StockStatus==StockStatusEmun.åºåºå®æ.ObjToInt()) |
| | | { |
| | | item.StockLength = 0; |
| | | item.MaterielWeight = 0; |
| | | item.MaterielThickness = 0; |
| | | item.MaterielWide = 0; |
| | | item.StockOutLength = 0; |
| | | item.IsFull = WhetherEnum.True.ObjToInt(); |
| | | item.IsPick = WhetherEnum.True.ObjToInt(); |
| | | } |
| | | } |
| | | #endregion |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfos); |
| | | _outboundRepository.OutStockLockInfoRepository.UpdateData(outStockLockInfos); |
| | | _outboundRepository.OutSGOrderRepository.UpdateData(outSGOrders); |
| | | _outboundRepository.OutSGOrderDetailRepository.UpdateData(orderDetails); |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK(ExistNoCodes.Count>0 ? string.Join(",", ExistNoCodes)+"èå坿£åºåä¸åå¨" : ""); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æä½æ°æ®ï¼å¹¶åé
éæ±åºå |
| | | _outboundRepository.OutMESOrderRepository.AddData(AddoutMESOrders); |
| | | List<Dt_OutMESOrder> mESOrders = _outboundRepository.OutMESOrderRepository.QueryData(x => AddoutMESOrders.Select(x => x.OutDetailId).Contains(x.OutDetailId)); |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_StockInfo>? stockInfos = null; |
| | | List<Dt_OutMESOrder>? Orders = null; |
| | | List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | { |
| | | //åé
åºå |
| | | (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(mESOrders); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | //åå»ºä»»å¡ |
| | | tasks = GetTasks(result.Item1, result.Item3); |
| | | result.Item2.ForEach(x => |
| | | { |
| | | OutOrderStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | //List<Dt_OutMESOrder> mESOrders = _outboundRepository.OutMESOrderRepository.QueryData(x => AddoutMESOrders.Select(x => x.OutDetailId).Contains(x.OutDetailId)); |
| | | //{ |
| | | // List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | // List<Dt_ProStockInfo>? stockInfos = null; |
| | | // List<Dt_OutMESOrder>? Orders = null; |
| | | // List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | // List<Dt_LocationInfo>? locationInfos = null; |
| | | // { |
| | | // if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList().Count>0) |
| | | // { |
| | | // //åé
åºå |
| | | // (List<Dt_ProStockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignProStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList()); |
| | | // if (result.Item1 != null && result.Item1.Count > 0) |
| | | // { |
| | | // //åå»ºä»»å¡ |
| | | // tasks = GetTasks(result.Item1, result.Item3); |
| | | // result.Item3.ForEach(x => |
| | | // { |
| | | // x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | // }); |
| | | // stockInfos = result.Item1; |
| | | // Orders = result.Item2; |
| | | // outStockLockInfos = result.Item3; |
| | | // locationInfos = result.Item4; |
| | | // } |
| | | // } |
| | | // } |
| | | // if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0) |
| | | // { |
| | | // BaseDal.AddData(tasks); |
| | | // stockInfos.ForEach(x => |
| | | // { |
| | | // x.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | // }); |
| | | // WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks); |
| | | |
| | | stockInfos = result.Item1; |
| | | Orders = result.Item2; |
| | | outStockLockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ åºå"); |
| | | } |
| | | } |
| | | int id = BaseDal.AddData(tasks); |
| | | |
| | | if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) |
| | | { |
| | | stockInfos.ForEach(x => |
| | | { |
| | | x.StockStatus=StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | }); |
| | | WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks); |
| | | |
| | | if (!contentResponse.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content.Error(contentResponse.Message); |
| | | } |
| | | } |
| | | |
| | | // if (!contentResponse.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return content.Error(contentResponse.Message); |
| | | // } |
| | | // } |
| | | //} |
| | | //{ |
| | | // List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | // List<Dt_StockInfo>? stockInfos = null; |
| | | // List<Dt_OutMESOrder>? Orders = null; |
| | | // List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | // List<Dt_LocationInfo>? locationInfos = null; |
| | | // { |
| | | // if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList().Count > 0) |
| | | // { |
| | | // //åé
åºå |
| | | // (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList()); |
| | | // if (result.Item1 != null && result.Item1.Count > 0) |
| | | // { |
| | | // //åå»ºä»»å¡ |
| | | // tasks = GetTasks(result.Item1, result.Item3); |
| | | // result.Item3.ForEach(x => |
| | | // { |
| | | // x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | // }); |
| | | // stockInfos = result.Item1; |
| | | // Orders = result.Item2; |
| | | // outStockLockInfos = result.Item3; |
| | | // locationInfos = result.Item4; |
| | | // } |
| | | // } |
| | | // } |
| | | // if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0) |
| | | // { |
| | | // BaseDal.AddData(tasks); |
| | | // stockInfos.ForEach(x => |
| | | // { |
| | | // x.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | // }); |
| | | // WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks); |
| | | // if (!contentResponse.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return content.Error(contentResponse.Message); |
| | | // } |
| | | // } |
| | | //} |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | return content.OK("æ¥æ¶æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// 空æå çåºåº |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent PlateOutbound(string stationCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åæææå°åºåºä»»å¡ |
| | | Dt_Task TasksOut = BaseDal.QueryFirst(x => x.TaskType == TaskTypeEnum.OutEmptyPlate.ObjToInt()); |
| | | if (TasksOut != null) |
| | | throw new Exception($"ä»»å¡å·²åå¨"); |
| | | //è·åè´§ä½ |
| | | List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => x.WarehouseId == WarehouseEnum.LLDCP.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()); |
| | | Dt_ProStockInfo? stockInfo = BaseDal.Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Select(x => x.LocationCode).Contains(x.LocationCode) && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt() && x.ProStockAttribute == ProStockAttributeEnum.空æ.ObjToInt()).OrderBy(x => x.CreateDate).ToList().FirstOrDefault() ?? throw new Exception($"åºåç©ºææ°éä¸è¶³"); |
| | | |
| | | Dt_LocationInfo locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == stockInfo.LocationCode); |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | |
| | | TaskTypeEnum typeEnum = TaskTypeEnum.OutEmptyPlate; |
| | | |
| | | List<Dt_Task> tasks = GetTasks(new List<Dt_ProStockInfo>() { stockInfo }, typeEnum, new List<Dt_LocationInfo>() { locationInfo }); |
| | | if (tasks == null || tasks.Count <= 0) |
| | | { |
| | | return content.Error($"çæä»»å¡å¤±è´¥"); |
| | | } |
| | | tasks.ForEach(x => |
| | | { |
| | | x.TargetAddress = stationCode; |
| | | }); |
| | | //夿æ¯å¦æåºåºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.ProStockInfoRepository.UpdateData(stockInfo); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicRepository.LocationInfoRepository.UpdateLocationStatus(new List<Dt_LocationInfo>() { locationInfo }, LocationStatusEnum.Lock); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(new List<Dt_LocationInfo>() { locationInfo }, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, taskNums: tasks.Select(x => x.TaskNum).ToList()); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(tasks); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(tasks); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |