| | |
| | | using LogLibrary.Log; |
| | | using MailKit; |
| | | using MailKit.Net.Smtp; |
| | | using MailKit.Search; |
| | | using Microsoft.AspNetCore.Http; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using Org.BouncyCastle.Asn1.X509; |
| | | using Org.BouncyCastle.Bcpg; |
| | | using SixLabors.ImageSharp; |
| | | using SqlSugar; |
| | | using System; |
| | |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.AllocateEnum; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.Helper; |
| | |
| | | private readonly IRepository<Dt_MesReturnRecord> _mesReturnRecord; |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | private readonly IRepository<Dt_TakeStockOrder> _takeStockOrder; |
| | | public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder) |
| | | private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository; |
| | | private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository; |
| | | public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | InboundOrderDetailService = inboundOrderDetailService; |
| | |
| | | _mesReturnRecord = mesReturnRecord; |
| | | _locationInfoService = locationInfoService; |
| | | _takeStockOrder = takeStockOrder; |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _allocateOrderRepository = allocateOrderRepository; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto) |
| | | public async Task<WebResponseContent> |
| | | GroupPallet(GroupPalletDto palletDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | |
| | | var details = _inboundOrderDetailRepository.QueryData(x => (x.OutBoxbarcodes == palletDto.Barcode|| x.Barcode == palletDto.Barcode) && x.OrderDetailStatus == (int)InOrderStatusEnum.æªå¼å§); |
| | | |
| | | |
| | | if (details.Count() <= 0) |
| | | { |
| | | return content.Error("请确认æ¯å¦å·²ç»ç»ç"); |
| | | |
| | | var inbounddetail = _inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode); |
| | | if (inbounddetail == null) |
| | | { |
| | | return content.Error($"æ¡ç {palletDto.Barcode}ä¸åå¨"); |
| | | } |
| | | var inbound = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.Id == inbounddetail.OrderId).First(); |
| | | if (inbound == null) |
| | | { |
| | | return content.Error("åæ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | var detail = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().LeftJoin<Dt_InboundOrder>((d, o) => d.OrderId == o.Id).Where((d, o) => d.OrderId == inbound.Id |
| | | && d.ReceiptQuantity != 0 |
| | | && d.OverInQuantity == 0).Select((d, o) => new |
| | | { |
| | | orderNo = o.InboundOrderNo, |
| | | d.Barcode, |
| | | d.MaterielCode, |
| | | d.BatchNo, |
| | | d.ReceiptQuantity, |
| | | d.Unit, |
| | | d.SupplyCode, |
| | | d.WarehouseCode |
| | | }).ToList(); |
| | | var palletId = _stockInfoDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode); |
| | | if (palletId == null) |
| | | { |
| | | return content.Error($"æ¡ç {palletDto.Barcode}å·²ç»ç"); |
| | | } |
| | | var pallet = _stockInfoRepository.QueryFirst(x => x.Id == palletId.StockId); |
| | | return content.Error($"æ¡ç {palletDto.Barcode}å·²ç»ç»å°{pallet.PalletCode}", detail); |
| | | } |
| | | inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Includes(x=>x.Details).Where(x => x.Id == details.First().OrderId).First(); |
| | | |
| | |
| | | return content.Error($"å½åååºä¸ä¸è´"); |
| | | } |
| | | |
| | | if(inboundOrder.BusinessType != "11"&& inboundOrder.Details.FirstOrDefault().WarehouseCode != palletDto.WarehouseType) |
| | | if(inboundOrder.BusinessType != "11") |
| | | { |
| | | return content.Error($"该æ¡ç æå±ä»åºä¸º{inboundOrder.Details.FirstOrDefault().WarehouseCode}ä¸å½åä»åº{palletDto.WarehouseType}ä¸ä¸è´ï¼ä¸å
许ç»ç"); |
| | | var warehouseType = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().Where(x => (x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode)&& x.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()).Select(x => x.WarehouseCode).First(); |
| | | |
| | | if (string.IsNullOrEmpty(warehouseType)) |
| | | { |
| | | return content.Error($"æªæ¥è¯¢å°æ¡ç [{palletDto.Barcode}]对åºçä»åºä¿¡æ¯ï¼ä¸å
许ç»ç"); |
| | | } |
| | | |
| | | if (!warehouseType.Equals(palletDto.WarehouseType)) |
| | | { |
| | | return content.Error($"该æ¡ç æå±ä»åºä¸º{warehouseType}ä¸å½åä»åº{palletDto.WarehouseType}ä¸ä¸è´ï¼ä¸å
许ç»ç"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | Dt_StockInfo? stockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync(); |
| | | |
| | |
| | | stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None, LocationType = Convert.ToInt32(palletDto.locationType) }; |
| | | stockInfo.Details = new List<Dt_StockInfoDetail>(); |
| | | } |
| | | //else |
| | | //{ |
| | | // var allowStatus = new[] |
| | | // { |
| | | // (int)StockStatusEmun.ç»çæå, |
| | | // (int)StockStatusEmun.æºä»å
¥æºä»ç»çæå, |
| | | // (int)StockStatusEmun.æå¨ç»çæå |
| | | // }; |
| | | |
| | | // if (!allowStatus.Contains(stockInfo.StockStatus)) |
| | | // { |
| | | // return content.Error($"该æç{stockInfo.PalletCode}ç¶æä¸å
许ç»ç"); |
| | | // } |
| | | //} |
| | | |
| | | if (inboundOrder.BusinessType != MESDocumentType.PurchaseInbound.ToString() && stockInfo != null && stockInfo.Details.Count > 0 && stockInfo.Details.FirstOrDefault()?.WarehouseCode != palletDto.WarehouseType) |
| | | { |
| | | return content.Error($"该æçç»çä»åºä¸º{stockInfo.Details.FirstOrDefault()?.WarehouseCode}ä¸å½åä»åº{palletDto.WarehouseType}ä¸ä¸è´ï¼ä¸å
许ç»ç"); |
| | | } |
| | | var isWarehouse = _inboundOrderDetailRepository.QueryFirst(x => x.OrderId == inboundOrder.Id && !string.IsNullOrEmpty(x.WarehouseCode)); |
| | | if (isWarehouse != null && inboundOrder.BusinessType == "11" && isWarehouse.WarehouseCode != palletDto.WarehouseType) |
| | | { |
| | | return content.Error($"ä¸ä¸ªéè´åæ®éé¢ä¸å
许ç»ç两个ä»åºï¼è¯·éæ°éæ©ä»åºï¼ä¸ä¸ä¸ªç»çä»åºä¸º{isWarehouse.WarehouseCode}"); |
| | | } |
| | | |
| | | if (inboundOrder.BusinessType == "11" && inboundOrder.IsTestMaterials == 1 && palletDto.WarehouseType != "1076" && palletDto.WarehouseType != "5057") |
| | | { |
| | | return content.Error($"è¯¥åæ®ä¸ºè¯äº§ç©æï¼éè¦å
¥åºå°è¯äº§ä»ï¼è¯·éæ°æ ¹æ®ååºéæ©è¯äº§ä»åºè¿è¡ç»çå
¥åº"); |
| | | } |
| | | if (inboundOrder.IsTestMaterials == 0 && (palletDto.WarehouseType == "1076" || palletDto.WarehouseType == "5057")) |
| | | { |
| | | return content.Error($"è¯¥åæ®ä¸ºéè¯äº§ç©æï¼ä¸è½å
¥å°è¯äº§ä»ï¼è¯·éæ°æ ¹æ®ä»åºè¿è¡ç»çå
¥åº"); |
| | | } |
| | | if (!_locationInfoService.QueryLocationCount(Convert.ToInt32(palletDto.locationType))) |
| | | { |
| | | return content.Error($"该åºåº{palletDto.locationType}ä¸åå¨ç©ºé²åºä½"); |
| | | } |
| | | |
| | | var nullpallet =_stockInfoRepository.QueryFirst(x => x.PalletType == -1 && x.PalletCode == palletDto.PalletCode); |
| | | if (nullpallet != null) |
| | | { |
| | | return content.Error($"该æç{palletDto.PalletCode}å·²ç»è¿è¡ç©ºæç»ç,ä¸è½å¨è¿è¡ç»ç"); |
| | | } |
| | | var outbundPallet = _stockInfoRepository.QueryFirst(x => x.StockStatus == (int)StockStatusEmun.åºåºå®æ && x.PalletCode == palletDto.PalletCode); |
| | | if (outbundPallet != null) |
| | | { |
| | | return content.Error($"该æç{palletDto.PalletCode}æªè¿è¡å空箱,ä¸è½è¿è¡ç»ç"); |
| | | } |
| | | |
| | | foreach (var item in details) |
| | |
| | | { |
| | | return content.Error("已䏿¶çæçä¸è½å次ç»ç"); |
| | | } |
| | | |
| | | var nullpallet = _stockInfoRepository.QueryFirst(x => x.PalletType == -1 && x.PalletCode == palletDto.PalletCode); |
| | | if (nullpallet != null) |
| | | { |
| | | return content.Error($"该æç{palletDto.PalletCode}å·²ç»è¿è¡ç©ºæç»ç,ä¸è½å¨è¿è¡ç»ç"); |
| | | } |
| | | var outbundPallet = _stockInfoRepository.QueryFirst(x => x.StockStatus == (int)StockStatusEmun.åºåºå®æ && x.PalletCode == palletDto.PalletCode); |
| | | if (outbundPallet != null) |
| | | { |
| | | return content.Error($"该æç{palletDto.PalletCode}æªè¿è¡å空箱,ä¸è½è¿è¡ç»ç"); |
| | | } |
| | | if (_stockService.StockInfoDetailService.ExistBarcodes(palletDto.Barcode)) |
| | | { |
| | | return content.Error($"{palletDto.Barcode} æ¡ç å¨åºåä¸å·²åå¨"); |
| | |
| | | { |
| | | return content.Error($"æªæ¾å°è¯¥æ¡ç {palletDto.Barcode}éè°å
¥æºä»çä¿¡æ¯"); |
| | | } |
| | | |
| | | if(allocateMaterialInfo.WarehouseCode != palletDto.WarehouseType) |
| | | { |
| | | return content.Error($"该æ¡ç è°å
¥ä»åºä¸º{allocateMaterialInfo.WarehouseCode},ä¸éæ©ç{palletDto.WarehouseType}ä»åºä¸ä¸è´"); |
| | | } |
| | | stockInfo.Details.Add(new Dt_StockInfoDetail |
| | | { |
| | | StockId = stockInfo == null ? 0 : stockInfo.Id, |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>() |
| | | Dt_InboundOrder inboundOrder = null; |
| | | var allocateOrder = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Where(x => x.Id == id).First(); |
| | | if (allocateOrder != null) |
| | | { |
| | | inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == allocateOrder.OrderNo).First(); |
| | | if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | return content = WebResponseContent.Instance.OK($"è¯¥åæ®å±äºä¸åæ¹èªå¨åä¼ ï¼ä¸å¯æå¨åæ¹åä¼ "); |
| | | } |
| | | }else |
| | | { |
| | | inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>() |
| | | .Where(x => x.Id == id) |
| | | .First(); |
| | | if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | return content = WebResponseContent.Instance.OK($"è¯¥åæ®å±äºä¸åæ¹èªå¨åä¼ ï¼ä¸å¯æå¨åæ¹åä¼ "); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | List<Dt_MesReturnRecord> returnRecords = _mesReturnRecord.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo && x.OrderId == inboundOrder.Id && x.ReturnStatus == 2); |
| | | foreach (var item in returnRecords) |
| | |
| | | //} |
| | | } |
| | | _mesReturnRecord.UpdateData(returnRecords); |
| | | //éæ°åè°å®æçåæ®ï¼æ´æ°åºåç¶æ |
| | | foreach (var returnRecord in returnRecords) |
| | | { |
| | | if (returnRecord.ReturnStatus == 1) |
| | | { |
| | | _stockInfoRepository.Db.Updateable<Dt_StockInfoDetail>().SetColumns(it => new Dt_StockInfoDetail |
| | | { |
| | | Status = StockStatusEmun.å
¥åºå®æ.ObjToInt() |
| | | }).Where(it => it.OrderNo == returnRecord.OrderNo && returnRecord.RequestData.Contains(it.Barcode)).ExecuteCommand(); |
| | | } |
| | | } |
| | | |
| | | var inboundOrderDetail = _inboundOrderRepository.Db.Queryable<Dt_InboundOrderDetail>() |
| | | .Where(x => x.OrderId == inboundOrder.Id && x.OrderDetailStatus==(int)OrderDetailStatusEnum.Over && x.ReturnToMESStatus == 0) |
| | | .Where(x => x.OrderId == inboundOrder.Id && x.OrderDetailStatus == (int)OrderDetailStatusEnum.Over && x.ReturnToMESStatus == 0) |
| | | .ToList(); |
| | | |
| | | var stocks = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ) |
| | | .Where(it => SqlFunc.Subqueryable<Dt_StockInfoDetail>().Where(s => s.StockId == it.Id && s.OrderNo == inboundOrder.InboundOrderNo).Any()) |
| | | .Where(it => SqlFunc.Subqueryable<Dt_StockInfoDetail>().Where(s => s.StockId == it.Id && s.OrderNo == inboundOrder.InboundOrderNo && s.Status == StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt()).Any()) |
| | | .ToList(); |
| | | |
| | | var stockIds = stocks.Select(s => s.Id).ToList(); |
| | |
| | | inbound => inbound.Barcode, |
| | | stockdetail => stockdetail.Barcode, |
| | | (inbound, stockdetail) => inbound.Id) |
| | | .ToList(); |
| | | |
| | | var inbounddetailBarcode = inboundOrderDetail |
| | | .Join(allDetailsData, |
| | | inbound => inbound.Barcode, |
| | | stockdetail => stockdetail.Barcode, |
| | | (inbound, stockdetail) => stockdetail.Barcode) |
| | | .ToList(); |
| | | |
| | | var detail = allDetailsData.Where(x => matchedData.Contains(x.Barcode)).ToList(); |
| | |
| | | { |
| | | if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1)) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | } |
| | | else if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 3; |
| | | } |
| | | else |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 0; |
| | | } |
| | | } |
| | | else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0) |
| | | { |
| | |
| | | inboundOrder.ReturnToMESStatus = 2; |
| | | } |
| | | _inboundOrderRepository.UpdateData(inboundOrder); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | } |
| | | |
| | | var response = responseModel(inboundOrder, 3, null, allocatefeedmodel); |
| | | |
| | | if (response != null && response.IsSuccess) |
| | | if (response != null && response.IsSuccess && response.Data.Code == "200") |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.OrderId == inboundOrder.Id && inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 3 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 0 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | |
| | | _stockInfoRepository.Db.Updateable<Dt_StockInfoDetail>().SetColumns(it => new Dt_StockInfoDetail |
| | | { |
| | | Status = StockStatusEmun.å
¥åºå®æ.ObjToInt() |
| | | }).Where(it => it.OrderNo == inboundOrder.InboundOrderNo && inbounddetailBarcode.Contains(it.Barcode)).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 }) |
| | | .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 2 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 4 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 0 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | return content.Error("åä¼ MES失败"); |
| | | } |
| | | } |
| | |
| | | details = FeedbackInboundDetailsModelDto(detail) |
| | | }; |
| | | |
| | | if (feedmodel.details.Count<=0) |
| | | if (feedmodel.details.Count <= 0) |
| | | { |
| | | if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1)) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | } |
| | | else if(inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 3; |
| | | } |
| | | else |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 0; |
| | | } |
| | | } |
| | | else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0) |
| | | { |
| | |
| | | inboundOrder.ReturnToMESStatus = 2; |
| | | } |
| | | _inboundOrderRepository.UpdateData(inboundOrder); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | } |
| | | var response = responseModel(inboundOrder, 3, feedmodel); |
| | | |
| | | if (response != null && response.IsSuccess) |
| | | if (response != null && response.IsSuccess && response.Data.Code == "200") |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | |
| | | if(inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else if(inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 3}) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 0 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | |
| | | _stockInfoRepository.Db.Updateable<Dt_StockInfoDetail>().SetColumns(it => new Dt_StockInfoDetail |
| | | { |
| | | Status = StockStatusEmun.å
¥åºå®æ.ObjToInt() |
| | | }).Where(it => it.OrderNo == inboundOrder.InboundOrderNo && inbounddetailBarcode.Contains(it.Barcode)).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 }) |
| | | .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 2 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 4 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 0 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | return content.Error("åä¼ MES失败"); |
| | | } |
| | | } |
| | |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<AllocateDtoDetail> GetAllocateDtoDetails(List<Dt_StockInfoDetail> stockInfoDetails) |
| | | { |
| | |
| | | { |
| | | return content.Error("已䏿¶çæçä¸è½å次ç»ç"); |
| | | } |
| | | |
| | | var nullpallet = _stockInfoRepository.QueryFirst(x => x.PalletType == -1 && x.PalletCode == palletDto.PalletCode); |
| | | if (nullpallet != null) |
| | | { |
| | | return content.Error($"该æç{palletDto.PalletCode}å·²ç»è¿è¡ç©ºæç»ç,ä¸è½å¨è¿è¡ç»ç"); |
| | | } |
| | | var outbundPallet = _stockInfoRepository.QueryFirst(x => x.StockStatus == (int)StockStatusEmun.åºåºå®æ && x.PalletCode == palletDto.PalletCode); |
| | | if (outbundPallet != null) |
| | | { |
| | | return content.Error($"该æç{palletDto.PalletCode}æªè¿è¡å空箱,ä¸è½è¿è¡ç»ç"); |
| | | } |
| | | Dt_StockInfoDetail stockInfoDetail = _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() |
| | | .Where(x => x.Barcode == palletDto.Barcode && x.StockId == 0) |
| | | .First(); |
| | |
| | | { |
| | | return content.Error($"该æçç»çä»åºä¸º{stockInfo.Details.FirstOrDefault()?.WarehouseCode}ä¸å½åä»åº{palletDto.WarehouseType}ä¸ä¸è´ï¼ä¸å
许ç»ç"); |
| | | } |
| | | var nullpallet = _stockInfoRepository.QueryFirst(x => x.PalletType == -1 && x.PalletCode == palletDto.PalletCode); |
| | | if (nullpallet != null) |
| | | { |
| | | return content.Error($"该æç{palletDto.PalletCode}å·²ç»è¿è¡ç©ºæç»ç,ä¸è½å¨è¿è¡ç»ç"); |
| | | } |
| | | var outbundPallet = _stockInfoRepository.QueryFirst(x => x.StockStatus == (int)StockStatusEmun.åºåºå®æ && x.PalletCode == palletDto.PalletCode); |
| | | if (outbundPallet != null) |
| | | { |
| | | return content.Error($"该æç{palletDto.PalletCode}æªè¿è¡å空箱,ä¸è½è¿è¡ç»ç"); |
| | | } |
| | | Dt_StockInfoDetail stockInfoDetail = _stockInfoRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.Barcode == palletDto.Barcode && x.Status == StockStatusEmun.鿣ä¸.ObjToInt()).First(); |
| | | if(stockInfoDetail == null) |
| | | { |
| | |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |