| | |
| | | return tasks; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// åºåæ°æ®è½¬åºåºä»»å¡,ä»»å¡éå
³è任塿ç»ID |
| | | /// </summary> |
| | | /// <param name="stockInfos"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_Task> GetTasksOutBoundDetailId(List<Dt_StockInfo> stockInfos,int detailId) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | | { |
| | | Dt_StockInfo stockInfo = stockInfos[i]; |
| | | |
| | | if (stockInfo != null) |
| | | { |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | Dt_RoadwayInfo roadwayInfo = _basicService.RoadwayInfoService.Repository.QueryFirst(x => x.RoadwayNo == locationInfo.RoadwayNo); |
| | | if (roadwayInfo != null) |
| | | { |
| | | Dt_Task task = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 3, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = roadwayInfo.OutStationCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = roadwayInfo.OutStationCode, |
| | | TaskStatus = OutTaskStatusEnum.OutNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Outbound.ObjToInt(), |
| | | Depth = locationInfo.Depth, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | Remark = detailId.ToString()//ç¨äºä»»å¡å
³èåºåºåæç» |
| | | }; |
| | | tasks.Add(task); |
| | | } |
| | | } |
| | | } |
| | | return tasks; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡æ°æ®å¤ç |
| | | /// </summary> |
| | |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks = GetTasks(result.Item1); |
| | | //tasks = GetTasks(result.Item1); |
| | | tasks = GetTasksOutBoundDetailId(result.Item1, orderDetailId); |
| | | result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | | { |
| | |
| | | if (stockLockInfos != null && stockLockInfos.Count > 0) |
| | | { |
| | | List<Dt_StockInfo> stocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCodes(stockLockInfos.Select(x => x.PalletCode).Distinct().ToList()); |
| | | tasks = GetTasks(stocks); |
| | | //tasks = GetTasks(stocks); |
| | | tasks = GetTasksOutBoundDetailId(stocks, orderDetailId); |
| | | } |
| | | } |
| | | |
| | |
| | | SourceAddress = location.LocationCode, |
| | | TargetAddress = locationInfos.LocationCode, |
| | | TaskStatus = InTaskStatusEnum.RelocationNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Relocation.ObjToInt(), |
| | | //TaskType = TaskTypeEnum.Relocation.ObjToInt(), |
| | | Depth= location.Depth, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | }; |
| | |
| | | /// </summary> |
| | | /// <param name="inTask"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent PalletOutboundTask(string roadwayNo, string endStation) |
| | | public WebResponseContent PalletOutboundTask(string roadwayNo, string endStation,string strayType) |
| | | { |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetPalletStockInfo(roadwayNo); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetPalletStockInfo(roadwayNo,strayType); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ç©ºæçåºå"); |
| | | } |
| | | if (BaseDal.QueryFirst(x => (x.TargetAddress == endStation) && x.TaskStatus == OutTaskStatusEnum.OutNew.ObjToInt()) != null) |
| | | { |
| | | return WebResponseContent.Instance.Error("å½ååºåºç«å°å·²ç»æä¸å°æ°çåºåºä»»å¡ï¼"); |
| | | } |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode && x.RoadwayNo == roadwayNo); |
| | | if (locationInfo == null) |
| | |
| | | TaskStatus = OutTaskStatusEnum.OutNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.PalletOutbound.ObjToInt(), |
| | | Depth = locationInfo.Depth, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | Creater = "System" |
| | | |
| | | }; |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.AddData(task); |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | tasks.Add(task); |
| | | (List<Dt_Task>?, List<Dt_Task>?) result = RelocationTasks(tasks.OrderBy(x => x.Depth).ToList()); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | for (int i = 0; i < result.Item1.Count; i++) |
| | | { |
| | | result.Item1[i].Grade = 1; |
| | | } |
| | | AddData(result.Item1); |
| | | var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", result.Item1, "å
¥åºä»»å¡ä¸å"); |
| | | if (!response.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error($"{response.Message}"); |
| | | } |
| | | } |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | for (int i = 0; i < result.Item2.Count; i++) |
| | | { |
| | | Dt_LocationInfo location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == result.Item2[i].SourceAddress && x.RoadwayNo == result.Item2[i].Roadway); |
| | | if (location.Depth == 2) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationLock(location, result.Item2[i].TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | } |
| | | result.Item2[i].Grade = 1; |
| | | } |
| | | AddData(result.Item2); |
| | | var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", result.Item2, "åºåºä»»å¡ä¸å"); |
| | | if (!response.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error($"{response.Message}"); |
| | | } |
| | | } |
| | | //(List<Dt_Task>?, List<Dt_Task>?) result = RelocationTasks(tasks.OrderBy(x => x.Depth).ToList()); |
| | | //if (result.Item1 != null && result.Item1.Count > 0) |
| | | //{ |
| | | // for (int i = 0; i < result.Item1.Count; i++) |
| | | // { |
| | | // result.Item1[i].Grade = 1; |
| | | // } |
| | | // AddData(result.Item1); |
| | | // var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", result.Item1, "å
¥åºä»»å¡ä¸å"); |
| | | // if (!response.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return WebResponseContent.Instance.Error($"{response.Message}"); |
| | | // } |
| | | //} |
| | | //if (result.Item2 != null && result.Item2.Count > 0) |
| | | //{ |
| | | // for (int i = 0; i < result.Item2.Count; i++) |
| | | // { |
| | | // Dt_LocationInfo location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == result.Item2[i].SourceAddress && x.RoadwayNo == result.Item2[i].Roadway); |
| | | // if (location.Depth == 2) |
| | | // { |
| | | // _basicService.LocationInfoService.UpdateLocationLock(location, result.Item2[i].TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | // } |
| | | // result.Item2[i].Grade = 1; |
| | | // } |
| | | // AddData(result.Item2); |
| | | // var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", result.Item2, "åºåºä»»å¡ä¸å"); |
| | | // if (!response.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return WebResponseContent.Instance.Error($"{response.Message}"); |
| | | // } |
| | | //} |
| | | _stockService.StockInfoService.UpdateData(stockInfo); |
| | | |
| | | _basicService.LocationInfoService.UpdateData(locationInfo); |
| | | |
| | | _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", tasks, "åºåºä»»å¡ä¸å"); |
| | | if (!response.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error($"{response.Message}"); |
| | | } |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |