ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java
@@ -311,7 +311,7 @@ tErpClinicWarehousing.setWarehousingType(1); tErpClinicWarehousing.setType(1); TErpClinicWarehousing last = erpClinicWarehousingService.getOne(new LambdaQueryWrapper<TErpClinicWarehousing>().orderByDesc(BaseModel::getCreateTime).last("LIMIT 1")); TErpClinicWarehousing last = erpClinicWarehousingService.getOne(new LambdaQueryWrapper<TErpClinicWarehousing>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicWarehousing::getWarehouseNo).last("LIMIT 1")); if(last==null){ tErpClinicWarehousing.setWarehouseNo("G"+ DateUtils.dateTimeNow()+"00001"); }else { ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java
@@ -252,7 +252,7 @@ HashMap<String, Object> map1 = new HashMap<>(); //TODO hzt map1.put("recv_no", "SR2024021195402"); map1.put("recv_no", "SR2023081514001"); // 手续费 BigDecimal bigDecimal = allMoney.multiply(new BigDecimal("0.038")).setScale(2, RoundingMode.HALF_UP); payMoney = payMoney.subtract(bigDecimal); @@ -453,7 +453,7 @@ @ApiOperation(value = "退款") @PostMapping(value = "/refundOrder") @SneakyThrows public R<?> refundOrder(@RequestParam String id, HttpServletRequest request) { public synchronized R<?> refundOrder(@RequestParam String id, HttpServletRequest request) { SysUser user = tokenService.getLoginUser().getUser(); try { // 先退分账 在退订单 @@ -561,7 +561,7 @@ // } HashMap<String, Object> map1 = new HashMap<>(); // TODO hzt map1.put("recv_no", "SR2024021195402"); map1.put("recv_no", "SR2023081514001"); map1.put("amt", erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + ""); objects.add(map1); map.put("total_amt",erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + ""); ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
@@ -380,7 +380,7 @@ tErpClinicWarehousing.setClinicId(supplierClinicId); tErpClinicWarehousing.setCreateId(user.getUserId().toString()); TErpClinicWarehousing last = this.getOne(new LambdaQueryWrapper<TErpClinicWarehousing>().orderByDesc(BaseModel::getCreateTime).last("LIMIT 1")); TErpClinicWarehousing last = this.getOne(new LambdaQueryWrapper<TErpClinicWarehousing>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicWarehousing::getWarehouseNo).last("LIMIT 1")); if(last==null){ tErpClinicWarehousing.setWarehouseNo("G" + DateUtils.dateTimeNow()+"00001"); }else{ @@ -468,7 +468,7 @@ TErpClinicOutbound tErpClinicOutbound = new TErpClinicOutbound(); tErpClinicOutbound.setClinicId(supplierClinicId); tErpClinicOutbound.setCreateId(user.getUserId().toString()); TErpClinicOutbound last = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).last("limit 1")); TErpClinicOutbound last = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicOutbound::getOutboundNumber).last("limit 1")); if(last==null){ tErpClinicOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001"); }else{ @@ -512,7 +512,11 @@ tErpClinicOutboundGoods1.setWarehousingId(tErpClinicWarehousingBatch.getWarehousingId()); tErpClinicOutboundGoods1.setWarehousingBatchId(batchId); tErpClinicOutboundGoods1.setOutboundCount(outboundGoodsNextDto.getNum()); tErpClinicOutboundGoods1.setTotalPrice(tErpClinicWarehousingBatch.getUnitAmount().multiply(BigDecimal.valueOf(outboundGoodsNextDto.getNum()))); if(tErpClinicWarehousingBatch.getUnitAmount()==null){ tErpClinicOutboundGoods1.setTotalPrice(tErpClinicWarehousingBatch.getSalesAmount().multiply(BigDecimal.valueOf(outboundGoodsNextDto.getNum()))); }else { tErpClinicOutboundGoods1.setTotalPrice(tErpClinicWarehousingBatch.getUnitAmount().multiply(BigDecimal.valueOf(outboundGoodsNextDto.getNum()))); } tErpClinicOutboundGoods1.setGoodsId(tErpClinicWarehousingBatch.getGoodsId()); tErpClinicOutboundGoods.add(tErpClinicOutboundGoods1); erpClinicOutboundGoodsMapper.insert(tErpClinicOutboundGoods1); ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
@@ -536,7 +536,7 @@ 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 { @@ -589,7 +589,7 @@ 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 { @@ -640,7 +640,7 @@ erpSupplierInventoryGoodsMapper.insert(tErpSupplierInventoryGoods); } else { int i =1; TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch1 = erpSupplierWarehousingBatchMapper.selectById(inventoryGoodsDto.getId()); String warehousingId1 = tErpSupplierWarehousingBatch1.getWarehousingId(); TErpSupplierWarehousing tErpSupplierWarehousing2 = erpSupplierWarehousingMapper.selectById(warehousingId1); @@ -681,7 +681,6 @@ throw new RuntimeException("网络繁忙,请重试"); } TErpSupplierOutboundGoods tErpSupplierOutboundGoods = new TErpSupplierOutboundGoods(); tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId()); tErpSupplierOutboundGoods.setWarehousingId(tErpSupplierWarehousing1.getId()); @@ -689,6 +688,7 @@ tErpSupplierOutboundGoods.setOutboundCount(count); tErpSupplierOutboundGoods.setTotalPrice(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(count))); erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods); i=2; } @@ -708,7 +708,7 @@ 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 } @@ -773,7 +773,7 @@ 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 { @@ -823,7 +823,7 @@ // 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 { @@ -886,13 +886,13 @@ 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"); @@ -931,12 +931,13 @@ 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 { @@ -947,7 +948,7 @@ 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 } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
@@ -459,7 +459,7 @@ // 获取上一条最新的数据 TErpProcurement tErpProcurement1 = this.baseMapper.selectOne(new QueryWrapper<TErpProcurement>().orderByDesc("create_time").last("limit 1")); TErpProcurement tErpProcurement1 = this.baseMapper.selectOne(new QueryWrapper<TErpProcurement>().orderByDesc("create_time").orderByDesc("procurement_code").last("limit 1")); if(tErpProcurement1==null){ tErpProcurement.setProcurementCode("C" + DateUtils.dateTimeNow()+"00001"); }else { @@ -607,7 +607,7 @@ //TODO 确定这个是采购价还是销售价格 tErpSupplierOutbound.setTotalMoney(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount))); TErpSupplierOutbound last = erpSupplierOutboundMapper.selectOne(new LambdaQueryWrapper<TErpSupplierOutbound>().orderByDesc(BaseModel::getCreateTime).last("limit 1")); TErpSupplierOutbound last = erpSupplierOutboundMapper.selectOne(new LambdaQueryWrapper<TErpSupplierOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpSupplierOutbound::getOutboundNumber).last("limit 1")); if(last==null){ tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001"); }else { @@ -655,7 +655,7 @@ tErpSupplierOutbound.setOutboundType(7); //TODO 确定这个是采购价还是销售价格 tErpSupplierOutbound.setTotalMoney(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount))); TErpSupplierOutbound last = erpSupplierOutboundMapper.selectOne(new LambdaQueryWrapper<TErpSupplierOutbound>().orderByDesc(BaseModel::getCreateTime).last("limit 1")); TErpSupplierOutbound last = erpSupplierOutboundMapper.selectOne(new LambdaQueryWrapper<TErpSupplierOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpSupplierOutbound::getOutboundNumber).last("limit 1")); if(last==null){ tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001"); }else { ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
@@ -166,9 +166,9 @@ tErpGoodsWarehouseVO.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber()); tErpGoodsWarehouseVO.setProductionDate(tErpSupplierWarehousingBatch.getProductionDate()); tErpGoodsWarehouseVO.setExpiryDate(tErpSupplierWarehousingBatch.getExpiryDate()); TErpSupplierOutboundGoods tErpSupplierOutboundGoods1 = tErpSupplierOutboundGoods.stream().filter(t -> t.getWarehousingBatchId().equals(tErpSupplierWarehousingBatch.getId())).findFirst().orElse(null); if(tErpSupplierOutboundGoods1!=null){ tErpGoodsWarehouseVO.setNowNum(tErpSupplierWarehousingBatch.getWarehousingNumber()-tErpSupplierOutboundGoods1.getOutboundCount()); List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods1 = tErpSupplierOutboundGoods.stream().filter(t -> t.getWarehousingBatchId().equals(tErpSupplierWarehousingBatch.getId())).collect(Collectors.toList()); if(!tErpSupplierOutboundGoods1.isEmpty()){ tErpGoodsWarehouseVO.setNowNum(tErpSupplierWarehousingBatch.getWarehousingNumber()-tErpSupplierOutboundGoods1.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum()); }else { tErpGoodsWarehouseVO.setNowNum(tErpSupplierWarehousingBatch.getWarehousingNumber()); } @@ -278,7 +278,7 @@ TErpSupplierWarehousing tErpSupplierWarehousing = new TErpSupplierWarehousing(); // 当前年月日时分秒 // 查询上一个入库单 TErpSupplierWarehousing last = erpSupplierWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpSupplierWarehousing>().orderByDesc(TErpSupplierWarehousing::getCreateTime).last("LIMIT 1")); TErpSupplierWarehousing last = erpSupplierWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpSupplierWarehousing>().orderByDesc(TErpSupplierWarehousing::getCreateTime).orderByDesc(TErpSupplierWarehousing::getWarehouseNo).last("LIMIT 1")); if(last==null){ tErpSupplierWarehousing.setWarehouseNo("G"+DateUtils.dateTimeNow()+"00001"); }else { ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
@@ -105,7 +105,7 @@ </if> ) as o where 1=1 <if test="query.type != null"> and o.type = #{query.type} and o.category = #{query.type} </if> order by o.operationTime desc @@ -115,7 +115,7 @@ <select id="validityPeriodWarning" resultType="com.ruoyi.system.vo.ValidityPeriodWarningVo"> select * from (select t2.warehouse_id,t2.warehouse_no warehousingNo, t4.goods_name, t4.quasi_number, t1.batch_number, t1.id as batchId,t1.expiry_date, t4.id as goodsId,t5.type_name,t6.unit_name packingUnitName, t1.warehousing_number -t3.outbound_count as num t1.warehousing_number -COALESCE (t3.outbound_count,0) as num from t_erp_supplier_warehousing_batch t1 left join t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id left join ( @@ -127,7 +127,8 @@ left join t_erp_goods_type t5 on t4.type_id = t5.id left join t_erp_goods_unit t6 on t4.packing_unit_id = t6.id where #{time} > t1.expiry_date <if test="user.roleType !=null and user.roleType ==4"> and t2.supplier_id =#{supplierClinicId} <if test="user.roleType !=null and user.roleType ==4"> and t2.supplier_id =#{supplierClinicId} </if> <if test="query.name != null and query.name != ''"> and t4.goods_name like concat('%',#{query.name},'%')