| | |
| | | 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; |
| | |
| | | _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) |
| | | { |
| | | throw new Exception($"{palletCode}RFIDä¿¡æ¯å·²åå¨"); |
| | |
| | | throw new Exception($"æªæ¾å°æ¡ç {stockInfoOld.PalletCode}䏿ERPåºåä¸åå¨"); |
| | | } |
| | | BSTStockInfoDTO bSTStockInfoDTO = bSTResponse.Data ?? throw new Exception($"䏿ERPæªè¿å{stockInfoOld.PalletCode}çåºåä¿¡æ¯"); |
| | | if (stockInfoOld.StockLength <= 0 || bSTStockInfoDTO.StockMeter<=0) |
| | | { |
| | | 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(); |
| | | List<Dt_OutLineView> outLineViewsDel = _outboundRepository.OutLineViewRepository.QueryData(x=>x.PalletCode==stockInfoOld.PalletCode); |
| | | if (outLineViewsDel.Count>0) |
| | | { |
| | | _outboundRepository.OutLineViewRepository.DeleteData(outLineViewsDel); |
| | | } |
| | | content.OK("æå",data:stockInfoOld); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | 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 ?? ""; |
| | | } |
| | |
| | | { |
| | | 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(); |
| | |
| | | } |
| | | 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($"æåå
¥åºå¤±è´¥"); |
| | | } |
| | |
| | | string request = _invokeERPService.ERPSemiProInUp( |
| | | new ERPProInUpModel() |
| | | { |
| | | PB_INV_PRODUCT_IN= pRODUCT_INItems |
| | | 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(); |
| | |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | | } |