| | |
| | | return WebResponseContent.Instance.Error(response.Message); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content=responseContent; |
| | | return content = responseContent; |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content=responseContent; |
| | | return content = responseContent; |
| | | } |
| | | } |
| | | return content=WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ç±»å对åºä¸å¡å¤çé»è¾"); |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ç±»å对åºä¸å¡å¤çé»è¾"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content=WebResponseContent.Instance.Error(ex.Message); |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | WriteLog.GetLog("ä»»å¡å®æ").Write(JsonConvert.SerializeObject(content), "ä»»å¡å®æ"); |
| | | WriteLog.GetLog("ä»»å¡å®æ").Write($"æä½äººï¼{(App.User.UserId>0? App.User.UserName: "System")}{ Environment.NewLine}{ JsonConvert.SerializeObject(content)}", "ä»»å¡å®æ"); |
| | | } |
| | | } |
| | | public WebResponseContent TaskCancel(int taskNum) |
| | |
| | | } |
| | | finally |
| | | { |
| | | WriteLog.GetLog("ä»»å¡åæ¶").Write(JsonConvert.SerializeObject(content), "ä»»å¡åæ¶"); |
| | | WriteLog.GetLog("ä»»å¡åæ¶").Write($"æä½äººï¼{(App.User.UserId > 0 ? App.User.UserName : "System")}{Environment.NewLine}{JsonConvert.SerializeObject(content)}", "ä»»å¡åæ¶"); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent UpdateTaskStatus(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | |
| | | { |
| | | throw new Exception($"ä»»å¡ç±»åé误,æªæ¾å°è¯¥ä»»å¡ç±»å,ä»»å¡å·:ã{task.TaskNum}ã,ä»»å¡ç±»å:ã{task.TaskType}ã"); |
| | | } |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ç±»å对åºä¸å¡å¤çé»è¾"); |
| | | _unitOfWorkManage.BeginTran(); |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = App.User.UserId > 0 ? App.User.UserName : "System"; |
| | | BaseDal.UpdateData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | PalletCode = task.PalletCode, |
| | | LocationCode = task.TargetAddress, |
| | | StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(), |
| | | Creater = App.User.UserId > 0 ? "" : "System", |
| | | Creater = App.User.UserId > 0 ? App.User.UserName : "System", |
| | | CreateDate = App.User.UserId > 0 ? DateTime.Now : DateTime.Now, |
| | | }; |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | |
| | | CheckCompleted(stockInfo, locationInfo); |
| | | |
| | | |
| | | _stockService.StockInfoService.Repository.AddData(stockInfo); |
| | | |
| | |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | if (task.Depth != 1) |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | if (!DepthTask(task)) |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | if (DepthTask(locationInfo) == false) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | //_basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | } |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | |
| | | beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) - beforeQuantity, StockChangeType.Outbound,task.TaskNum); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) - beforeQuantity, StockChangeType.Outbound, task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return OnOutboundTaskCompleted?.Invoke(task) ?? WebResponseContent.Instance.OK(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | if (DepthTask(locationInfo) == false) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | } |
| | | } |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | |
| | | task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | | Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | Dt_LocationInfo locationStart = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | |
| | | CheckCompleted(stockInfo, locationEnd); |
| | | |
| | | stockInfo.LocationCode = locationEnd.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | |
| | | if (locationStart.Depth == 1) |
| | | { |
| | | if (DepthTask(locationStart) == false) |
| | | { |
| | | locationStart.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.RelocationFree(locationEnd, task.TaskNum); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationStart); |
| | | } |
| | | else |
| | | { |
| | | locationStart.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationStart); |
| | | } |
| | | } |
| | | |
| | | _basicService.LocationInfoService.RelocationFree(locationEnd, task.TaskNum); |
| | | |
| | |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false); |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | } |
| | | |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | task.TaskStatus = InTaskStatusEnum.InCancel.ObjToInt(); |
| | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | } |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | task.TaskStatus = InTaskStatusEnum.InCancel.ObjToInt(); |
| | |
| | | _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetail); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | if (DepthTask(locationInfo) == false) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), true); |
| | | } |
| | | } |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | if (DepthTask(locationInfo) == false) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), true); |
| | | } |
| | | } |
| | | locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt(); |
| | | //_basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), true); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | public bool DepthTask(Dt_Task task) |
| | | public bool DepthTask(Dt_LocationInfo location) |
| | | { |
| | | Dt_LocationInfo location=_locationInfoService.Repository.QueryFirst(x=>x.LocationCode == task.SourceAddress); |
| | | if(location != null) |
| | | if (location != null ) |
| | | { |
| | | if(location.Row%2==0) |
| | | Dt_LocationInfo locations = _locationInfoService.Repository.QueryFirst(x => x.RoadwayNo == location.RoadwayNo && x.Column == location.Column && x.Layer == location.Layer && x.Depth != location.Depth && x.Row != location.Row && (SqlFunc.Abs(x.Row - location.Row) == 1)); |
| | | if (locations != null) |
| | | { |
| | | Dt_LocationInfo locations = _locationInfoService.Repository.QueryFirst(x => x.Row == location.Row - 1 && x.Layer == location.Layer && x.Column == location.Column && x.RoadwayNo == location.RoadwayNo); |
| | | Dt_Task tasks=BaseDal.QueryFirst(x=>x.SourceAddress == locations.LocationCode); |
| | | return tasks != null ? true : false; |
| | | } |
| | | else |
| | | { |
| | | Dt_LocationInfo locations = _locationInfoService.Repository.QueryFirst(x => x.Row == location.Row + 1 && x.Layer == location.Layer && x.Column == location.Column && x.RoadwayNo == location.RoadwayNo); |
| | | Dt_Task tasks = BaseDal.QueryFirst(x => x.SourceAddress == locations.LocationCode); |
| | | return tasks != null ? true : false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public WebResponseContent GetTaskInfo() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |