| | |
| | | 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; |
| | |
| | | |
| | | var details = _inboundOrderDetailRepository.QueryData(x => (x.OutBoxbarcodes == palletDto.Barcode|| x.Barcode == palletDto.Barcode) && x.OrderDetailStatus == (int)InOrderStatusEnum.æªå¼å§); |
| | | |
| | | |
| | | if (details.Count() <= 0) |
| | | { |
| | | var inbounddetail =_inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode); |
| | | if(inbounddetail == null) |
| | | |
| | | var inbounddetail = _inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode); |
| | | if (inbounddetail == null) |
| | | { |
| | | return content.Error($"æ¡ç {palletDto.Barcode}ä¸åå¨"); |
| | | } |
| | |
| | | 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 |
| | | 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); |
| | | { |
| | | 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}ä¸åå¨"); |
| | | return content.Error($"æ¡ç {palletDto.Barcode}å·²ç»ç"); |
| | | } |
| | | var pallet =_stockInfoRepository.QueryFirst(x => x.Id == palletId.StockId); |
| | | return content.Error($"æ¡ç {palletDto.Barcode}å·²ç»ç»å°{pallet.PalletCode}",detail); |
| | | 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($"该æçç»çä»åºä¸º{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 (!_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} æ¡ç å¨åºåä¸å·²åå¨"); |
| | |
| | | //} |
| | | } |
| | | _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(); |
| | |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.OrderId == inboundOrder.Id && inbounddetailID.Contains(it.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 |
| | | { |
| | |
| | | details = FeedbackInboundDetailsModelDto(detail) |
| | | }; |
| | | |
| | | if (feedmodel.details.Count<=0) |
| | | if (feedmodel.details.Count <= 0) |
| | | { |
| | | if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1)) |
| | | { |
| | |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => inbounddetailID.Contains(it.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 |
| | | { |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |