| | |
| | | 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; |
| | |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.Basic; |
| | |
| | | UpdateStock(stockInfoOld, weight, thickness, wide); |
| | | return content.OK($"临æ¶å
¥åº{stockInfoOld.RfidCode}"); |
| | | } |
| | | else if (stockInfoOld != null && stockInfoOld.MaterielInvOrgId == MaterielInvOrgEnum.èå.ObjToInt() && stockInfoOld.StockStatus == StockStatusEmun.åºåºå®æ.ObjToInt() && stockInfoOld.IsPick==WhetherEnum.False.ObjToInt() && stationCode.IsNotEmptyOrNull()) |
| | | else if (stockInfoOld != null && stockInfoOld.MaterielInvOrgId == MaterielInvOrgEnum.èå.ObjToInt() && stockInfoOld.StockStatus == StockStatusEmun.åºåºå®æ.ObjToInt() && stationCode.IsNotEmptyOrNull()) |
| | | { |
| | | decimal oldQty = stockInfoOld.StockLength; |
| | | //è°ç¨æ´æ°éæåºåå䏿¥éé |
| | |
| | | //è®°å½åºååå¨ |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfoOld, oldQty, oldQty < stockInfoOld.StockLength ? stockInfoOld.StockLength- oldQty: oldQty- stockInfoOld.StockLength, StockChangeTypeEnum.MaterielGroup); |
| | | return content.OK($"èå颿éåºRFID{stockInfoOld.RfidCode}æ¡ç {stockInfoOld.PalletCode}"); |
| | | } |
| | | else if (stockInfoOld != null && stockInfoOld.MaterielInvOrgId == MaterielInvOrgEnum.èå.ObjToInt() && stockInfoOld.StockStatus == StockStatusEmun.åºåºå®æ.ObjToInt() && stockInfoOld.StockLength<=0 && stationCode.IsNullOrEmpty()) |
| | | { |
| | | _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfoOld, App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | | throw new Exception($"{palletCode}RFIDä¿¡æ¯èåé¢æåæ åºåéæ"); |
| | | } |
| | | else if (stockInfoOld != null) |
| | | { |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (thickness < 400) |
| | | { |
| | | throw new Exception($"RFID{stockInfoOld.RfidCode}æ¡ç {stockInfoOld.PalletCode}ç´å¾å°äº400mm"); |
| | | } |
| | | BSTResponse<BSTStockInfoDTO> bSTResponse = _invokeERPService.BSTStockAsync(stockInfoOld.PalletCode).DeserializeObject<BSTResponse<BSTStockInfoDTO>>(); |
| | | if (bSTResponse.Code == 500) |
| | | { |
| | | throw new Exception($"æªæ¾å°æ¡ç {stockInfoOld.PalletCode}䏿ERPåºåä¸åå¨"); |
| | | } |
| | | |
| | | BSTStockInfoDTO bSTStockInfoDTO = bSTResponse.Data ?? throw new Exception($"䏿ERPæªè¿å{stockInfoOld.PalletCode}çåºåä¿¡æ¯"); |
| | | if (stockInfoOld.StockStatus == StockStatusEmun.èåéææå.ObjToInt()) |
| | | if (stockInfoOld.StockLength <= 0 || bSTStockInfoDTO.StockMeter<=0) |
| | | { |
| | | stockInfoOld.IsPick = WhetherEnum.False.ObjToInt(); |
| | | throw new Exception($"{stockInfoOld.RfidCode}ç»å®æ¡ç {stockInfoOld.PalletCode}åºå为0"); |
| | | } |
| | | stockInfoOld.IsPick = WhetherEnum.False.ObjToInt(); |
| | | decimal stockLength = bSTStockInfoDTO.StockMeter; |
| | | if (weight != bSTStockInfoDTO.Qty && weight < stockInfoOld.InitialWeight) |
| | | decimal errWeight = Math.Abs(weight - bSTStockInfoDTO.Qty); |
| | | if (weight != bSTStockInfoDTO.Qty && weight < stockInfoOld.InitialWeight && errWeight <= AppSettings.Get("ErrWeight").ObjToInt()) |
| | | { |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterialSourceId == stockInfoOld.MaterielId); |
| | | int gramWeight = (int)(materielInfo.MaterielWeight * 1000); |
| | |
| | | Paper_code = stockInfoOld.PalletCode, |
| | | Estimate_weight = bSTStockInfoDTO.Qty, |
| | | Actual_weight = weight, |
| | | Error_weight = Math.Abs(weight - bSTStockInfoDTO.Qty), |
| | | Error_weight = errWeight, |
| | | Weigh_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Operator = "LiKu", |
| | | Width = bSTStockInfoDTO.W, |
| | |
| | | stockInfoOld.StockLength = stockLength; |
| | | stockInfoOld.StockOutLength = 0; |
| | | stockInfoOld.WarehouseId = WarehouseEnum.LLDYL.ObjToInt(); |
| | | if (thickness < 400) |
| | | List<Dt_OutLineView> outLineViewsDel = _outboundRepository.OutLineViewRepository.QueryData(x=>x.PalletCode==stockInfoOld.PalletCode); |
| | | if (outLineViewsDel.Count>0) |
| | | { |
| | | throw new Exception($"RFID{stockInfoOld.RfidCode}æ¡ç {stockInfoOld.PalletCode}ç´å¾å°äº400mm"); |
| | | _outboundRepository.OutLineViewRepository.DeleteData(outLineViewsDel); |
| | | } |
| | | content.OK("æå",data:stockInfoOld); |
| | | } |
| | |
| | | bool RoadwayType = stockInfo.PalletType == LocationTypeEnum.MediumPallet.ObjToInt(); |
| | | //è·ååé
|
| | | List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.RoadwayNo.Contains("YLDual") && (stockInfo.PalletType == LocationTypeEnum.MediumPallet.ObjToInt() ? x.LocationType == LocationTypeEnum.MediumPallet.ObjToInt() : x.LocationType == LocationTypeEnum.SmallPallet.ObjToInt())).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).OrderBy(x => x.RoadwayNo).ToList(); |
| | | if (RoadwayType) |
| | | { |
| | | foreach (var item in locationCounts) |
| | | { |
| | | if (item.RoadwayNo.Contains("YLDual")) |
| | | { |
| | | int count = Db.Queryable<Dt_LocationInfo>() |
| | | .Where(x => x.WarehouseId == warehouse.WarehouseId |
| | | && x.LocationStatus == (int)LocationStatusEnum.Free |
| | | && x.EnableStatus == (int)EnableStatusEnum.Normal |
| | | && x.LocationType == LocationTypeEnum.MediumPallet.ObjToInt() |
| | | && x.RoadwayNo == item.RoadwayNo).Count(); |
| | | item.Count = count; |
| | | } |
| | | } |
| | | } |
| | | roadwayNo = HandleRoadway(locationCounts, warehouse, ErrorRoadway ? roadways : null); |
| | | } |
| | | } |
| | |
| | | { |
| | | item.Count -= count.Count; |
| | | } |
| | | if (item.Count >= 50 && count?.Count<=1) |
| | | { |
| | | return item.RoadwayNo; |
| | | } |
| | | } |
| | | return locationCounts.Where(x => x.Count > 0).OrderByDescending(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; |
| | | } |
| | |
| | | if (agvstation != null) |
| | | { |
| | | agvstation.IsOccupied = WhetherEnum.False.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(); |
| | | return content.OK(); |
| | | } |
| | | Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x=>x.proStockInfoDetails).First(); |
| | | if (proStockInfo != null && proStockInfo.StockStatus == StockStatusEmun.MES空æéåº.ObjToInt()) |
| | |
| | | } |
| | | proInUpModel.PB_INV_PRODUCT_IN= pRODUCT_INItems; |
| | | string request = _invokeERPService.ERPProInUp(proInUpModel) ?? throw new Exception("æåå
¥åºæ¥å£è¯·æ±å¤±è´¥"); |
| | | if (!request.Contains("Success")) |
| | | if (!request.Contains("success")) |
| | | { |
| | | throw new Exception($"æåå
¥åºå¤±è´¥"); |
| | | } |
| | |
| | | /// <summary> |
| | | /// æå空æååº |
| | | /// </summary> |
| | | public WebResponseContent EmptyBackTask(string barCode, string startPoint) |
| | | public WebResponseContent EmptyBackTask(string barCode, string startPoint,int target) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | { |
| | | return content.Error($"æç{barCode}ä»»å¡å·²åå¨"); |
| | | } |
| | | Dt_ProStockInfo proStockInfoOld = _stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == barCode); |
| | | if (proStockInfoOld!=null) |
| | | Dt_Task newTask = null; |
| | | Dt_ProStockInfo proStockInfo = null; |
| | | if (target==WhetherEnum.False.ObjToInt())//å ç空æä»»å¡ |
| | | { |
| | | return content.Error($"æç{barCode}å·²åå¨"); |
| | | newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = startPoint, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = barCode, |
| | | Roadway = agvstation.AGVStationCode.StartsWith("PNT_1") ? "StackPlate1": "StackPlate2", |
| | | SourceAddress = startPoint, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.EmptyStackPlate.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = WarehouseEnum.LLDFL.ObjToInt(), |
| | | PalletType = 1 |
| | | }; |
| | | } |
| | | //åé
å··é |
| | | string roadWay=AssignCPRoadwayNo(); |
| | | |
| | | Dt_ProStockInfo proStockInfo = new Dt_ProStockInfo() |
| | | else //ç«åºç©ºæä»»å¡ |
| | | { |
| | | PalletCode=barCode, |
| | | ProStockAttribute=ProStockAttributeEnum.空æ.ObjToInt(), |
| | | PalletType=1, |
| | | LocationCode="", |
| | | WarehouseId= WarehouseEnum.LLDFL.ObjToInt(), |
| | | StockStatus=StockStatusEmun.MES空æéåº.ObjToInt() |
| | | }; |
| | | |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = startPoint, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = barCode, |
| | | Roadway = roadWay, |
| | | SourceAddress = startPoint, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.EmptyProductBack.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = WarehouseEnum.LLDFL.ObjToInt(), |
| | | PalletType = 1 |
| | | }; |
| | | Dt_ProStockInfo proStockInfoOld = _stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == barCode); |
| | | if (proStockInfoOld != null) |
| | | { |
| | | return content.Error($"æç{barCode}å·²åå¨"); |
| | | } |
| | | //åé
å··é |
| | | string roadWay = AssignCPRoadwayNo(); |
| | | proStockInfo = new Dt_ProStockInfo() |
| | | { |
| | | PalletCode = barCode, |
| | | ProStockAttribute = ProStockAttributeEnum.空æ.ObjToInt(), |
| | | PalletType = 1, |
| | | LocationCode = "", |
| | | WarehouseId = WarehouseEnum.LLDFL.ObjToInt(), |
| | | StockStatus = StockStatusEmun.MES空æéåº.ObjToInt() |
| | | }; |
| | | newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = startPoint, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = barCode, |
| | | Roadway = roadWay, |
| | | SourceAddress = startPoint, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.EmptyProductBack.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = WarehouseEnum.LLDFL.ObjToInt(), |
| | | PalletType = 1 |
| | | }; |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | _stockRepository.ProStockInfoRepository.AddData(proStockInfo); |
| | | if (proStockInfo!=null) |
| | | { |
| | | _stockRepository.ProStockInfoRepository.AddData(proStockInfo); |
| | | } |
| | | newTask.TaskId = taskId; |
| | | _unitOfWorkManage.CommitTran(); |
| | | //æ¨éä»»å¡ |
| | |
| | | return content.Error("ä¼ å
¥ä¿¡æ¯ä¸ºç©º"); |
| | | } |
| | | //è·åæææåï¼åæåä¿¡æ¯ |
| | | List<Dt_MESProInOrderInfo> proInOrderInfos = _inboundRepository.MESProInOrderInfoRepository.QueryData(); |
| | | List<Dt_MESProInOrderInfo> proInOrderInfosOld = _inboundRepository.MESProInOrderInfoRepository.QueryData(); |
| | | //è·åææç©æä¿¡æ¯ |
| | | List<Dt_MaterielInfo> materielInfos = _basicRepository.MaterielInfoRepository.QueryData(x => x.MaterielInvOrgId == MaterielInvOrgEnum.æ°å.ObjToInt()); |
| | | |
| | |
| | | List<Dt_AGVStationInfo> aGVStationInfos = _basicRepository.AGVStationInfoRepository.QueryData(x => !string.IsNullOrEmpty(x.MESPointCode)); |
| | | |
| | | //夿æ¯å¦åå¨éå¤ |
| | | MESProInDTO? proInDTO = proInDTOs.FirstOrDefault(x => x.IsMantissa == false && proInOrderInfos.Select(x => x.BarCode).Contains(x.BarCode)); |
| | | MESProInDTO? proInDTO = proInDTOs.FirstOrDefault(x => x.IsMantissa == false && proInOrderInfosOld.Select(x => x.BarCode).Contains(x.BarCode)); |
| | | if (proInDTO != null) |
| | | { |
| | | return content.Error($"{proInDTO.ProductOrderNo}ç产工å{proInDTO.BarCode}æ¡ç å·²åå¨"); |
| | | } |
| | | Dt_MESProInOrderInfo? proInOrderInfo = proInOrderInfos.FirstOrDefault(x => x.MESProInStatus == InOrderStatusEnum.å
³é.ObjToInt() && proInDTOs.Select(x => x.ProductOrderNo).Distinct().Contains(x.ProductOrderNo)); |
| | | Dt_MESProInOrderInfo? proInOrderInfo = proInOrderInfosOld.FirstOrDefault(x => x.MESProInStatus == InOrderStatusEnum.å
³é.ObjToInt() && proInDTOs.Select(x => x.ProductOrderNo).Distinct().Contains(x.ProductOrderNo)); |
| | | if (proInOrderInfo != null) |
| | | { |
| | | return content.Error($"{proInOrderInfo.ProductOrderNo}ç产工åå·²å
³é"); |
| | |
| | | foreach (var item in proInDTOs) |
| | | { |
| | | Dt_MaterielInfo materielInfo = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterialCode); |
| | | //夿 |
| | | if ((item.Thickness <= 0 || item.Wide <= 0) && materielInfo.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()) |
| | | { |
| | | return content.Error($"ç©æ{item.MaterialCode}æ¡ç {item.BarCode}ç´å¾æå¹
宽ä¸è½å°äº0"); |
| | | } |
| | | if (materielInfo.MaterielSourceType != MaterielTypeEnum.æå.ObjToInt()) |
| | | { |
| | | Dt_AGVStationInfo? CheckPointCode = aGVStationInfos.FirstOrDefault(x => x.MESPointCode == item?.PointCode); |
| | |
| | | Dt_MESProInOrderInfo AddproInOrderInfo = _mapper.Map<Dt_MESProInOrderInfo>(item); |
| | | AddproInOrderInfo.WarehouseId = materielInfo.WarehouseId; |
| | | AddproInOrderInfo.MESProOrderType = materielInfo.MaterielSourceType; |
| | | //å°äº550å¹
宽åä¸è½æ¬è¿ |
| | | if (item.Wide < 550 && materielInfo.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()) |
| | | { |
| | | AddproInOrderInfo.MESProInStatus=InOrderStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | AddMESProInOrders.Add(AddproInOrderInfo); |
| | | } |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | |
| | | string request = _invokeERPService.ERPSemiProInUp( |
| | | new ERPProInUpModel() |
| | | { |
| | | PB_INV_PRODUCT_IN= pRODUCT_INItems |
| | | PB_INV_PRODUCT_IN = pRODUCT_INItems |
| | | }) ?? throw new Exception("åæåå
¥åºæ¥å£è¯·æ±å¤±è´¥"); |
| | | //çæåæåå
¥åº |
| | | WebResponseContent webResponse = SemiProInbound(AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.åæå.ObjToInt()).ToList()); |
| | | if (!webResponse.Status) |
| | | List<Dt_MESProInOrderInfo> semiProInOrderInfos = mESProInOrderInfos.Where(x => x.MESProInStatus == InOrderStatusEnum.æªå¼å§.ObjToInt() && x.WarehouseId==WarehouseEnum.LLDYL.ObjToInt()).ToList(); |
| | | if (semiProInOrderInfos.Count>0) |
| | | { |
| | | throw new Exception(webResponse.Message); |
| | | } |
| | | tasks = webResponse.Data as List<Dt_Task>; |
| | | WebResponseContent taskResponse = PushTasksToWCS(tasks); |
| | | if (!taskResponse.Status) |
| | | { |
| | | throw new Exception(taskResponse.Message); |
| | | WebResponseContent webResponse = SemiProInbound(semiProInOrderInfos); |
| | | if (!webResponse.Status) |
| | | { |
| | | throw new Exception(webResponse.Message); |
| | | } |
| | | tasks = webResponse.Data as List<Dt_Task>; |
| | | WebResponseContent taskResponse = PushTasksToWCS(tasks); |
| | | if (!taskResponse.Status) |
| | | { |
| | | throw new Exception(taskResponse.Message); |
| | | } |
| | | _inboundRepository.MESProInOrderInfoRepository.UpdateData(mESProInOrderInfos); |
| | | } |
| | | } |
| | | if (AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.æå.ObjToInt()).Count() > 0) |
| | | List<Dt_MESProInOrderInfo> proInOrderInfos = AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.æå.ObjToInt()).ToList(); |
| | | if (proInOrderInfos.Count > 0) |
| | | { |
| | | WebResponseContent webResponse = PushPackaxisTaskToWCS(AddMESProInOrders.Where(x => x.MESProOrderType == MaterielTypeEnum.æå.ObjToInt()).ToList()); |
| | | WebResponseContent webResponse = PushPackaxisTaskToWCS(proInOrderInfos); |
| | | if (!webResponse.Status) |
| | | { |
| | | throw new Exception(webResponse.Message); |
| | |
| | | { |
| | | return content.Error("ä¼ å
¥ä¿¡æ¯ä¸ºç©º"); |
| | | } |
| | | |
| | | List<Dt_MaterielInfo> materielInfos = _basicRepository.MaterielInfoRepository.QueryData(); |
| | | List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>(); |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | |
| | | NextAddress = "", |
| | | PalletCode = item.BarCode, |
| | | Roadway = "", |
| | | SourceAddress = CheckPointCode.AGVStationCode, |
| | | SourceAddress = item.PointCode.StartsWith("YS") ? CheckPointCode.AGVStationCode : CheckPointCode.MESPointCode, |
| | | TargetAddress = "", |
| | | TaskType = 0, |
| | | 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 |
| | | { |
| | | nameof(StationAreaEnum.䏿¥¼å°å·) => TaskTypeEnum.PrintYLInbound, |
| | | nameof(StationAreaEnum.䏿¥¼åå) => TaskTypeEnum.PartOffInbound, |
| | | nameof(StationAreaEnum.䏿¥¼çº¸å¼ æ·è) => TaskTypeEnum.PaperFilmInbound, |
| | | nameof(StationAreaEnum.䏿¥¼æ 纺æ·è) => TaskTypeEnum.WFBYLInbound, |
| | | nameof(StationAreaEnum.䏿¥¼æ 纺ç»å¸) => TaskTypeEnum.WFBYLInbound, |
| | | nameof(StationAreaEnum.䏿¥¼æ 纺æ·è) => TaskTypeEnum.WFBLMYLInbound, |
| | | _ => throw new Exception("æªæ¾å°å¯¹åºä»»å¡") |
| | | }; |
| | | if (taskTypeEnum == TaskTypeEnum.WFBYLInbound) |
| | | if (taskTypeEnum == TaskTypeEnum.WFBYLInbound || taskTypeEnum == TaskTypeEnum.WFBLMYLInbound) |
| | | { |
| | | Dt_AGVStationInfo? stationInfo = AssignWFBStation(_AGVStationInfos?.Select(x => x.AGVStationCode).ToList()) ?? throw new Exception("æªæ¾å°å¯ç¨æ çººå¸æåæ¶"); |
| | | newTask.NextAddress = stationInfo.AGVStationCode; |
| | |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æåç»ç |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent BoxingInBound(string stationCode,List<string> barCodes) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | | } |