| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | |
| | | if (warehouse.WarehouseCode==WarehouseEnum.HA57.ToString()) |
| | | { |
| | | Dt_Task dt_TaskMesReturn = BaseDal.QueryFirst(x=>x.TaskType==TaskTypeEnum.MesMatReturn.ObjToInt() && x.TaskStatus!=TaskStatusEnum.SC_Executing.ObjToInt()); |
| | | if (dt_TaskMesReturn!=null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"éæä»»å¡æ£æ§è¡"); |
| | | } |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | |
| | | _stockRepository.StockInfoRepository.AddData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | PutFinish(address); |
| | | PutFinish(address, newTask.PalletCode, newTask.TaskNum.ToString()); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); |
| | | |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | if (newTask.WarehouseId == 5) PutFinish(stationCode); |
| | | if (newTask.WarehouseId == 5) PutFinish(stationCode.ToString(),newTask.PalletCode, newTask.TaskNum.ToString()); |
| | | return WebResponseContent.Instance.OK(data: wMSTaskDTO); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.åºåºå®æ.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.éåº.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MESéåº.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES空æéåº.ObjToInt()) |
| | | if (stockInfo.StockStatus != StockStatusEmun.éåº.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MESéåº.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES空æéåº.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | |
| | | WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); |
| | | |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | if (newTask.WarehouseId == 5) PutFinish(stationCode); |
| | | if (newTask.WarehouseId == 5) PutFinish(stationCode, newTask.PalletCode, newTask.TaskNum.ToString()); |
| | | return WebResponseContent.Instance.OK(data: wMSTaskDTO); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | public readonly string[] OutStartPonits = { "5230", "5237", "5244" }; |
| | | /// <summary> |
| | | /// æå使éåºå
¥ä» |
| | | /// </summary> |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string palletCode = @"^C\d{5}$"; // æ£åè¡¨è¾¾å¼ |
| | | bool isValid = Regex.IsMatch(barCode, palletCode); |
| | | if (!isValid) |
| | | { |
| | | return content.Error($"æ¡ç æ ¼å¼é误{barCode}"); |
| | | } |
| | | if (!OutStartPonits.Contains(startPoint)) |
| | | { |
| | | return content.Error($"èµ·ç¹é误{startPoint}"); |
| | | } |
| | | //夿å½åç¹ä½æ¯å¦éå¤ |
| | | Dt_Task taskOldPoint = BaseDal.QueryFirst(x=>x.SourceAddress==startPoint && (x.TaskStatus == TaskStatusEnum.New.ObjToInt()||x.TaskStatus==TaskStatusEnum.Line_Execute.ObjToInt()|| x.TaskStatus == TaskStatusEnum.Line_Executing.ObjToInt() || x.TaskStatus == TaskStatusEnum.AGV_Takeing.ObjToInt())); |
| | | if (taskOldPoint != null) |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string palletCode = @"^C\d{5}$"; // æ£åè¡¨è¾¾å¼ |
| | | bool isValid = Regex.IsMatch(barCode, palletCode); |
| | | if (!isValid) |
| | | { |
| | | return content.Error($"æ¡ç æ ¼å¼é误{barCode}"); |
| | | } |
| | | if (!OutStartPonits.Contains(startPoint)) |
| | | { |
| | | return content.Error($"èµ·ç¹é误{startPoint}"); |
| | | } |
| | | //夿å½åç¹ä½æ¯å¦éå¤ |
| | | Dt_Task taskOldPoint = BaseDal.QueryFirst(x => x.SourceAddress == startPoint && (x.TaskStatus == TaskStatusEnum.New.ObjToInt() || x.TaskStatus == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskStatus == TaskStatusEnum.Line_Executing.ObjToInt())); |
| | | //if (taskOldPoint != null) |
| | |
| | | { |
| | | return content.Error($"è¶æ¡{barCode}ä»»å¡å·²åå¨"); |
| | | } |
| | | |
| | | //if (_stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == barCode) != null) |
| | | //{ |
| | | // return content.Error($"è¶æ¡{barCode}åºåä¿¡æ¯å·²åå¨"); |
| | | //} |
| | | //todo:临æ¶è§£ç» |
| | | Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == barCode); |
| | | if (_stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == barCode) != null) |
| | | { |
| | | proStockInfo.PalletCode = proStockInfo.PalletCode + ":" + DateTime.Now.ToString("MM/dd"); |
| | | } |
| | | //è·åæåå¹³åº |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); |
| | | Dt_Task newTask = new Dt_Task() |
| | |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | if (proStockInfo!=null) |
| | | { |
| | | _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo); |
| | | } |
| | | newTask.TaskId = taskId; |
| | | _unitOfWorkManage.CommitTran(); |
| | | //æ¨éä»»å¡ |