| | |
| | | using Autofac.Core; |
| | | using Microsoft.IdentityModel.Tokens; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Operators; |
| | | using SqlSugar; |
| | |
| | | { |
| | | agvstation.IsOccupied = WhetherEnum.False.ObjToInt(); |
| | | } |
| | | //å çä»»å¡åç¬å®æ |
| | | if (task.TaskType==TaskTypeEnum.EmptyStackPlate.ObjToInt()) |
| | | //å ç/å²åæ¬è¿è³é¾å ä»»å¡åç¬å®æ |
| | | if (task.TaskType==TaskTypeEnum.EmptyStackPlate.ObjToInt() || task.TaskType == TaskTypeEnum.PunchingInbound.ObjToInt()) |
| | | { |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | if (agvstation != null) |
| | | { |
| | | _basicRepository.AGVStationInfoRepository.UpdateData(agvstation); |
| | | } |
| | | if (task.ProductNo.IsNotEmptyOrNull()) |
| | | { |
| | | Dt_MESProInOrderInfo mESProInOrderInfo = _inboundRepository.MESProInOrderInfoRepository.QueryFirst(x=>x.BarCode== task.ProductNo); |
| | | mESProInOrderInfo.MESProInStatus = InOrderStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | _inboundRepository.MESProInOrderInfoRepository.UpdateData(mESProInOrderInfo); |
| | | } |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.äººå·¥å®æ : WIDESEA_Core.Enums.OperateTypeEnum.èªå¨å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | PB_INV_PRODUCT_IN= pRODUCT_INItems |
| | | }) ?? throw new Exception("åæåå
¥åºæ¥å£è¯·æ±å¤±è´¥"); |
| | | //çæåæåå
¥åº |
| | | List<Dt_MESProInOrderInfo> semiProInOrderInfos = mESProInOrderInfos.Where(x => x.MESProInStatus == InOrderStatusEnum.æªå¼å§.ObjToInt()).ToList(); |
| | | List<Dt_MESProInOrderInfo> semiProInOrderInfos = mESProInOrderInfos.Where(x => x.MESProInStatus == InOrderStatusEnum.æªå¼å§.ObjToInt() && x.WarehouseId==WarehouseEnum.LLDYL.ObjToInt()).ToList(); |
| | | if (semiProInOrderInfos.Count>0) |
| | | { |
| | | WebResponseContent webResponse = SemiProInbound(AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.åæå.ObjToInt()).ToList()); |
| | | WebResponseContent webResponse = SemiProInbound(semiProInOrderInfos); |
| | | if (!webResponse.Status) |
| | | { |
| | | throw new Exception(webResponse.Message); |
| | |
| | | { |
| | | throw new Exception(taskResponse.Message); |
| | | } |
| | | _inboundRepository.MESProInOrderInfoRepository.UpdateData(mESProInOrderInfos); |
| | | } |
| | | } |
| | | List<Dt_MESProInOrderInfo> proInOrderInfos = AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.æå.ObjToInt()).ToList(); |
| | |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = materielInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType, |
| | | TaskLength = (int)item.Wide |
| | | TaskLength = (int)item.Wide, |
| | | WorkCentreCode=item.MakeCode, |
| | | MaterielCode = item.MaterialCode, |
| | | Quantity =item.ProQuantity |
| | | }; |
| | | TaskTypeEnum taskTypeEnum = CheckPointCode.StationArea switch |
| | | { |
| | |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// åæåæçæ¬è¿å
¥åº |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent SemiProIn(string barcode, string palletCode, string address) |
| | | { |
| | | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åå½ååæåä¿¡æ¯ |
| | | Dt_MESProInOrderInfo mESProInOrderInfo = _inboundRepository.MESProInOrderInfoRepository.QueryFirst(x=>x.BarCode==barcode) ?? throw new Exception($"åæåæ¡ç {barcode}ä¿¡æ¯ä¸åå¨ï¼è¯·æ ¸å¯¹ä¿¡æ¯"); |
| | | //è·åå å·¥ä¸å¿ |
| | | Dt_MakeCenterInfo makeCenterInfo = _basicRepository.MakeCenterInfoRepository.QueryFirst(x=>x.MakeCode==mESProInOrderInfo.MakeCode); |
| | | if (makeCenterInfo.MakeArea!=StationAreaEnum.䏿¥¼åå.ObjToInt() && makeCenterInfo.MakeArea != StationAreaEnum.䏿¥¼å²å.ObjToInt() && makeCenterInfo.MakeArea != StationAreaEnum.䏿¥¼æ¨¡å.ObjToInt()) throw new Exception($"åæåæ¡ç {barcode}ä¸å±äºåå/å²å/模åå å·¥"); |
| | | |
| | | //å¤æä»»å¡ |
| | | Dt_Task? taskExist = BaseDal.QueryFirst(x=>x.PalletCode==palletCode) == null ? null: throw new Exception($"æç{palletCode}ä»»å¡å·²åå¨"); |
| | | //夿åºå |
| | | Dt_ProStockInfo? proStockInfoExist = BaseDal.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode== palletCode).Includes(x => x.proStockInfoDetails).First() == null ? null : throw new Exception($"æç{palletCode}åºåå·²åå¨"); ; |
| | | //夿å°å |
| | | Dt_AGVStationInfo StationInfoStart = _basicRepository.AGVStationInfoRepository.QueryFirst(x=>x.AGVStationCode==address) ?? throw new Exception($"å°åç {address}ä¸åå¨"); |
| | | |
| | | Dt_AGVStationInfo? StationInfoEnd = null; |
| | | Dt_Task? newTask = null; |
| | | #region é»è¾å¤æï¼åå&模åå
¥æå(è¾
æ)åºï¼å²åæ¬è¿è³äºæ¥¼é¾åä¸è½¬åºï¼ |
| | | if (makeCenterInfo.MakeArea == StationAreaEnum.䏿¥¼å²å.ObjToInt()) |
| | | { |
| | | //è·åé¾åä¸è½¬åºç¹ä½ |
| | | StationInfoEnd = _basicRepository.AGVStationInfoRepository.QueryFirst(x=>x.StationArea== StationAreaEnum.äºæ¥¼é¾å.ToString() && x.IsOccupied==WhetherEnum.False.ObjToInt()) ?? throw new Exception($"äºæ¥¼é¾åå¯ç¨ç¹ä½ä¸è¶³"); |
| | | //çæä»»å¡ |
| | | newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = StationInfoStart.AGVStationCode, |
| | | Grade = 0, |
| | | NextAddress = StationInfoEnd.AGVStationCode, |
| | | PalletCode = palletCode, |
| | | Roadway = "AGV", |
| | | SourceAddress = StationInfoStart.AGVStationCode, |
| | | TargetAddress = StationInfoEnd.AGVStationCode, |
| | | TaskType = TaskTypeEnum.PunchingInbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = mESProInOrderInfo.WarehouseId, |
| | | PalletType = PalletTypeEnum.SmallPallet.ObjToInt(), |
| | | TaskLength = (int)mESProInOrderInfo.Wide, |
| | | WorkCentreCode = mESProInOrderInfo.MakeCode, |
| | | MaterielCode=mESProInOrderInfo.MaterialCode, |
| | | Quantity=mESProInOrderInfo.ProQuantity, |
| | | ProductNo=mESProInOrderInfo.BarCode |
| | | }; |
| | | StationInfoEnd.IsOccupied = 1; |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ææ¶æ æ³æ»¡è¶³"); |
| | | } |
| | | mESProInOrderInfo.MESProInStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | //æ°æ®åºæä½å¹¶æ¨éWCSä»»å¡ |
| | | _unitOfWorkManage.BeginTran(); |
| | | _basicRepository.AGVStationInfoRepository.UpdateData(StationInfoEnd); |
| | | BaseDal.AddData(newTask); |
| | | _inboundRepository.MESProInOrderInfoRepository.UpdateData(mESProInOrderInfo); |
| | | WebResponseContent taskResponse = PushTasksToWCS(new List<Dt_Task>() { newTask }); |
| | | if (!taskResponse.Status) |
| | | { |
| | | throw new Exception(taskResponse.Message); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | #endregion |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |