| | |
| | | beforeQuantity = stockInfo.Details.Sum(x => x.StockQuantity); |
| | | } |
| | | |
| | | ; |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA64.ToString()) |
| | | { |
| | | stockInfo.Remark = Initiallife.ToString(); |
| | | string batchNo = models.FirstOrDefault()?.LotNo ?? ""; |
| | | Dt_StockInfoDetail existDetail = _stockRepository.StockInfoDetailRepository.QueryFirst(x => x.BatchNo == batchNo); |
| | | if (existDetail != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"{batchNo}æµè¯æ¶å·²åå¨"); |
| | | } |
| | | if (models.Count >= 2) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ç»çæç»ä¸å¯ä¸"); |
| | | } |
| | | if (palletCode.Substring(0, 1) == "6") |
| | | { |
| | | stockInfo.PalletType = PalletTypeEnum.MediumPallet.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo.PalletType = PalletTypeEnum.LargestPallet.ObjToInt(); |
| | | } |
| | | } |
| | | |
| | | List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); |
| | | List<int> detailKeys = new List<int>(); |
| | |
| | | _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.MaterielGroup); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //if (warehouse.WarehouseCode==WarehouseEnum.HA153.ToString()) |
| | | //{ |
| | | // //忥æµè¯æ¶ä¿¡æ¯ |
| | | // foreach (var model in models) |
| | | // { |
| | | // _taskService.TestSynStock(new TestToolSynInfo() { ToolCode = model.LotNo, Life = Initiallife }); |
| | | // } |
| | | //} |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | float beforeQuantity = 0; |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | stockInfo = new Dt_StockInfo() |
| | |
| | | return WebResponseContent.Instance.Error($"æçå·éå¤"); |
| | | } |
| | | beforeQuantity = stockInfo.Details.Sum(x => x.StockQuantity); |
| | | } |
| | | |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA64.ToString()) |
| | | { |
| | | string batchNo = models.FirstOrDefault()?.LotNo ?? ""; |
| | | Dt_StockInfoDetail existDetail = _stockRepository.StockInfoDetailRepository.QueryFirst(x => x.BatchNo == batchNo); |
| | | if (existDetail != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"{batchNo}æµè¯æ¶å·²åå¨"); |
| | | } |
| | | if (models.Count >= 2) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ç»çæç»ä¸å¯ä¸"); |
| | | } |
| | | stockInfo.Remark = Initiallife.ToString(); |
| | | if (palletCode.Substring(0, 1) == "6") |
| | | { |
| | | stockInfo.PalletType = PalletTypeEnum.MediumPallet.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo.PalletType = PalletTypeEnum.LargestPallet.ObjToInt(); |
| | | } |
| | | } |
| | | |
| | | List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); |
| | |
| | | } |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.MaterielGroup); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //忥æµè¯æ¶ä¿¡æ¯ |
| | | //foreach (var model in models) |
| | | //{ |
| | | // _taskService.TestSynStock(new TestToolSynInfo() { ToolCode = model.LotNo, Life = Initiallife }); |
| | | //} |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | else if (warehouse.WarehouseCode == WarehouseEnum.HA152.ObjToString()) |
| | | { |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2)); |
| | | if(palletTypeInfo == null) |
| | | if (palletTypeInfo == null) |
| | | { |
| | | throw new Exception($"æçå·é误"); |
| | | } |