Selaa lähdekoodia

Merge remote-tracking branch 'origin/CangKu' into dev

zouzhuo 3 vuotta sitten
vanhempi
commit
34edb3bb45

+ 14 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseAgreement.java

@@ -137,6 +137,20 @@ public class TWarehouseAgreement extends BaseEntity {
     @Excel(name = "类型名称")
     private String fBilltypeName;
 
+    /**
+     * 仓库
+     */
+    @Excel(name = "仓库")
+    private String fWarehouseid;
+
+    public String getfWarehouseid() {
+        return fWarehouseid;
+    }
+
+    public void setfWarehouseid(String fWarehouseid) {
+        this.fWarehouseid = fWarehouseid;
+    }
+
     public String getfBilltypeName() {
         return fBilltypeName;
     }

+ 3 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseAgreementitemsMapper.java

@@ -76,7 +76,9 @@ public interface TWarehouseAgreementitemsMapper {
      */
     List<TWarehouseAgreementitems> getItemsBytWarehouseAgreementMsg(@Param("fCorpid") Long fCorpid,
                                                                     @Param("fGoodsid") String fGoodsid,
-                                                                    @Param("feeUnitid") Long feeUnitid);
+                                                                    @Param("feeUnitid") Long feeUnitid,
+                                                                    @Param("cangKuZhi") String cangKuZhi,
+                                                                    @Param("cangKey") String cangKey);
 
     /**
      *  根据主表id 更新主表对应状态

+ 10 - 6
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java

@@ -138,7 +138,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
             }
         }
         map.put("corps", corpsList);
-       // map.put("goodsList", goodsList);
+        // map.put("goodsList", goodsList);
         map.put("feesList", feesList);
         map.put("tWarehouseAgreementitems", tWarehouseAgreementitemss);
         map.put("dept", sysDeptMapper.selectDeptById(tWarehouseAgreement.getfDeptid()));
@@ -440,7 +440,9 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
      * @param feeUnitid    计价单位
      * @param itemNums     数量
      * @param earlySumDays 已经计算过仓储费的天数(假设传参80,则阶梯计价时按照80往后的计算)  21.01.14 曹志刚要求新增
-     * @return
+     * @param cangKey      是否需要校验仓库
+     * @param warehouseId  仓库id
+     * @return  结果
      * @author shanxin
      */
     public Map<String, Object> getCarryingCost(Long fCorpid,
@@ -448,19 +450,21 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
                                                Long days,
                                                Long feeUnitid,
                                                BigDecimal itemNums,
-                                               Long earlySumDays) {
+                                               Long earlySumDays,
+                                               String cangKey,
+                                               String warehouseId) {
         Map<String, Object> map = new HashMap<>();
         if (null == fCorpid ||
                 null == fGoodsid ||
                 null == days ||
                 null == feeUnitid ||
                 null == itemNums ||
-                null == earlySumDays) {
+                null == earlySumDays ||
+                null == cangKey) {
             return null;
         }
         List<TWarehouseAgreementitems> itemList =
-                this.tWarehouseAgreementitemsMapper.getItemsBytWarehouseAgreementMsg(fCorpid, fGoodsid, feeUnitid);
-
+                this.tWarehouseAgreementitemsMapper.getItemsBytWarehouseAgreementMsg(fCorpid, fGoodsid, feeUnitid, warehouseId, cangKey);
         if (CollUtil.isEmpty(itemList)) {
             return null;
         }

+ 25 - 11
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -41,6 +41,8 @@ import com.ruoyi.shipping.mapper.*;
 import com.ruoyi.system.domain.SysCheckCode;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.mapper.*;
+import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.system.service.impl.SysConfigServiceImpl;
 import com.ruoyi.warehouseBusiness.domain.*;
 import com.ruoyi.warehouseBusiness.excel.*;
 import com.ruoyi.warehouseBusiness.mapper.*;
@@ -129,6 +131,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     private SysDictDataMapper sysDictDataMapper;
 
     @Autowired
+    private ISysConfigService sysConfigService;
+
+    @Autowired
+    private SysConfigServiceImpl sysConfigServiceImpl;
+
+    @Autowired
     private AuditItemsServiceImpl auditItemsService;
 
     @Autowired
@@ -3963,9 +3971,10 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      * @param warehouseBills
      * @param mapItem
      * @param loginUser
+     * @param cangKey
      * @return
      */
-    public Map<String, Object> getWarehouseItems(TWarehouseBills warehouseBills, List<Map<String, Object>> mapItem, LoginUser loginUser) {
+    public Map<String, Object> getWarehouseItems(TWarehouseBills warehouseBills, List<Map<String, Object>> mapItem, LoginUser loginUser, String cangKey) {
         Map<String, Object> map = new HashMap<>();
         long feeId = 0L;
         BigDecimal sumAmt = new BigDecimal(0);
@@ -3979,6 +3988,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             Date fBsdate = (Date) item.get("fBsdate");
             long fCorpid = warehouseBills.getfCorpid();
             String fBilltype = (String) item.get("fBilltype");
+            String warehouseId = item.get("warehouse").toString();
             String fGoodsid = (String) item.get("fTypeid");
             if (StringUtils.isNotEmpty(fGoodsid)) {
                 fGoodsid = "\"" + fGoodsid + "\"";
@@ -4009,8 +4019,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error("单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到计费单位,请确认");
             }
-            // 计算仓储费明细
-            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, fBillingDays, dictLabel, fQty, accumulatedDays);
+            // 仓储费协议计算
+            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, fBillingDays, dictLabel, fQty, accumulatedDays, cangKey, warehouseId);
             if (StringUtils.isNull(objectMap)) {
                 map.put("error", "单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到仓储费协议,请确认");
                 return map;
@@ -4076,7 +4086,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      * @param loginUser
      * @return
      */
-    public Map<String, Object> getWarehouseItemsList(TWarehouseBills warehouseBills, List<Map<String, Object>> mapItem, LoginUser loginUser) {
+    public Map<String, Object> getWarehouseItemsList(TWarehouseBills warehouseBills, List<Map<String, Object>> mapItem, LoginUser loginUser, String warehouse) {
         Map<String, Object> map = new HashMap<>();
         long feeId = 0L;
         BigDecimal sumAmt = new BigDecimal(0);
@@ -4091,6 +4101,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             long fCorpid = warehouseBills.getfCorpid();
             String fBilltype = (String) item.get("fBilltype");
             String fGoodsid = (String) item.get("fTypeid");
+            String warehouseId = (String) item.get("warehouse");
             if (StringUtils.isNotEmpty(fGoodsid)) {
                 fGoodsid = "\"" + fGoodsid + "\"";
             }
@@ -4121,7 +4132,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 return AjaxResult.error("单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到计费单位,请确认");
             }
             // 计算仓储费明细
-            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, fBillingDays, dictLabel, fQty, accumulatedDays);
+            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, fBillingDays, dictLabel, fQty, accumulatedDays, warehouse, warehouseId);
             if (StringUtils.isNull(objectMap)) {
                 map.put("error", "单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到仓储费协议,请确认");
                 return map;
@@ -4224,6 +4235,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         List<TWarehousebillsfees> itemsList = new ArrayList<>();
         BigDecimal bigDecimal = new BigDecimal(0);
         Map<String, Object> map = new HashMap<>();
+        //调一次公共方法,获取字符类型的true或者false传
+        String cangKey = sysConfigServiceImpl.selectConfigByKey("agreement.warehouse");
         // 库存总账id
         long whgenlegFeeId = 0;
         // 计费单位
@@ -4231,7 +4244,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         // 查询 出库 货转的库存明细
         List<Map<String, Object>> warehousebillsitemsList = tWarehousebillsitemsMapper.selectStorageFeeItemList(tWarehouseBills);
         if (warehousebillsitemsList.size() != 0) {
-            Map<String, Object> mapItem = getWarehouseItems(tWarehouseBills, warehousebillsitemsList, loginUser);
+            Map<String, Object> mapItem = getWarehouseItems(tWarehouseBills, warehousebillsitemsList, loginUser, cangKey);
             if (mapItem.containsKey("error")) {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error((String) mapItem.get("error"));
@@ -4240,7 +4253,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         }
         List<Map<String, Object>> tWhgenlegs = tWhgenlegMapper.selectStorageFeeItemList(tWarehouseBills);
         if (tWhgenlegs.size() != 0) {
-            Map<String, Object> mapItem = getWarehouseItems(tWarehouseBills, tWhgenlegs, loginUser);
+            Map<String, Object> mapItem = getWarehouseItems(tWarehouseBills, tWhgenlegs, loginUser, cangKey);
             if (mapItem.containsKey("error")) {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error((String) mapItem.get("error"));
@@ -4309,8 +4322,9 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             long feeUnitid = 1;
             // 查询 出库 货转的库存明细
             List<Map<String, Object>> warehousebillsitemsList = tWarehousebillsitemsMapper.selectStorageFeeItemList(tWarehouseBills);
+            String cangKey = sysConfigServiceImpl.selectConfigByKey("agreement.warehouse");
             if (warehousebillsitemsList.size() != 0) {
-                Map<String, Object> mapItem = getWarehouseItemsList(tWarehouseBills, warehousebillsitemsList, loginUser);
+                Map<String, Object> mapItem = getWarehouseItemsList(tWarehouseBills, warehousebillsitemsList, loginUser, cangKey);
                 if (mapItem.containsKey("error")) {
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     return AjaxResult.error((String) mapItem.get("error"));
@@ -6449,12 +6463,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         TWarehousebillsCntr warehousebillsCntr = tWarehousebillsCntrMapper.selectTWarehousebillsCntrByPId(selectOne.getfId());
         warehousebillsCntr.setUpdateBy(SecurityUtils.getUsername());
         warehousebillsCntr.setUpdateTime(new Date());
-        warehousebillsCntr.setfCntrcount(warehousebillsCntr.getfCntrcount()-number);
+        warehousebillsCntr.setfCntrcount(warehousebillsCntr.getfCntrcount() - number);
         tWarehousebillsCntrMapper.updateTWarehousebillsCntr(warehousebillsCntr);
         //修改箱信息
-        if (CollectionUtils.isNotEmpty(tWarehousebillsCntritemsList)){
+        if (CollectionUtils.isNotEmpty(tWarehousebillsCntritemsList)) {
             for (TWarehousebillsCntritems warehousebillsCntritems : tWarehousebillsCntritemsList) {
-                tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemOlder(selectOne.getfId(),warehousebillsCntritems.getfCntrno());
+                tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemOlder(selectOne.getfId(), warehousebillsCntritems.getfCntrno());
             }
         }*/
         if (isApprove) {

+ 1 - 0
ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml

@@ -458,6 +458,7 @@
             wh.f_qtyblc AS fQty,
             wh.f_grossweightblc AS fGrossweight,
             wh.f_netweightblc AS fNetweight,
+            wh.f_warehouseid AS warehouse,
             "KCZZ" AS fBilltype,
             goods.f_typeid AS fTypeid,
             goods.f_name AS fGoodsids

+ 6 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehouseAgreementMapper.xml

@@ -30,6 +30,7 @@
         <result property="fDc" column="f_dc"/>
         <result property="fBilltype" column="f_billtype"/>
         <result property="fBilltypeName" column="f_billtype_name"/>
+        <result property="fWarehouseid" column="f_warehouseid"/>
     </resultMap>
 
     <sql id="selectTWarehouseAgreementVo">
@@ -57,7 +58,8 @@
                f_task_type,
                f_dc,
                f_billtype,
-               f_billtype_name
+               f_billtype_name,
+               f_warehouseid
         from t_warehouse_agreement
     </sql>
 
@@ -150,6 +152,7 @@
             <if test="fStltypeid != null">f_stltypeid,</if>
             <if test="fFeetypeid != null">f_feetypeid,</if>
             <if test="tPackages != null">t_packages,</if>
+            <if test="fWarehouseid != null">f_warehouseid,</if>
             <if test="fTrademodeid != null">f_trademodeid,</if>
             <if test="fFreedays != null">f_freedays,</if>
             <if test="fBegindate != null">f_begindate,</if>
@@ -176,6 +179,7 @@
             <if test="fStltypeid != null">#{fStltypeid},</if>
             <if test="fFeetypeid != null">#{fFeetypeid},</if>
             <if test="tPackages != null">#{tPackages},</if>
+            <if test="fWarehouseid != null">#{fWarehouseid},</if>
             <if test="fTrademodeid != null">#{fTrademodeid},</if>
             <if test="fFreedays != null">#{fFreedays},</if>
             <if test="fBegindate != null">#{fBegindate},</if>
@@ -206,6 +210,7 @@
             <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
             <if test="fFeetypeid != null">f_feetypeid = #{fFeetypeid},</if>
             <if test="tPackages != null">t_packages = #{tPackages},</if>
+            <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
             <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
             <if test="fFreedays != null">f_freedays = #{fFreedays},</if>
             <if test="fBegindate != null">f_begindate = #{fBegindate},</if>

+ 6 - 3
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehouseAgreementitemsMapper.xml

@@ -100,18 +100,21 @@
             items.create_time,
             items.update_by,
             items.update_time,
-            items.remark
+            items.remark,
+            agreement.f_warehouseid
         FROM
             t_warehouse_agreement AS agreement
             LEFT JOIN t_warehouse_agreementitems AS items ON agreement.f_id = items.f_pid
-        WHERE
-            agreement.f_corpid = #{fCorpid}
+        <where>
+            <if test="cangKey == '0'">AND JSON_CONTAINS( agreement.f_warehouseid -> '$[*]', #{cangKuZhi}, '$')</if>
+            AND agreement.f_corpid = #{fCorpid}
             AND JSON_CONTAINS( agreement.t_packages -> '$[*]', #{fGoodsid}, '$')
             AND items.f_feeUnitid = #{feeUnitid}
             AND agreement.f_status = '0'
             AND agreement.del_flag = '0'
             AND agreement.f_feetypeid = '0'
             AND items.del_flag = '0'
+        </where>
         ORDER BY
             items.f_fromdays
     </select>

+ 1 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsMapper.xml

@@ -445,6 +445,7 @@
     <select id="selectStorageFeeItemList" parameterType="com.ruoyi.warehouseBusiness.domain.TWarehouseBills"
             resultType="Map">
         SELECT
+            ware.f_warehouseid AS warehouse,
             item.f_id AS fId,
             item.f_billno AS fBillno,
             item.f_goodsid AS fGoodsid,