| | |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Basic; |
| | | using WIDESEA_Model.Models.Check; |
| | | |
| | | namespace WIDESEA_InboundService |
| | | { |
| | |
| | | |
| | | if (allocatefeedmodel.Details.Count <= 0) |
| | | { |
| | | if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1)) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | } |
| | | else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 4; |
| | | } |
| | | else if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 2)) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 2; |
| | | } |
| | | _inboundOrderRepository.UpdateData(inboundOrder); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | } |
| | | |
| | |
| | | |
| | | if (feedmodel.details.Count<=0) |
| | | { |
| | | if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1)) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | } |
| | | else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 4; |
| | | } |
| | | else if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 2)) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 2; |
| | | } |
| | | _inboundOrderRepository.UpdateData(inboundOrder); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | } |
| | | var response = responseModel(inboundOrder, 3, feedmodel); |
| | |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public async Task<WebResponseContent> ReCheckGroupPallet(GroupPalletDto palletDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | (bool, string, object?) result2 = ModelValidate.ValidateModelData(palletDto); |
| | | if (!result2.Item1) return content.Error(result2.Item2); |
| | | |
| | | var code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == palletDto.WarehouseType).Select(x => x.Code).First(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return content.Error($"ä»åºä¸æ²¡æè¯¥{palletDto.WarehouseType}ç¼å·ã"); |
| | | } |
| | | |
| | | Dt_StockInfo? stockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync(); |
| | | |
| | | if (_taskRepository.QueryFirst(x => x.PalletCode == palletDto.PalletCode) != null) |
| | | { |
| | | return content.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | if (stockInfo != null && !string.IsNullOrEmpty(stockInfo.LocationCode) && stockInfo.StockStatus != (int)StockStatusEmun.ç»çæå) |
| | | { |
| | | return content.Error("已䏿¶çæçä¸è½å次ç»ç"); |
| | | } |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None, LocationType = Convert.ToInt32(palletDto.locationType) }; |
| | | stockInfo.Details = new List<Dt_StockInfoDetail>(); |
| | | } |
| | | |
| | | if (stockInfo != null && stockInfo.Details.Count > 0 && stockInfo.Details.FirstOrDefault()?.WarehouseCode != palletDto.WarehouseType) |
| | | { |
| | | return content.Error($"该æçç»çä»åºä¸º{stockInfo.Details.FirstOrDefault()?.WarehouseCode}ä¸å½åä»åº{palletDto.WarehouseType}ä¸ä¸è´ï¼ä¸å
许ç»ç"); |
| | | } |
| | | 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("æªæ¾å°åºåä¸éæ£å»ç»çæ¡ç "); |
| | | } |
| | | Dt_ReCheckOrder reCheckOrder = _stockInfoRepository.Db.Queryable<Dt_ReCheckOrder>().Where(x => x.MaterielCode == stockInfoDetail.MaterielCode && x.BatchNo == stockInfoDetail.BatchNo && x.Result == 0).First(); |
| | | if(reCheckOrder != null) |
| | | { |
| | | return content.Error($"è¯¥éæ£æ¡ç çæ¹æ¬¡å¨éæ£å䏿ªæ¿å°éæ£ç»æï¼è¯·æ£æµéæ£å{reCheckOrder.OrderNo}ç¶æ"); |
| | | } |
| | | stockInfo.Details.Add(new Dt_StockInfoDetail |
| | | { |
| | | StockId = stockInfo == null ? 0 : stockInfo.Id, |
| | | Barcode = stockInfoDetail.Barcode, |
| | | MaterielCode = stockInfoDetail.MaterielCode, |
| | | MaterielName = stockInfoDetail.MaterielName, |
| | | BatchNo = stockInfoDetail.BatchNo, |
| | | Unit = stockInfoDetail.Unit, |
| | | SupplyCode = stockInfoDetail.SupplyCode, |
| | | WarehouseCode = stockInfoDetail.WarehouseCode, |
| | | StockQuantity = stockInfoDetail.StockQuantity, |
| | | BarcodeQty = stockInfoDetail.BarcodeQty, |
| | | BarcodeUnit = stockInfoDetail.BarcodeUnit, |
| | | FactoryArea = stockInfoDetail.FactoryArea, |
| | | Status = stockInfoDetail.Status, |
| | | OrderNo = stockInfoDetail.OrderNo, |
| | | BusinessType = "30", |
| | | ValidDate = stockInfoDetail.ValidDate |
| | | }); |
| | | _stockInfoRepository.Db.Deleteable<Dt_StockInfoDetail>().Where(x => x.Barcode == stockInfoDetail.Barcode).ExecuteCommand(); |
| | | if (stockInfo.Id == 0) |
| | | { |
| | | stockInfo.PalletCode = palletDto.PalletCode; |
| | | stockInfo.StockStatus = (int)StockStatusEmun.鿣åºå宿; |
| | | } |
| | | stockInfo.PalletType = (int)PalletTypeEnum.None; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockService.StockInfoService.AddMaterielGroup(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | Dt_StockInfo? NewstockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync(); |
| | | |
| | | return WebResponseContent.Instance.OK(data: NewstockInfo.Details.OrderByDescending(x => x.Id)); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | LogFactory.GetLog($"ç»çä¿¡æ¯").Info(true, $"ãå¼å¸¸ãï¼ã{ex.Message}ã{Environment.NewLine}ã{ex.StackTrace}ã{Environment.NewLine}{Environment.NewLine}"); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |