| | |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stationCode, |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskStatus = InTaskStatusEnum.InNew.ObjToInt(), |
| | | TaskState = InTaskStatusEnum.InNew.ObjToInt(), |
| | | TaskType = taskType, |
| | | }; |
| | | BaseDal.AddData(task); |
| | |
| | | { |
| | | var task = BaseDal.QueryFirst(x => x.PalletCode == lineDTO.Barcode); |
| | | if (task == null) throw new Exception($"æªæ¾å°æçå·[{lineDTO.Barcode}]çå
¥åºä»»å¡"); |
| | | if (task.TaskStatus != (int)InTaskStatusEnum.Line_InFinish) throw new Exception($"æçå·[{lineDTO.Barcode}]çå
¥åºä»»å¡ç¶æä¸å¹é
"); |
| | | if (task.TaskState != (int)InTaskStatusEnum.Line_InFinish) throw new Exception($"æçå·[{lineDTO.Barcode}]çå
¥åºä»»å¡ç¶æä¸å¹é
"); |
| | | |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(lineDTO.Barcode); |
| | | if (stockInfo == null) throw new Exception($"æªæ¾å°æç[{lineDTO.Barcode}]çç»çä¿¡æ¯"); |
| | |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// è¾é线ç³è¯·å
¥åº |
| | | /// </summary> |
| | | /// <param name="lineDTO"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ConveyorLineRequestInbound(ConveyorLineDTO lineDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent().OK(); |
| | | try |
| | | { |
| | | var task = BaseDal.QueryFirst(x => x.PalletCode == lineDTO.Barcode); |
| | | if (task == null) throw new Exception($"æªæ¾å°æçå·[{lineDTO.Barcode}]çå
¥åºä»»å¡"); |
| | | if (task.TaskStatus != (int)InTaskStatusEnum.AGV_InFinish) throw new Exception($"æçå·[{lineDTO.Barcode}]çå
¥åºä»»å¡ç¶æä¸å¹é
"); |
| | | |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(lineDTO.Barcode); |
| | | (bool, string) result = CheckRequestInbound(lineDTO.stationCode, lineDTO.Barcode, true, stockInfo); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | |
| | | if (lineDTO.Spec != 1 || lineDTO.Weight != 500)//æ¡ä»¶éæ´æ¹ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ |
| | | { |
| | | task.NextAddress = "101"; |
| | | task.TaskStatus = (int)InTaskStatusEnum.InException; |
| | | task.Remark = $"æç[{lineDTO.Barcode}]ä¿¡æ¯ä¸åæ ¼"; |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºæ¤é.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | task.NextAddress = "104"; |
| | | task.CurrentAddress = lineDTO.stationCode; |
| | | task.TaskStatus = (int)InTaskStatusEnum.Line_InExecuting; |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | |
| | | #region äºå¡ |
| | | using (TransactionScope scope = new TransactionScope()) |
| | | { |
| | | BaseDal.UpdateData(task); |
| | | Db.Updateable(stockInfo); |
| | | scope.Complete(); |
| | | } |
| | | #endregion |
| | | |
| | | if (!string.IsNullOrEmpty(task.Remark)) throw new Exception(task.Remark); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Code = 404; |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// éªè¯æ°æ® |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <param name="isCheckStock">æ¯å¦æ£æ¥ç»çä¿¡æ¯--åºåç©æå
¥åºå空æå
¥åº</param> |
| | | /// <param name="stockInfo">ç»çä¿¡æ¯--å¯ç©º</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | private (bool, string) CheckRequestInbound(string stationCode, string palletCode, bool isCheckStock = true, Dt_StockInfo? stockInfo = null) |
| | | { |
| | | //if (BaseDal.QueryFirst(x => x.PalletCode == palletCode) != null) |
| | | //{ |
| | | // return (false, "该æçå·å·²æä»»å¡"); |
| | | //} |
| | | if (BaseDal.QueryFirst(x => (x.SourceAddress == stationCode || x.CurrentAddress == stationCode) && x.TaskStatus == InTaskStatusEnum.AGV_InFinish.ObjToInt()) != null) |
| | | { |
| | | return (false, "å½åå
¥åºç«å°å·²æä¸æ¡ä»»å¡"); |
| | | } |
| | | if (isCheckStock) |
| | | { |
| | | if (stockInfo == null) |
| | | { |
| | | return (false, "æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt()) |
| | | { |
| | | return (false, "该ç»çç¶æä¸å¯å
¥åº"); |
| | | } |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return (false, "该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | if (stockInfo.Details == null || stockInfo.Details.Count == 0) |
| | | { |
| | | return (false, "没æåºåæç»ä¿¡æ¯"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (_stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == palletCode) != null) |
| | | { |
| | | return (false, "该æçå·²åå¨åºå
"); |
| | | } |
| | | } |
| | | |
| | | return (true, "æå"); |
| | | } |
| | | |
| | | |