Quellcode durchsuchen

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

lazhaoqian vor 3 Jahren
Ursprung
Commit
a5ea5cac53

+ 15 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TEnclosure.java

@@ -26,6 +26,12 @@ public class TEnclosure extends BaseEntity {
     private Long fPid;
 
     /**
+     * 来源id
+     */
+    @Excel(name = "来源id")
+    private Long srcId;
+
+    /**
      * 行号
      */
     @Excel(name = "行号")
@@ -82,6 +88,14 @@ public class TEnclosure extends BaseEntity {
         return fPid;
     }
 
+    public void setSrcId(Long srcId) {
+        this.srcId = srcId;
+    }
+
+    public Long getSrcId() {
+        return srcId;
+    }
+
     public void setfLineno(Long fLineno) {
         this.fLineno = fLineno;
     }
@@ -143,6 +157,7 @@ public class TEnclosure extends BaseEntity {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                 .append("fId", getfId())
                 .append("fPid", getfPid())
+                .append("srcId", getSrcId())
                 .append("fLineno", getfLineno())
                 .append("fName", getfName())
                 .append("fDesc", getfDesc())

+ 22 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TEnclosureMapper.java

@@ -76,4 +76,26 @@ public interface TEnclosureMapper extends BaseMapper<TEnclosure> {
      * @return
      */
     public List<TEnclosure> selectTEnclosureByPId(Long fPid);
+
+    /**
+     *  根据主表id查询对应附件信息
+     * @param fPid
+     * @return
+     */
+    public List<String> selectUrlByPId(Long fPid);
+
+    /**
+     *  根据主表id查询对应附件信息
+     * @param fPid
+     * @return
+     */
+    public List<TEnclosure> selectTEnclosureListByPId(Long fPid);
+
+    /**
+     *  根据来源id查询对应附件信息
+     * @param srcId
+     * @return
+     */
+    public List<TEnclosure> selectTEnclosureListBySrcId(Long srcId);
+
 }

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

@@ -1748,12 +1748,17 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             tWarehousebillsitems.setUpdateBy(SecurityUtils.getUsername());
             tWarehousebillsitemsMapper.updateTWarehousebillsitems(tWarehousebillsitems);
         }
+
+        List<String> urlList = tEnclosureMapper.selectUrlByPId(tWarehousebillsitems.getfPid());
         tEnclosureMapper.deleteByFPid(tWarehousebillsitems.getfPid());
         if (StringUtils.isNotEmpty(attachs) && !"[]".equals(attachs)) {
             //  附件添加
             JSONArray jsonDrArray = JSONArray.parseArray(attachs);
             List<TEnclosure> tEnclosureList = JSONObject.parseArray(jsonDrArray.toJSONString(), TEnclosure.class);
             for (TEnclosure enclosure : tEnclosureList) {
+                if (!urlList.contains(enclosure.getfUrl())) {
+                    enclosure.setSrcId(tWarehousebillsitems.getfId());
+                }
                 enclosure.setfStatus("2");
                 enclosure.setCreateTime(new Date());
                 enclosure.setfPid(tWarehousebillsitems.getfPid());
@@ -2968,11 +2973,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         }
         map.put("item", itemMap);
         if (itemMap.containsKey("fPid") && StringUtils.isNotNull(itemMap.get("fPid"))) {
-            long fPid = Long.valueOf(String.valueOf(itemMap.get("fPid")));
+            long fPid = Long.parseLong(String.valueOf(itemMap.get("fPid")));
             TWarehouseBills tWarehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(fPid);
             map.put("warehouseBills", tWarehouseBills);
             // 查询附件
-            map.put("enclosure", tEnclosureMapper.selectTEnclosureByPId(tWarehouseBills.getfId()));
+            List<TEnclosure> tEnclosures = tEnclosureMapper.selectTEnclosureListByPId(tWarehouseBills.getfId());
+            tEnclosures.addAll(tEnclosureMapper.selectTEnclosureListBySrcId(fId));
+            map.put("enclosure", tEnclosures);
         }
         return AjaxResult.success(map);
     }
@@ -3088,7 +3095,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             }
         }
         tWarehousebillsitems.setfChargedate(time);//仓储费计算日期
-        if (StringUtils.isNull(warehousebillsitems) || warehousebillsitems.getfBillstatus() != 30L) {
+        if (warehousebillsitems.getfBillstatus() != 30L) {
             return AjaxResult.error("请确认是该明细数据是否存在,或该明细数据状态异常");
         }
         TGoods goods = tGoodsMapper.selectTGoodsById(warehousebillsitems.getfGoodsid());
@@ -3163,12 +3170,17 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             // 添加状态log
             insertTWarehousebillsLog(tWarehousebillsitems, 40L);
         }
+
+        List<String> urlList = tEnclosureMapper.selectUrlByPId(tWarehousebillsitems.getfPid());
         tEnclosureMapper.deleteByFPid(warehouseBills.getfId());
         //  附件添加
         if (StringUtils.isNotEmpty(attachs) && !"[]".equals(attachs)) {
             JSONArray jsonDrArray = JSONArray.parseArray(attachs);
             List<TEnclosure> tEnclosureList = JSONObject.parseArray(jsonDrArray.toJSONString(), TEnclosure.class);
             for (TEnclosure enclosure : tEnclosureList) {
+                if (!urlList.contains(enclosure.getfUrl())) {
+                    enclosure.setSrcId(tWarehousebillsitems.getfId());
+                }
                 enclosure.setfStatus("6");
                 enclosure.setCreateTime(new Date());
                 enclosure.setfPid(warehouseBills.getfId());
@@ -3233,12 +3245,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         TWarehouseBills bills = tWarehouseBillsMapper.selectTWarehousebillsById(warehousebillsitems.getfPid());
         if (tWarehousebillsitems.getBsdate() != null && "0".equals(bills.getfChargetype())) {
             boolean fchargedate = this.getFchargedate(warehousebillsitems.getfPid(), tWarehousebillsitems.getBsdate());
-            if (fchargedate == false) {
+            if (!fchargedate) {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error("入库日期不能小于最小仓储费计算日期");
             }
         }
-        Date time = new Date();
+        Date time;
         if (StringUtils.isNotEmpty(bills.getfChargetype()) && "0".equals(bills.getfChargetype())) {
             time = tWarehousebillsitemsMapper.selecMinBsDateByFPid(tWarehousebillsitems.getfPid());
             tWarehousebillsitems.setfChargedate(time);
@@ -3286,19 +3298,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         warehouseBills.setfNetweight(itemInFo.getfNetweight());
         warehouseBills.setfGrossweight(itemInFo.getfGrossweight());
         tWarehouseBillsMapper.updateTWarehousebills(warehouseBills);
-        tEnclosureMapper.deleteByFPid(warehouseBills.getfId());
-        //  附件添加
-        if (StringUtils.isNotEmpty(attachs) && !"[]".equals(attachs)) {
-            JSONArray jsonDrArray = JSONArray.parseArray(attachs);
-            List<TEnclosure> tEnclosureList = JSONObject.parseArray(jsonDrArray.toJSONString(), TEnclosure.class);
-            for (TEnclosure enclosure : tEnclosureList) {
-                enclosure.setfStatus("6");
-                enclosure.setCreateTime(new Date());
-                enclosure.setfPid(warehouseBills.getfId());
-                enclosure.setCreateBy(SecurityUtils.getUsername());
-                tEnclosureMapper.insertTEnclosure(enclosure);
-            }
-        }
         return AjaxResult.success();
     }
 
@@ -4506,25 +4505,26 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             storageFeesDto.setfGoodsid(fGoodsid);
             long fId = Long.parseLong(String.valueOf(item.get("fId")));
             // 累计计费天数
-            storageFeesDto.setEarlySumDays(DateUtils.getDateDay((Date) item.get("fChargedate"), (Date) item.get("fOriginalbilldate")));
+            storageFeesDto.setEarlySumDays(DateUtils.getDateDay((Date) item.get("fChargedate"), (Date) item.get("fOriginalbilldate")) - 1);
             // 库存天数
             long fInventoryDays;
             // 要计费天数
             long fBillingDays = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), (Date) item.get("fOriginalbilldate"));
             if ("SJCK".equals(fBilltype)) {
-                fInventoryDays = DateUtils.getDateDay(fBsdate, (Date) item.get("fChargedate"));
-                fBillingDays = DateUtils.getDateDay((Date) item.get("fChargedate"), (Date) item.get("fOriginalbilldate"));
+                fInventoryDays = DateUtils.getDateDay(fBsdate, (Date) item.get("fOriginalbilldate"));
+                fBillingDays = DateUtils.getDateDay(fBsdate, (Date) item.get("fChargedate"));
                 storageFeesDto.setStartTime((Date) item.get("fChargedate"));
                 storageFeesDto.setEndTime(fBsdate);
             } else if (WarehouseTypeEnum.HQZY.getType().equals(fBilltype)) {
-                fInventoryDays = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), fBsdate);
-                storageFeesDto.setStartTime(fBsdate);
-                storageFeesDto.setEndTime(warehouseBills.getfBillingDeadline());
+                fInventoryDays = DateUtils.getDateDay(fBsdate, (Date) item.get("fOriginalbilldate"));
+                fBillingDays = DateUtils.getDateDay(fBsdate, (Date) item.get("fChargedate"));
+                storageFeesDto.setStartTime((Date) item.get("fChargedate"));
+                storageFeesDto.setEndTime(fBsdate);
             } else {
-                storageFeesDto.setStartTime((Date) item.get("fOriginalbilldate"));
-                storageFeesDto.setEndTime(warehouseBills.getfBillingDeadline());
-                fBillingDays = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), (Date) item.get("fChargedate"));
                 fInventoryDays = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), (Date) item.get("fOriginalbilldate"));
+                fBillingDays = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), (Date) item.get("fChargedate"));
+                storageFeesDto.setStartTime((Date) item.get("fChargedate"));
+                storageFeesDto.setEndTime(warehouseBills.getfBillingDeadline());
             }
             if (fBillingDays <= 0) {
                 continue;
@@ -4533,7 +4533,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             storageFeesDto.setfMblno((String) item.get("fMblno"));
             // 赋值要计算的数量单位
             storageFeesDto.setfQty(new BigDecimal(String.valueOf(item.get("fQty"))));
-            storageFeesDto.setfVolumn(new BigDecimal(String.valueOf(item.get("fQty"))));
+            storageFeesDto.setfVolumn(new BigDecimal(String.valueOf(item.get("fVolumn"))));
             storageFeesDto.setfNetweight(new BigDecimal(String.valueOf(item.get("fNetweight"))));
             storageFeesDto.setfGrossweight(new BigDecimal(String.valueOf(item.get("fGrossweight"))));
             // 计算仓储费明细

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

@@ -753,8 +753,8 @@
             leg.f_corpid AS fCorpIds,
             corp.f_name AS fCorpid,
             leg.f_shipper AS fShipper,
-            <if test="isCntrno != null and isCntrno != 2 ">ware.f_warehouse_information AS fWarehouseids,</if>
-            <if test="isCntrno != null and isCntrno == 2 ">ware.f_name AS fWarehouseids,</if>
+            <if test="isCntrno != 2 ">ware.f_warehouse_information AS fWarehouseids,</if>
+            <if test="isCntrno == 2 ">ware.f_name AS fWarehouseids,</if>
             area.f_name AS fWarehouseLocationids,
             leg.f_originalbillno AS fOriginalbillno,
             leg.f_warehouse_locationid AS fWarehouseLocationid,
@@ -793,8 +793,8 @@
             LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
             LEFT JOIN t_customer_contact tc ON tc.f_pid = corp.f_id
             LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
-            <if test="isCntrno != null and isCntrno != 2 ">LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid</if>
-            <if test="isCntrno != null and isCntrno == 2 ">LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouseid</if>
+            <if test="isCntrno != 2 ">LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid</if>
+            <if test="isCntrno == 2 ">LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouseid</if>
             LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
             LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
             LEFT JOIN sys_dict_data dict1 ON dict1.dict_value = leg.f_trademodeid
@@ -843,10 +843,10 @@
             <if test="isCntrno == null">
                 GROUP BY leg.f_corpid, leg.f_originalbillno, leg.f_originalbilldate, leg.f_warehouse_locationid, leg.f_goodsid, leg.f_trademodeid
             </if>
-            <if test="isCntrno != null and isCntrno == 1 ">
+            <if test="isCntrno == 1 ">
                 GROUP BY leg.f_corpid, leg.f_originalbillno, leg.f_originalbilldate, leg.f_warehouse_locationid, leg.f_goodsid, leg.f_trademodeid,leg.f_cntrno
             </if>
-            <if test="isCntrno != null and isCntrno == 2 ">GROUP BY leg.f_corpid, leg.f_mblno, leg.f_goodsid, leg.f_warehouseid</if>
+            <if test="isCntrno == 2 ">GROUP BY leg.f_corpid, leg.f_mblno, leg.f_goodsid, leg.f_warehouseid</if>
         </where>
         ${params.dataScope}
         order by leg.f_bsdate desc

+ 20 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TEnclosureMapper.xml

@@ -7,6 +7,7 @@
     <resultMap type="TEnclosure" id="TEnclosureResult">
         <result property="fId" column="f_id"/>
         <result property="fPid" column="f_pid"/>
+        <result property="srcId" column="src_id"/>
         <result property="fLineno" column="f_lineno"/>
         <result property="fName" column="f_name"/>
         <result property="fDesc" column="f_desc"/>
@@ -22,13 +23,14 @@
     </resultMap>
 
     <sql id="selectTEnclosureVo">
-        select f_id, f_pid, f_lineno, f_name, f_desc, f_url, f_type, f_status, del_flag, create_by, create_time, update_by, update_time, remark from t_enclosure
+        select f_id, f_pid, src_id, f_lineno, f_name, f_desc, f_url, f_type, f_status, del_flag, create_by, create_time, update_by, update_time, remark from t_enclosure
     </sql>
 
     <select id="selectTEnclosureList" parameterType="TEnclosure" resultMap="TEnclosureResult">
         <include refid="selectTEnclosureVo"/>
         <where>
             <if test="fPid != null ">and f_pid = #{fPid}</if>
+            <if test="srcId != null ">and src_id = #{srcId}</if>
             <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
             <if test="fName != null  and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
             <if test="fDesc != null  and fDesc != ''">and f_desc = #{fDesc}</if>
@@ -58,6 +60,7 @@
         insert into t_enclosure
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="fPid != null">f_pid,</if>
+            <if test="srcId != null">src_id,</if>
             <if test="fLineno != null">f_lineno,</if>
             <if test="fName != null and fName != ''">f_name,</if>
             <if test="fDesc != null and fDesc != ''">f_desc,</if>
@@ -72,6 +75,7 @@
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="fPid != null">#{fPid},</if>
+            <if test="srcId != null">#{srcId},</if>
             <if test="fLineno != null">#{fLineno},</if>
             <if test="fName != null and fName != ''">#{fName},</if>
             <if test="fDesc != null and fDesc != ''">#{fDesc},</if>
@@ -90,6 +94,7 @@
         update t_enclosure
         <trim prefix="SET" suffixOverrides=",">
             <if test="fPid != null">f_pid = #{fPid},</if>
+            <if test="srcId != null">src_id = #{srcId},</if>
             <if test="fLineno != null">f_lineno = #{fLineno},</if>
             <if test="fName != null and fName != ''">f_name = #{fName},</if>
             <if test="fDesc != null and fDesc != ''">f_desc = #{fDesc},</if>
@@ -120,4 +125,18 @@
         </foreach>
     </delete>
 
+    <select id="selectUrlByPId" parameterType="long" resultType="string">
+        select f_url from t_enclosure where f_pid = #{fPid} and src_id is null
+    </select>
+
+    <select id="selectTEnclosureListByPId" parameterType="long" resultMap="TEnclosureResult">
+        <include refid="selectTEnclosureVo"/>
+        where f_pid = #{fPid} and src_id is null
+    </select>
+
+    <select id="selectTEnclosureListBySrcId" parameterType="long" resultMap="TEnclosureResult">
+        <include refid="selectTEnclosureVo"/>
+        where src_id = #{srcId}
+    </select>
+
 </mapper>

+ 7 - 3
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -1228,7 +1228,7 @@
             <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
             <if test="fMblno != null">f_mblno = #{fMblno},</if>
             <if test="fEmblno != null">f_emblno = #{fEmblno},</if>
-            <if test="fCompany != null">f_company = #{fCompany},</if>
+            f_company = #{fCompany},
             <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
             <if test="fEta != null">f_eta = #{fEta},</if>
             <if test="fMarks != null">f_marks = #{fMarks},</if>
@@ -1254,8 +1254,8 @@
             <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
             <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
             <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
-            <if test="fLabour != null">f_labour = #{fLabour},</if>
-            <if test="fFleet != null">f_fleet = #{fFleet},</if>
+            f_labour = #{fLabour},
+            f_fleet = #{fFleet},
             <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
             <if test="fBstime != null">f_bstime = #{fBstime},</if>
             <if test="fCartype != null">f_cartype = #{fCartype},</if>
@@ -2656,6 +2656,9 @@
             IFNULL(ROUND(w.f_grossweight/1000.3465,2),0) fGrossweight,
             t.f_grossweight fGrossweights,
             t.f_cntqty fCntqty,
+            fleet.f_name fleetName,
+            t.f_driver_name fDriverName,
+            t.f_driver_tel fDriverTel,
         CASE
 		    WHEN t.f_billstatus = '10' THEN
 		        '计划'
@@ -2669,6 +2672,7 @@
         FROM
             t_warehousebills w
             LEFT JOIN t_warehousebillsitems t ON t.f_pid = w.f_id
+            LEFT JOIN t_corps fleet ON fleet.f_id = t.f_fleet
             LEFT JOIN t_corps c ON c.f_id = w.f_corpid
             LEFT JOIN t_goods g ON g.f_id = t.f_goodsid
             LEFT JOIN t_cntr cntr ON cntr.f_id = t.f_cntrtype

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

@@ -727,22 +727,22 @@
             t.f_id fId,
             t.f_pid fPid,
             t.f_shipper fShipper,
-            t.f_bsdate bsdate,
+            t.f_bsdate fBsdate,
             corp.f_name corpName,
             t.f_mblno fMblno,
             stor.dict_label businessType,
-            t.f_marks marks,
-            t.f_labour labour,
+            t.f_marks fMarks,
+            t.f_labour fLabour,
             g.f_name goodsName,
             fleet.f_name fleetName,
-            t.f_warehouse_information warehouseInformation,
+            t.f_warehouse_information fWarehouseInformation,
             t.f_warehouselocid fWarehouselocid,
             t.f_forkliftman fForkliftman,
-            t.f_truckno truckno,
+            t.f_truckno fTruckno,
             cntr.f_name cntrtypes,
-            t.f_cntrtype cntrtype,
-            t.f_cntqty cntqty,
-            t.f_cntrno cntrno,
+            t.f_cntrtype fCntrtype,
+            t.f_cntqty fCntqty,
+            t.f_cntrno fCntrno,
             t.f_qty fQty,
             t.f_truckno fTruckno,
             t.f_driver_name fDriverName,