Przeglądaj źródła

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

songyang 1 rok temu
rodzic
commit
3ac3dc4bc7

+ 11 - 1
src/main/java/com/dk/mdm/controller/report/ReportController.java

@@ -136,9 +136,19 @@ public class ReportController  {
     }
 
     /**
+     * @desc   : 日结对账表
+     * @date   : 2024/4/24 15:10
+     * @author : 寇珊珊
+     */
+    @PostMapping("daily_reconciliation_report")
+    public ResponseResultVO<PageList<Map<String, Object>>> getDailyReconciliationReport(@RequestBody Map<String, Object> param) {
+        return reportService.getDailyReconciliationReport(param);
+    }
+
+    /**
      * @desc   : 收发存汇总报表
      * @author : 宋扬
-     * @date   : 2024/4/20 13:20
+     * @date   : 2024/4/23 14:08
      */
     @PostMapping("ivt_sum_report")
     public ResponseResultVO<PageList<Map<String, Object>>> getIvtSumReport(@RequestBody Map<String, Object> param) {

+ 1 - 1
src/main/java/com/dk/mdm/mapper/pur/PurchaseMapper.xml

@@ -778,7 +778,7 @@
     <!-- 采购跟踪-->
     <select id="selectTrackReport" resultType="java.util.Map">
         SELECT *
-        FROM dkic_b.f_query_pur_for_track(#{purId}::uuid)
+        FROM dkic_b.f_query_pur_for_track(#{purId}::uuid,#{cpId})
     </select>
     <select id="selectPurOrderAndDeatil" resultType="java.util.Map">
         SELECT

+ 15 - 0
src/main/java/com/dk/mdm/mapper/report/ReportMapper.java

@@ -128,6 +128,21 @@ public interface ReportMapper extends BaseMapper<JSONObject> {
 
 
     /**
+     * @desc   : 日结对账表列表查询
+     * @date   : 2024/4/24 15:22
+     * @author : 寇珊珊
+     */
+    List<Map<String, Object>> getDailyReconciliationReport(Map param);
+
+
+    /**
+     * @desc   : 日结对账表列表查询数量
+     * @date   : 2024/4/24 15:22
+     * @author : 寇珊珊
+     */
+    Long getDailyReconciliationReportCount(Map<String, Object> param);
+
+    /**
      * @desc   : 收发存汇总报表
      * @author : 宋扬
      * @date   : 2024/4/20 13:34

+ 486 - 0
src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml

@@ -1389,4 +1389,490 @@
                    ,#{accDateEnd} ::date,#{i18n} ,#{currentPage},#{pageSize})
     </select>
 
+    <select id="getSalesTrackingReportDetail"  resultType="java.util.Map">
+        SELECT T
+                   ."id",
+               T."no",
+               T."itemId",
+               T."type",
+               T."skuCode",
+               T."skuName",
+               T."skuModel",
+               T."skuImages",
+               T."brandName",
+               T."shortName",
+               T."returnQty",
+               T."outQty",
+               T."outingQty",
+               T."priceSale",
+               T."itemQty",
+               T."sumQuantity",
+               T."sumAmount",
+               T."sumAmtRec",
+               T."sumShouldHandle",
+               T."sumUsePaymentResidue",
+               T."sumWaiveAmt",
+               T."makeTime",
+               T."whId",
+               T."whName",
+               T."remarks"
+        FROM
+            (
+                SELECT
+                    tpo.order_id AS "id",
+                    tpo.order_no AS "no",
+                    tpoi.item_id AS "itemId",
+                    '销售订单' AS "type",
+                    tmgs.sku_code AS "skuCode",
+                    tmgs.sku_name AS "skuName",
+                    tmgs.sku_model AS "skuModel",
+                    tmgs.sku_images AS "skuImages",
+                    tmgb.brand_name AS "brandName",
+                    tmgb.short_name AS "shortName",
+                    tpo.return_qty AS "returnQty",
+                    tpo.out_qty AS "outQty",
+                    tpo.outing_qty AS "outingQty",
+                    tpoi.price_sale AS "priceSale",
+                    tpoi.item_qty AS "itemQty",
+                    tpo.sum_quantity AS "sumQuantity",
+                    tpo.sum_amount AS "sumAmount",
+                    0.00 AS "sumAmtRec",
+                    0.00 AS "sumShouldHandle",
+                    0.00 AS "sumUsePaymentResidue",
+                    0.00 AS "sumWaiveAmt",
+                    tpo.make_time AS "makeTime",
+                    tpoi.wh_id AS "whId",
+                    tmw.wh_name AS "whName",
+                    tpoi.remarks AS "remarks"
+                FROM
+                    dkic_b.t_psi_order_item tpoi
+                        LEFT JOIN dkic_b.t_psi_order tpo ON tpo.order_id = tpoi.order_id
+                        LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpoi.sku_id
+                        LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
+                        LEFT JOIN dkic_b.t_mst_warehouse tmw ON tmw.wh_id = tpoi.wh_id
+                WHERE
+                    tpo.order_id =  #{id}::uuid
+                UNION ALL
+                SELECT
+                    tpobi.out_id AS "id",
+                    tpob.out_no AS "no",
+                    tpobi.item_id AS "itemId",
+                    '销售出库' AS "type",
+                    tmgs.sku_code AS "skuCode",
+                    tmgs.sku_name AS "skuName",
+                    tmgs.sku_model AS "skuModel",
+                    tmgs.sku_images AS "skuImages",
+                    tmgb.brand_name AS "brandName",
+                    tmgb.short_name AS "shortName",
+                    tpob.return_qty AS "returnQty",
+                    tpob.out_qty AS "outQty",
+                    tpob.outing_qty AS "outingQty",
+                    tpobi.price_out AS "priceSale",
+                    CASE
+
+                    WHEN tpobi.out_status = '出库状态-出库中' THEN
+                    tpobi.outing_qty ELSE tpobi.out_qty
+                    END AS "itemQty",
+                    0.00 AS "sumQuantity",
+                    0.00 AS "sumAmount",
+                    0.00 AS "sumAmtRec",
+                    0.00 AS "sumShouldHandle",
+                    0.00 AS "sumUsePaymentResidue",
+                    0.00 AS "sumWaiveAmt",
+                    tpob.make_time AS "makeTime",
+                    NULL AS "whId",
+                    NULL AS "whName",
+                    tpobi.remarks AS "remarks"
+                FROM
+                    dkic_b.t_psi_outbound_item tpobi
+                    LEFT JOIN dkic_b.t_psi_outbound tpob ON tpob.out_id = tpobi.out_id
+                    LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpobi.sku_id
+                    LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
+                WHERE
+                    tpob.from_id =  #{id}::uuid
+                  AND tpob.out_type = '出库类型-销售出库' UNION ALL
+                SELECT
+                    tpobi.out_id AS "id",
+                    tpob.out_no AS "no",
+                    tpobi.item_id AS "itemId",
+                    '销售退货' AS "type",
+                    tmgs.sku_code AS "skuCode",
+                    tmgs.sku_name AS "skuName",
+                    tmgs.sku_model AS "skuModel",
+                    tmgs.sku_images AS "skuImages",
+                    tmgb.brand_name AS "brandName",
+                    tmgb.short_name AS "shortName",
+                    tpob.return_qty AS "returnQty",
+                    tpob.out_qty AS "outQty",
+                    tpob.outing_qty AS "outingQty",
+                    tpobi.price_out AS "priceSale",
+                    CASE
+
+                    WHEN tpobi.out_status = '出库状态-出库中' THEN
+                    tpobi.outing_qty ELSE tpobi.out_qty
+                    END AS "itemQty",
+                    0.00 AS "sumQuantity",
+                    0.00 AS "sumAmount",
+                    0.00 AS "sumAmtRec",
+                    0.00 AS "sumShouldHandle",
+                    0.00 AS "sumUsePaymentResidue",
+                    0.00 AS "sumWaiveAmt",
+                    tpob.make_time AS "makeTime",
+                    NULL AS "whId",
+                    NULL AS "whName",
+                    tpobi.remarks AS "remarks"
+                FROM
+                    dkic_b.t_psi_outbound_item tpobi
+                    LEFT JOIN dkic_b.t_psi_outbound tpob ON tpob.out_id = tpobi.out_id
+                    LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpobi.sku_id
+                    LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
+                WHERE
+                    tpob.from_id =  #{id}::uuid
+                  AND tpob.out_type = '出库类型-销售出库退货' UNION ALL
+                SELECT
+                    tmrp.rp_id AS "id",
+                    tmrp.rp_no AS "no",
+                    NULL AS "itemId",
+                    '核销信息' AS "type",
+                    NULL AS "skuCode",
+                    NULL AS "skuName",
+                    NULL AS "skuModel",
+                    NULL AS "skuImages",
+                    NULL AS "brandName",
+                    NULL AS "shortName",
+                    NULL AS "returnQty",
+                    NULL AS "outQty",
+                    NULL AS "outingQty",
+                    NULL AS "priceSale",
+                    NULL AS "itemQty",
+                    0.00 AS "sumQuantity",
+                    0.00 AS "sumAmount",
+                    tmrp.sum_amt_rec AS "sumAmtRec",
+                    tmrp.sum_should_handle AS "sumShouldHandle",
+                    tmrp.sum_use_payment_residue AS "sumUsePaymentResidue",
+                    tmrp.sum_waive_amt AS "sumWaiveAmt",
+                    NULL AS "makeTime",
+                    NULL AS "whId",
+                    NULL AS "whName",
+                    tmrp.remarks AS "remarks"
+                FROM
+                    dkic_b.t_mac_rec_pay tmrp
+                WHERE
+                    tmrp.biznis_id =  #{id}::uuid
+            ) T
+    </select>
+
+    <!--  采购跟踪表 列表查询 -->
+    <select id="getPurTrackingReport" resultType="java.util.Map">
+        SELECT
+        tpp.pur_id AS "purId"
+        ,tpp.pur_no AS "purNo"
+        ,tpp.pur_type AS "purType"
+        ,sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) AS "purTypeName"
+        ,tpp.org_id AS "orgId"
+        ,tmo.org_name AS "orgName"
+        ,tpp.staff_id AS "staffId"
+        ,tpp.sup_id AS "supId"
+        ,tpp.contact_name AS "contactName"
+        ,tpp.contact_phone AS "contactPhone"
+        ,tpp.wh_id AS "whId"
+        ,tpp.pickup_date AS "pickupDate"
+        ,tpp.sum_quantity AS "sumQuantity"
+        ,tpp.sum_standard AS "sumStandard"
+        ,tpp.sum_amount AS "sumAmount"
+        ,tpp.pur_discount AS "purDiscount"
+        ,tpp.pur_status AS "purStatus"
+        ,sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}) as "purStatusName"
+        ,tpp.into_status AS "intoStatus"
+        ,sys.f_get_name_i18n(tdk3.kind_name_i18n, #{i18n}) as "intoStatusName"
+        ,tpp.intoing_qty AS "intoingQty"
+        ,tpp.intoing_amt AS "intoingAmt"
+        ,tpp.into_qty AS "intoQty"
+        ,tpp.into_amt AS "intoAmt"
+        ,tpp.return_qty AS "returnQty"
+        ,tpp.return_amt AS "returnAmt"
+        ,tpp.amt_payable AS "amtPayable"
+        ,tpp.amt_handle AS "amtHandle"
+        ,tpp.amt_residue AS "amtResidue"
+        ,tpp.remarks AS "remarks"
+        ,tpp.annex_paths AS "annexPaths"
+        ,tpp.make_staff AS "makeStaff"
+        ,tpp.make_time AS "makeTime"
+        ,tpp.flg_valid AS "flgValid"
+        ,tms.sup_code AS "supCode"
+        ,tms.sup_name As "supName"
+        ,tms.contact_phone As "contactPhone"
+        FROM
+        dkic_b.t_psi_purchase tpp
+        left join dkic_b.t_mst_supplier tms on tpp.sup_id = tms.sup_id
+        left join sys.t_data_kind as tdk1 on tpp.pur_type = tdk1.kind_code
+        left join sys.t_data_kind as tdk2 on tpp.pur_status = tdk2.kind_code
+        left join sys.t_data_kind as tdk3 on tpp.into_status = tdk3.kind_code
+        left join dkic_b.t_mst_org as tmo on tpp.org_id = tmo.org_id
+        <include refid="ConditionPurTrackingReport"/>
+        order by tpp.op_create_time desc
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+
+    <select id="getPurTrackingReportCount" resultType="java.lang.Long">
+        SELECT count(1)
+        FROM
+        dkic_b.t_psi_purchase tpp
+        <include refid="ConditionPurTrackingReport"/>
+    </select>
+
+    <!--采购跟踪表通用查询映射结果 -->
+    <resultMap id="PurTrackingReportResultMapResponse" type="com.dk.mdm.model.response.report.ReportResponse">
+        <id column="id" property="id"/>
+        <result column="no" property="no"/>
+        <result column="type" property="type"/>
+        <result column="contactPhone" property="contactPhone" />
+        <result column="contactName" property="contactName" />
+        <result column="whId" property="whId" typeHandler="UuidTypeHandler"/>
+        <result column="makeTime" property="makeTime" typeHandler="TimestampTypeHandler"/>
+        <result column="pickupDate" property="pickupDate" typeHandler="TimestampTypeHandler"/>
+        <result column="sumQuantity" property="sumQuantity"/>
+        <result column="intoQty" property="intoQty"/>
+        <result column="returnQty" property="returnQty"/>
+        <result column="sumAmtRec" property="sumAmtRec"/>
+        <result column="sumShouldHandle" property="sumShouldHandle"/>
+        <result column="sumUsePaymentResidue" property="sumUsePaymentResidue"/>
+        <result column="sumWaiveAmt" property="sumWaiveAmt"/>
+
+        <collection property="itemResponseList" resultMap="PurTrackingReportItemListMap" columnPrefix="list_"/>
+    </resultMap>
+
+    <!--   采购跟踪表 关联映射-->
+    <resultMap id="PurTrackingReportItemListMap" type="java.util.Map">
+        <id column="itemId" property="itemId"/>
+        <result column="id" property="id" typeHandler="UuidTypeHandler"/>
+        <result column="type" property="type"/>
+        <result column="skuId" property="skuId" typeHandler="UuidTypeHandler"/>
+        <result column="skuCode" property="skuCode"/>
+        <result column="skuName" property="skuName"/>
+        <result column="skuModel" property="skuModel"/>
+        <result column="skuImages" property="skuImages" typeHandler="JsonTypeHandler"/>
+        <result column="brandName" property="brandName"/>
+        <result column="shortName" property="shortName"/>
+        <result column="pricePur" property="pricePur"/>
+        <result column="itemQty" property="itemQty"/>
+        <result column="remarks" property="remarks"/>
+    </resultMap>
+    
+    <!--采购跟踪表 明细查询-->
+    <select id="getPurTrackingReportDetail" resultMap="PurTrackingReportResultMapResponse">
+        SELECT T."id"
+             ,T."no"
+             ,T."type"
+             ,T."contactName"
+             ,T."contactPhone"
+             ,T."whId"
+             ,T."makeTime"
+             ,T."pickupDate"
+             ,T."sumQuantity"
+             ,T."intoQty"
+             ,T."returnQty"
+             ,T."sumAmtRec"
+             ,T."sumShouldHandle"
+             ,T."sumUsePaymentResidue"
+             ,T."sumWaiveAmt"
+             ,T."itemId" AS list_itemId
+             ,T."id" AS list_id
+             ,T."type" AS list_type
+             ,T."skuId" AS list_skuId
+             ,T."skuCode" AS list_skuCode
+             ,T. "skuName" AS list_skuName
+             ,T."skuModel" AS list_skuModel
+             ,T. "skuImages" AS list_skuImages
+             ,T."brandName" AS list_brandName
+             ,T."shortName" AS list_shortName
+             ,T."pricePur" AS list_pricePur
+             ,T."itemQty" AS list_itemQty
+             ,T."remarks"  AS list_remarks
+        FROM
+            (
+                SELECT
+                    tpp.pur_id AS "id"
+                     ,tpp.pur_no AS "no"
+                     ,tpp.contact_name AS "contactName"
+                     ,tpp.contact_phone AS "contactPhone"
+                     ,tpp.wh_id AS "whId"
+                     ,tpp.make_time AS "makeTime"
+                     ,tpp.pickup_date AS "pickupDate"
+                     ,tpp.sum_quantity AS "sumQuantity"
+                     ,tpp.sum_amount AS "sumAmount"
+                     ,tpp.into_qty AS "intoQty"
+                     ,tpp.return_qty AS "returnQty"
+                     ,0.00 AS "sumAmtRec"
+                     ,0.00 AS "sumShouldHandle"
+                     ,0.00 AS "sumUsePaymentResidue"
+                     ,0.00 AS "sumWaiveAmt"
+                     ,tppi.item_id AS "itemId"
+                     ,'采购订单' AS "type"
+                     ,tppi.sku_id AS "skuId"
+                     ,tmgs.sku_code AS "skuCode"
+                     ,tmgs.sku_name AS "skuName"
+                     ,tmgs.sku_model AS "skuModel"
+                     ,tmgs.sku_images AS "skuImages"
+                     ,tmgb.brand_name AS "brandName"
+                     ,tmgb.short_name AS "shortName"
+                     ,tppi.price_pur AS "pricePur"
+                     ,tppi.item_qty AS "itemQty"
+                     ,tppi.remarks AS "remarks"
+                FROM
+                    dkic_b.t_psi_purchase_item tppi
+                        LEFT JOIN dkic_b.t_psi_purchase tpp ON tpp.pur_id = tppi.pur_id
+                        LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tppi.sku_id
+                        LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
+                WHERE
+                    tpp.pur_id = = #{id}::uuid
+                UNION  ALL
+                SELECT
+                    tpi.into_id AS "id"
+                        ,tpi.into_no AS "no"
+                        ,NULL AS "contactName"
+                        ,NULL AS "contactPhone"
+                        ,NULL AS "whId"
+                        ,NULL AS "makeTime"
+                        ,NULL AS "pickupDate"
+                        ,NULL AS "sumQuantity"
+                        ,NULL AS "sumAmount"
+                        ,NULL AS "intoQty"
+                        ,0 AS "returnQty"
+                        ,0.00 AS "sumAmtRec"
+                        ,0.00 AS "sumShouldHandle"
+                        ,0.00 AS "sumUsePaymentResidue"
+                        ,0.00 AS "sumWaiveAmt"
+                        ,tpii.item_id AS "itemId"
+                        ,'采购入库' AS "type"
+                        ,tpii.sku_id AS "skuId"
+                        ,tmgs.sku_code AS "skuCode"
+                        ,tmgs.sku_name AS "skuName"
+                        ,tmgs.sku_model AS "skuModel"
+                        ,tmgs.sku_images AS "skuImages"
+                        ,tmgb.brand_name AS "brandName"
+                        ,tmgb.short_name AS "shortName"
+                        ,tpii.price_into AS "pricePur"
+                        , CASE
+                    WHEN tpii.into_status = '入库状态-入库中' THEN  tpii.intoing_qty
+                    ELSE tpii.into_qty
+                    END AS "itemQty"
+                    --  入库中显示入库中数量  已入库显示 已入库数量
+                        ,tpii.remarks AS "remarks"
+                FROM
+                    dkic_b.t_psi_inbound_item tpii
+                    LEFT JOIN dkic_b.t_psi_inbound tpi ON tpi.into_id = tpii.into_id
+                    LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpii.sku_id
+                    LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
+                WHERE
+                    tpi.from_id = = #{id}::uuid
+                UNION ALL
+                SELECT
+                    tmrp.rp_id AS "id"
+                        ,tmrp.rp_no AS "no"
+                        ,NULL AS "contactName"
+                        ,NULL AS "contactPhone"
+                        ,NULL AS "whId"
+                        ,NULL AS "makeTime"
+                        ,NULL AS "pickupDate"
+                        ,NULL AS "sumQuantity"
+                        ,NULL AS "sumAmount"
+                        ,NULL AS "intoQty"
+                        ,NULL AS "returnQty"
+                        ,tmrp.sum_amt_rec AS "sumAmtRec"
+                        ,tmrp.sum_should_handle AS "sumShouldHandle"
+                        ,tmrp.sum_use_payment_residue AS "sumUsePaymentResidue"
+                        ,tmrp.sum_waive_amt AS "sumWaiveAmt"
+                        ,Null AS "itemId"
+                        ,'核销信息' AS "type"
+                        ,Null AS "skuId"
+                        ,Null AS "skuCode"
+                        ,Null AS "skuName"
+                        ,Null AS "skuModel"
+                        ,Null AS "skuImages"
+                        ,Null AS "brandName"
+                        ,Null AS "shortName"
+                        ,Null AS "pricePur"
+                        ,Null AS "itemQty"
+                        ,Null AS "remarks"
+                FROM
+                    dkic_b.t_mac_rec_pay tmrp
+
+                WHERE
+                    tmrp.biznis_id= #{id}::uuid
+            ) T
+
+    </select>
+
+    <!--   日结对账表列表查询-->
+    <select id="getDailyReconciliationReport" resultType="java.util.Map">
+        SELECT
+        T.item_id,
+        T.item_id        as "accItemId",
+        T.acc_item_type,
+        T.object_id,
+        tmc.cus_code     as "cusCode",
+        tmc.cus_name     as "cusName",
+        tmc.cus_phone    as "cusPhone",
+        tmc.address_full as "addressFull",
+        T.org_id,
+        tmo.org_name     as "orgName",
+        T.staff_id,
+        tms.staff_name   as "staffName",
+        T.biznis_type,
+        T.biznis_id,
+        T.biznis_no,
+        T.acc_date,
+        T.rec_status,
+        sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "recStatusName",
+        T.amt_rec,
+        T.amt_pay,
+        T.amt_should,
+        T.amt_handle,
+        T.amt_waive,
+        T.amt_residue    as "amtNotHandle",
+        T.amt_residue    as "amtReceivableHandle",
+        T.amt_residue,
+        T.remarks,
+        T.make_staff,
+        T.make_time,
+        T.flg_valid,
+        T.cp_id,
+        ord.totalOrderAmount
+        FROM dkic_b.t_mac_account_item as T
+        left join (select sum(tpo.sum_amount) as totalOrderAmount ,tpo.cus_id from dkic_b.t_psi_order tpo group by tpo.cus_id ) ord on ord.cus_id =T.object_id
+        left join dkic_b.t_mac_other_receivable as tmor on tmor.receivable_id = t.biznis_id and t.biznis_type = 't_mac_other_receivable'
+        left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
+        left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
+        left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
+        left join sys.t_data_kind as tdk1 on t.rec_status = tdk1.kind_code
+        <include refid="ConditionDailyReconciliationReport"/>
+        order by  tpo.op_create_time desc
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+    <!--  日结对账表列表查询数量-->
+    <select id="getDailyReconciliationReportCount" resultType="java.lang.Long">
+        SELECT count(1)
+        FROM
+        dkic_b.t_psi_order tpo
+        <include refid="ConditionDailyReconciliationReport"/>
+    </select>
+
+    <!--  日结对账表查询条件-->
+    <sql id="ConditionDailyReconciliationReport">
+        <where>
+            <if test="cpId != null">
+                tpo.cp_id = #{cpId}
+            </if>
+        </where>
+    </sql>
+
+
+
 </mapper>

+ 2 - 2
src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml

@@ -524,7 +524,7 @@
         FROM dkic_b.t_psi_order_item as t
         left join dkic_b.t_psi_order as tpo on tpo.order_id = t.order_id
         inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
-        left join(select from_item_id,sum(item_qty) as sumQty from t_psi_purchase_item
+        left join(select from_item_id,sum(item_qty) as sumQty from dkic_b.t_psi_purchase_item
             group by from_item_id) as pi on pi.from_item_id = t.item_id
         <where>
             t.item_qty - coalesce(sumQty,0) > 0
@@ -544,7 +544,7 @@
         FROM dkic_b.t_psi_order_item as t
         left join dkic_b.t_psi_order as tpo on tpo.order_id = t.order_id
         inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
-        left join(select from_item_id,sum(item_qty) as sumQty from t_psi_purchase_item
+        left join(select from_item_id,sum(item_qty) as sumQty from dkic_b.t_psi_purchase_item
         group by from_item_id) as pi on pi.from_item_id = t.item_id
         <where>
             t.item_qty - coalesce(sumQty,0) > 0

+ 17 - 18
src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java

@@ -134,8 +134,23 @@ public class InventoryService extends BaseService<Inventory> {
             rollbackFor = {Exception.class}
     )
     public List<InOutRecordVO> setInOutRecordMessageByOut(List<InOutRecordVO> inOutRecordVOList) {
+        //region  查询当前公司的系统参数  自动办理信息  并赋值
+        Map<String, Object> map = new HashMap<>();
+        map.put("cpId", inOutRecordVOList.get(0).getCpId());
+        map.put("code",Constant.SystemConstant.IVT_002.getValue());
+        //负数标识1
+        String flgHandleSetting = commonMapper.getSettingValue(map);
+        //endregion
         //赋值
         for (InOutRecordVO inOutRecordVO : inOutRecordVOList) {
+            //负数标识1 可以
+            if (Constant.FlgAutoHandleStringType.ONE.getValue().equals(flgHandleSetting)) {
+                inOutRecordVO.setCanNegativeFlag(true);
+            }
+            //不可以
+            else{
+                inOutRecordVO.setCanNegativeFlag(false);
+            }
             //业务单据
             inOutRecordVO.setBiznisType(Constant.InventoryDocCode.OUTBOUND.getTableName());
             //业务单ID
@@ -186,22 +201,7 @@ public class InventoryService extends BaseService<Inventory> {
         if (inOutRecordVOList.size() == 0) {
             throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.DETAIL_LIST_IS_NUL.getMessage());
         }
-        //region  查询当前公司的系统参数  自动办理信息  并赋值
-        Map<String, Object> map = new HashMap<>();
-        map.put("cpId", inOutRecordVOList.get(0).getCpId());
-        map.put("code",Constant.SystemConstant.IVT_002.getValue());
-        //负数标识1
-        String flgHandleSetting = commonMapper.getSettingValue(map);
-        //endregion
         for (InOutRecordVO inventoryBatchVO : inOutRecordVOList) {
-            //负数标识1 可以
-            if (Constant.FlgAutoHandleStringType.ONE.getValue().equals(flgHandleSetting)) {
-                inventoryBatchVO.setCanNegativeFlag(true);
-            }
-            //不可以
-            else{
-                inventoryBatchVO.setCanNegativeFlag(false);
-            }
             //商品ID
             if (inventoryBatchVO.getSkuId() == null || "".equals(inventoryBatchVO.getSkuId())) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.SKU_IS_NULL.getMessage());
@@ -323,7 +323,6 @@ public class InventoryService extends BaseService<Inventory> {
         }
         //endregion
 
-
         //region  判断是库位调整还是其他类型操作库存然后走对应的逻辑
         //库位移动
         if (Constant.InventoryDocCode.MOVE.getValue().equals(inventoryDocCode)) {
@@ -358,6 +357,7 @@ public class InventoryService extends BaseService<Inventory> {
                 }
             }
             //endregion
+
             //region 删除
             else {
                 //入库
@@ -1122,6 +1122,7 @@ public class InventoryService extends BaseService<Inventory> {
             rollbackFor = {Exception.class}
     )
     public void updateInventoryMessageDelete(InventoryResponse inventoryResponse, InOutRecordVO inOutRecordVO) {
+
         //region  根据库存id查询库存批次明细 汇总金额
         List<InventoryBatchResponse> inventoryBatchResponseList = inventoryBatchMapper.selectAmountAndQuantity(new InventoryBatchQuery().setInvId(inventoryResponse.getInvId()));
         //库存资产汇总  ---库存需要
@@ -1348,7 +1349,6 @@ public class InventoryService extends BaseService<Inventory> {
                 inOutRecordMapper.deleteData(inOutRecord);
                 //endregion
 
-
                 //region   要把出库成本也删除
                 OutboundItemCost outboundItemCost = new OutboundItemCost();
                 //出库明细Id
@@ -1356,7 +1356,6 @@ public class InventoryService extends BaseService<Inventory> {
                 outboundItemCostMapper.deleteData(inOutRecord);
                 //endregion
 
-
                 //新建存货流水 一正一负
                 this.insertInboundRecord(inOutRecordVO);
                 //新建出库成本

+ 23 - 5
src/main/java/com/dk/mdm/service/report/ReportService.java

@@ -288,17 +288,35 @@ public class ReportService {
         return ResponseResultUtil.success(reportMapper.getSalesTrackingReportDetail(id) );
     }
 
+
     /**
-     * @desc   : 收发存汇总报
-     * @author : 宋扬
-     * @date   : 2024/4/20 13:30
+     * @desc   : 日结对账
+     * @date   : 2024/4/24 15:11
+     * @author : 寇珊珊
      */
-    public ResponseResultVO<PageList<Map<String, Object>>> getIvtSumReport(Map<String, Object> param) {
+    public ResponseResultVO<PageList<Map<String, Object>>> getDailyReconciliationReport(Map<String, Object> param) {
         // 校验分页参数
         if (param.get("pageSize") == null || param.get("currentPage") == null) {
             return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL, "请检查分页参数!");
         }
-//
+        // 定义返回值
+        PageList data = new PageList<>();
+        param.put("start", (Integer.parseInt(param.get("currentPage").toString()) - 1) * Integer.parseInt(param.get("pageSize").toString()));
+        param.put("end", Integer.parseInt(param.get("pageSize").toString()));
+        List<Map<String, Object>> dataList = reportMapper.getDailyReconciliationReport(param);
+        data.setList(dataList);
+        data.setTotal(reportMapper.getDailyReconciliationReportCount(param));
+        data.setPageSize((Integer) param.get("pageSize"));
+        data.setCurrentPage((Integer) param.get("currentPage"));
+        return ResponseResultUtil.success(data);
+    }
+
+    /**
+     * @desc   : 收发存汇总报表
+     * @author : 宋扬
+     * @date   : 2024/4/20 13:30
+     */
+    public ResponseResultVO<PageList<Map<String, Object>>> getIvtSumReport(Map<String, Object> param) {
         if (param.get("querys") != null) {
             JSONObject querys = JSONObject.parseObject(param.get("querys").toString());
             param.put("querys",querys);