xuhy
2 天以前 72aaf45389cd09c206ee1b90f0c7f5bf59782930
Merge remote-tracking branch 'origin/master'
10个文件已修改
68 ■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TErpGoods.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java
@@ -225,7 +225,7 @@
            return R.fail("该订单已发货");
        }
        exchange1.setStatus(2);
        exchange1.setLogisticsNumber(exchange1.getLogisticsNumber());
        exchange1.setLogisticsNumber(exchange.getLogisticsNumber());
        sysGoodsExchangeService.updateById(exchange1);
        return R.ok();
    }
ruoyi-system/src/main/java/com/ruoyi/system/model/TErpGoods.java
@@ -118,8 +118,8 @@
    @ApiModelProperty(value = "是否为处方药 1=是 2=否")
    @TableField("is_prescription_drug")
    @Excel(name = "是否为处方药",replace = {"是_1","否_2"})
    private Integer isPrescriptionDrug;
    @Excel(name = "是否为处方药",replace = {"是_1","否_2","_3"})
    private Integer isPrescriptionDrug=3;
    @Excel(name = "包装单位")
    @TableField(exist = false)
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());
            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/TErpProcurementMapper.xml
@@ -91,7 +91,7 @@
               t1.procurement_code,
               t2.clinic_name,
               t2.clinic_address,
               t1.logistics_number,
               t1.logistics_number as logisticsNo,
                t1.send_time,
               t1.clinic_id,
               t1.status,
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},'%')