| | |
| | | if(tErpGoodsUnit!=null){ |
| | | tErpClinicWarehousingBatch.setUnitName(tErpGoodsUnit.getUnitName()); |
| | | } |
| | | |
| | | tErpClinicWarehousingBatch.setPurchaseCount(tErpClinicWarehousingBatch.getWarehousingNumber()); |
| | | } |
| | | |
| | | warehouseGoodsDetailVo.setList(tErpClinicWarehousingBatches); |
| | |
| | | List<TErpClinicOutboundGoods> tErpClinicOutboundGoods2 = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getWarehousingBatchId, outboundGoods.getWarehousingBatchId())); |
| | | int sum = tErpClinicOutboundGoods2.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum(); |
| | | |
| | | int count = tErpClinicWarehousingBatch.getPurchaseCount() - sum; |
| | | int count = tErpClinicWarehousingBatch.getWarehousingNumber() - sum; |
| | | outboundGoodsDetailNextVo.setSurplusCount(count); |
| | | |
| | | outboundGoodsDetailNextVo.setUnitAmount(tErpClinicWarehousingBatch.getUnitAmount()); |
| | | if(outboundGoodsDetailNextVo.getUnitAmount()==null){ |
| | | outboundGoodsDetailNextVo.setUnitAmount(tErpClinicWarehousingBatch.getSalesAmount()); |
| | | } |
| | | outboundGoodsDetailNextVo.setOutboundCount(outboundGoods.getOutboundCount()); |
| | | outboundGoodsDetailNextVo.setExpiryDate(tErpClinicWarehousingBatch.getExpiryDate()); |
| | | outboundGoodsDetailNextVo.setTotalAmount(outboundGoodsDetailNextVo.getUnitAmount().multiply(new BigDecimal(outboundGoods.getOutboundCount()))); |
| | |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | TErpSupplierInventory tErpSupplierInventory = new TErpSupplierInventory(); |
| | | TErpSupplierInventory last1 = erpSupplierInventoryMapper.selectOne(new LambdaQueryWrapper<TErpSupplierInventory>().orderByDesc(BaseModel::getCreateTime).last("limit 1")); |
| | | TErpSupplierInventory last1 = erpSupplierInventoryMapper.selectOne(new LambdaQueryWrapper<TErpSupplierInventory>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpSupplierInventory::getInventoryNumber).last("limit 1")); |
| | | if(last1==null){ |
| | | tErpSupplierInventory.setInventoryNumber("P" + DateUtils.dateTimeNow()+"00001"); |
| | | }else { |
| | |
| | | tErpSupplierWarehousing.setUnitAmount(tErpSupplierWarehousing1.getUnitAmount()); |
| | | tErpSupplierWarehousing.setTotalPrice(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(tErpSupplierWarehousing.getGoodsCount()))); |
| | | // 当前年月日时分秒 |
| | | TErpSupplierWarehousing last = erpSupplierWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpSupplierWarehousing>().orderByDesc(BaseModel::getCreateTime).last("LIMIT 1")); |
| | | TErpSupplierWarehousing last = erpSupplierWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpSupplierWarehousing>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpSupplierWarehousing::getWarehouseNo).last("LIMIT 1")); |
| | | if(last==null){ |
| | | tErpSupplierWarehousing.setWarehouseNo("G"+DateUtils.dateTimeNow()+"00001"); |
| | | }else { |
| | |
| | | erpSupplierInventoryGoodsMapper.insert(tErpSupplierInventoryGoods); |
| | | |
| | | } else { |
| | | |
| | | int i =1; |
| | | TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch1 = erpSupplierWarehousingBatchMapper.selectById(inventoryGoodsDto.getId()); |
| | | String warehousingId1 = tErpSupplierWarehousingBatch1.getWarehousingId(); |
| | | TErpSupplierWarehousing tErpSupplierWarehousing2 = erpSupplierWarehousingMapper.selectById(warehousingId1); |
| | |
| | | throw new RuntimeException("网络繁忙,请重试"); |
| | | |
| | | } |
| | | |
| | | TErpSupplierOutboundGoods tErpSupplierOutboundGoods = new TErpSupplierOutboundGoods(); |
| | | tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId()); |
| | | tErpSupplierOutboundGoods.setWarehousingId(tErpSupplierWarehousing1.getId()); |
| | |
| | | tErpSupplierOutboundGoods.setOutboundCount(count); |
| | | tErpSupplierOutboundGoods.setTotalPrice(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(count))); |
| | | erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods); |
| | | i=2; |
| | | } |
| | | |
| | | |
| | |
| | | String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5)); |
| | | int number = Integer.parseInt(numberPart); |
| | | if (number < 99999) { |
| | | number++; |
| | | number+=i; |
| | | } else { |
| | | number = 2; // 达到99999后重置为00002 |
| | | } |
| | |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | TErpClinicInventory tErpSupplierInventory = new TErpClinicInventory(); |
| | | TErpClinicInventory last = erpClinicInventoryMapper.selectOne(new LambdaQueryWrapper<TErpClinicInventory>().orderByDesc(BaseModel::getCreateTime).last("limit 1")); |
| | | TErpClinicInventory last = erpClinicInventoryMapper.selectOne(new LambdaQueryWrapper<TErpClinicInventory>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicInventory::getInventoryNumber).last("limit 1")); |
| | | if(last==null){ |
| | | tErpSupplierInventory.setInventoryNumber("P" + DateUtils.dateTimeNow()+"00001"); |
| | | }else { |
| | |
| | | // tErpSupplierWarehousing.setUnitAmount(erpGoods.getSalesAmount()); |
| | | tErpSupplierWarehousing.setTotalPrice(tErpSupplierWarehousingBatch.getUnitAmount().multiply(new BigDecimal(inventoryGoodsDto.getInventoryCount() - inventoryGoodsDto.getNum()))); |
| | | // 当前年月日时分秒 |
| | | TErpClinicWarehousing last1 = erpClinicWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpClinicWarehousing>().orderByDesc(BaseModel::getCreateTime).last("limit 1")); |
| | | TErpClinicWarehousing last1 = erpClinicWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpClinicWarehousing>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicWarehousing::getWarehouseNo).last("limit 1")); |
| | | if(last1==null){ |
| | | tErpSupplierWarehousing.setWarehouseNo("G" + DateUtils.dateTimeNow()+"00001"); |
| | | }else { |
| | |
| | | erpClinicInventoryGoodsMapper.insert(tErpSupplierInventoryGoods); |
| | | |
| | | } else { |
| | | |
| | | int i=1; |
| | | if(inventoryGoodsDto.getDamagedCount()!=null && inventoryGoodsDto.getDamagedCount()>0){ |
| | | TErpClinicOutbound tErpSupplierOutbound = new TErpClinicOutbound(); |
| | | // tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); |
| | | // tErpSupplierOutbound.setSupplierId(supplierClinicId); |
| | | tErpSupplierOutbound.setOutboundType(1); |
| | | TErpClinicOutbound last2 = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).last("limit 1")); |
| | | TErpClinicOutbound last2 = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicOutbound::getOutboundNumber).last("limit 1")); |
| | | if(last2==null){ |
| | | |
| | | tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001"); |
| | |
| | | tErpSupplierOutboundGoods.setOutboundCount(count); |
| | | tErpSupplierOutboundGoods.setTotalPrice(erpGoods.getSalesAmount().multiply(new BigDecimal(count))); |
| | | erpClinicOutboundGoodsMapper.insert(tErpSupplierOutboundGoods); |
| | | i=2; |
| | | } |
| | | TErpClinicOutbound tErpSupplierOutbound = new TErpClinicOutbound(); |
| | | // tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); |
| | | // tErpSupplierOutbound.setSupplierId(supplierClinicId); |
| | | tErpSupplierOutbound.setOutboundType(6); |
| | | TErpClinicOutbound last4 = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).last("limit 1")); |
| | | TErpClinicOutbound last4 = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicOutbound::getOutboundNumber).last("limit 1")); |
| | | if(last4==null){ |
| | | tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001"); |
| | | }else { |
| | |
| | | String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5)); |
| | | int number = Integer.parseInt(numberPart); |
| | | if (number < 99999) { |
| | | number++; |
| | | number+=i; |
| | | } else { |
| | | number = 2; // 达到99999后重置为00002 |
| | | } |