| | |
| | | using Microsoft.IdentityModel.Tokens; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Operators; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections; |
| | |
| | | return WebResponseContent.Instance.OK($"该æçå·²çæä»»å¡", _mapper.Map<WMSTaskDTO>(task)); |
| | | } |
| | | |
| | | if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该ç«ç¹å·²ææªæ§è¡çä»»å¡"); |
| | | } |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); |
| | | Dt_ProStockInfo stockInfo = _stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _stockRepository.ProStockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); |
| | | |
| | |
| | | else if (stockInfoOld != null && stockInfoOld.MaterielInvOrgId == MaterielInvOrgEnum.èå.ObjToInt() && stockInfoOld.StockStatus == StockStatusEmun.åºåºå®æ.ObjToInt() && stockInfoOld.IsPick==WhetherEnum.False.ObjToInt() && stationCode.IsNotEmptyOrNull()) |
| | | { |
| | | decimal oldQty = stockInfoOld.StockLength; |
| | | //è°ç¨æ´æ°éæåºå |
| | | stockInfoOld = ReturnStockUp(stockInfoOld, thickness); |
| | | //è°ç¨æ´æ°éæåºåå䏿¥éé |
| | | WebResponseContent returnContent = ReturnStockUp(stockInfoOld, thickness, weight); |
| | | if (!returnContent.Status) |
| | | { |
| | | throw new Exception(returnContent.Message); |
| | | } |
| | | stockInfoOld = returnContent.Data as Dt_StockInfo; |
| | | //æ´æ°æ°æ® |
| | | UpdateStock(stockInfoOld, weight, thickness, wide); |
| | | //è®°å½åºååå¨ |
| | |
| | | else if (stockInfoOld != null && stockInfoOld.MaterielInvOrgId == MaterielInvOrgEnum.èå.ObjToInt() && stockInfoOld.StockStatus == StockStatusEmun.èåéææå.ObjToInt() && stationCode.IsNotEmptyOrNull()) |
| | | { |
| | | decimal oldQty = stockInfoOld.StockLength; |
| | | //è°ç¨æ´æ°éæåºå |
| | | stockInfoOld = ReturnStockUp(stockInfoOld, thickness); |
| | | //è°ç¨æ´æ°éæåºåå䏿¥éé |
| | | WebResponseContent returnContent = ReturnStockUp(stockInfoOld, thickness, weight); |
| | | if (!returnContent.Status) |
| | | { |
| | | throw new Exception(returnContent.Message); |
| | | } |
| | | stockInfoOld = returnContent.Data as Dt_StockInfo; |
| | | //æ´æ°æ°æ® |
| | | UpdateStock(stockInfoOld, weight, thickness, wide); |
| | | //è®°å½åºååå¨ |
| | |
| | | /// æ´æ°éæåºå |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public Dt_StockInfo ReturnStockUp(Dt_StockInfo stockInfoOld,decimal thickness) |
| | | public WebResponseContent ReturnStockUp(Dt_StockInfo stockInfoOld,decimal thickness,decimal weight) |
| | | { |
| | | BSTResponse<BSTStockInfoDTO> bSTResponse = _invokeERPService.BSTStockAsync(stockInfoOld.PalletCode).DeserializeObject<BSTResponse<BSTStockInfoDTO>>(); |
| | | if (bSTResponse.Code == 500) |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | throw new Exception($"æªæ¾å°æ¡ç {stockInfoOld.PalletCode}䏿ERPåºåä¸åå¨"); |
| | | } |
| | | 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()) |
| | | { |
| | | stockInfoOld.IsPick = WhetherEnum.False.ObjToInt(); |
| | | BSTStockInfoDTO bSTStockInfoDTO = bSTResponse.Data ?? throw new Exception($"䏿ERPæªè¿å{stockInfoOld.PalletCode}çåºåä¿¡æ¯"); |
| | | if (stockInfoOld.StockStatus == StockStatusEmun.èåéææå.ObjToInt()) |
| | | { |
| | | stockInfoOld.IsPick = WhetherEnum.False.ObjToInt(); |
| | | } |
| | | decimal stockLength = bSTStockInfoDTO.StockMeter; |
| | | if (weight != bSTStockInfoDTO.Qty) |
| | | { |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterialSourceId == stockInfoOld.MaterielId); |
| | | int gramWeight = (int)(materielInfo.MaterielWeight * 1000); |
| | | BSTWeightUpDTO bSTWeightUpDTO = new BSTWeightUpDTO() |
| | | { |
| | | Paper_code = stockInfoOld.PalletCode, |
| | | Estimate_weight = bSTStockInfoDTO.Qty, |
| | | Actual_weight = weight, |
| | | Error_weight = Math.Abs(weight - bSTStockInfoDTO.Qty), |
| | | Weigh_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Operator = "LiKu", |
| | | Width = bSTStockInfoDTO.W, |
| | | Gram_weight = gramWeight |
| | | }; |
| | | BSTResponse<object> Response = _invokeERPService.BSTWeightUp(bSTWeightUpDTO).DeserializeObject<BSTResponse<object>>(); |
| | | if (Response.Code != 200) |
| | | { |
| | | throw new Exception($"䏿¥ç§°é失败"); |
| | | } |
| | | stockLength = weight / bSTStockInfoDTO.W / gramWeight * 1000000; |
| | | } |
| | | stockInfoOld.StockStatus = StockStatusEmun.èåéåº.ObjToInt(); |
| | | stockInfoOld.MaterielThickness = bSTStockInfoDTO.Thick; |
| | | stockInfoOld.MaterielWeight = weight; |
| | | stockInfoOld.MaterielWide = bSTStockInfoDTO.W; |
| | | stockInfoOld.StockLength = stockLength; |
| | | stockInfoOld.IsFull = WhetherEnum.True.ObjToInt(); |
| | | stockInfoOld.StockOutLength = 0; |
| | | stockInfoOld.WarehouseId = WarehouseEnum.LLDYL.ObjToInt(); |
| | | if (thickness < 400) |
| | | { |
| | | throw new Exception($"RFID{stockInfoOld.RfidCode}æ¡ç {stockInfoOld.PalletCode}ç´å¾å°äº400mm"); |
| | | } |
| | | content.OK("æå",data:stockInfoOld); |
| | | } |
| | | stockInfoOld.StockStatus = StockStatusEmun.èåéåº.ObjToInt(); |
| | | stockInfoOld.MaterielThickness = bSTStockInfoDTO.Thick; |
| | | stockInfoOld.MaterielWeight = bSTStockInfoDTO.Qty; |
| | | stockInfoOld.MaterielWide = bSTStockInfoDTO.W; |
| | | stockInfoOld.StockLength = bSTStockInfoDTO.StockMeter; |
| | | stockInfoOld.IsFull = WhetherEnum.True.ObjToInt(); |
| | | stockInfoOld.StockOutLength = 0; |
| | | stockInfoOld.WarehouseId = WarehouseEnum.LLDYL.ObjToInt(); |
| | | if (thickness < 400) |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception($"RFID{stockInfoOld.RfidCode}æ¡ç {stockInfoOld.PalletCode}ç´å¾å°äº400mm"); |
| | | content.Error(ex.Message); |
| | | } |
| | | return stockInfoOld; |
| | | return content; |
| | | } |
| | | public void UpdateStock(Dt_StockInfo stockInfo, decimal weight = 0, decimal thickness = 0, decimal wide = 0) |
| | | { |
| | |
| | | } |
| | | if (orderType>0) //æ°å纸å·å¹³å°å
¥åº |
| | | { |
| | | //è·å主å |
| | | Dt_InboundOrder inboundOrder = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x=>x.OrderType==orderType).Includes(x=>x.Details).Where(x=>x.Details.Any(v=>v.BarCode==palletCode)).First(); |
| | | if (inboundOrder==null) |
| | | InOrderTypeEnum inOrderTypeEnum = (InOrderTypeEnum)orderType; |
| | | if (inOrderTypeEnum== InOrderTypeEnum.PurchaseIn) |
| | | { |
| | | throw new Exception($"æªæ¾å°æ¡ç {palletCode}å
¥åºåæ®ä¿¡æ¯"); |
| | | } |
| | | Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x=>x.BarCode == palletCode); |
| | | if (inboundOrderDetail==null) |
| | | { |
| | | throw new Exception($"æªæ¾å°å
¥åºåå·ä¸º{inboundOrder.UpperOrderNo}æ¡ç {palletCode}åæ®ä¿¡æ¯"); |
| | | } |
| | | if (inboundOrderDetail.MaterialWide < 690) |
| | | { |
| | | return content.Error("æ°åç©æå¹
宽éå¶ä¸º690-2700mm"); |
| | | } |
| | | if (inboundOrderDetail.MaterialThick<=0) |
| | | { |
| | | return content.Error("ç©æç´å¾éè¦å¤§äº0"); |
| | | } |
| | | if (inboundOrderDetail.OrderDetailStatus != InOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | throw new Exception($"æ¡ç {palletCode}ä¿¡æ¯å·²å
¥åºæå
¥åºä¸"); |
| | | } |
| | | Dt_YLInboundCache? yLInboundCache = _inboundRepository.YLInboundCacheRepository.QueryData(x => x.InvOrg == MaterielInvOrgEnum.æ°å.ToString()).FirstOrDefault(); |
| | | if (yLInboundCache == null) |
| | | { |
| | | throw new Exception("æªæ¾å°åææ¡ç ç¼åä¿¡æ¯"); |
| | | } |
| | | int Id = yLInboundCache.Id; |
| | | if (yLInboundCache.BarCode == palletCode) |
| | | { |
| | | throw new Exception($"æ¡ç {palletCode}å·²æ«ç "); |
| | | } |
| | | else if (yLInboundCache.BarCode != palletCode && yLInboundCache.BindStatus == WhetherEnum.True.ObjToInt()) |
| | | { |
| | | yLInboundCache = _mapper.Map<Dt_YLInboundCache>(inboundOrderDetail); |
| | | yLInboundCache.Id = Id; |
| | | //è·å主å |
| | | Dt_PurchaseOrder inboundOrder = BaseDal.Db.Queryable<Dt_PurchaseOrder>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.BarCode == palletCode)).First(); |
| | | |
| | | //è·åç©æ |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == inboundOrderDetail.MaterialCode); |
| | | //çæåºåç»çä¿¡æ¯ |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | if (inboundOrder == null) |
| | | { |
| | | MaterielInvOrgId = materielInfo.MaterielInvOrgId, |
| | | PalletCode = inboundOrderDetail.BarCode, |
| | | RfidCode = "", |
| | | LocationCode = "", |
| | | PalletType = 1, |
| | | WarehouseId = materielInfo.WarehouseId, |
| | | StockAttribute = materielInfo.MaterielSourceType, |
| | | StockStatus = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | MaterielSpec = materielInfo.MaterielSpec, |
| | | Unit = materielInfo.MaterielUnit, |
| | | MaterielThickness = inboundOrderDetail.MaterialThick, |
| | | MaterielWide = inboundOrderDetail.MaterialWide, |
| | | MaterielWeight = inboundOrderDetail.MaterialWeight, |
| | | MaterielCode = materielInfo.MaterielCode, |
| | | MaterielName = materielInfo.MaterielName, |
| | | BatchNo=inboundOrderDetail.MaterialLot, |
| | | StockLength = inboundOrderDetail.OrderQuantity |
| | | }; |
| | | if (inboundOrderDetail.MaterialWide > 1200) |
| | | { |
| | | stockInfo.PalletType = 2; |
| | | throw new Exception($"æªæ¾å°æ¡ç {palletCode}éè´å
¥åºåæ®ä¿¡æ¯"); |
| | | } |
| | | inboundOrderDetail.OrderDetailStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | _inboundRepository.YLInboundCacheRepository.UpdateData(yLInboundCache); |
| | | //æ°å¢ç»çä¿¡æ¯ |
| | | _stockRepository.StockInfoRepository.AddData(stockInfo); |
| | | if (inboundOrder.InboundOrderStatus == InOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | Dt_PurchaseOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BarCode == palletCode); |
| | | |
| | | if (inboundOrderDetail == null) |
| | | { |
| | | inboundOrder.InboundOrderStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); |
| | | throw new Exception($"æªæ¾å°å
¥åºåå·ä¸º{inboundOrder.PurchaseOrderNo}æ¡ç {palletCode}åæ®ä¿¡æ¯"); |
| | | } |
| | | _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail); |
| | | //å¯å¨çº¿ä½ |
| | | WebResponseContent webResponse = YLPurchasePush(); |
| | | if (!webResponse.Status) |
| | | if (inboundOrderDetail.PurchaseDetailWide < 690) |
| | | { |
| | | throw new Exception(webResponse.Message); |
| | | return content.Error("æ°åç©æå¹
宽éå¶ä¸º690-2700mm"); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | Dt_StockInfo stockInfoAdd = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); |
| | | //è®°å½åºååå¨ |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfoAdd, 0, stockInfoAdd.StockLength, StockChangeTypeEnum.MaterielGroup); |
| | | return content.OK("æå", yLInboundCache); |
| | | if (inboundOrderDetail.PurchaseDetailThickness <= 0) |
| | | { |
| | | return content.Error("ç©æç´å¾éè¦å¤§äº0"); |
| | | } |
| | | if (inboundOrderDetail.PurchaseDetailStatus != InOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | throw new Exception($"æ¡ç {palletCode}ä¿¡æ¯å·²å
¥åºæå
¥åºä¸"); |
| | | } |
| | | Dt_YLInboundCache? yLInboundCache = _inboundRepository.YLInboundCacheRepository.QueryData(x => x.InvOrg == MaterielInvOrgEnum.æ°å.ToString()).FirstOrDefault(); |
| | | if (yLInboundCache == null) |
| | | { |
| | | throw new Exception("æªæ¾å°åææ¡ç ç¼åä¿¡æ¯"); |
| | | } |
| | | int Id = yLInboundCache.Id; |
| | | if (yLInboundCache.BarCode == palletCode) |
| | | { |
| | | throw new Exception($"æ¡ç {palletCode}å·²æ«ç "); |
| | | } |
| | | else if (yLInboundCache.BarCode != palletCode && yLInboundCache.BindStatus == WhetherEnum.True.ObjToInt()) |
| | | { |
| | | yLInboundCache = _mapper.Map<Dt_YLInboundCache>(inboundOrderDetail); |
| | | yLInboundCache.Id = Id; |
| | | |
| | | //è·åç©æ |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == inboundOrderDetail.MaterialCode); |
| | | //çæåºåç»çä¿¡æ¯ |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | { |
| | | MaterielInvOrgId = materielInfo.MaterielInvOrgId, |
| | | PalletCode = inboundOrderDetail.BarCode, |
| | | RfidCode = "", |
| | | LocationCode = "", |
| | | PalletType = 1, |
| | | WarehouseId = materielInfo.WarehouseId, |
| | | StockAttribute = materielInfo.MaterielSourceType, |
| | | StockStatus = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | MaterielSpec = materielInfo.MaterielSpec, |
| | | Unit = materielInfo.MaterielUnit, |
| | | MaterielThickness = inboundOrderDetail.PurchaseDetailThickness, |
| | | MaterielWide = inboundOrderDetail.PurchaseDetailWide, |
| | | MaterielWeight = inboundOrderDetail.PurchaseDetailWeight, |
| | | MaterielCode = materielInfo.MaterielCode, |
| | | MaterielName = materielInfo.MaterielName, |
| | | BatchNo = inboundOrderDetail.MaterialLot, |
| | | StockLength = inboundOrderDetail.PurchaseDetailQuantity |
| | | }; |
| | | if (inboundOrderDetail.PurchaseDetailWide > 1200) |
| | | { |
| | | stockInfo.PalletType = 2; |
| | | } |
| | | inboundOrderDetail.PurchaseDetailStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | _inboundRepository.YLInboundCacheRepository.UpdateData(yLInboundCache); |
| | | //æ°å¢ç»çä¿¡æ¯ |
| | | _stockRepository.StockInfoRepository.AddData(stockInfo); |
| | | if (inboundOrder.PurchaseOrderStatus == InOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | inboundOrder.PurchaseOrderStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | _inboundRepository.PurchaseOrderRepository.UpdateData(inboundOrder); |
| | | } |
| | | _inboundRepository.PurchaseOrderDetailRepository.UpdateData(inboundOrderDetail); |
| | | //å¯å¨çº¿ä½ |
| | | WebResponseContent webResponse = YLPurchasePush(); |
| | | if (!webResponse.Status) |
| | | { |
| | | throw new Exception(webResponse.Message); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | Dt_StockInfo stockInfoAdd = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); |
| | | //è®°å½åºååå¨ |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfoAdd, 0, stockInfoAdd.StockLength, StockChangeTypeEnum.MaterielGroup); |
| | | return content.OK("æå", yLInboundCache); |
| | | } |
| | | else |
| | | { |
| | | throw new Exception($"ä¸å·æ¡ç {yLInboundCache.BarCode}è¿æªè¿è¡ç»å®"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | throw new Exception($"ä¸å·æ¡ç {yLInboundCache.BarCode}è¿æªè¿è¡ç»å®"); |
| | | //è·å主å |
| | | Dt_InboundOrder inboundOrder = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderType == orderType).Includes(x => x.Details).Where(x => x.Details.Any(v => v.BarCode == palletCode)).First(); |
| | | if (inboundOrder == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°æ¡ç {palletCode}å
¥åºåæ®ä¿¡æ¯"); |
| | | } |
| | | Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BarCode == palletCode); |
| | | if (inboundOrderDetail == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°å
¥åºåå·ä¸º{inboundOrder.UpperOrderNo}æ¡ç {palletCode}åæ®ä¿¡æ¯"); |
| | | } |
| | | if (inboundOrderDetail.MaterialWide < 690) |
| | | { |
| | | return content.Error("æ°åç©æå¹
宽éå¶ä¸º690-2700mm"); |
| | | } |
| | | if (inboundOrderDetail.MaterialThick <= 0) |
| | | { |
| | | return content.Error("ç©æç´å¾éè¦å¤§äº0"); |
| | | } |
| | | if (inboundOrderDetail.OrderDetailStatus != InOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | throw new Exception($"æ¡ç {palletCode}ä¿¡æ¯å·²å
¥åºæå
¥åºä¸"); |
| | | } |
| | | Dt_YLInboundCache? yLInboundCache = _inboundRepository.YLInboundCacheRepository.QueryData(x => x.InvOrg == MaterielInvOrgEnum.æ°å.ToString()).FirstOrDefault(); |
| | | if (yLInboundCache == null) |
| | | { |
| | | throw new Exception("æªæ¾å°åææ¡ç ç¼åä¿¡æ¯"); |
| | | } |
| | | int Id = yLInboundCache.Id; |
| | | if (yLInboundCache.BarCode == palletCode) |
| | | { |
| | | throw new Exception($"æ¡ç {palletCode}å·²æ«ç "); |
| | | } |
| | | else if (yLInboundCache.BarCode != palletCode && yLInboundCache.BindStatus == WhetherEnum.True.ObjToInt()) |
| | | { |
| | | yLInboundCache = _mapper.Map<Dt_YLInboundCache>(inboundOrderDetail); |
| | | yLInboundCache.Id = Id; |
| | | |
| | | //è·åç©æ |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == inboundOrderDetail.MaterialCode); |
| | | //çæåºåç»çä¿¡æ¯ |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | { |
| | | MaterielInvOrgId = materielInfo.MaterielInvOrgId, |
| | | PalletCode = inboundOrderDetail.BarCode, |
| | | RfidCode = "", |
| | | LocationCode = "", |
| | | PalletType = 1, |
| | | WarehouseId = materielInfo.WarehouseId, |
| | | StockAttribute = materielInfo.MaterielSourceType, |
| | | StockStatus = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | MaterielSpec = materielInfo.MaterielSpec, |
| | | Unit = materielInfo.MaterielUnit, |
| | | MaterielThickness = inboundOrderDetail.MaterialThick, |
| | | MaterielWide = inboundOrderDetail.MaterialWide, |
| | | MaterielWeight = inboundOrderDetail.MaterialWeight, |
| | | MaterielCode = materielInfo.MaterielCode, |
| | | MaterielName = materielInfo.MaterielName, |
| | | BatchNo = inboundOrderDetail.MaterialLot, |
| | | StockLength = inboundOrderDetail.OrderQuantity |
| | | }; |
| | | if (inboundOrderDetail.MaterialWide > 1200) |
| | | { |
| | | stockInfo.PalletType = 2; |
| | | } |
| | | inboundOrderDetail.OrderDetailStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | _inboundRepository.YLInboundCacheRepository.UpdateData(yLInboundCache); |
| | | //æ°å¢ç»çä¿¡æ¯ |
| | | _stockRepository.StockInfoRepository.AddData(stockInfo); |
| | | if (inboundOrder.InboundOrderStatus == InOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | inboundOrder.InboundOrderStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); |
| | | } |
| | | _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail); |
| | | //å¯å¨çº¿ä½ |
| | | WebResponseContent webResponse = YLPurchasePush(); |
| | | if (!webResponse.Status) |
| | | { |
| | | throw new Exception(webResponse.Message); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | Dt_StockInfo stockInfoAdd = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); |
| | | //è®°å½åºååå¨ |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfoAdd, 0, stockInfoAdd.StockLength, StockChangeTypeEnum.MaterielGroup); |
| | | return content.OK("æå", yLInboundCache); |
| | | } |
| | | else |
| | | { |
| | | throw new Exception($"ä¸å·æ¡ç {yLInboundCache.BarCode}è¿æªè¿è¡ç»å®"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else //èå纸å·å¹³å°å
¥åº |
| | | { |
| | |
| | | /// <param name="palletCode">æ¡ç å·</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public string AssignYLRoadwayNo(string palletCode) |
| | | public string AssignYLRoadwayNo(string palletCode, int wide = 0, int thickness = 0, int weight = 0) |
| | | { |
| | | try |
| | | { |
| | |
| | | |
| | | string roadwayNo = ""; |
| | | |
| | | bool isReturn=false; |
| | | |
| | | if (stockInfo.MaterielInvOrgId==MaterielInvOrgEnum.æ°å.ObjToInt()) |
| | | { |
| | | //éå¶ç´å¾ |
| | | if (stockInfo.CheckThickness >= 300 && stockInfo.CheckThickness <= 1300 && stockInfo.MaterielWide >= 690 && stockInfo.MaterielWide <= 2700) |
| | | if (wide>0 && thickness>0 && weight>0) |
| | | { |
| | | stockInfo.CheckThickness = thickness; |
| | | stockInfo.CheckWeight = weight; |
| | | stockInfo.CheckWide = wide; |
| | | isReturn = true; |
| | | } |
| | | //éå¶ç´å¾ |
| | | if (stockInfo.CheckThickness >= 300 && stockInfo.CheckThickness <= 1300 && stockInfo.MaterielWide >= 690 && stockInfo.MaterielWide <= 2500) |
| | | { |
| | | bool LayerLimit = stockInfo.CheckThickness >= 1200; |
| | | //è·ååé
|
| | | 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 (LayerLimit) |
| | | { |
| | | locationCounts = locationCounts.Where(x => x.RoadwayNo != "SC03_YLDual").ToList(); |
| | | } |
| | | |
| | | roadwayNo = HandleRoadway(locationCounts, warehouse); |
| | | } |
| | | } |
| | |
| | | //éå¶ |
| | | if (stockInfo.CheckThickness >= 800 && stockInfo.CheckThickness <= 1500 && stockInfo.MaterielWide >= 700 && stockInfo.MaterielWide <= 2500) |
| | | { |
| | | bool LayerLimit = false; |
| | | if (stockInfo.CheckThickness > 1300) |
| | | bool LayerLimit = stockInfo.CheckThickness > 1300; |
| | | bool RoadwayLimit = stockInfo.MaterielWide > 2200; |
| | | var query = Db.Queryable<Dt_LocationInfo>() |
| | | .Where(x => x.WarehouseId == warehouse.WarehouseId |
| | | && x.LocationStatus == (int)LocationStatusEnum.Free |
| | | && x.EnableStatus == (int)EnableStatusEnum.Normal |
| | | && x.RoadwayNo.Contains("YL")) |
| | | .Select(x => new { x.RoadwayNo, x.Columns }); |
| | | |
| | | // æ ¹æ®æ¡ä»¶è¿æ»¤ |
| | | if (LayerLimit) |
| | | { |
| | | LayerLimit = true; |
| | | query = query.Where(x => x.Columns >= 56 && !x.RoadwayNo.Contains("YLDual")); |
| | | } |
| | | //è·ååé
|
| | | 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("YL") && !x.RoadwayNo.Contains("YLDual") && (LayerLimit ? x.Columns>=56 : x.Columns<=55)).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).OrderBy(x => x.RoadwayNo).ToList(); |
| | | if (stockInfo.MaterielWide > 2200) |
| | | if (RoadwayLimit) |
| | | { |
| | | locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.RoadwayNo == "SC02_YL" && (LayerLimit ? x.Columns >= 56 : x.Columns <= 55)).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).OrderBy(x => x.RoadwayNo).ToList(); |
| | | query = query.Where(x => !x.RoadwayNo.Contains("SC01_YL")); |
| | | } |
| | | List<LocationCount> locationCounts = query |
| | | .GroupBy(x => x.RoadwayNo) |
| | | .Select(x => new LocationCount |
| | | { |
| | | RoadwayNo = x.RoadwayNo, |
| | | Count = SqlFunc.AggregateCount(x) |
| | | }) |
| | | .OrderBy(x => x.RoadwayNo) |
| | | .ToList(); |
| | | |
| | | roadwayNo = HandleRoadway(locationCounts, warehouse); |
| | | } |
| | |
| | | roadwayNo = HandleRoadway(locationCounts, warehouse); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (isReturn && !string.IsNullOrEmpty(roadwayNo)) |
| | | { |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | } |
| | | |
| | | return !string.IsNullOrEmpty(roadwayNo) ? (roadwayNo) : throw new Exception("æªæ¾å°å¯åé
å··é"); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | return content.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); |
| | | } |
| | | Dt_AGVStationInfo agvstation = _basicRepository.AGVStationInfoRepository.QueryFirst(x => x.AGVStationCode == task.SourceAddress && ( x.StationArea == nameof(StationAreaEnum.䏿¥¼æå°ç 头) || x.StationArea == nameof(StationAreaEnum.䏿¥¼æ 纺ç»å¸) || x.StationArea == nameof(StationAreaEnum.䏿¥¼æ 纺æ·è) || x.StationArea == nameof(StationAreaEnum.䏿¥¼æ 纺æ·è))); |
| | | Dt_AGVStationInfo agvstation = _basicRepository.AGVStationInfoRepository.QueryFirst(x => x.AGVStationCode == task.SourceAddress && ( x.StationArea == nameof(StationAreaEnum.䏿¥¼æå°ç 头) || x.StationArea == nameof(StationAreaEnum.䏿¥¼æ 纺ç»å¸) || x.StationArea == nameof(StationAreaEnum.䏿¥¼æ 纺æ·è))); |
| | | if (agvstation != null) |
| | | { |
| | | agvstation.IsOccupied = WhetherEnum.False.ObjToInt(); |
| | |
| | | } |
| | | //è·åè´§ä½ä¿¡æ¯ |
| | | Dt_LocationInfo locationInfoEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | if (locationInfoEnd == null) |
| | | if (locationInfoEnd == null && task.TaskType!=TaskTypeEnum.WFBLMYLBackInbound.ObjToInt() && task.TaskType != TaskTypeEnum.WFBYLInbound.ObjToInt()) |
| | | { |
| | | return content.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); |
| | | } |
| | |
| | | Dt_LocationInfo locationInfoStart = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId); |
| | | } |
| | | stockInfo.LocationCode = locationInfoEnd.LocationCode; |
| | | if (task.TaskType != TaskTypeEnum.WFBLMYLBackInbound.ObjToInt() && task.TaskType != TaskTypeEnum.WFBYLInbound.ObjToInt()) |
| | | { |
| | | stockInfo.LocationCode = locationInfoEnd.LocationCode; |
| | | } |
| | | else |
| | | { |
| | | stockInfo.LocationCode = task.TargetAddress; |
| | | } |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | if (task.TaskType!=TaskTypeEnum.Inbound.ObjToInt()) |
| | | { |
| | | stockInfo.IsFull = WhetherEnum.True.ObjToInt(); |
| | | } |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | | if (locationInfoEnd!=null) |
| | | { |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | | } |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.äººå·¥å®æ : WIDESEA_Core.Enums.OperateTypeEnum.èªå¨å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //è®°å½åºååå¨ |
| | |
| | | Quantity = inboundOrderDetail.OrderQuantity, |
| | | PalletType = 1 |
| | | }; |
| | | if (agvstation.StationArea==StationAreaEnum.äºæ¥¼æååºç¼ååº.ToString()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.Inbound2ndFloor.ObjToInt(); |
| | | } |
| | | inboundOrderDetail.OrderDetailStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | if (inboundOrder.InboundOrderStatus == InOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | |
| | | } |
| | | return content; |
| | | } |
| | | public Dt_AGVStationInfo? AssignWFBStation(List<string> assignPoints) |
| | | { |
| | | try |
| | | { |
| | | Dictionary<string, OrderByType> orderBy = new Dictionary<string, OrderByType>() |
| | | { |
| | | { nameof(Dt_AGVStationInfo.Depth),OrderByType.Asc } |
| | | }; |
| | | List<string> stockPoints = _stockRepository.StockInfoRepository.QueryData(x=>x.StockAttribute== MaterielTypeEnum.åæå.ObjToInt() && x.LocationCode.StartsWith("PNT")).Select(x=>x.LocationCode).ToList(); |
| | | return _basicRepository.AGVStationInfoRepository.QueryFirst(x => x.StationArea == StationAreaEnum.䏿¥¼æåæ¶.ToString() && x.IsOccupied == WhetherEnum.False.ObjToInt() && !stockPoints.Contains(x.AGVStationCode) && !assignPoints.Contains(x.AGVStationCode), orderBy); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |