caifc 3 gadi atpakaļ
vecāks
revīzija
dec4939bb5

+ 19 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/TWhgenleg.java

@@ -3,6 +3,7 @@ package com.ruoyi.reportManagement.domain;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -60,9 +61,18 @@ public class TWhgenleg extends BaseEntity {
     private Long fGoodsid;
 
     /**
+     * 业务日期
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @Excel(name = "仓储计费日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date fBsdate;
+
+    /**
      * 仓储计费日期
      */
-    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     @Excel(name = "仓储计费日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date fChargedate;
 
@@ -237,6 +247,14 @@ public class TWhgenleg extends BaseEntity {
     private String timeStartBsdate;
     private String timeEndBsdate;
 
+    public Date getfBsdate() {
+        return fBsdate;
+    }
+
+    public void setfBsdate(Date fBsdate) {
+        this.fBsdate = fBsdate;
+    }
+
     public String getfTel() {
         return fTel;
     }

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

@@ -450,15 +450,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         tWhgenleg.setfBusinessType(warehousebillsitems.getfBusinessType());
         // 业务类型详情
         tWhgenleg.setfMarks(warehousebillsitems.getfMarks());
-        // 原始入库日期
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-        String time = sdf.format(warehousebillsitems.getfOriginalbilldate());
-        try {
-            tWhgenleg.setfOriginalbilldate(sdf.parse(time));
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-        // 箱号
+        // 业务日期
+        tWhgenleg.setfBsdate(warehousebillsitems.getfBsdate());
         if ("1".equals(ifCntrno)) {
             tWhgenleg.setfCntrno(warehousebillsitems.getfCntrno());
         }
@@ -522,6 +515,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             // 仓储计费日期
             tWhgenleg.setfChargedate(warehousebillsitems.getfChargedate());
         }
+        // 业务日期
+        tWhgenleg.setfBsdate(warehousebillsitems.getfBsdate());
         // 明细类型
         tWhgenleg.setfBusinessType(warehousebillsitems.getfBusinessType());
         // 仓库
@@ -3341,12 +3336,10 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             }
             if (!businessStatus) {
                 // 查询库容量  是否可入库
-                int m = calculation(tWarehouseBills.getfWarehouseid(), item.getfGrossweight());
-                if (m == 0) {
+                if (calculation(tWarehouseBills.getfWarehouseid(), item.getfGrossweight()) == 0) {
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     return AjaxResult.error("更新库存总账失败-->入库毛重大于库容");
                 }
-
                 item.setfOriginalbilldate(item.getfBsdate());
                 item.setfBillingway(tWarehouseBills.getfBillingway());
                 if ("1".equals(tWarehouseBills.getfChargetype())) {
@@ -3651,7 +3644,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                     if (StringUtils.isNull(tWarehouseBills.getfBsdate()) || StringUtils.isNull(wbItem.getfChargedate())) {
                         return AjaxResult.error("库存明细第" + i + "行请检查日期,操作终止");
                     }
-                    long dateDay = DateUtils.getDateDay(tWarehouseBills.getfBsdate(), wbItem.getfChargedate());
+                    DateUtils.getDateDay(tWarehouseBills.getfBsdate(), wbItem.getfChargedate());
                     if (StringUtils.isNull(tWarehouseBills.getfCorpid())) {
                         return AjaxResult.error("库存明细第" + i + "行请检查客户信息,操作终止");
                     }
@@ -4236,7 +4229,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      */
     @Override
     @Transactional
-    public AjaxResult calculateStorageFees(TWarehouseBills tWarehouseBills, LoginUser loginUser, String billsType) {
+    /*public AjaxResult calculateStorageFees(TWarehouseBills tWarehouseBills, LoginUser loginUser, String billsType) {
         if (StringUtils.isNull(tWarehouseBills.getfCorpid())) {
             return AjaxResult.error("请选择客户信息");
         }
@@ -4322,9 +4315,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         map.put("warehouseItemList", itemsList);
         return AjaxResult.success(map);
     }
-
-    // todo:: asdasd
-    public AjaxResult calculateStorageFees1(TWarehouseBills tWarehouseBills, LoginUser loginUser, String billsType) {
+*/
+    public AjaxResult calculateStorageFees(TWarehouseBills tWarehouseBills, LoginUser loginUser, String billsType) {
         if (StringUtils.isNull(tWarehouseBills.getfCorpid())) {
             return AjaxResult.error("请选择客户信息");
         }
@@ -6329,10 +6321,10 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         // 仓库库容
         TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(fId);
         // 毛重公斤转化为吨
-        fGrossweight = fGrossweight.divide(new BigDecimal(1000), 0, BigDecimal.ROUND_HALF_UP);
+        fGrossweight = fGrossweight.divide(new BigDecimal(1000), 0, RoundingMode.HALF_UP);
         // 总账使用
         List<Map<String, Object>> whouseList = tWhgenlegMapper.selectWareHouseListWhouse(fId);
-        if (whouseList != null && whouseList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(whouseList)) {
             String fTotalgross = null;
             String fGrossweightblc = null;
             for (Map<String, Object> m : whouseList) {

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

@@ -95,46 +95,46 @@
 
     <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
         select
-        ware.f_id,
-        ware.f_billno,
-        ware.f_ctrlcorpid,
-        ware.f_act_id,
-        ware.f_corpid,
-        ware.t_mblno,
-        ware.f_trans_act_id,
-        ware.f_amtdr,
-        ware.f_amtcr,
-        ware.f_billtype,
-        CASE
-        WHEN ware.f_billstatus = '1' THEN '新建'
-        WHEN ware.f_billstatus = '2' THEN '暂存'
-        WHEN ware.f_billstatus = '3' THEN '审批驳回'
-        WHEN ware.f_billstatus = '4' THEN '提交审核'
-        WHEN ware.f_billstatus = '5' THEN '审核中'
-        WHEN ware.f_billstatus = '6' THEN '审核完成'
-        END
-        AS f_billstatus,
-        ware.f_remarks,
-        ware.f_from_date,
-        ware.f_to_date,
-        ware.f_accbilldate,
-        ware.f_ref_no,
-        ware.del_flag,
-        ware.create_by,
-        ware.f_deptid,
-        ware.create_time,
-        ware.update_by,
-        ware.update_time,
-        pro.dict_label AS charging_method,
-        ware.invoice_no,
-        ware.bank,
-        ware.water_bill_no,
-        ware.f_system_type
+            ware.f_id,
+            ware.f_billno,
+            ware.f_ctrlcorpid,
+            ware.f_act_id,
+            ware.f_corpid,
+            ware.t_mblno,
+            ware.f_trans_act_id,
+            ware.f_amtdr,
+            ware.f_amtcr,
+            ware.f_billtype,
+            CASE
+            WHEN ware.f_billstatus = '1' THEN '新建'
+            WHEN ware.f_billstatus = '2' THEN '暂存'
+            WHEN ware.f_billstatus = '3' THEN '审批驳回'
+            WHEN ware.f_billstatus = '4' THEN '提交审核'
+            WHEN ware.f_billstatus = '5' THEN '审核中'
+            WHEN ware.f_billstatus = '6' THEN '审核完成'
+            END
+            AS f_billstatus,
+            ware.f_remarks,
+            ware.f_from_date,
+            ware.f_to_date,
+            ware.f_accbilldate,
+            ware.f_ref_no,
+            ware.del_flag,
+            ware.create_by,
+            ware.f_deptid,
+            ware.create_time,
+            ware.update_by,
+            ware.update_time,
+            pro.dict_label AS charging_method,
+            ware.invoice_no,
+            ware.bank,
+            ware.water_bill_no,
+            ware.f_system_type
         from
-        t_fee ware
-        left join sys_user u on ware.create_by = u.user_name
-        left join sys_dept d on ware.f_deptid = d.dept_id
-        LEFT JOIN sys_dict_data pro ON pro.dict_value = ware.charging_method and pro.dict_type = 'data_settlement_type'
+            t_fee ware
+            left join sys_user u on ware.create_by = u.user_name
+            left join sys_dept d on ware.f_deptid = d.dept_id
+            LEFT JOIN sys_dict_data pro ON pro.dict_value = ware.charging_method and pro.dict_type = 'data_settlement_type'
         <where>
             <if test="fBillno != null  and fBillno != ''">and ware.f_billno = #{fBillno}</if>
             <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
@@ -170,7 +170,7 @@
             <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
             <if test="fSystemType != null and fSystemType != ''">and ware.f_system_type = #{fSystemType}</if>
         </where>
-        ORDER BY ware.create_time desc
+        ORDER BY ware.f_id desc
         ${params.dataScope}
     </select>
 

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

@@ -54,6 +54,7 @@
         <result property="fGoodsid" column="f_goodsid"/>
         <result property="fBsdate" column="f_bsdate"/>
         <result property="fBillingway" column="f_billingway"/>
+        <result property="fBsdate" column="f_bsdate"/>
         <result property="fChargedate" column="f_chargedate"/>
         <result property="fOriginalbilldate" column="f_originalbilldate"/>
         <result property="fMblno" column="f_mblno"/>
@@ -72,7 +73,7 @@
 
     <sql id="selectTWhgenlegVo">
         select f_id, f_accyear, f_accmonth, f_corpid, f_mblno, f_originalbillno, f_warehouse_locationid, f_goodsid, f_trademodeid, f_preqty,
-         f_pregrossweight, f_warehouseid, f_prenetweight, f_chargedate, f_volumnD, f_qtyD, f_billingway, f_grossweightD, f_netweightD, f_volumnC,
+         f_pregrossweight, f_warehouseid, f_prenetweight, f_bsdate, f_chargedate, f_volumnD, f_qtyD, f_billingway, f_grossweightD, f_netweightD, f_volumnC,
           f_qtyC, f_grossweightC, f_qtyblc, f_grossweightblc, f_netweightC, f_netweightblc, f_cntrno, f_status, del_flag, f_marks, create_by,
            create_time, update_by, f_volumnblc, update_time, remark, f_business_type, f_originalbilldate, f_localcntrno,f_customno from t_whgenleg
     </sql>
@@ -86,6 +87,7 @@
             left join sys_dept d on u.dept_id = d.dept_id
         <where>
             <if test="fOriginalbillno != null  and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
+            <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
             <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
             <if test="fPreqty != null ">and f_preqty = #{fPreqty}</if>
             <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
@@ -120,12 +122,29 @@
             <if test="fCntrno != null ">and f_cntrno = #{fCntrno}</if>
             <if test="fBusinessType != null ">and f_business_type = #{fBusinessType}</if>
             <if test="fMarks != null ">and f_marks = #{fMarks}</if>
+            <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
+            <if test="fWarehouseLocationid != null ">and f_warehouse_locationid = #{fWarehouseLocationid}</if>
+            <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
+            <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
+        </where>
+    </select>
+
+<!--
+    <select id="selectTWhgenleg" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
+        <include refid="selectTWhgenlegVo"/>
+        <where>
+            <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
+            <if test="fMblno != null ">and f_mblno = #{fMblno}</if>
+            <if test="fCntrno != null ">and f_cntrno = #{fCntrno}</if>
+            <if test="fBusinessType != null ">and f_business_type = #{fBusinessType}</if>
+            <if test="fMarks != null ">and f_marks = #{fMarks}</if>
             <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
             <if test="fWarehouseLocationid != null ">and f_warehouse_locationid = #{fWarehouseLocationid}</if>
             <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
             <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
         </where>
     </select>
+-->
 
     <select id="selectTWhgenlegById" parameterType="Long" resultMap="TWhgenlegResult">
         <include refid="selectTWhgenlegVo"/>
@@ -147,6 +166,7 @@
             <if test="fPregrossweight != null">f_pregrossweight,</if>
             <if test="fWarehouseid != null">f_warehouseid,</if>
             <if test="fPrenetweight != null">f_prenetweight,</if>
+            <if test="fBsdate != null">f_bsdate,</if>
             <if test="fChargedate != null">f_chargedate,</if>
             <if test="fVolumnd != null">f_volumnD,</if>
             <if test="fQtyd != null">f_qtyD,</if>
@@ -187,6 +207,7 @@
             <if test="fPregrossweight != null">#{fPregrossweight},</if>
             <if test="fWarehouseid != null">#{fWarehouseid},</if>
             <if test="fPrenetweight != null">#{fPrenetweight},</if>
+            <if test="fBsdate != null">#{fBsdate},</if>
             <if test="fChargedate != null">#{fChargedate},</if>
             <if test="fVolumnd != null">#{fVolumnd},</if>
             <if test="fQtyd != null">#{fQtyd},</if>
@@ -231,6 +252,7 @@
             <if test="fPregrossweight != null">f_pregrossweight = #{fPregrossweight},</if>
             <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
             <if test="fPrenetweight != null">f_prenetweight = #{fPrenetweight},</if>
+            <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
             <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
             <if test="fVolumnd != null">f_volumnD = #{fVolumnd},</if>
             <if test="fQtyd != null">f_qtyD = #{fQtyd},</if>
@@ -271,6 +293,53 @@
                 f_netweightD = f_netweightD + #{map.warehousebillsitems.fNetweight},
                 f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fGrossweight},
                 f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
+                ,f_chargedate = #{map.warehousebillsitems.fBsdate}
+                <if test="map.warehousebillsitems.fCustomno != null  and map.warehousebillsitems.fCustomno != ''">
+                    ,f_customno = #{map.warehousebillsitems.fCustomno}
+                </if>
+                <if test="map.warehousebillsitems.remark != null  and map.warehousebillsitems.remark != ''">
+                    ,remark = #{map.warehousebillsitems.remark}
+                </if>
+            </if>
+            /*判断是否撤销入库*/
+            <if test="map.billType == 'SJRKRevoke'">
+                f_qtyD = f_qtyD - #{map.warehousebillsitems.fQty},
+                f_volumnD = f_volumnD - #{map.warehousebillsitems.fVolumn},
+                f_netweightD = f_netweightD - #{map.warehousebillsitems.fNetweight},
+                f_grossweightD = f_grossweightD - #{map.warehousebillsitems.fGrossweight},
+                f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
+            </if>
+            /*判断是否出库*/
+            <if test="map.billType == 'SJCK'">
+                f_qtyC = f_qtyC + #{map.warehousebillsitems.fQty},
+                f_volumnC = f_volumnC + #{map.warehousebillsitems.fVolumn},
+                f_netweightC = f_netweightC + #{map.warehousebillsitems.fNetweight},
+                f_grossweightC = f_grossweightC + #{map.warehousebillsitems.fGrossweight},
+                f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
+            </if>
+            /*判断是否撤销出库*/
+            <if test="map.billType == 'SJCKRevoke'">
+                f_qtyC = f_qtyC - #{map.warehousebillsitems.fQty},
+                f_volumnC = f_volumnC - #{map.warehousebillsitems.fVolumn},
+                f_netweightC = f_netweightC - #{map.warehousebillsitems.fNetweight},
+                f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fGrossweight},
+                f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
+            </if>
+            -- update_by = NOW()
+        </trim>
+        where f_id = #{map.whgenlegId}
+    </update>
+<!--
+    <update id="updateTWhgenlegData" parameterType="Map">
+        update t_whgenleg
+        <trim prefix="SET" suffixOverrides=",">
+            /*判断是否入库*/
+            <if test="map.billType == 'SJRK'">
+                f_qtyD = f_qtyD + #{map.warehousebillsitems.fQty},
+                f_volumnD = f_volumnD + #{map.warehousebillsitems.fVolumn},
+                f_netweightD = f_netweightD + #{map.warehousebillsitems.fNetweight},
+                f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fGrossweight},
+                f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
                 <if test="map.warehousebillsitems.fBilltype != null  and map.warehousebillsitems.fBilltype == 'HQZY'">
                     ,f_chargedate = #{map.warehousebillsitems.fBsdate}
                 </if>
@@ -308,10 +377,11 @@
                 f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fGrossweight},
                 f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
             </if>
-            -- update_by = NOW()
+            &#45;&#45; update_by = NOW()
         </trim>
         where f_id = #{map.whgenlegId}
     </update>
+-->
 
     <delete id="deleteTWhgenlegById" parameterType="Long">
         delete from t_whgenleg where f_id = #{fId}
@@ -640,53 +710,53 @@
 
     <select id="selectInventoryMapList" parameterType="TWhgenleg" resultType="Map">
         select
-        DISTINCT
-        leg.f_id AS fId,
-        leg.f_corpid AS fCorpIds,
-        corp.f_name AS fCorpid,
-        ware.f_warehouse_information AS fWarehouseids,
-        area.f_name AS fWarehouseLocationids,
-        leg.f_originalbillno AS fOriginalbillno,
-        leg.f_warehouse_locationid AS fWarehouseLocationid,
-        dict1.dict_label AS fTrademodeid,
-        goods.f_name AS fGoodsids,
-        leg.f_trademodeid AS fTrademodeids,
-        goods.f_packagespecs AS fPackagespecs,
-        leg.f_goodsid AS fGoodsid,
-        IFNULL(SUM(leg.f_volumnD),0) AS fVolumnD,
-        IFNULL(SUM(leg.f_qtyD),0) AS fQtyD,
-        leg.f_mblno AS fMblno,
-        IFNULL(SUM(leg.f_grossweightD),0) AS fGrossweightD,
-        IFNULL(SUM(leg.f_netweightD),0) AS fNetweightD,
-        IFNULL(SUM(leg.f_volumnC),0) AS fVolumnC,
-        IFNULL(SUM(leg.f_volumnblc),0) AS fVolumnblc,
-        SUM(leg.f_qtyC) AS fQtyC,
-        leg.f_business_type AS fBusinessType,
-        IFNULL(SUM(leg.f_grossweightC),0) AS fGrossweightC,
-        IFNULL(SUM(leg.f_netweightC),0) AS fNetweightC,
-        IFNULL(SUM(leg.f_qtyblc),0) AS fQtyblc,
-        leg.f_billingway AS fBillingway,
-        leg.f_chargedate AS fChargedate,
-        IFNULL(SUM(leg.f_grossweightblc),0) AS fGrossweightblc,
-        IFNULL(SUM(leg.f_netweightblc),0) AS fNetweightblc,
-        dict.dict_label AS fBusinessTypes,
-        leg.f_marks AS fMarks,
-        DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
-        DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
-        leg.f_cntrno AS fCntrno,
-        leg.f_localcntrno fLocalcntrno
+            DISTINCT
+            leg.f_id AS fId,
+            leg.f_corpid AS fCorpIds,
+            corp.f_name AS fCorpid,
+            ware.f_warehouse_information AS fWarehouseids,
+            area.f_name AS fWarehouseLocationids,
+            leg.f_originalbillno AS fOriginalbillno,
+            leg.f_warehouse_locationid AS fWarehouseLocationid,
+            dict1.dict_label AS fTrademodeid,
+            goods.f_name AS fGoodsids,
+            leg.f_trademodeid AS fTrademodeids,
+            goods.f_packagespecs AS fPackagespecs,
+            leg.f_goodsid AS fGoodsid,
+            IFNULL(SUM(leg.f_volumnD),0) AS fVolumnD,
+            IFNULL(SUM(leg.f_qtyD),0) AS fQtyD,
+            leg.f_mblno AS fMblno,
+            IFNULL(SUM(leg.f_grossweightD),0) AS fGrossweightD,
+            IFNULL(SUM(leg.f_netweightD),0) AS fNetweightD,
+            IFNULL(SUM(leg.f_volumnC),0) AS fVolumnC,
+            IFNULL(SUM(leg.f_volumnblc),0) AS fVolumnblc,
+            SUM(leg.f_qtyC) AS fQtyC,
+            leg.f_business_type AS fBusinessType,
+            IFNULL(SUM(leg.f_grossweightC),0) AS fGrossweightC,
+            IFNULL(SUM(leg.f_netweightC),0) AS fNetweightC,
+            IFNULL(SUM(leg.f_qtyblc),0) AS fQtyblc,
+            leg.f_billingway AS fBillingway,
+            leg.f_chargedate AS fChargedate,
+            IFNULL(SUM(leg.f_grossweightblc),0) AS fGrossweightblc,
+            IFNULL(SUM(leg.f_netweightblc),0) AS fNetweightblc,
+            dict.dict_label AS fBusinessTypes,
+            leg.f_marks AS fMarks,
+            DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
+            DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
+            leg.f_cntrno AS fCntrno,
+            leg.f_localcntrno fLocalcntrno
         FROM
-        t_whgenleg leg
-        left join sys_user u on leg.create_by = u.user_name
-        left join sys_user u1 on leg.create_by = u1.user_name
-        left join sys_dept d on u.dept_id = d.dept_id
-        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
-        LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
-        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
+            t_whgenleg leg
+            left join sys_user u on leg.create_by = u.user_name
+            left join sys_user u1 on leg.create_by = u1.user_name
+            left join sys_dept d on u.dept_id = d.dept_id
+            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
+            LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
+            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
         <where>
             dict.status = '0'
             AND dict1.status = '0'