Pārlūkot izejas kodu

凯和拆单修改

lazhaoqian 3 gadi atpakaļ
vecāks
revīzija
31ffef45fc

+ 4 - 2
ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/impl/TCntrnoServiceImpl.java

@@ -25,6 +25,7 @@ import com.ruoyi.shipping.domain.*;
 import com.ruoyi.shipping.excel.*;
 import com.ruoyi.shipping.mapper.*;
 import com.ruoyi.system.mapper.SysDictDataMapper;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
@@ -656,13 +657,14 @@ public class TCntrnoServiceImpl implements ITCntrnoService {
                             if (StringUtils.isEmpty(dataFormatString)) {
                                 return AjaxResult.error("Excel箱信息数据第" + line + "行数据缺少动态日期");
                             }
-                            Date parse = new Date();
+                            Date parse = HSSFDateUtil.getJavaDate(Double.valueOf(dataFormatString));
+                           /* Date parse = new Date();
                             try {
                                 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                                 parse = simpleDateFormat.parse(dataFormatString);
                             }catch (Exception e){
                                 return AjaxResult.error("日期格式有误,正确格式如: 2021/9/2 15:11:22");
-                            }
+                            }*/
                             companyMsg.setfUpdatetime(parse);
                             break;
                         case "船名":

+ 33 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/approvalFlow/service/impl/AuditPathsServiceImpl.java

@@ -583,6 +583,24 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                         tWarehouseBills.setfId(auditItems.getBillId());
                         tWarehouseBills.setfDeleteStatus(fettle);
                         tWarehouseBillsMapper.updateKaHeOrder(tWarehouseBills);
+                    }else if (auditItems.getActId()== 474 ){
+                        if ("F".equals(at.getIffinalItem())) {
+                            fettle = 5L;
+                        } else if ("T".equals(at.getIffinalItem())) {
+                            fettle = 6L;
+                            //修改原订单信息
+                            AjaxResult ajaxResult = tWarehouseBillsService.approveDismount(auditItems.getBillId());
+                            String string = ajaxResult.get("code").toString();
+                            if ("500".equals(string)) {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return ajaxResult;
+                            }
+                        }
+                        //变更凯和订单状态
+                        TWarehouseBills tWarehouseBills = new TWarehouseBills();
+                        tWarehouseBills.setfId(auditItems.getBillId());
+                        tWarehouseBills.setfDismountStatus(fettle);
+                        tWarehouseBillsMapper.updateKaHeOrder(tWarehouseBills);
                     } else if (auditItems.getActId()== 181 ){
                         if ("T".equals(at.getIffinalItem())) {
                             fettle = 6L;
@@ -768,7 +786,14 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
             tWarehouseBills.setfId(auditItems.getBillId());
             tWarehouseBills.setfDeleteStatus(fettle);
             tWarehouseBillsMapper.updateKaHeOrder(tWarehouseBills);
-        }else if (auditItems.getActId()== 181 ){
+        }else if (auditItems.getActId()== 474 ){
+             fettle = 3L;
+            //变更凯和拆单单状态
+            TWarehouseBills tWarehouseBills = new TWarehouseBills();
+            tWarehouseBills.setfId(auditItems.getBillId());
+            tWarehouseBills.setfDismountStatus(fettle);
+            tWarehouseBillsMapper.updateKaHeOrder(tWarehouseBills);
+        } else if (auditItems.getActId()== 181 ){
             fettle = 3L;
             //业务处理
         }
@@ -1000,6 +1025,13 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
             tWarehouseBills.setfId(auditItems.getBillId());
             tWarehouseBills.setfDeleteStatus(fettle);
             tWarehouseBillsMapper.updateKaHeOrder(tWarehouseBills);
+        }else if (auditItems.getActId()== 474 ){
+            fettle = 2L;
+            //变更凯和拆单单状态
+            TWarehouseBills tWarehouseBills = new TWarehouseBills();
+            tWarehouseBills.setfId(auditItems.getBillId());
+            tWarehouseBills.setfDismountStatus(fettle);
+            tWarehouseBillsMapper.updateKaHeOrder(tWarehouseBills);
         }else if (auditItems.getActId()== 181 ){
             fettle = 2L;
             //业务处理

+ 15 - 3
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java

@@ -435,7 +435,7 @@ public class TWarehouseBills extends BaseEntity {
      * 保险金额
      */
     @Excel(name = "保险金额")
-    private Long fInsuranceamt;
+    private BigDecimal fInsuranceamt;
 
     /**
      * 截港日期
@@ -595,6 +595,9 @@ public class TWarehouseBills extends BaseEntity {
     /**查询箱号*/
     @Excel(name = "箱号")
     private String fCntrno;
+    /** 拆单审批状态 */
+    @Excel(name = "拆单审批状态")
+    private Long fDismountStatus;
 
     public String getfCntrno() {
         return fCntrno;
@@ -1161,11 +1164,11 @@ public class TWarehouseBills extends BaseEntity {
         this.fInsurance = fInsurance;
     }
 
-    public Long getfInsuranceamt() {
+    public BigDecimal getfInsuranceamt() {
         return fInsuranceamt;
     }
 
-    public void setfInsuranceamt(Long fInsuranceamt) {
+    public void setfInsuranceamt(BigDecimal fInsuranceamt) {
         this.fInsuranceamt = fInsuranceamt;
     }
 
@@ -1793,6 +1796,14 @@ public class TWarehouseBills extends BaseEntity {
         this.fChargetype = fChargetype;
     }
 
+    public Long getfDismountStatus() {
+        return fDismountStatus;
+    }
+
+    public void setfDismountStatus(Long fDismountStatus) {
+        this.fDismountStatus = fDismountStatus;
+    }
+
     @Override
     public String toString() {
         return "TWarehouseBills{" +
@@ -1931,6 +1942,7 @@ public class TWarehouseBills extends BaseEntity {
                 ", fRemarksFees=" + fRemarksFees +
                 ", fCargoPlanning=" + fCargoPlanning +
                 ", fArrivalStatus=" + fArrivalStatus +
+                ", fDismountStatus=" + fDismountStatus +
                 '}';
     }
 }

+ 7 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -567,4 +567,11 @@ public interface ITWarehouseBillsService {
      * @return
      */
     public AjaxResult updateMessageSign(String tWarehousebills,String tWarehousebillsCntr,String tWarehousebillsCntritems,String fOriginalbillno);
+
+    /**
+     * 拆单审批通过修改原单数据
+     * @param orderId
+     * @return
+     */
+    public AjaxResult approveDismount(Long orderId);
 }

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

@@ -6239,6 +6239,23 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         //保存新单主表信息
         //保存新单货物信息
         //保存新单想信息
+        boolean isApprove = false;//是否开启审批流
+        String key = "khwarehouse.dismountOrder.ApprovalFlow";//键
+        long actId = 474L;//活动id
+        Long billStatus = null; //状态id
+        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
+        if (StringUtils.isNull(sysConfig)) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return AjaxResult.error("系统参数异常,未找到开启审批流参数");
+        }
+        if ("0".equals(sysConfig.getConfigValue())) {
+            isApprove = true;
+        }
+        if (isApprove){
+            billStatus = 4L;
+        }else {
+            billStatus = 6L;
+        }
         TWarehouseBills warehouseBills = JSONArray.parseObject(tWarehousebills, TWarehouseBills.class); //新单主表信息
         JSONArray jsonCrArray = JSONArray.parseArray(tWarehousebillsCntr);
         List<TWarehousebillsCntr> tWarehousebillsCntrs = JSONObject.parseArray(jsonCrArray.toJSONString(), TWarehousebillsCntr.class);//新单货物信息
@@ -6258,6 +6275,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return AjaxResult.error("分单箱量不能超出原单数量");
         }
+        if (CollectionUtils.isNotEmpty(tWarehousebillsCntrs)){
+            TWarehousebillsCntr cnTrWareHouse = tWarehousebillsCntrs.get(0);
+            if(cnTrWareHouse.getfCntrcount() >=Cntr.getfCntrcount() ){
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("分单箱量不能超出原单数量");
+            }
+        }
         //拆单数量
         Long number = 0L;
         if (warehouseBills.getfId() == null) {
@@ -6270,6 +6294,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             warehouseBills.setfBilltype("KHDD");
             warehouseBills.setfTypeid(1);
             warehouseBills.setfOriginalbillno(fOriginalbillno);
+            warehouseBills.setfDismountStatus(billStatus);
             warehouseBills.setfDeptid(SecurityUtils.getLoginUser().getUser().getDeptId());
             warehouseBills.setfBsdeptid(SecurityUtils.getLoginUser().getUser().getDeptId());
             int i = tWarehouseBillsMapper.insertTWarehousebills(warehouseBills);
@@ -6313,7 +6338,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                     tWarehousebillsfeesMapper.insertTWarehousebillsfees(tWarehousebillsfees);
                 }
             }
-            List<TWarehousebillsfees> WarehousebillsfeesList = tWarehousebillsfeesMapper.selectWarehousebillsfeesByPId(selectOne.getfId());
+            /*List<TWarehousebillsfees> WarehousebillsfeesList = tWarehousebillsfeesMapper.selectWarehousebillsfeesByPId(selectOne.getfId());
             if (CollectionUtils.isNotEmpty(WarehousebillsfeesList)){
                 //修改原单费用
                 for (TWarehousebillsfees tWarehousebillsfees : WarehousebillsfeesList) {
@@ -6323,11 +6348,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                     tWarehousebillsfees.setfAmount(tWarehousebillsfees.getfQty().multiply(tWarehousebillsfees.getfUnitprice()));
                     tWarehousebillsfeesMapper.updateTWarehousebillsfees(tWarehousebillsfees);
                 }
-            }
+            }*/
         } else {
             TWarehouseBills tWarehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(warehouseBills.getfId());
             warehouseBills.setUpdateTime(DateUtils.getNowDate());
             warehouseBills.setUpdateBy(SecurityUtils.getUsername());
+            warehouseBills.setfDismountStatus(billStatus);
             tWarehouseBillsMapper.updateTWarehousebills(warehouseBills);
             tWarehousebillsCntrMapper.deleteTWarehousebillsCntrfPid(warehouseBills.getfId());
             if (CollectionUtils.isNotEmpty(tWarehousebillsCntrs)) {
@@ -6339,7 +6365,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                     int cntr = tWarehousebillsCntrMapper.insertTWarehousebillsCntr(warehousebillsCntr);
                 }
             }
-            tWarehouseAgreementitemsMapper.deleteByFPid(warehouseBills.getfId());
+            tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemsfPid(warehouseBills.getfId());
             if (CollectionUtils.isNotEmpty(tWarehousebillsCntritemsList)) {
                 for (TWarehousebillsCntritems warehousebillsCntritems : tWarehousebillsCntritemsList) {
                     TWarehousebillsCntr billsCntr = tWarehousebillsCntrMapper.selectTWarehousebillsCntrByPId(warehouseBills.getfId());
@@ -6370,19 +6396,19 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                     tWarehousebillsfeesMapper.insertTWarehousebillsfees(tWarehousebillsfees);
                 }
             }
-            List<TWarehousebillsfees> WarehousebillsfeesList = tWarehousebillsfeesMapper.selectWarehousebillsfeesByPId(selectOne.getfId());
+            /*List<TWarehousebillsfees> WarehousebillsfeesList = tWarehousebillsfeesMapper.selectWarehousebillsfeesByPId(selectOne.getfId());
             if (CollectionUtils.isNotEmpty(WarehousebillsfeesList)){
                 //修改原单费用
                 for (TWarehousebillsfees tWarehousebillsfees : WarehousebillsfeesList) {
                     tWarehousebillsfees.setUpdateBy(SecurityUtils.getUsername());
                     tWarehousebillsfees.setUpdateTime(new Date());
                     tWarehousebillsfees.setfQty(tWarehousebillsfees.getfQty().subtract(new BigDecimal(number)));
-                    tWarehousebillsfees.setfAmount(tWarehousebillsfees.getfQty().multiply(tWarehousebillsfees.getfUnitprice()));
+                    tWarehousebillsfees.setfAmount(tWarehousebillsfdees.getfQty().multiply(tWarehousebillsfees.getfUnitprice()));
                     tWarehousebillsfeesMapper.updateTWarehousebillsfees(tWarehousebillsfees);
                 }
-            }
+            }*/
         }
-        //修改原单的货物信息
+        /*//修改原单的货物信息
         TWarehousebillsCntr warehousebillsCntr = tWarehousebillsCntrMapper.selectTWarehousebillsCntrByPId(selectOne.getfId());
         warehousebillsCntr.setUpdateBy(SecurityUtils.getUsername());
         warehousebillsCntr.setUpdateTime(new Date());
@@ -6393,6 +6419,41 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             for (TWarehousebillsCntritems warehousebillsCntritems : tWarehousebillsCntritemsList) {
                 tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemOlder(selectOne.getfId(),warehousebillsCntritems.getfCntrno());
             }
+        }*/
+        if (isApprove) {
+            AuditItems auditItems = new AuditItems();
+            auditItems.setLevelId(0L);
+            auditItems.setBillId(warehouseBills.getfId());
+            auditItems.setActId(actId);
+            auditItems.setIffinalItem("F");
+            auditItems.setBillNo(warehouseBills.getfBillno());
+            // 存储委托方(货权方)
+            auditItems.setRefno1(warehouseBills.getfCorpid() + "");
+            // 存储业务类型(业务类型)
+            auditItems.setRefno2(warehouseBills.getfBilltype());
+            // 存储提单号(提单号)
+            if (StringUtils.isNotEmpty(warehouseBills.getfMblno())){
+                auditItems.setRefno3(warehouseBills.getfMblno());
+            }else {
+                auditItems.setRefno3(warehouseBills.getfBillno());
+            }
+            auditItems.setSendUserId(SecurityUtils.getLoginUser().getUser().getUserId());
+            auditItems.setSendName(SecurityUtils.getUsername());
+            auditItems.setSendTime(new Date());
+            auditItems.setAuditUserId(SecurityUtils.getLoginUser().getUser().getUserId());
+            auditItems.setAuditItem(new Date());
+            auditItems.setAuditOpTime(new Date());
+            auditItems.setAuditMsg("提交");
+            auditItems.setFidStatus("f_dismount_status");
+            auditItems.setAuditStatus("O");
+            AjaxResult approvalFlow = auditItemsService.createApprovalFlow(auditItems);
+//            Long code = Long.valueOf(String.valueOf(approvalFlow.get("code"))).longValue();
+            String code = approvalFlow.get("code").toString();
+//                Long code = Long.valueOf(String.valueOf(ajaxResult.get("code"))).longValue();
+            if ("500".equals(code)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            }
+            return approvalFlow;
         }
         return AjaxResult.success();
 }
@@ -6416,4 +6477,52 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         return null;
     }
 
+    /**
+     * 审批通过修改原单信息
+     * @param orderId
+     * @return
+     */
+    @Override
+    @Transactional
+    public AjaxResult approveDismount(Long orderId){
+        TWarehouseBills warehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(orderId);
+        //获取原单信息
+        TWarehouseBills bills = new TWarehouseBills();
+        bills.setfBillno(warehouseBills.getfOriginalbillno());
+        List<TWarehouseBills> tWarehouseBillsList = tWarehouseBillsMapper.webVersionOrderList(bills);
+        if (CollectionUtils.isEmpty(tWarehouseBillsList)){
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return AjaxResult.error("未查到原单信息");
+        }
+        TWarehouseBills selectOne = tWarehouseBillsList.get(0);
+        //获取新单信息
+        TWarehousebillsCntr wareHouseBillsCnTr = tWarehousebillsCntrMapper.selectTWarehousebillsCntrByPId(orderId);
+        //获取旧单信息 修改货物信息中的箱量
+        TWarehousebillsCntr billsCnTr = tWarehousebillsCntrMapper.selectTWarehousebillsCntrByPId(selectOne.getfId());
+        billsCnTr.setUpdateBy(SecurityUtils.getUsername());
+        billsCnTr.setUpdateTime(new Date());
+        billsCnTr.setfCntrcount(billsCnTr.getfCntrcount()-wareHouseBillsCnTr.getfCntrcount());
+        tWarehousebillsCntrMapper.updateTWarehousebillsCntr(billsCnTr);//修改原单货物信息中的箱量
+        //修改原单的费用信息
+        List<TWarehousebillsfees> WarehousebillsfeesList = tWarehousebillsfeesMapper.selectWarehousebillsfeesByPId(selectOne.getfId());
+        if (CollectionUtils.isNotEmpty(WarehousebillsfeesList)){
+            //修改原单费用
+            for (TWarehousebillsfees tWarehousebillsfees : WarehousebillsfeesList) {
+                tWarehousebillsfees.setUpdateBy(SecurityUtils.getUsername());
+                tWarehousebillsfees.setUpdateTime(new Date());
+                tWarehousebillsfees.setfQty(tWarehousebillsfees.getfQty().subtract(new BigDecimal(wareHouseBillsCnTr.getfCntrcount())));
+                tWarehousebillsfees.setfAmount(tWarehousebillsfees.getfQty().multiply(tWarehousebillsfees.getfUnitprice()));
+                tWarehousebillsfeesMapper.updateTWarehousebillsfees(tWarehousebillsfees);
+            }
+        }
+        //修改原单箱信息
+        List<TWarehousebillsCntritems> tWarehousebillsCntritemsList = tWarehousebillsCntritemsMapper.selectTWarehousebillsCntritemsByPId(orderId);
+        if (CollectionUtils.isNotEmpty(tWarehousebillsCntritemsList)){
+            for (TWarehousebillsCntritems warehousebillsCntritems : tWarehousebillsCntritemsList) {
+                tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemOlder(selectOne.getfId(),warehousebillsCntritems.getfCntrno());
+            }
+        }
+        return AjaxResult.success();
+    }
+
 }

+ 76 - 51
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -117,6 +117,7 @@
         <result property="fRemarksFees"    column="f_remarks_fees"    />
         <result property="fCargoPlanning"    column="f_cargo_planning"    />
         <result property="fArrivalStatus"    column="f_arrival_status"    />
+        <result property="fDismountStatus"    column="f_dismount_status"    />
     </resultMap>
 
     <sql id="selectTWarehousebillsVo">
@@ -129,7 +130,7 @@
         f_consigneeattn, f_consigneetel, f_insurance, f_insuranceamt, f_closedate, f_docmentdate, f_vslid, f_voyid, f_typeid, f_paymode, f_laneid, f_cntval,
         free_container_date, f_business_attribution, f_supervision_unit, f_declaration_elements, f_part_number, f_ifinspection, f_value, f_weighing_date,
         f_ifsampling, send_sample_date, f_ifweight_recovery, weight_recovery_date, warehouse_status, f_times ,f_date_changed, f_chargetype,f_weigh_weight,
-               f_predict_branch,f_grade,f_delivery_details,f_salesman_id,f_itemstatus,f_updete_status, f_submit_update, f_delete_status,f_remarks_fees,f_cargo_planning,f_arrival_status from t_warehousebills
+               f_predict_branch,f_grade,f_delivery_details,f_salesman_id,f_itemstatus,f_updete_status, f_submit_update, f_delete_status,f_remarks_fees,f_cargo_planning,f_arrival_status,f_dismount_status from t_warehousebills
     </sql>
 
     <select id="selectTWarehousebillsList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
@@ -907,6 +908,7 @@
             <if test="fRemarksFees != null">f_remarks_fees,</if>
             <if test="fCargoPlanning != null">f_cargo_planning,</if>
             <if test="fArrivalStatus != null">f_arrival_status,</if>
+            <if test="fDismountStatus != null">f_dismount_status,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="fBillno != null">#{fBillno},</if>
@@ -1020,6 +1022,7 @@
             <if test="fRemarksFees != null">#{fRemarksFees},</if>
             <if test="fCargoPlanning != null">#{fCargoPlanning},</if>
             <if test="fArrivalStatus != null">#{fArrivalStatus},</if>
+            <if test="fDismountStatus != null">#{fDismountStatus},</if>
         </trim>
     </insert>
 
@@ -1137,6 +1140,7 @@
             <if test="fRemarksFees != null">f_remarks_fees = #{fRemarksFees},</if>
             <if test="fCargoPlanning != null">f_cargo_planning = #{fCargoPlanning},</if>
             <if test="fArrivalStatus != null">f_arrival_status = #{fArrivalStatus},</if>
+            <if test="fDismountStatus != null">f_dismount_status = #{fDismountStatus},</if>
         </trim>
         where f_id = #{fId}
     </update>
@@ -1256,6 +1260,7 @@
             <if test="fRemarksFees != null">f_remarks_fees = #{fRemarksFees},</if>
             <if test="fCargoPlanning != null">f_cargo_planning = #{fCargoPlanning},</if>
             <if test="fArrivalStatus != null">f_arrival_status = #{fArrivalStatus},</if>
+            <if test="fDismountStatus != null">f_dismount_status = #{fDismountStatus},</if>
         </trim>
         where f_id = #{fId}
     </update>
@@ -1526,7 +1531,8 @@
             tw.f_submit_update,
             tw.f_delete_status,
             tw.f_cargo_planning,
-            tw.f_arrival_status
+            tw.f_arrival_status,
+            tw.f_dismount_status
         FROM t_warehousebills tw
             LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
             LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
@@ -1651,6 +1657,7 @@
         DISTINCT
         tw.f_id fId,
         tw.f_billno fBillno,
+        tw.f_originalbillno fOriginalbillno,
         tw.f_mblno fMblno,
         sd.dict_label fServiceitems,
         tw.f_consigneername fConsigneername,
@@ -1670,54 +1677,62 @@
         ts.f_name  destportName,
         tc.f_name goodsName,
         CASE
-        WHEN tw.f_billstatus = '1' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '1' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单新建'
-        WHEN tw.f_billstatus = '2' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '2' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单暂存'
-        WHEN tw.f_billstatus = '3' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '3' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单驳回'
-        WHEN tw.f_billstatus = '4' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '4' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单提交'
-        WHEN tw.f_billstatus = '5' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '5' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单审批中'
-        WHEN tw.f_billstatus = '6' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '6' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单审批通过'
-        WHEN tw.f_billstatus = '7' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '7' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船暂存'
-        WHEN tw.f_billstatus = '8' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '8' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船驳回'
-        WHEN tw.f_billstatus = '9' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '9' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船提交'
-        WHEN tw.f_billstatus = '10' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '10' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船审批中'
-        WHEN tw.f_billstatus = '11' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '11' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船审批通过'
-        WHEN tw.f_billstatus = '12' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '12' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '运单变更'
-        WHEN  tw.f_updete_status = '3'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_updete_status = '3'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '申请变更驳回'
-        WHEN  tw.f_updete_status = '4'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_updete_status = '4'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '申请变更提交'
-        WHEN  tw.f_updete_status = '5'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_updete_status = '5'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '申请变更审批中'
-        WHEN  tw.f_updete_status = '6'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_updete_status = '6'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '申请变更通过'
-        WHEN  tw.f_submit_update = '3' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_submit_update = '3' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '提交变更驳回'
-        WHEN  tw.f_submit_update = '4' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_submit_update = '4' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '提交变更审批'
-        WHEN  tw.f_submit_update = '5' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_submit_update = '5' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '提交变更审批中'
-        WHEN  tw.f_submit_update = '6' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_submit_update = '6' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '提交变更通过'
-        WHEN  tw.f_delete_status = '3' THEN
+        WHEN  tw.f_delete_status = '3' and tw.f_dismount_status = '2' THEN
         '申请删单驳回'
-        WHEN  tw.f_delete_status = '4' THEN
+        WHEN  tw.f_delete_status = '4' and tw.f_dismount_status = '2' THEN
         '申请删单提交'
-        WHEN  tw.f_delete_status = '5' THEN
+        WHEN  tw.f_delete_status = '5' and tw.f_dismount_status = '2' THEN
         '申请删单审批中'
-        WHEN  tw.f_delete_status = '6' THEN
+        WHEN  tw.f_delete_status = '6' and tw.f_dismount_status = '2' THEN
         '申请删单通过'
+        WHEN  tw.f_dismount_status = '3' THEN
+        '拆单审批驳回'
+        WHEN  tw.f_dismount_status = '4' THEN
+        '拆单审批提交'
+        WHEN  tw.f_dismount_status = '5' THEN
+        '拆单审批中'
+        WHEN  tw.f_dismount_status = '6' THEN
+        '拆单审批通过'
         END AS fBillstatus,
         CASE
         WHEN tf.f_billstatus = '1' THEN
@@ -1912,6 +1927,7 @@
         SELECT
         tw.f_id fId,
         tw.f_billno fBillno,
+        tw.f_originalbillno fOriginalbillno,
         tw.f_mblno fMblno,
         sd.dict_label fServiceitems,
         tw.f_consigneername fConsigneername,
@@ -1933,54 +1949,62 @@
         tw.f_billstatus fBillstatus,
         CASE
 
-        WHEN tw.f_billstatus = '1' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '1' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单新建'
-        WHEN tw.f_billstatus = '2' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '2' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单暂存'
-        WHEN tw.f_billstatus = '3' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '3' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单驳回'
-        WHEN tw.f_billstatus = '4' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '4' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单提交'
-        WHEN tw.f_billstatus = '5' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '5' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单审批中'
-        WHEN tw.f_billstatus = '6' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '6' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '下单审批通过'
-        WHEN tw.f_billstatus = '7' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '7' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船暂存'
-        WHEN tw.f_billstatus = '8' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '8' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船驳回'
-        WHEN tw.f_billstatus = '9' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '9' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船提交'
-        WHEN tw.f_billstatus = '10' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '10' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船审批中'
-        WHEN tw.f_billstatus = '11' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '11' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '配船审批通过'
-        WHEN tw.f_billstatus = '12' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN tw.f_billstatus = '12' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '运单变更'
-        WHEN  tw.f_updete_status = '3'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_updete_status = '3'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '申请变更驳回'
-        WHEN  tw.f_updete_status = '4'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_updete_status = '4'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '申请变更提交'
-        WHEN  tw.f_updete_status = '5'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_updete_status = '5'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '申请变更审批中'
-        WHEN  tw.f_updete_status = '6'and tw.f_submit_update = '2' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_updete_status = '6'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '申请变更通过'
-        WHEN  tw.f_submit_update = '3' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_submit_update = '3' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '提交变更驳回'
-        WHEN  tw.f_submit_update = '4' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_submit_update = '4' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '提交变更审批'
-        WHEN  tw.f_submit_update = '5' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_submit_update = '5' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '提交变更审批中'
-        WHEN  tw.f_submit_update = '6' and tw.f_delete_status = '2' THEN
+        WHEN  tw.f_submit_update = '6' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
         '提交变更通过'
-        WHEN  tw.f_delete_status = '3' THEN
+        WHEN  tw.f_delete_status = '3' and tw.f_dismount_status = '2' THEN
         '申请删单驳回'
-        WHEN  tw.f_delete_status = '4' THEN
+        WHEN  tw.f_delete_status = '4' and tw.f_dismount_status = '2' THEN
         '申请删单提交'
-        WHEN  tw.f_delete_status = '5' THEN
+        WHEN  tw.f_delete_status = '5' and tw.f_dismount_status = '2' THEN
         '申请删单审批中'
-        WHEN  tw.f_delete_status = '6' THEN
+        WHEN  tw.f_delete_status = '6' and tw.f_dismount_status = '2' THEN
         '申请删单通过'
+        WHEN  tw.f_dismount_status = '3' THEN
+        '拆单审批驳回'
+        WHEN  tw.f_dismount_status = '4' THEN
+        '拆单审批提交'
+        WHEN  tw.f_dismount_status = '5' THEN
+        '拆单审批中'
+        WHEN  tw.f_dismount_status = '6' THEN
+        '拆单审批通过'
         END AS fBillstatusName,
         CASE
         WHEN tf.f_billstatus = '1' THEN
@@ -2262,7 +2286,8 @@
                tw.f_submit_update,
                tw.f_delete_status,
                tw.f_cargo_planning,
-               tw.f_arrival_status
+               tw.f_arrival_status,
+               tw.f_dismount_status
         FROM t_warehousebills tw
                  LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
                  LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid