| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | public WebResponseContent InboundTaskCompleted(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.LocationCode = locationInfo.LocationCode; |
| | | 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.InStock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false); |
| | | |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | task.TaskStatus = InTaskStatusEnum.InFinish.ObjToInt(); |
| | | |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, StockChangeType.Inbound, task.TaskNum); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æçå
¥åºå®æå¤ç |
| | |
| | | WriteLog.GetLog("ä»»å¡å®æ").Write($"æä½äººï¼{(App.User.UserId > 0 ? App.User.UserName : "System")}{Environment.NewLine}ä»»å¡å·ï¼{taskNum}{Environment.NewLine}{JsonConvert.SerializeObject(content)}", "ä»»å¡å®æ"); |
| | | } |
| | | } |
| | | public WebResponseContent TaskCancel(int taskNum) |
| | | public WebResponseContent TaskCancel(string taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum && (x.TaskStatus == AGVTaskStatusEnum.AGV_Wait.ObjToInt() || x.TaskStatus == AGVTaskStatusEnum.AGV_Query.ObjToInt())); |
| | | if (task == null) |
| | | var tasknums = taskNum.Split(','); |
| | | foreach (var item in tasknums) |
| | | { |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯æä»»å¡ç¶æä¸å¹é
"); |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == item.ObjToInt() && (x.TaskStatus == AGVTaskStatusEnum.AGV_Wait.ObjToInt() || x.TaskStatus == AGVTaskStatusEnum.AGV_Query.ObjToInt())); |
| | | if (task == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯æä»»å¡ç¶æä¸å¹é
"); |
| | | } |
| | | //_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); |
| | | } |
| | | //_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) |
| | |
| | | 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) |
| | | if (!source.PointCode.Contains("åææåº")) |
| | | { |
| | | if (toaddress.Contains("æååº")) |
| | | if (target != null && source != null) |
| | | { |
| | | source.PointStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.CachePointService.Repository.UpdateData(source); |
| | | target.PointStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | _basicService.CachePointService.Repository.UpdateData(target); |
| | | if (toaddress.Contains("æååº")) |
| | | { |
| | | source.PointStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.CachePointService.Repository.UpdateData(source); |
| | | target.PointStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | _basicService.CachePointService.Repository.UpdateData(target); |
| | | } |
| | | else |
| | | { |
| | | source.PointStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.CachePointService.Repository.UpdateData(source); |
| | | //target.PointStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | //_basicService.CachePointService.Repository.UpdateData(target); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | source.PointStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.CachePointService.Repository.UpdateData(source); |
| | | //target.PointStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | //_basicService.CachePointService.Repository.UpdateData(target); |
| | | } |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent HCJCope(Dt_Task task, int TaskStatus) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | Dt_CachePoint source = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == task.SourceAddress); |
| | | if (source != null && source.PointCode.Contains("åææåº")) |
| | | { |
| | | source.PointStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.CachePointService.Repository.UpdateData(source); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent CacheStatus(SaveModel saveModel) |
| | | { |
| | | WebResponseContent response = new WebResponseContent(); |