| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æ¾è´§å®æ |
| | | /// </summary> |
| | | /// <param name="code"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent PutFinish(string code, string barCode = "", string taskNum = "") |
| | | { |
| | | try |
| | | { |
| | | string url = AppSettings.Get("WCS"); |
| | | if (string.IsNullOrEmpty(url)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WCSAApiå°å,è¯·æ£æ¥é
ç½®æä»¶"); |
| | | } |
| | | string response = HttpHelper.Post($"{url}/api/CTU_AGV/PutFinish?code={code}&barCode={barCode}&taskNum={taskNum}" ); |
| | | |
| | | return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("è¿åé误"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent AGVTasks(SaveModel saveModel) |
| | | { |
| | |
| | | PalletType = stockInfo.PalletType, |
| | | MaterielCode = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode, |
| | | Quantity = (float)stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.StockQuantity, |
| | | BatchNo = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.AddData(newTask); |
| | |
| | | switch (task.TaskType) |
| | | { |
| | | case (int)TaskTypeEnum.OutProduct: |
| | | case (int)TaskTypeEnum.OutSendProduct: |
| | | content = OutProductCompleted(task); |
| | | break; |
| | | case (int)TaskTypeEnum.OutMesRworkProduct: |
| | |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //MESæååºåºåæ¥ |
| | | MesShipmentOrderSync shipmentOrderSync = MesOutSync(outProStockInfo, proOutOrderDetail, proStockInfoDetails); |
| | | ShipmentOrderSync(shipmentOrderSync); |
| | | ShipmentOrderMESSync(shipmentOrderSync); |
| | | if (task.TaskType!= TaskTypeEnum.OutSendProduct.ObjToInt()) |
| | | { |
| | | MesShipmentOrderSync shipmentOrderSync = MesOutSync(outProStockInfo, proOutOrderDetail, proStockInfoDetails); |
| | | ShipmentOrderSync(shipmentOrderSync); |
| | | ShipmentOrderMESSync(shipmentOrderSync); |
| | | } |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent InboundTaskHandCancel(int taskNum, int warehouseId) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).Includes(x => x.Details).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°æç对åºçç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.Details.Count == 0 && stockInfo.PalletType != PalletTypeEnum.Empty.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥æçåºåæç»ä¿¡æ¯"); |
| | | } |
| | | if (task.TaskType == TaskTypeEnum.MesPalletLargeReturn.ObjToInt() || task.TaskType == TaskTypeEnum.MesPalletSmallReturn.ObjToInt()) |
| | | { |
| | | task.TaskStatus = TaskStatusEnum.Cancel.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.人工å é¤ : OperateTypeEnum.èªå¨å é¤); |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å é¤ : OperateTypeEnum.人工å é¤); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å é¤ : OperateTypeEnum.人工å é¤); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | if (locationInfo != null) |
| | | { |
| | | if (locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½ç¶æä¸æ£ç¡®"); |
| | | } |
| | | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |