Jelajahi Sumber

凯和航次运价修改

lazhaoqian 4 tahun lalu
induk
melakukan
b263870283

+ 22 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/controller/KHUpdateOrderMessage.java

@@ -65,12 +65,12 @@ public class KHUpdateOrderMessage extends BaseController {
     }
 
     /**
-     * 凯和导出清
+     * 凯和公司端导出订
      * 船名,航次必填
      * @param tWarehouseBills
      * @return
      */
-    @Log(title = "凯和导出清单", businessType = BusinessType.EXPORT)
+    @Log(title = "凯和公司端导出订单", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult exportInventory(TWarehouseBills tWarehouseBills)
     {
@@ -127,6 +127,26 @@ public class KHUpdateOrderMessage extends BaseController {
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tWarehousebillsService.updateBoxMessage(tCntrno,loginUser);
     }
+    /**
+     * 凯和商务端导出订单
+     * 船名,航次必填
+     * @param tWarehouseBills
+     * @return
+     */
+    @Log(title = "凯和商务端导出订单", businessType = BusinessType.EXPORT)
+    @GetMapping("/exportOrderMessage")
+    public AjaxResult exportOrderMessage(TWarehouseBills tWarehouseBills)
+    {
+        if (tWarehouseBills.getfVoyid() == null){
+            return AjaxResult.error("航次不能为空");
+        }
+        if (tWarehouseBills.getfVslid() == null){
+            return AjaxResult.error("船名不能为空");
+        }
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        tWarehouseBills.setCreateBy(loginUser.getUser().getUserName());
+        return tWarehousebillsService.exportInventory(tWarehouseBills);
+    }
 
 }
 

+ 15 - 9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/controller/TVoyageController.java

@@ -7,14 +7,7 @@ import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.utils.StringUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -157,7 +150,7 @@ public class TVoyageController extends BaseController
     public TableDataInfo freightList(TVoyage tVoyage)
     {
         startPage();
-        List<TVoyage> list = tVoyageService.freightList(tVoyage);
+        List<TVoyage> list = tVoyageService.createOrder(tVoyage);
         return getDataTable(list);
     }
 
@@ -196,4 +189,17 @@ public class TVoyageController extends BaseController
         List<TVoyage> list = tVoyageService.selectMessage(tVoyage);
         return getDataTable(list);
     }
+    @Log(title = "新增航次运价", businessType = BusinessType.INSERT)
+    @PostMapping("/insertMessage")
+    public AjaxResult insertMessage(@RequestParam String tVoyage,
+                          @RequestParam String tCtnpriceItems)
+    {
+        if (StringUtils.isEmpty(tVoyage)|| "[]".equals(tVoyage)){
+            return AjaxResult.error("未找到航次信息,请确认");
+        }
+        if (StringUtils.isEmpty(tCtnpriceItems) || "[]".equals(tCtnpriceItems)){
+            return AjaxResult.error("未找到运价信息,请确认");
+        }
+        return tVoyageService.insertMessage(tVoyage,tCtnpriceItems);
+    }
 }

+ 13 - 1
ruoyi-shipping/src/main/java/com/ruoyi/shipping/domain/TCtnpriceItems.java

@@ -34,6 +34,9 @@ public class TCtnpriceItems extends BaseEntity
     /** 单价 */
     @Excel(name = "单价")
     private BigDecimal fPrice;
+    /** 航期 */
+    @Excel(name = "航期")
+    private String fDates;
 
     /** 默认 T ,正常T 停用F 下拉选择 */
     @Excel(name = "默认 T ,正常T 停用F 下拉选择")
@@ -52,6 +55,14 @@ public class TCtnpriceItems extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date fEtd;
 
+    public String getfDates() {
+        return fDates;
+    }
+
+    public void setfDates(String fDates) {
+        this.fDates = fDates;
+    }
+
     public Long getfPortoftransshipment() {
         return fPortoftransshipment;
     }
@@ -159,6 +170,7 @@ public class TCtnpriceItems extends BaseEntity
             .append("updateBy", getUpdateBy())
             .append("updateTime", getUpdateTime())
             .append("remark", getRemark())
-            .toString();
+            .append("fDates", getfDates())
+                .toString();
     }
 }

+ 10 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/domain/TVoyage.java

@@ -126,6 +126,16 @@ public class TVoyage extends BaseEntity
     private Long empty;
     //航线名称
     private String fLaneName;
+    //运价信息
+    private List<TCtnpriceItems> tCtnpriceItemsList;
+
+    public List<TCtnpriceItems> gettCtnpriceItemsList() {
+        return tCtnpriceItemsList;
+    }
+
+    public void settCtnpriceItemsList(List<TCtnpriceItems> tCtnpriceItemsList) {
+        this.tCtnpriceItemsList = tCtnpriceItemsList;
+    }
 
     public String getfLaneName() {
         return fLaneName;

+ 9 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/mapper/TCtnpriceItemsMapper.java

@@ -112,4 +112,13 @@ public interface TCtnpriceItemsMapper
      */
     public List<TCtnpriceItems> selectItemMeaasge(@Param("fPid") Long fPid,
             @Param("fCntrid") Long fCntrid);
+
+    /**
+     * 根据航次 获取所有航次中对应箱型的最低价
+     * @param fPid
+     * @param fNo
+     * @return
+     */
+    public String selectMinMoney(@Param("fNo") String fNo,
+                                 @Param("fPid") List<Long> fPid);
 }

+ 32 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/mapper/TVoyageMapper.java

@@ -1,9 +1,12 @@
 package com.ruoyi.shipping.mapper;
 
+import java.util.Date;
 import java.util.List;
+import java.util.LongSummaryStatistics;
 import java.util.Map;
 
 import com.ruoyi.shipping.domain.TVoyage;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 航次Mapper接口
@@ -87,4 +90,33 @@ public interface TVoyageMapper
      * @return
      */
     public List<Map<String, Object>> selectTVoyagefNumber(TVoyage tVoyage);
+
+    /**
+     * 判断航次是否重复
+     * @param fNo 航次编号
+     * @param fPortofloadid 起运港
+     * @param fDistinationid 目的港
+     * @param fPortoftransshipment 中转港
+     * @param fEtd 预计开船日期
+     * @return
+     */
+    public List<TVoyage> selectTVoyageMessage(@Param("fNo") String fNo,
+                                              @Param("fPortofloadid") Long fPortofloadid,
+                                              @Param("fDistinationid") Long fDistinationid,
+                                              @Param("fPortoftransshipment") Long fPortoftransshipment,
+                                              @Param("fEtd") Date fEtd);
+
+    /**
+     * 获取对应起运港 中转港 目的港的航次ID
+     * @param tVoyage
+     * @return
+     */
+    public List<Long> selectTVoyageIds(TVoyage tVoyage);
+
+    /**
+     * 获取每个航次对应的箱型的运价
+     * @param fId
+     * @return
+     */
+    public TVoyage selectTVoyageByFid(Long fId);
 }

+ 16 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/ITVoyageService.java

@@ -3,6 +3,7 @@ package com.ruoyi.shipping.service;
 import java.util.List;
 import java.util.Map;
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.shipping.domain.TVoyage;
 
 /**
@@ -92,4 +93,19 @@ public interface ITVoyageService
      * @return 航次集合
      */
     public List<TVoyage> selectMessage(TVoyage tVoyage);
+
+    /**
+     * 新增航次运价信息
+     * @param tVoyage 航次信息
+     * @param tCtnpriceItems 运价信息
+     * @return
+     */
+    public AjaxResult insertMessage (String tVoyage,String tCtnpriceItems);
+    /**
+     * 商务端船期查询
+     *
+     * @param tVoyage 航次
+     * @return 航次集合
+     */
+    public List<TVoyage> createOrder(TVoyage tVoyage);
 }

+ 136 - 2
ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/impl/TVoyageServiceImpl.java

@@ -3,11 +3,18 @@ package com.ruoyi.shipping.service.impl;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.shipping.domain.TCntr;
+import com.ruoyi.shipping.domain.TCtnprice;
+import com.ruoyi.shipping.domain.TCtnpriceItems;
+import com.ruoyi.shipping.mapper.TCntrMapper;
 import com.ruoyi.shipping.mapper.TCtnpriceItemsMapper;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,6 +22,8 @@ import org.springframework.stereotype.Service;
 import com.ruoyi.shipping.mapper.TVoyageMapper;
 import com.ruoyi.shipping.domain.TVoyage;
 import com.ruoyi.shipping.service.ITVoyageService;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 /**
  * 航次Service业务层处理
@@ -29,6 +38,8 @@ public class TVoyageServiceImpl implements ITVoyageService
     private TVoyageMapper tVoyageMapper;
     @Autowired
     private TCtnpriceItemsMapper tCtnpriceItemsMapper;
+    @Autowired
+    private TCntrMapper tCntrMapper;
 
     /**
      * 查询航次
@@ -39,7 +50,12 @@ public class TVoyageServiceImpl implements ITVoyageService
     @Override
     public TVoyage selectTVoyageById(Long fId)
     {
-        return tVoyageMapper.selectTVoyageById(fId);
+        TVoyage voyage = tVoyageMapper.selectTVoyageById(fId);//航次信息
+        TCtnpriceItems tCtnpriceItems = new TCtnpriceItems();
+        tCtnpriceItems.setfPid(fId);
+        List<TCtnpriceItems> ctnpriceItems = tCtnpriceItemsMapper.selectTCtnpriceItemsList(tCtnpriceItems);
+        voyage.settCtnpriceItemsList(ctnpriceItems);
+        return voyage;
     }
 
     /**
@@ -261,6 +277,124 @@ public class TVoyageServiceImpl implements ITVoyageService
 
     @Override
     public List<TVoyage> selectMessage(TVoyage tVoyage) {
-        return tVoyageMapper.selectMessage(tVoyage);
+        List<TVoyage> tVoyages = new ArrayList<>();
+        List<TVoyage> voyages = tVoyageMapper.selectMessage(tVoyage);
+        if (CollectionUtils.isNotEmpty(voyages)){
+            for (TVoyage voyage : voyages) {
+                TVoyage tVoyageByFid = tVoyageMapper.selectTVoyageByFid(voyage.getfId());
+                tVoyages.add(tVoyageByFid);
+            }
+        }
+        return tVoyages;
+    }
+
+    @Override
+    @Transactional
+    public AjaxResult insertMessage(String tVoyage, String tCtnpriceItems) {
+        TVoyage voyage = JSONArray.parseObject(tVoyage, TVoyage.class);
+        if (StringUtils.isEmpty(voyage.getfNo())){
+            return AjaxResult.error("航次不能为空");
+        }
+        if (voyage.getfPortofloadid() == null){
+            return AjaxResult.error("装货港不能为空");
+        }
+        /*if (tVoyage.getfPortofdischargeid() == null){
+            return AjaxResult.error("卸货港不能为空");
+        }*/
+        if (voyage.getfDistinationid() == null){
+            return AjaxResult.error("目的港不能为空");
+        }
+        if (voyage.getfEtd() == null){
+            return AjaxResult.error("预计开船日期不能为空");
+        }
+        if (voyage.getfEta() == null){
+            return AjaxResult.error("预计到达日期不能为空");
+        }
+        if (voyage.getfDucomentrayoffdate() == null){
+            return AjaxResult.error("截单日期不能为空");
+        }
+        if (StringUtils.isEmpty(voyage.getfTel())){
+            return AjaxResult.error("电话不能为空");
+        }
+        long dateDay = DateUtils.getDateDay(voyage.getfEta(),voyage.getfEtd());
+        voyage.setfDays(dateDay);
+        if (voyage.getfId() == null){
+            //航次 起运港 目的港 中转港 预计开船日期不能重复
+            List<TVoyage> tVoyages = tVoyageMapper.selectTVoyageMessage(voyage.getfNo(), voyage.getfPortofloadid(), voyage.getfDistinationid(),
+                    voyage.getfPortoftransshipment(), voyage.getfEtd());
+            if (CollectionUtils.isNotEmpty(tVoyages)){
+                return AjaxResult.error("航次信息重复");
+            }
+            voyage.setCreateTime(DateUtils.getNowDate());
+            voyage.setCreateBy(SecurityUtils.getUsername());
+            tVoyageMapper.insertTVoyage(voyage);
+        }else {
+            voyage.setUpdateTime(DateUtils.getNowDate());
+            voyage.setUpdateBy(SecurityUtils.getUsername());
+            tVoyageMapper.updateTVoyage(voyage);
+        }
+        //tCtnpriceItemsMapper.deleteTCtnpriceItemsByfPid(voyage.getfId());
+        JSONArray warehouseJSON = JSONArray.parseArray(tCtnpriceItems);
+        List<TCtnpriceItems> ctnpriceItems = JSONObject.parseArray(warehouseJSON.toJSONString(), TCtnpriceItems.class);
+        if (CollectionUtils.isNotEmpty(ctnpriceItems)){
+            for (TCtnpriceItems ctnpriceItem : ctnpriceItems) {
+                if (ctnpriceItem.getfCntrid() == null){
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("集装箱类型不能为空");
+                }
+                if (ctnpriceItem.getfPrice() == null){
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("单价不能为空");
+                }
+                if (ctnpriceItem.getfId() == null){
+                    List<TCtnpriceItems> ctnpriceItemsList = tCtnpriceItemsMapper.selectItemMeaasge(voyage.getfId(), ctnpriceItem.getfCntrid());
+                    if (CollectionUtils.isNotEmpty(ctnpriceItemsList)){
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        TCntr cntr = tCntrMapper.selectTCntrById(ctnpriceItem.getfCntrid());
+                        return AjaxResult.error("运价中集装箱编号"+cntr.getfNo()+"重复,请确认");
+                    }
+                    ctnpriceItem.setfPid(voyage.getfId());
+                    ctnpriceItem.setCreateTime(DateUtils.getNowDate());
+                    ctnpriceItem.setCreateBy(SecurityUtils.getUsername());
+                    int items = tCtnpriceItemsMapper.insertTCtnpriceItems(ctnpriceItem);
+                }else {
+                    ctnpriceItem.setfPid(voyage.getfId());
+                    ctnpriceItem.setUpdateTime(DateUtils.getNowDate());
+                    ctnpriceItem.setUpdateBy(SecurityUtils.getUsername());
+                    int items = tCtnpriceItemsMapper.updateTCtnpriceItems(ctnpriceItem);
+                }
+            }
+        }
+        return AjaxResult.success();
+    }
+
+    @Override
+    public List<TVoyage> createOrder(TVoyage tVoyage) {
+        //查询所有的航次 然后按 起运港 中转港 目的港 去重
+        List<TVoyage> tVoyages = new ArrayList<>();
+        tVoyages = tVoyageMapper.selectTVoyageListNew(tVoyage);
+        tVoyages = tVoyages.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(TVoyage -> TVoyage.getfPortofloadid() + ";"+ TVoyage.getfDistinationid()+ ";"+ TVoyage.getfPortoftransshipment()))), ArrayList::new));
+        if (CollectionUtils.isNotEmpty(tVoyages)){
+            for (TVoyage voyage : tVoyages) {
+                //然后根据 起运港 中转港  目的港 获取所有的航次ID
+                List<Long> longs = tVoyageMapper.selectTVoyageIds(voyage);
+                //然后根据航次ID去运价详情表中获取对应箱型的最低价
+               if (CollectionUtils.isNotEmpty(longs)){
+                   voyage.setTwenty(tCtnpriceItemsMapper.selectMinMoney("20GP",longs));
+                   voyage.setFortyHc(tCtnpriceItemsMapper.selectMinMoney("40HC",longs));
+                   voyage.setFortyRh(tCtnpriceItemsMapper.selectMinMoney("40RH",longs));
+                   List<TVoyage> freightselect = new ArrayList<>();
+                   //然后根据 所有的航次ID 获取对应的航次信息以及对应箱型的价格
+                   for (Long aLong : longs) {
+                       TVoyage tVoyageByFid = tVoyageMapper.selectTVoyageByFid(aLong);
+                       if (tVoyageByFid != null){
+                           freightselect.add(tVoyageByFid);
+                       }
+                   }
+                   voyage.setFreight(freightselect);
+               }
+            }
+        }
+        return tVoyages;
     }
 }

+ 1 - 1
ruoyi-shipping/src/main/resources/mapper/shipping/TCntrnoMapper.xml

@@ -213,7 +213,7 @@
         tc.f_no,
         tc.f_typeid,
         tc.f_sealno,
-        t.f_name typeidName,
+        t.f_no typeidName,
 		t.f_cntrsize cntrsize,
 		prs.dict_label cntrsizeName,
         tc.f_owner,

+ 24 - 7
ruoyi-shipping/src/main/resources/mapper/shipping/TCtnpriceItemsMapper.xml

@@ -15,6 +15,7 @@
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
         <result property="remark" column="remark"/>
+        <result property="fDates"    column="f_dates"    />
     </resultMap>
 
     <sql id="selectTCtnpriceItemsVo">
@@ -27,7 +28,8 @@
                create_time,
                update_by,
                update_time,
-               remark
+               remark,
+               f_dates
         from t_ctnprice_items
     </sql>
 
@@ -38,15 +40,13 @@
         ti.f_cntrid,
         tc.f_no cntridName,
         ti.f_price,
-        CASE
-        WHEN ti.f_status = 'T' THEN
-        '正常' ELSE '停用'
-        END AS f_status,
+        ti.f_status,
         ti.create_by,
         ti.create_time,
         ti.update_by,
         ti.update_time,
-        ti.remark
+        ti.remark,
+        ti.f_dates
         FROM
         t_ctnprice_items ti
         LEFT JOIN t_cntr tc ON ti.f_cntrid = tc.f_id
@@ -81,6 +81,7 @@
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
+            <if test="fDates != null">f_dates,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="fPid != null">#{fPid},</if>
@@ -92,6 +93,7 @@
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
+            <if test="fDates != null">#{fDates},</if>
         </trim>
     </insert>
 
@@ -107,6 +109,7 @@
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="remark != null">remark = #{remark},</if>
+            <if test="fDates != null">f_dates = #{fDates},</if>
         </trim>
         where f_id = #{fId}
     </update>
@@ -186,10 +189,24 @@
                create_time,
                update_by,
                update_time,
-               remark
+               remark,
+               f_dates
         from t_ctnprice_items
         where f_pid = #{fPid}
           AND f_cntrid = #{fCntrid}
+          AND f_status = 'T'
+    </select>
+    <select id="selectMinMoney" resultType="string">
+        SELECT IFNULL(min(ti.f_price), 0) price
+        FROM t_ctnprice_items ti
+        LEFT JOIN t_cntr tr ON ti.f_cntrid = tr.f_id
+        WHERE
+        tr.f_no = #{fNo}
+        AND ti.f_status = 'T'
+        AND ti.f_pid in
+        <foreach item="item" collection="fPid" open="(" separator="," close=")">
+            #{item}
+        </foreach>
     </select>
 
 </mapper>

+ 94 - 5
ruoyi-shipping/src/main/resources/mapper/shipping/TVoyageMapper.xml

@@ -312,11 +312,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             tv.f_manageid,
             su.user_name manageidName,
             tv.f_tel,
-            CASE
-
-                WHEN tv.f_status = 'T' THEN
-                    '正常' ELSE '停用'
-                END AS f_status,
+            tv.f_status,
             TIMESTAMPDIFF(
                     DAY,
                     tv.f_ETD,
@@ -471,5 +467,98 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="fStatus != null  and fStatus != ''"> and f_status = #{fStatus}</if>
         <if test="fLaneid != null "> and f_laneid = #{fLaneid}</if>
     </select>
+    <!--查询航次信息是否重复-->
+    <select id="selectTVoyageMessage" parameterType="Long" resultMap="TVoyageResult">
+        <include refid="selectTVoyageVo"/>
+        where f_no = #{fNo}
+        and f_portofloadid = #{fPortofloadid}
+        and f_distinationid = #{fDistinationid}
+        and f_ETD = #{fEtd}
+        <if test="fPortoftransshipment != null "> and f_portoftransshipment = #{fPortoftransshipment}</if>
+        <if test="fPortoftransshipment == null "> and f_portoftransshipment IS NULL</if>
+    </select>
+    <select id="selectTVoyageIds" parameterType="TVoyage" resultType="long">
+        SELECT
+        tv.f_id
+        FROM
+        t_voyage tv
+        <where>
+            tv.f_status = 'T'
+            AND (date(tv.f_ATD) >= DATE_SUB(CURDATE(), INTERVAL 2 DAY)
+            OR tv.f_ATD IS NULL)
+            <if test="fPortofloadid != null "> and tv.f_portofloadid = #{fPortofloadid}</if>
+            <if test="fDistinationid != null "> and tv.f_distinationid = #{fDistinationid}</if>
+            <if test="fPortoftransshipment != null "> and tv.f_portoftransshipment = #{fPortoftransshipment}</if>
+            <if test="fPortoftransshipment == null"> and tv.f_portoftransshipment IS NULL</if>
+        </where>
+    </select>
+    <select id="selectTVoyageByFid" parameterType="TVoyage" resultMap="TVoyageResult">
+        SELECT
+        tv.f_id,
+        tv.f_pid,
+        te.f_name pidName,
+        tv.f_no,
+        tv.f_portofloadid,
+        ta.f_name portofloadidName,
+        tv.f_portofdischargeid,
+        td.f_name portofdischargeidName,
+        tv.f_distinationid,
+        tr.f_name distinationidName,
+        tv.f_portoftransshipment,
+        ts.f_name portoftransshipmentName,
+        tv.f_ETD,
+        tv.f_ATD,
+        tv.f_ETA,
+        tv.f_ATA,
+        tv.f_days,
+        tv.f_ducomentrayoffdate,
+        tv.f_cutoffdate,
+        tv.f_teu,
+        tv.f_manageid,
+        su.user_name manageidName,
+        tv.f_tel,
+        CASE
+
+        WHEN tv.f_status = 'T' THEN
+        '正常' ELSE '停用'
+        END AS f_status,
+        TIMESTAMPDIFF(
+        DAY,
+        tv.f_ETD,
+        DATE_FORMAT( tv.f_ducomentrayoffdate, '%Y-%m-%d %H:%i:%S' )) closing,
+        tv.create_by,
+        tv.create_time,
+        tv.update_by,
+        tv.update_time,
+        tv.remark,
+        tv.f_laneid,
+        SUM( CASE WHEN tc.fNo = '20GP' THEN tc.price ELSE 0 END ) AS twenty,
+        SUM( CASE WHEN tc.fNo = '40HC' THEN tc.price ELSE 0 END ) AS fortyHc,
+        SUM( CASE WHEN tc.fNo = '40RH' THEN tc.price ELSE 0 END ) AS fortyRh
+        FROM
+        t_voyage tv
+        LEFT JOIN t_vessel te ON tv.f_pid = te.f_id
+        LEFT JOIN t_address ta ON tv.f_portofloadid = ta.f_id
+        LEFT JOIN t_address td ON tv.f_portofdischargeid = td.f_id
+        LEFT JOIN t_address tr ON tv.f_distinationid = tr.f_id
+        LEFT JOIN t_address ts ON tv.f_portoftransshipment = ts.f_id
+        LEFT JOIN sys_user su ON tv.f_manageid = su.user_id
+        LEFT JOIN (
+        SELECT
+        ti.f_pid pId,
+        ti.f_price price,
+        tc.f_no fNo
+        FROM
+        t_ctnprice_items ti
+        LEFT JOIN t_cntr tc ON ti.f_cntrid = tc.f_id
+        ) tc
+        ON tv.f_id = tc.pId
+        <where>
+            tv.f_status = 'T'
+            AND (date(tv.f_ATD) >= DATE_SUB(CURDATE(), INTERVAL 2 DAY)
+            OR tv.f_ATD IS NULL)
+            AND tv.f_id = #{fId}
+        </where>
+    </select>
 
 </mapper>

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

@@ -1767,7 +1767,8 @@
             tw.f_typeid = '1'
             and tw.del_flag = '0'
             <if test="fId != null">and tw.f_id = #{fId}</if>
-            <if test="fBillno != null  and fBillno != ''">and tw.f_billno = #{fBillno}</if>
+            <if test="fBillno != null  and fBillno != ''">and tw.f_billno like concat('%',
+                #{fBillno}, '%')</if>
             <if test="fCustomsdeclartion != null  and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
                 #{fCustomsdeclartion}
             </if>
@@ -1797,7 +1798,8 @@
             <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
             <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
             <if test="fFeetunit != null  and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
-            <if test="fMblno != null  and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
+            <if test="fMblno != null  and fMblno != ''">and tw.f_mblno like concat('%',
+                #{fMblno}, '%')</if>
             <if test="fMarks != null  and fMarks != ''">and tw.f_marks = #{fMarks}</if>
             <if test="fVslvoy != null  and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
             <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
@@ -1894,6 +1896,12 @@
             <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
                 and tw.f_bsdate &lt;= #{cLoadDate[1]}
             </if>
+            <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
+                and ty.f_ATD &gt;= #{timeInterval[0]}
+            </if>
+            <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
+                and ty.f_ATD &lt;= #{timeInterval[1]}
+            </if>
             <if test="fCargoPlanning != null "> and tw.f_cargo_planning = #{fCargoPlanning}</if>
             <if test="fArrivalStatus != null "> and tw.f_arrival_status = #{fArrivalStatus}</if>
         </where>