瀏覽代碼

库存+日结报表

koushanshan 1 年之前
父節點
當前提交
ea29072bb6

+ 10 - 0
src/main/java/com/dk/mdm/controller/report/ReportController.java

@@ -124,6 +124,16 @@ public class ReportController  {
         return reportService.getSalesTrackingReportDetail(id);
     }
 
+    /**
+     * @desc   : 日结对账表
+     * @date   : 2024/4/24 15:10
+     * @author : 寇珊珊
+     */
+    @PostMapping("daily_reconciliation_report/{id}")
+    public ResponseResultVO<PageList<Map<String, Object>>> getDailyReconciliationReport(@RequestBody Map<String, Object> param) {
+        return reportService.getDailyReconciliationReport(param);
+    }
+
 }
 
 

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

@@ -109,4 +109,20 @@ public interface ReportMapper extends BaseMapper<JSONObject> {
 
     List<Map<String, Object>>  getPurTrackingReportDetail(@Param("id") String id);
 
+
+    /**
+     * @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);
+
 }

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

@@ -1481,4 +1481,72 @@
 
     </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>

+ 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);
                 //新建出库成本

+ 24 - 0
src/main/java/com/dk/mdm/service/report/ReportService.java

@@ -203,4 +203,28 @@ public class ReportService {
         return ResponseResultUtil.success(reportMapper.getSalesTrackingReportDetail(id) );
     }
 
+    
+    /**
+     * @desc   : 日结对账表
+     * @date   : 2024/4/24 15:11
+     * @author : 寇珊珊
+     */
+    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);
+    }
+
+
 }