caifc 3 lat temu
rodzic
commit
6ef7507c83

+ 13 - 10
ruoyi-warehouse/src/main/java/com/ruoyi/approvalFlow/service/impl/AuditPathsServiceImpl.java

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.ruoyi.approvalFlow.domain.*;
 import com.ruoyi.approvalFlow.mapper.*;
 import com.ruoyi.approvalFlow.service.IAuditPathsService;
+import com.ruoyi.basicData.domain.TFees;
+import com.ruoyi.basicData.mapper.TFeesMapper;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.exception.WarehouseException;
@@ -86,6 +88,9 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
     private TFeeMapper tFeeMapper;
 
     @Autowired
+    private TFeesMapper feesMapper;
+
+    @Autowired
     private TWarehouseAgreementMapper tWarehouseAgreementMapper;
 
     /**
@@ -346,20 +351,18 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                         if (Objects.equals(auditItems.getActId(), 120L)) {
                             List<TWarehousebillsfees> feesList = tWarehousebillsfeesMapper.selectWarehousebillsfeesByPId(auditItems.getBillId());
                             // 获取仓储费,并判断费用中是否存在仓储费
-                            TFee ccf = tFeeMapper.seletFeeByCode("CCF");
+                            TFees ccf = feesMapper.seletFeesByCCF();
                             if (Objects.isNull(ccf)) {
                                 throw new WarehouseException("未找到仓储费费用信息");
                             }
                             // 过滤出费用类型等于仓储费并且有商机id,并取出来进行更新仓储费计费日期
-                            List<TWarehousebillsfees> warehousebillsfees = feesList.stream().filter(li -> Objects.equals(li.getfFeeid(), ccf.getfId()) && Objects.nonNull(li.getSrcId()))
-                                    .distinct().collect(Collectors.toList());
-                            // 更新子表仓储费截止日期
-                            warehousebillsfees.forEach(li -> {
-                                TWarehousebillsitems warehousebillsitems = new TWarehousebillsitems();
-                                warehousebillsitems.setfId(li.getSrcId());
-                                warehousebillsitems.setfStorageFeeDeadline(li.getfBillingDeadline());
-                                tWarehousebillsitemsMapper.updateById(warehousebillsitems);
-                            });
+                            long count = feesList.stream().filter(li -> Objects.equals(li.getfFeeid(), ccf.getfId()) && Objects.nonNull(li.getSrcId()))
+                                    .count();
+                            if (count > 0) {
+                                TWarehousebillsfees warehousebillsfees = feesList.stream().findFirst().orElseThrow(() -> new WarehouseException("未找到费用明细"));
+                                // 更新子表仓储费截止日期
+                                tWarehousebillsitemsMapper.updateItemStorageFeeDeadlineByPId(warehousebillsfees.getfPid(), warehousebillsfees.getfBillingDeadline());
+                            }
                         } else if (Objects.equals(auditItems.getActId(), 150L)) {
                             List<TWarehousebillsfees> feesList = tWarehousebillsfeesMapper.selectWarehousebillsfeesByPId(auditItems.getBillId());
                             if (CollectionUtils.isNotEmpty(feesList)) {

+ 5 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TFeesMapper.java

@@ -2,6 +2,8 @@ package com.ruoyi.basicData.mapper;
 
 import com.ruoyi.basicData.domain.TFees;
 import com.ruoyi.basicData.domain.TGoods;
+import com.ruoyi.finance.domain.TFee;
+import io.lettuce.core.dynamic.annotation.Param;
 
 import java.util.List;
 
@@ -87,4 +89,7 @@ public interface TFeesMapper {
      * @return
      */
     public TFees selectTFeesByFName(String fName);
+
+    // 根据查询仓储费费用信息
+    public TFees seletFeesByCCF();
 }

+ 0 - 3
ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeMapper.java

@@ -120,9 +120,6 @@ public interface TFeeMapper {
 
     public List<Map<String, Object>> selectDetailedList1(TWarehousebill tWarehousebill);
 
-    // 根据编号查询费用信息
-    public TFee seletFeeByCode(@Param("code") String code);
-
     /**
      * 网页版发票查询
      * @param tFee

+ 1 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -190,7 +190,7 @@ public class TFeeServiceImpl implements ITFeeService {
                 map1.put("fUnitprice", tWarehousebillsfees.getfUnitprice());
                 if (tWarehousebillsfees.getfBilltype().equals("KHDD")) {
                     map1.put("fBusinessType", "船运订单");
-                } else {
+                } else if (CollectionUtils.isNotEmpty(sysDictDataListIn)) {
                     map1.put("fBusinessType", sysDictDataListIn.get(0).getDictLabel());
                 }
                 if (tWarehousebills.getfBilltype().equals("SJRK")) {

+ 9 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsitemsMapper.java

@@ -224,4 +224,13 @@ public interface TWarehousebillsitemsMapper extends BaseMapper<TWarehousebillsit
      * @return
      */
     int queryChangedByFstorageFeeDeadline(@Param("ids") List<Long> ids, @Param("time") Date chargedate);
+
+    /**
+     * 根据仓库主表id更新仓储费计费截止日期
+     *
+     * @param pId   仓库主Id
+     * @param time  仓储费计费截止日期
+     * @return
+     */
+    int updateItemStorageFeeDeadlineByPId(@Param("pId")Long pId, @Param("time") Date time);
 }

+ 6 - 12
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -89,9 +89,6 @@ import static java.util.stream.Collectors.toList;
 public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 
     @Autowired
-    private TFeeMapper tFeeMapper;
-
-    @Autowired
     private TFeesMapper tFeesMapper;
 
     @Autowired
@@ -1234,6 +1231,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             key = "warehouse.transfer.ApprovalFlow";
         } else if ("HWTG".equals(billsType)) {
             key = "warehouse.cargoClearance.ApprovalFlow";
+        } else if ("CDZZ".equals(billsType)) {
+            key = "warehouse.yardLoading.ApprovalFlow";
         }
         SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
         if (StringUtils.isNull(sysConfig)) {
@@ -4268,7 +4267,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 mblno = item.get("fMblno").toString();
             }
             String remark = objectMap.get("remark").toString();
-            feeId = Long.valueOf(String.valueOf(objectMap.get("feeId"))).longValue();
+            feeId = Long.valueOf(String.valueOf(objectMap.get("feeId")));
             BigDecimal amt = (BigDecimal) objectMap.get("amt");
             map.put("feeId", feeId);
             map.put("itemFeeId", objectMap.get("feeId"));
@@ -4277,6 +4276,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             fees.setfFeeid(feeId);
             fees.setfDc("D");
             fees.setfAmt(amt);
+            fees.setfQty(fQty);
             fees.setSrcId(fId);
             fees.setfMblno(mblno);
             fees.setRemark(remark);
@@ -4291,7 +4291,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             fees.setfBillingDays(fBillingDays);
             fees.setCreateTime(new Date());
             fees.setfWarehouseid(storageFeesDto.getWarehouseId());
-            fees.setfQty(new BigDecimal(1));
             fees.setfPid(warehouseBills.getfId());
             fees.setfInventoryDays(fInventoryDays);
             fees.setfExrate(new BigDecimal(1));
@@ -4948,22 +4947,17 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      * @param tWarehousebills 订单信息
      */
     private void cancellationInStockFee(TWarehouseBills tWarehousebills) {
-        LambdaUpdateWrapper<TWarehousebillsitems> updateWrapper = Wrappers.<TWarehousebillsitems>lambdaUpdate();
         // 查询出库费用信息
         List<TWarehousebillsfees> feesList = tWarehousebillsfeesMapper.selectWarehousebillsfeesByPId(tWarehousebills.getfId());
         // 获取仓储费,并判断费用中是否存在仓储费
-        TFee ccf = tFeeMapper.seletFeeByCode("CCF");
+        TFees ccf = tFeesMapper.seletFeesByCCF();
         if (Objects.isNull(ccf)) {
             throw new WarehouseException("未找到仓储费费用信息");
         }
         // 过滤出费用类型等于仓储费并且有商机id,并取出来进行更新仓储费计费日期
         List<Long> itemIds = feesList.stream().filter(li -> Objects.equals(li.getfFeeid(), ccf.getfId()) && Objects.nonNull(li.getSrcId()))
                 .map(TWarehousebillsfees::getSrcId).distinct().collect(toList());
-
-        updateWrapper = updateWrapper.in(TWarehousebillsitems::getfPid, itemIds)
-                .isNull(TWarehousebillsitems::getfStorageFeeDeadline);
-
-        tWarehousebillsitemsMapper.update(new TWarehousebillsitems(), updateWrapper);
+        itemIds.forEach(id -> tWarehousebillsitemsMapper.updatefStorageFeeDeadlinefPid(id));
     }
 
     /**

+ 5 - 0
ruoyi-warehouse/src/main/resources/mapper/basicData/TFeesMapper.xml

@@ -129,4 +129,9 @@
         select f_id,f_name from t_fees where f_name = #{fAame}
     </select>
 
+    <select id="seletFeesByCCF" resultMap="TFeesResult">
+        <include refid="selectTFeesVo"/>
+        where f_no = 'CCF' and del_flag = 0
+    </select>
+
 </mapper>

+ 0 - 4
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -1957,10 +1957,6 @@
         ORDER BY tf.f_id desc
     </select>
 
-    <select id="seletFeeByCode" resultType="com.ruoyi.finance.domain.TFee">
-        <include refid="selectTFeeVo"/>
-        where f_no = #{code} and del_flag = 0
-    </select>
     <!--凯和检索费用信息-->
     <select id="FinancialFeesList" resultType="java.util.Map">
     SELECT

+ 10 - 2
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsMapper.xml

@@ -279,7 +279,7 @@
             <if test="fSealno != null">f_sealno,</if>
             <if test="fNowCarton != null">f_now_carton,</if>
             <if test="fItemstatus != null">f_itemstatus,</if>
-            <if test="fCartypeId != null">f_cartype_id,</if> 
+            <if test="fCartypeId != null">f_cartype_id,</if>
             <if test="fDc != null">f_dc,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -414,7 +414,7 @@
             <if test="fNowCarton != null">f_now_carton = #{fNowCarton},</if>
             <if test="fItemstatus != null">f_itemstatus = #{fItemstatus},</if>
             <if test="fCartypeId != null">f_cartype_id = #{fCartypeId},</if>
-            <if test="fDc != null">f_dc = #{fDc},</if>     
+            <if test="fDc != null">f_dc = #{fDc},</if>
         </trim>
         where f_id = #{fId}
     </update>
@@ -472,6 +472,7 @@
             LEFT JOIN t_warehouse wa ON wa.f_id = ware.f_warehouseid
         <where>
             ware.f_corpid = #{warehouse.fCorpid}
+            <if test="warehouse.fId != null">and item.f_id = #{warehouse.fId}</if>
             and ware.f_billtype in ("HQZY", "SJCK")
             and wa.f_charg = 1
             and item.f_billstatus = 40
@@ -759,6 +760,7 @@
         WHERE
         f_pid = #{fPid}
     </update>
+
     <select id="selectStorageFeeItemfTruckNo" parameterType="string" resultType="Map">
         SELECT
         DISTINCT
@@ -794,4 +796,10 @@
             and f_storage_fee_deadline != #{time}
     </select>
 
+    <update id="updateItemStorageFeeDeadlineByPId">
+        UPDATE t_warehousebillsitems
+        SET f_storage_fee_deadline = #{time}
+        WHERE f_pid = #{pId}
+    </update>
+
 </mapper>