| | |
| | | _taskHtyService = taskHtyService; |
| | | _locationInfoService = locationInfoService; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æå¨ä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent TaskCompleted(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | //_unitOfWorkManage.BeginTran(); |
| | | int TaskStatus = AGVTaskStatusEnum.AGV_Completion.ObjToInt(); |
| | | _taskHtyService.AddTaskHty(task, TaskStatus); |
| | | HCJFree(task, TaskStatus); |
| | | BaseDal.DeleteData(task); |
| | | #region |
| | | //MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted"); |
| | | //if (methodInfo != null) |
| | | //{ |
| | | // WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { task }); |
| | | // if (responseContent != null) |
| | | // { |
| | | // if (App.User.UserId > 0) |
| | | // { |
| | | // var response = HttpHelper.Post<WebResponseContent>(url + "StackCraneTaskCompleted?taskNum=" + task.TaskNum, "", "ä»»å¡å®æ"); |
| | | // if (!response.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return WebResponseContent.Instance.Error(response.Message); |
| | | // } |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // return content = responseContent; |
| | | // } |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // return content = responseContent; |
| | | // } |
| | | |
| | | //} |
| | | #endregion |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | WriteLog.GetLog("ä»»å¡å®æ").Write($"æä½äººï¼{(App.User.UserId > 0 ? App.User.UserName : "System")}{Environment.NewLine}ä»»å¡å·ï¼{taskNum}{Environment.NewLine}{JsonConvert.SerializeObject(content)}", "ä»»å¡å®æ"); |
| | | } |
| | | } |
| | | public WebResponseContent TaskCancel(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | //_unitOfWorkManage.BeginTran(); |
| | | int TaskStatus = AGVTaskStatusEnum.AGV_ManuallyCancel.ObjToInt(); |
| | | _taskHtyService.AddTaskHty(task, TaskStatus); |
| | | //HCJFree(task, TaskStatus); |
| | | BaseDal.DeleteData(task); |
| | | #region |
| | | //MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCancel"); |
| | | //if (methodInfo != null) |
| | | //{ |
| | | // WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { task }); |
| | | // if (responseContent != null) |
| | | // { |
| | | // if (responseContent != null) |
| | | // { |
| | | // if (App.User.UserId > 0) |
| | | // { |
| | | // var response = HttpHelper.Post<WebResponseContent>(url + "TaskCancel?taskNum=" + task.TaskNum, "", "ä»»å¡åæ¶"); |
| | | // if (!response.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return content = WebResponseContent.Instance.Error(response.Message); |
| | | // } |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // return content = responseContent; |
| | | // } |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // return content = responseContent; |
| | | // } |
| | | // } |
| | | //} |
| | | #endregion |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | WriteLog.GetLog("ä»»å¡åæ¶").Write($"æä½äººï¼{(App.User.UserId > 0 ? App.User.UserName : "System")}{Environment.NewLine}ä»»å¡å·ï¼{taskNum}{Environment.NewLine}{JsonConvert.SerializeObject(content)}", "ä»»å¡åæ¶"); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent UpdateTaskStatus(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | { |
| | | task.TaskStatus = OutTaskStatusEnum.SC_OutExecuting.ObjToInt(); |
| | | } |
| | | else if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() ) |
| | | else if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt()) |
| | | { |
| | | task.TaskStatus = InTaskStatusEnum.SC_InExecuting.ObjToInt(); |
| | | } |
| | |
| | | |
| | | return (true, "æå"); |
| | | } |
| | | |
| | | public WebResponseContent OutboundTaskCompleted(Dt_Task task) |
| | | /// <summary> |
| | | /// æå¨ä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent TaskCompleted(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | decimal beforeQuantity = 0; |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | |
| | | CheckCompleted(stockInfo, locationInfo); |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | if (locationInfo.Depth == 2) |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | if (DepthTask(locationInfo) == false) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | |
| | | } |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | //_unitOfWorkManage.BeginTran(); |
| | | int TaskStatus = AGVTaskStatusEnum.AGV_Completion.ObjToInt(); |
| | | _taskHtyService.AddTaskHty(task, TaskStatus); |
| | | HCJFree(task, TaskStatus); |
| | | BaseDal.DeleteData(task); |
| | | #region |
| | | //MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted"); |
| | | //if (methodInfo != null) |
| | | //{ |
| | | // WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { task }); |
| | | // if (responseContent != null) |
| | | // { |
| | | // if (App.User.UserId > 0) |
| | | // { |
| | | // var response = HttpHelper.Post<WebResponseContent>(url + "StackCraneTaskCompleted?taskNum=" + task.TaskNum, "", "ä»»å¡å®æ"); |
| | | // if (!response.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return WebResponseContent.Instance.Error(response.Message); |
| | | // } |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // return content = responseContent; |
| | | // } |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // return content = responseContent; |
| | | // } |
| | | |
| | | task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, 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); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return OnOutboundTaskCompleted?.Invoke(task) ?? WebResponseContent.Instance.OK(); |
| | | |
| | | //} |
| | | #endregion |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | WriteLog.GetLog("ä»»å¡å®æ").Write($"æä½äººï¼{(App.User.UserId > 0 ? App.User.UserName : "System")}{Environment.NewLine}ä»»å¡å·ï¼{taskNum}{Environment.NewLine}{JsonConvert.SerializeObject(content)}", "ä»»å¡å®æ"); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent PalletOutboundTaskCompleted(Dt_Task task) |
| | | public WebResponseContent TaskCancel(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | |
| | | CheckCompleted(stockInfo, locationInfo); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | |
| | | if (locationInfo.Depth == 2) |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum && (x.TaskStatus == AGVTaskStatusEnum.AGV_Wait.ObjToInt() || x.TaskStatus == AGVTaskStatusEnum.AGV_Query.ObjToInt())); |
| | | if (task == null) |
| | | { |
| | | if (DepthTask(locationInfo) == false) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | } |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯æä»»å¡ç¶æä¸å¹é
"); |
| | | } |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | //_unitOfWorkManage.BeginTran(); |
| | | int TaskStatus = AGVTaskStatusEnum.AGV_ManuallyCancel.ObjToInt(); |
| | | _taskHtyService.AddTaskHty(task, TaskStatus); |
| | | Dt_CachePoint source = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == task.SourceAddress); |
| | | Dt_CachePoint target = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == task.TargetAddress); |
| | | var toaddress = JsonConvert.SerializeObject(target); |
| | | if (target != null && source != null) |
| | | { |
| | | source.PointStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.CachePointService.Repository.UpdateData(source); |
| | | target.PointStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.CachePointService.Repository.UpdateData(target); |
| | | } |
| | | BaseDal.DeleteData(task); |
| | | #region |
| | | //MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCancel"); |
| | | //if (methodInfo != null) |
| | | //{ |
| | | // WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { task }); |
| | | // if (responseContent != null) |
| | | // { |
| | | // if (responseContent != null) |
| | | // { |
| | | // if (App.User.UserId > 0) |
| | | // { |
| | | // var response = HttpHelper.Post<WebResponseContent>(url + "TaskCancel?taskNum=" + task.TaskNum, "", "ä»»å¡åæ¶"); |
| | | // if (!response.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return content = WebResponseContent.Instance.Error(response.Message); |
| | | // } |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // return content = responseContent; |
| | | // } |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // return content = responseContent; |
| | | // } |
| | | // } |
| | | //} |
| | | #endregion |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | WriteLog.GetLog("ä»»å¡åæ¶").Write($"æä½äººï¼{(App.User.UserId > 0 ? App.User.UserName : "System")}{Environment.NewLine}ä»»å¡å·ï¼{taskNum}{Environment.NewLine}{JsonConvert.SerializeObject(content)}", "ä»»å¡åæ¶"); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent RelocationTaskCompleted(Dt_Task task) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | 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); |
| | | |
| | | task.TaskStatus = InTaskStatusEnum.RelocationFinish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent InboundTaskCancel(Dt_Task task) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | decimal beforeQuantity = 0; |
| | | |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | |
| | | CheckCompleted(stockInfo, locationInfo); |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.ç»çæå.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | |
| | | beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | } |
| | | |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | task.TaskStatus = InTaskStatusEnum.InCancel.ObjToInt(); |
| | | |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | public WebResponseContent PalletInboundTaskCancel(Dt_Task task) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | } |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | task.TaskStatus = InTaskStatusEnum.InCancel.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | public WebResponseContent OutboundTaskCancel(Dt_Task task) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | decimal beforeQuantity = 0; |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | Dt_StockInfoDetail stockInfoDetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfo.Id); |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | |
| | | CheckCompleted(stockInfo, locationInfo); |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | stockInfoDetail.OutboundQuantity = beforeQuantity; |
| | | |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | _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); |
| | | |
| | | |
| | | task.TaskStatus = OutTaskStatusEnum.OutCancel.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); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent PalletOutboundTaskCancel(Dt_Task task) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | |
| | | CheckCompleted(stockInfo, 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 = StatusEnum.Pallet.ObjToInt(); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | |
| | | task.TaskStatus = OutTaskStatusEnum.OutCancel.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent RelocationTaskCancel(Dt_Task task) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | 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); |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | |
| | | locationEnd.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.RelocationFree(locationStart, task.TaskNum); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationEnd); |
| | | |
| | | task.TaskStatus = InTaskStatusEnum.RelocationCancel.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | public bool DepthTask(Dt_LocationInfo location) |
| | | { |
| | | if (location != null) |
| | | { |
| | | 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_Task tasks = BaseDal.QueryFirst(x => x.SourceAddress == locations.LocationCode); |
| | | return tasks != null ? true : false; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | public WebResponseContent GetTaskInfo() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | List<Dt_CachePoint> cachePoints = _basicService.CachePointService.Repository.QueryData(x => x.PointCode.Contains("æååº")).ToList(); |
| | | foreach (var cachePoint in cachePoints) |
| | | { |
| | | bool isState = (cachePoint.PointStatus == LocationStatusEnum.Free.ObjToInt()); |
| | | //bool isState = (cachePoint.PointStatus == LocationStatusEnum.Free.ObjToInt()); |
| | | string stateName = ""; |
| | | switch (cachePoint.PointStatus) |
| | | { |
| | |
| | | default: |
| | | break; |
| | | } |
| | | list.Add(new { name = cachePoint.Depth, state = isState, statename = stateName }); |
| | | list.Add(new { name = cachePoint.PointName, state = cachePoint.PointStatus, statename = stateName }); |
| | | } |
| | | |
| | | response.OK(data: new { list }); |