Jelajahi Sumber

Merge branch 'master' of http://62.234.61.92:3000/wjm/mec-cloud_IntelligentManufacturing_CLIENT

lph 1 tahun lalu
induk
melakukan
569b5ea8e7
29 mengubah file dengan 1732 tambahan dan 1009 penghapusan
  1. 40 0
      zkqy-admin/src/main/java/com/zkqy/web/asd.json
  2. 1 0
      zkqy-admin/src/main/java/com/zkqy/web/controller/common/CommonFileController.java
  3. 31 0
      zkqy-custom-business/src/main/java/com/zkqy/business/atregulartime/zedaData/MasterbatchMachineHandle.java
  4. 12 7
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductOutboundRecordController.java
  5. 86 9
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleAccountsReceivableDetailController.java
  6. 28 35
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleOrderController.java
  7. 9 18
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleRegistrationCollectionController.java
  8. 1 1
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductInvoice.java
  9. 82 49
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductOutboundRecordBatch.java
  10. 324 218
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleAccountsReceivableDetail.java
  11. 187 145
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOrder.java
  12. 2 2
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOtherCollection.java
  13. 101 80
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleRegistrationCollection.java
  14. 31 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/NewOldProductCodeListVO.java
  15. 97 25
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleProductsVo.java
  16. 7 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductOutboundRecordBatchMapper.java
  17. 25 34
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleOrderMapper.java
  18. 10 9
      zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleAccountsReceivableDetailService.java
  19. 10 17
      zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleOrderService.java
  20. 192 69
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleAccountsReceivableDetailServiceImpl.java
  21. 154 110
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java
  22. 30 29
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleRegistrationCollectionServiceImpl.java
  23. 5 27
      zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml
  24. 70 42
      zkqy-custom-business/src/main/resources/mapper/business/ProductOutboundRecordBatchMapper.xml
  25. 1 0
      zkqy-custom-business/src/main/resources/mapper/business/ProductOutboundRecordMapper.xml
  26. 146 75
      zkqy-custom-business/src/main/resources/mapper/business/SaleAccountsReceivableDetailMapper.xml
  27. 47 5
      zkqy-custom-business/src/main/resources/mapper/business/SaleOrderMapper.xml
  28. 2 2
      zkqy-framework/src/main/java/com/zkqy/framework/sso_oauth2/controller/OauthController.java
  29. 1 1
      zkqy-framework/src/main/java/com/zkqy/framework/sso_oauth2/controller/ThirdPartLoginController.java

+ 40 - 0
zkqy-admin/src/main/java/com/zkqy/web/asd.json

@@ -0,0 +1,40 @@
+com.zkqy.business.domain.SaleAccountsReceivableDetail@682535c6[
+  id=<null>
+  accountingType=1
+  customerId=1
+  accountsReceivableDate=Thu Aug 01 00:00:00 CST 2024
+  saleNo=2024073180778
+  saleProductNo=<null>
+  productId=5590
+  productName=150D仿锦纶高弹
+  productSpecifications=150D
+  productLevel=AA
+  productColour=003雪花白
+  lotNumber=24-7-31
+  boxNum=3
+  weight=<null>
+  productPrice=<null>
+  amountReceivable=68.2
+  receivedAmount=0.0
+  amounts=<null>
+  paymentMethod=<null>
+  billingType=1
+  accountsReceivableRemark=<null>
+  settlementUnit=<null>
+  returnReceipt=0
+  returnReceiptDate=<null>
+  returnReceiptRemark=<null>
+  noticeNumber=20240731175442
+  status=1
+  spare1=<null>
+  spare2=<null>
+  spare3=<null>
+  remark=<null>
+  createBy=<null>
+  createById=<null>
+  createTime=<null>
+  updateBy=<null>
+  updateById=<null>
+  updateTime=<null>
+  delFlag=<null>
+]

+ 1 - 0
zkqy-admin/src/main/java/com/zkqy/web/controller/common/CommonFileController.java

@@ -74,6 +74,7 @@ public class CommonFileController {
     private static final String FILE_DELIMETER = ",";
 
     /**
+     * 共通导出
      * 通用导出excel
      */
     @Log(title = "动态表格", businessType = BusinessType.EXPORT)

+ 31 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/atregulartime/zedaData/MasterbatchMachineHandle.java

@@ -0,0 +1,31 @@
+package com.zkqy.business.atregulartime.zedaData;
+
+import com.zkqy.execution.produce.dispersed.service.ICommonService;
+import com.zkqy.system.service.ISysDictDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @author hanzihang
+ */
+public class MasterbatchMachineHandle {
+
+    // 字典
+    private ISysDictDataService iSysDictDataService;
+
+
+    // 共通service
+    private ICommonService iCommonService;
+
+
+
+}
+
+// 所需参数实体对应
+class MasterbatchMachineEntity {
+
+    private String machineId;
+
+    private String region;
+
+
+}

+ 12 - 7
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductOutboundRecordController.java

@@ -148,20 +148,24 @@ public class ProductOutboundRecordController extends BaseController {
         if (productHandsetOutboundRecord != null) {
             return AjaxResult.success("当前货品已在出库列表中,不能重复出库!", false);
         }
-        return success(true);
+        return AjaxResult.success("扫码成功!", productWarehousingRecord);
     }
 
     /**
      * 销售单/零售单出库明细记录
      */
     @GetMapping("/outboundDetails")
-    public TableDataInfo outboundDetails(@RequestParam String saleOrderNo) {
+    public TableDataInfo outboundDetails(String saleOrderNo, String productNo) {
         List<ProductCodeListVO> productCodeListVOS = new ArrayList<>();
         ////根据销售单编号查询通知单编号
         ProductInvoice productInvoice = productInvoiceService.selectProductInvoiceBySaleOrderNo(saleOrderNo);
         if (productInvoice != null) {
             startPage();
-            productCodeListVOS = productOutboundRecordService.outboundDetails(productInvoice.getNoticeNumber());
+            productOutboundRecordService.outboundDetails(productInvoice.getNoticeNumber()).forEach(item -> {
+                if (item.getProductNo().equals(productNo)) {
+                    productCodeListVOS.add(item);
+                }
+            });
         }
         return getDataTable(productCodeListVOS);
     }
@@ -174,20 +178,21 @@ public class ProductOutboundRecordController extends BaseController {
         ProductInvoice productInvoice = productInvoiceService.selectProductInvoiceBySaleOrderNo(saleOrderNo);
         if (productInvoice != null) {
             Map<String, Object> stringObjectMap = saleOrderService.selectSaleOrderByNo(productInvoice.getSaleOrderNo());
+            Map<String, Object> objectMap = (Map<String, Object>) stringObjectMap.get(saleOrderNo);
             startPage();
             productCodeListVOS = productOutboundRecordService.outboundDetails(productInvoice.getNoticeNumber());
             ExcelUtil<ProductCodeListVO> util = new ExcelUtil<ProductCodeListVO>(ProductCodeListVO.class);
             SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             Map<Integer, String> map = new HashMap<>();
             map.put(0, "客户名称:");
-            map.put(1, stringObjectMap.get("customName").toString());
+            map.put(1, objectMap.get("customName").toString());
             Map<Integer, String> map1 = new HashMap<>();
             map1.put(0, "通知单号:");
-            map1.put(1, stringObjectMap.get("saleNo").toString());
+            map1.put(1, objectMap.get("saleNo").toString());
             map1.put(2, "备注");
-            map1.put(3, stringObjectMap.get("dispatchNoteRemark").toString());
+            map1.put(3, objectMap.get("dispatchNoteRemark") != null ? objectMap.get("dispatchNoteRemark").toString() : "");
             map1.put(4, "出库日期");
-            map1.put(5, stringObjectMap.get("deliveryDate").toString().split("T")[0]);
+            map1.put(5, objectMap.get("deliveryDate").toString().split("T")[0]);
             List<Map<Integer, String>> mapList = new ArrayList<>();
             mapList.add(map);
             mapList.add(map1);

+ 86 - 9
zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleAccountsReceivableDetailController.java

@@ -1,15 +1,21 @@
 package com.zkqy.business.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.io.IOException;
+import java.util.*;
+import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.zkqy.business.domain.vo.FinishedProductInvoiceVo;
+import com.zkqy.common.utils.DateUtils;
 import com.zkqy.execution.produce.dispersed.entity.CommonEntity;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -29,6 +35,8 @@ import com.zkqy.business.service.ISaleAccountsReceivableDetailService;
 import com.zkqy.common.utils.poi.ExcelUtil;
 import com.zkqy.common.core.page.TableDataInfo;
 
+import static com.zkqy.common.utils.StringUtils.toCamelCase;
+
 /**
  * 应收帐明细Controller
  *
@@ -152,6 +160,7 @@ public class SaleAccountsReceivableDetailController extends BaseController {
 
     /**
      * 驳回
+     * 撤销登账 处理客户余额
      */
     @PostMapping("/reject")
     public AjaxResult reject(@RequestBody SaleAccountsReceivableDetail saleAccountsReceivableDetail) {
@@ -159,7 +168,7 @@ public class SaleAccountsReceivableDetailController extends BaseController {
     }
 
     /**
-     * 撤销登账
+     * 撤销登账(只处理订单)
      */
     @PostMapping("/cancelAccountEntry")
     public AjaxResult cancelAccountEntry(@RequestBody SaleAccountsReceivableDetail saleAccountsReceivableDetail) {
@@ -173,7 +182,7 @@ public class SaleAccountsReceivableDetailController extends BaseController {
     @Log(title = "动态应收帐明细", businessType = BusinessType.EXPORT)
     @PostMapping("/dynamicExport")
     @ApiOperation(value = "动态导出应收帐明细列表")
-    public void dynamicExport(HttpServletResponse response, CommonEntity commonEntity) {
+    public void dynamicExport(HttpServletResponse response, CommonEntity commonEntity) throws IOException {
         String exportType = commonEntity.getBasicMap().get("exportType").toString();
         List<SaleAccountsReceivableDetail> list = new ArrayList<>();
         switch (exportType) {
@@ -185,13 +194,81 @@ public class SaleAccountsReceivableDetailController extends BaseController {
                 break;
             case "checkOff":
                 //  勾选导出
-                list = (List<SaleAccountsReceivableDetail>) commonEntity.getResultMap().get("exportRow");
+                list = JSON.parseArray(commonEntity.getResultMap().get("exportRow").toString(), SaleAccountsReceivableDetail.class);
                 break;
         }
-        // 写入excel数据
+        // 得到当前列表状态字典值
+        Map<String, List<Map<String, Object>>> dictData = (Map<String, List<Map<String, Object>>>) JSON.parseObject(commonEntity.getBasicMap().get("dictTransform").toString(), Map.class);
 
-        ExcelUtil<SaleAccountsReceivableDetail> util = new ExcelUtil<SaleAccountsReceivableDetail>(SaleAccountsReceivableDetail.class);
-        util.exportExcel(response, list, "应收帐明细数据");
+
+        // 处理excel标头
+        JSONArray headerJson = JSON.parseArray(commonEntity.getExeclMap().toString());
+
+
+        // 标头信息
+//        Map<String, String> headerMap = new HashMap<>();
+//        headerJson.forEach(item -> {
+//            Map<String, String> objectMap = (Map<String, String>) item;
+//            headerMap.putAll(objectMap);
+//        });
+
+        // 创建Excel文档
+        XSSFWorkbook workbook = new XSSFWorkbook();
+        XSSFSheet sheet = workbook.createSheet("Sheet1");
+        //标题
+        List<String> titleList = new ArrayList<>();
+        //字段
+        List<String> fieldList = new ArrayList<>();
+        headerJson.forEach(item -> {
+            Map<String, String> objectMap = (Map<String, String>) item;
+            objectMap.forEach((k, v) -> {
+                fieldList.add(k.replace("@", "_"));
+                titleList.add(v == null ? "" : v);
+            });
+        });
+
+//        for (Map.Entry<String, String> entry : headerJson) {
+//            fieldList.add(entry.getKey().replace("@", "_"));
+//            titleList.add(entry.getValue() == null ? "" : entry.getValue());
+//        }
+
+        // 创建表头
+        XSSFRow header = sheet.createRow(0);
+        for (int q = 0; q < titleList.size(); q++) {
+            header.createCell(q).setCellValue(titleList.get(q));
+        }
+        int rowIndex = 1;
+        List<Map<String, Object>> listMap = new ArrayList<>();
+        String listJson = JSON.toJSONString(list);
+        listMap = JSON.parseObject(listJson, List.class);
+
+        // 列表数据对应字典值
+        listMap.forEach(item -> {
+            dictData.forEach((k, v) -> {
+                dictData.get(k).forEach(dtem -> {
+                    if (dtem.get("value").equals(item.get(k))) {
+                        item.put(k, dtem.get("label"));
+                    }
+                });
+            });
+        });
+
+
+        //获取列表信息
+        for (int w = 0; w < listMap.size(); w++) {
+            XSSFRow row = sheet.createRow(rowIndex++);
+            for (int e = 0; e < fieldList.size(); e++) {
+                Object val = listMap.get(w).get(toCamelCase(fieldList.get(e)));
+                row.createCell(e).setCellValue((val == null ? "" : val).toString());
+            }
+        }
+        response.setContentType("application/vnd.ms-excel");
+        response.setHeader("Content-Disposition", "attachment; filename=" + DateUtils.dateTimeNow() + ".xlsx");
+        // 将Excel文档写入响应流中
+        ServletOutputStream outputStream = response.getOutputStream();
+        workbook.write(outputStream);
+        outputStream.flush();
+        outputStream.close();
     }
 
 }

+ 28 - 35
zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleOrderController.java

@@ -140,7 +140,7 @@ public class SaleOrderController extends BaseController {
      * 销售单/零售单列表--权限过滤
      */
     @GetMapping("/saleOrderList")
-    public TableDataInfo saleOrderList(SaleOrder saleOrder){
+    public TableDataInfo saleOrderList(SaleOrder saleOrder) {
         startPage();
         List<SaleOrderVO> list = saleOrderService.saleOrderList(saleOrder);
         System.err.println(saleOrder);
@@ -210,8 +210,7 @@ public class SaleOrderController extends BaseController {
      * 修改订单
      */
     @PutMapping("/updateOrder")
-    public AjaxResult updateOrder(@RequestBody SaleOrder saleOrder)
-    {
+    public AjaxResult updateOrder(@RequestBody SaleOrder saleOrder) {
         return toAjax(saleOrderService.updateOrder(saleOrder));
     }
 
@@ -219,7 +218,7 @@ public class SaleOrderController extends BaseController {
      * 外协订单列表
      */
     @GetMapping("/outsourceOrderList")
-    public TableDataInfo outsourceOrderList(SaleOrder saleOrder){
+    public TableDataInfo outsourceOrderList(SaleOrder saleOrder) {
         startPage();
         List<SaleOrderVO> list = saleOrderService.outsourceOrderList(saleOrder);
         return getDataTable(list);
@@ -271,39 +270,36 @@ public class SaleOrderController extends BaseController {
      * 打印出库单列表
      */
     @GetMapping("/printOutsourceOrderList")
-    public AjaxResult printOutsourceOrderList(@RequestParam String saleNo){
-        return AjaxResult.success(saleOrderService.printOutsourceOrderList(saleNo));
+    public AjaxResult printOutsourceOrderList(@RequestParam String saleNo) {
+        return AjaxResult.success(saleOrderService.printOutsourceOrderList(saleNo, ""));
     }
 
+
     /**
-     * 销售出库单打印接口
+     * 记录批次-新增应收明细-》当前订单阶段性结束
      */
     @PostMapping("/printOutsourceOrder")
-    public AjaxResult printOutsourceOrder(@RequestBody List<SaleAccountsReceivableDetail> saleAccountsReceivableDetailList){
-        return toAjax(saleOrderService.printOutsourceOrder(saleAccountsReceivableDetailList));
+    public AjaxResult printOutsourceOrder(@RequestBody List<SaleAccountsReceivableDetail> saleAccountsReceivableDetailList) {
+        return toAjax(saleOrderService.recordBatch(saleAccountsReceivableDetailList));
     }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+    /**
+     * 订单重新登账
+     *
+     * @param saleAccountsReceivableDetail 应收明细参数
+     * @return
+     */
+    @PostMapping("/againRecordBatch")
+    public AjaxResult againRecordBatch(@RequestBody SaleAccountsReceivableDetail saleAccountsReceivableDetail) {
+        return toAjax(saleOrderService.againRecordBatch(saleAccountsReceivableDetail));
+    }
 
 
     /**
      * 查询销售单下单前10名客户信息单据数量货品总量
      */
     @GetMapping("/saleOrderTop10List")
-    public AjaxResult saleOrderTop10List(){
+    public AjaxResult saleOrderTop10List() {
         return AjaxResult.success(saleOrderService.saleOrderTop10List());
     }
 
@@ -311,7 +307,7 @@ public class SaleOrderController extends BaseController {
      * 统计客户单量和每个货品的数量月、季度、年度进行筛选,默认年度
      */
     @PostMapping("/customerOrderStatistics")
-    public AjaxResult customerOrderStatistics(@RequestBody Map<String,Object> map){
+    public AjaxResult customerOrderStatistics(@RequestBody Map<String, Object> map) {
         return AjaxResult.success(saleOrderService.customerStatistics(map));
     }
 
@@ -319,7 +315,7 @@ public class SaleOrderController extends BaseController {
      * 按品钟查询已售货品数量最多得产品、年-月-日-季度筛选
      */
     @PostMapping("/mostItemsSold")
-    public AjaxResult mostItemsSold(@RequestBody Map<String,Object> map){
+    public AjaxResult mostItemsSold(@RequestBody Map<String, Object> map) {
         return AjaxResult.success(saleOrderService.mostItemsSold(map));
     }
 
@@ -327,15 +323,15 @@ public class SaleOrderController extends BaseController {
      * 统计各销售员当月销售单量和单据货品总数量可选择日、月、季度、年度进行筛选
      */
     @PostMapping("/saleOrderCountBySalesman")
-    public AjaxResult saleOrderCountBySalesman(@RequestBody Map<String,Object> map){
-        return AjaxResult.success(saleOrderService.saleOrderCountBySalesman(map,getTenantId()));
+    public AjaxResult saleOrderCountBySalesman(@RequestBody Map<String, Object> map) {
+        return AjaxResult.success(saleOrderService.saleOrderCountBySalesman(map, getTenantId()));
     }
 
     /**
      * 销售品类占比  各个已销售的产品中各类产品的占用百分比
      */
     @GetMapping("/productPercentage")
-    public AjaxResult productPercentage(){
+    public AjaxResult productPercentage() {
         return AjaxResult.success(saleOrderService.productPercentage());
     }
 
@@ -343,7 +339,7 @@ public class SaleOrderController extends BaseController {
      * 销售统计(产销比例)已销售的产品和生产产品的比较、可选择日、月、季度、年度进行筛选
      */
     @PostMapping("/productionMarketingRatio")
-    public AjaxResult productionMarketingRatio(@RequestBody Map<String,Object> map){
+    public AjaxResult productionMarketingRatio(@RequestBody Map<String, Object> map) {
         return AjaxResult.success(saleOrderService.productionMarketingRatio(map));
     }
 
@@ -351,7 +347,7 @@ public class SaleOrderController extends BaseController {
      * 销售排行   按时间可以进行查询、默认当月、可选择日、月、季度、年度进行筛选
      */
     @PostMapping("/saleOrderRanking")
-    public AjaxResult saleOrderRanking(@RequestBody Map<String,Object> map){
+    public AjaxResult saleOrderRanking(@RequestBody Map<String, Object> map) {
         return AjaxResult.success(saleOrderService.saleOrderRanking(map));
     }
 
@@ -359,12 +355,9 @@ public class SaleOrderController extends BaseController {
      * 当月快销产品统计、可选择日、月、季度、年度进行筛选
      */
     @PostMapping("/fastSellingProduct")
-    public AjaxResult fastSellingProduct(@RequestBody Map<String,Object> map){
+    public AjaxResult fastSellingProduct(@RequestBody Map<String, Object> map) {
         return AjaxResult.success(saleOrderService.fastSellingProduct(map));
     }
 
 
-
-
-
 }

+ 9 - 18
zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleRegistrationCollectionController.java

@@ -34,8 +34,7 @@ import com.zkqy.common.core.page.TableDataInfo;
 @RestController
 @RequestMapping("/system/SaleRegistrationCollection")
 @Api(value = "/system/SaleRegistrationCollection", description = "收款登记-接口")
-public class SaleRegistrationCollectionController extends BaseController
-{
+public class SaleRegistrationCollectionController extends BaseController {
     @Autowired
     private ISaleRegistrationCollectionService saleRegistrationCollectionService;
 
@@ -45,8 +44,7 @@ public class SaleRegistrationCollectionController extends BaseController
     //@PreAuthorize("@ss.hasPermi('system:SaleRegistrationCollection:list')")
     @GetMapping("/list")
     @ApiOperation(value = "查询收款登记列表")
-    public TableDataInfo list(SaleRegistrationCollection saleRegistrationCollection)
-    {
+    public TableDataInfo list(SaleRegistrationCollection saleRegistrationCollection) {
         startPage();
         List<SaleRegistrationCollectionVo> list = saleRegistrationCollectionService.selectRegistrationCollectionList(saleRegistrationCollection);
         return getDataTable(list);
@@ -59,8 +57,7 @@ public class SaleRegistrationCollectionController extends BaseController
     @Log(title = "收款登记", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ApiOperation(value = "导出收款登记列表")
-    public void export(HttpServletResponse response, SaleRegistrationCollection saleRegistrationCollection)
-    {
+    public void export(HttpServletResponse response, SaleRegistrationCollection saleRegistrationCollection) {
         List<SaleRegistrationCollection> list = saleRegistrationCollectionService.selectSaleRegistrationCollectionList(saleRegistrationCollection);
         ExcelUtil<SaleRegistrationCollection> util = new ExcelUtil<SaleRegistrationCollection>(SaleRegistrationCollection.class);
         util.exportExcel(response, list, "收款登记数据");
@@ -72,8 +69,7 @@ public class SaleRegistrationCollectionController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:SaleRegistrationCollection:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取收款登记详细信息")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(saleRegistrationCollectionService.selectSaleRegistrationCollectionById(id));
     }
 
@@ -84,8 +80,7 @@ public class SaleRegistrationCollectionController extends BaseController
     @Log(title = "收款登记", businessType = BusinessType.INSERT)
     @PostMapping
     @ApiOperation(value = "新增收款登记")
-    public AjaxResult add(@RequestBody SaleRegistrationCollection saleRegistrationCollection)
-    {
+    public AjaxResult add(@RequestBody SaleRegistrationCollection saleRegistrationCollection) {
         return toAjax(saleRegistrationCollectionService.insertSaleRegistrationCollection(saleRegistrationCollection));
     }
 
@@ -96,8 +91,7 @@ public class SaleRegistrationCollectionController extends BaseController
     @Log(title = "收款登记", businessType = BusinessType.UPDATE)
     @PutMapping
     @ApiOperation(value = "修改收款登记")
-    public AjaxResult edit(@RequestBody SaleRegistrationCollection saleRegistrationCollection)
-    {
+    public AjaxResult edit(@RequestBody SaleRegistrationCollection saleRegistrationCollection) {
         return toAjax(saleRegistrationCollectionService.updateSaleRegistrationCollection(saleRegistrationCollection));
     }
 
@@ -108,20 +102,17 @@ public class SaleRegistrationCollectionController extends BaseController
     @Log(title = "收款登记", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "删除收款登记")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(saleRegistrationCollectionService.deleteSaleRegistrationCollectionByIds(ids));
     }
 
     /**
-     * 审核通过接口
+     * 收款登记审核接口
      */
     @PostMapping("/audit")
-    public AjaxResult audit(@RequestBody SaleRegistrationCollection saleRegistrationCollection){
+    public AjaxResult audit(@RequestBody SaleRegistrationCollection saleRegistrationCollection) {
         return toAjax(saleRegistrationCollectionService.audit(saleRegistrationCollection));
     }
 
 
-
-
 }

+ 1 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductInvoice.java

@@ -115,7 +115,7 @@ public class ProductInvoice extends BaseEntity {
     private String auditOpinion;
 
     /**
-     * 状态
+     * 状态(1:待出库,2已出库)
      */
     @Excel(name = "状态")
     private String status;

+ 82 - 49
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductOutboundRecordBatch.java

@@ -7,115 +7,148 @@ import com.zkqy.common.annotation.Excel;
 
 /**
  * 成品出库记录批次对象 product_outbound_record_batch
- * 
+ *
  * @author zkqy
  * @date 2024-06-28
  */
-public class ProductOutboundRecordBatch extends BaseEntity
-{
+public class ProductOutboundRecordBatch extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 主键 */
+    /**
+     * 主键
+     */
     private Long id;
 
-    /** 销售单号 */
+    /**
+     * 销售单号
+     */
     @Excel(name = "销售单号")
     private String saleNo;
 
-    /** 通知单号 */
+    /**
+     * 通知单号
+     */
     @Excel(name = "通知单号")
     private String noticeNumber;
 
-    /** 出库记录编号 */
+    /**
+     * 出库记录编号
+     */
     @Excel(name = "出库记录编号")
     private Long outboundRecordId;
 
-    /** 批次数 */
+    /**
+     * 批次数
+     */
     @Excel(name = "批次数")
     private Long batchNumber;
 
-    /** 创建者ID */
+    /**
+     * 批次状态 默认0
+     * 0正常、1撤销登账
+     */
+    private char batchState;
+
+    /**
+     * 创建者ID
+     */
     private Long createById;
 
-    /** 删除标志(0:否;2:是) */
+    /**
+     * 删除标志(0:否;2:是)
+     */
     private String delFlag;
 
-    public void setId(Long id) 
-    {
+    /**
+     * 出库单IDS
+     */
+    private String outboundRecordIds;
+
+    public String getOutboundRecordIds() {
+        return outboundRecordIds;
+    }
+
+    public void setOutboundRecordIds(String outboundRecordIds) {
+        this.outboundRecordIds = outboundRecordIds;
+    }
+
+    public char getBatchState() {
+        return batchState;
+    }
+
+    public void setBatchState(char batchState) {
+        this.batchState = batchState;
+    }
+
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setSaleNo(String saleNo) 
-    {
+
+    public void setSaleNo(String saleNo) {
         this.saleNo = saleNo;
     }
 
-    public String getSaleNo() 
-    {
+    public String getSaleNo() {
         return saleNo;
     }
-    public void setNoticeNumber(String noticeNumber) 
-    {
+
+    public void setNoticeNumber(String noticeNumber) {
         this.noticeNumber = noticeNumber;
     }
 
-    public String getNoticeNumber() 
-    {
+    public String getNoticeNumber() {
         return noticeNumber;
     }
-    public void setOutboundRecordId(Long outboundRecordId) 
-    {
+
+    public void setOutboundRecordId(Long outboundRecordId) {
         this.outboundRecordId = outboundRecordId;
     }
 
-    public Long getOutboundRecordId() 
-    {
+    public Long getOutboundRecordId() {
         return outboundRecordId;
     }
-    public void setBatchNumber(Long batchNumber) 
-    {
+
+    public void setBatchNumber(Long batchNumber) {
         this.batchNumber = batchNumber;
     }
 
-    public Long getBatchNumber() 
-    {
+    public Long getBatchNumber() {
         return batchNumber;
     }
-    public void setCreateById(Long createById) 
-    {
+
+    public void setCreateById(Long createById) {
         this.createById = createById;
     }
 
-    public Long getCreateById() 
-    {
+    public Long getCreateById() {
         return createById;
     }
-    public void setDelFlag(String delFlag) 
-    {
+
+    public void setDelFlag(String delFlag) {
         this.delFlag = delFlag;
     }
 
-    public String getDelFlag() 
-    {
+    public String getDelFlag() {
         return delFlag;
     }
 
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("saleNo", getSaleNo())
-            .append("noticeNumber", getNoticeNumber())
-            .append("outboundRecordId", getOutboundRecordId())
-            .append("batchNumber", getBatchNumber())
-            .append("createBy", getCreateBy())
-            .append("createById", getCreateById())
-            .append("createTime", getCreateTime())
-            .append("delFlag", getDelFlag())
-            .toString();
+        final StringBuilder sb = new StringBuilder("ProductOutboundRecordBatch{");
+        sb.append("id=").append(id);
+        sb.append(", saleNo='").append(saleNo).append('\'');
+        sb.append(", noticeNumber='").append(noticeNumber).append('\'');
+        sb.append(", outboundRecordId=").append(outboundRecordId);
+        sb.append(", batchNumber=").append(batchNumber);
+        sb.append(", batchState=").append(batchState);
+        sb.append(", createById=").append(createById);
+        sb.append(", delFlag='").append(delFlag).append('\'');
+        sb.append('}');
+        return sb.toString();
     }
 }

+ 324 - 218
zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleAccountsReceivableDetail.java

@@ -1,6 +1,7 @@
 package com.zkqy.business.domain;
 
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.zkqy.common.core.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -9,180 +10,319 @@ import com.zkqy.common.annotation.Excel;
 
 /**
  * 应收帐明细对象 sale_accounts_receivable_detail
- * 
+ *
  * @author zkqy
  * @date 2024-06-27
  */
-public class SaleAccountsReceivableDetail extends BaseEntity
-{
+public class SaleAccountsReceivableDetail extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 编号 */
+    /**
+     * 编号
+     */
     private Long id;
 
-    /** 账务类型 */
+    /**
+     * 账务类型
+     * // 销售应收 1
+     * // 收款  2
+     * // 其他应收 3
+     * // 贴息  4
+     */
     @Excel(name = "账务类型")
     private String accountingType;
 
-    /** 客户编号 */
+    /**
+     * 客户编号
+     */
     @Excel(name = "客户编号")
     private Long customerId;
 
     //客户名称
     private String customName;
 
-    /** 应收帐日期 */
+    /**
+     * 应收帐日期
+     */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "应收帐日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date accountsReceivableDate;
 
-    /** 销售单号 */
+    /**
+     * 销售单号
+     */
     @Excel(name = "销售单号")
     private String saleNo;
 
-    /** 销售产品编号 */
+    /**
+     * 销售产品编号
+     */
     @Excel(name = "销售产品编号")
     private String saleProductNo;
 
-    /** 收款登记编号 */
+    /**
+     * 收款登记编号
+     */
     private Long registrationCollectionId;
 
-    /** 产品编号 */
+    /**
+     * 产品编号
+     */
     @Excel(name = "产品编号")
     private Long productId;
 
-    /** 产品名称 */
+    /**
+     * 产品名称
+     */
     @Excel(name = "产品名称")
     private String productName;
 
-    /** 产品规格 */
+    /**
+     * 产品规格
+     */
     @Excel(name = "产品规格")
     private String productSpecifications;
 
-    /** 产品等级 */
+    /**
+     * 产品等级
+     */
     @Excel(name = "产品等级")
     private String productLevel;
 
-    /** 产品颜色 */
+    /**
+     * 产品颜色
+     */
     @Excel(name = "产品颜色")
     private String productColour;
 
-    /** 批号 */
+    /**
+     * 批号
+     */
     @Excel(name = "批号")
     private String lotNumber;
 
-    /** 箱数 */
+    /**
+     * 箱数
+     */
     @Excel(name = "箱数")
     private Long boxNum;
 
-    /** 重量 */
+    /**
+     * 重量
+     */
     @Excel(name = "重量")
     private Double weight;
 
-    /** 产品单价 */
+    /**
+     * 产品单价
+     */
     @Excel(name = "产品单价")
     private Double productPrice;
 
-    /** 应收金额 */
+    /**
+     * 应收金额
+     */
     @Excel(name = "应收金额")
     private Double amountReceivable;
 
-    /** 已收金额 */
+    /**
+     * 已收金额
+     */
     @Excel(name = "已收金额")
     private Double receivedAmount;
 
-    /** 金额 */
-    @Excel(name = "金额")
+    /**
+     * 金额(当前还剩余多少钱)
+     */
+    @Excel(name = "金额(当前还剩余多少钱)")
     private Double amounts;
 
-    /** 付款方式 */
+    /**
+     * 付款方式
+     */
     @Excel(name = "付款方式")
     private String paymentMethod;
 
-    /** 开票类型 */
+    /**
+     * 开票类型
+     */
     @Excel(name = "开票类型")
     private String billingType;
 
-    /** 应收帐备注 */
+    /**
+     * 应收帐备注
+     */
     @Excel(name = "应收帐备注")
     private String accountsReceivableRemark;
 
-    /** 结算单位 */
+    /**
+     * 结算单位
+     */
     @Excel(name = "结算单位")
     private Long settlementUnit;
 
     //结算单位名称
     private String settlementUnitName;
 
-    /** 回单 */
+    /**
+     * 回单
+     */
     @Excel(name = "回单")
     private String returnReceipt;
 
-    /** 回单日期 */
+    /**
+     * 回单日期
+     */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "回单日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date returnReceiptDate;
 
-    /** 回单备注 */
+    /**
+     * 回单备注
+     */
     @Excel(name = "回单备注")
     private String returnReceiptRemark;
 
-    /** 通知单号 */
+    /**
+     * 通知单号
+     */
     @Excel(name = "通知单号")
     private String noticeNumber;
 
-    /** 状态 */
+    /**
+     * 状态
+     */
     @Excel(name = "状态")
     private String status;
 
-    /** 备用列1 */
+    /**
+     * 备用列1
+     */
     @Excel(name = "备用列1")
     private String spare1;
 
-    /** 备用列2 */
+    /**
+     * 备用列2
+     */
     @Excel(name = "备用列2")
     private String spare2;
 
-    /** 备用列3 */
+    /**
+     * 备用列3
+     */
     @Excel(name = "备用列3")
     private String spare3;
 
-    /** 创建者ID */
+    /**
+     * 创建者ID
+     */
     private Long createById;
 
-    /** 更新者ID */
+    /**
+     * 更新者ID
+     */
     private Long updateById;
 
-    /** 删除标志(0:否;2:是) */
+    /**
+     * 删除标志(0:否;2:是)
+     */
     private String delFlag;
 
-    /** 开票标志(0:否;1:是) */
+    /**
+     * 开票标志(0:否;1:是)
+     */
     private String billingFlag;
 
-    /** 开始时间 */
+    /**
+     * 开始时间
+     */
     private String startTime;
 
-    /** 结束时间 */
+    /**
+     * 结束时间
+     */
     private String endTime;
 
     // 发票登记编号
     private Long finishedProductInvoiceId;
 
-    /** 发票号 */
+    /**
+     * 发票号
+     */
     private String invoiceNumber;
 
-    /** 发票类型 */
+    /**
+     * 发票类型
+     */
     private String invoiceType;
 
-    /** 贴息金额 */
+    /**
+     * 贴息金额
+     */
     private Double interestSubsidy;
 
-    /** 其他收款编号 */
+    /**
+     * 其他收款编号
+     */
     private Long otherCollectionId;
 
-    /** 批次 */
+    /**
+     * 批次
+     */
     private Long batchNumber;
 
+    /**
+     * 原数据ID
+     */
+    private String dataId;
+
+    /**
+     * 数据条顺序
+     */
+    private String orderBy;
+
+    /**
+     * 批次记录ID
+     */
+    private String batchId;
+
+    /**
+     * 是否修改订单状态
+     */
+    private boolean isOrderUpdate;
+
+    public boolean isOrderUpdate() {
+        return isOrderUpdate;
+    }
+
+    public void setOrderUpdate(boolean orderUpdate) {
+        isOrderUpdate = orderUpdate;
+    }
+
+    public String getBatchId() {
+        return batchId;
+    }
+
+    public void setBatchId(String batchId) {
+        this.batchId = batchId;
+    }
+
+    public String getOrderBy() {
+        return orderBy;
+    }
+
+    public void setOrderBy(String orderBy) {
+        this.orderBy = orderBy;
+    }
+
+    public String getDataId() {
+        return dataId;
+    }
+
+    public void setDataId(String dataId) {
+        this.dataId = dataId;
+    }
+
     public Long getBatchNumber() {
         return batchNumber;
     }
@@ -279,345 +419,311 @@ public class SaleAccountsReceivableDetail extends BaseEntity
         this.registrationCollectionId = registrationCollectionId;
     }
 
-    public void setId(Long id)
-    {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setAccountingType(String accountingType) 
-    {
+
+    public void setAccountingType(String accountingType) {
         this.accountingType = accountingType;
     }
 
-    public String getAccountingType() 
-    {
+    public String getAccountingType() {
         return accountingType;
     }
-    public void setCustomerId(Long customerId) 
-    {
+
+    public void setCustomerId(Long customerId) {
         this.customerId = customerId;
     }
 
-    public Long getCustomerId() 
-    {
+    public Long getCustomerId() {
         return customerId;
     }
-    public void setAccountsReceivableDate(Date accountsReceivableDate) 
-    {
+
+    public void setAccountsReceivableDate(Date accountsReceivableDate) {
         this.accountsReceivableDate = accountsReceivableDate;
     }
 
-    public Date getAccountsReceivableDate() 
-    {
+    public Date getAccountsReceivableDate() {
         return accountsReceivableDate;
     }
-    public void setSaleNo(String saleNo) 
-    {
+
+    public void setSaleNo(String saleNo) {
         this.saleNo = saleNo;
     }
 
-    public String getSaleNo() 
-    {
+    public String getSaleNo() {
         return saleNo;
     }
-    public void setSaleProductNo(String saleProductNo) 
-    {
+
+    public void setSaleProductNo(String saleProductNo) {
         this.saleProductNo = saleProductNo;
     }
 
-    public String getSaleProductNo() 
-    {
+    public String getSaleProductNo() {
         return saleProductNo;
     }
-    public void setProductId(Long productId) 
-    {
+
+    public void setProductId(Long productId) {
         this.productId = productId;
     }
 
-    public Long getProductId() 
-    {
+    public Long getProductId() {
         return productId;
     }
-    public void setProductName(String productName) 
-    {
+
+    public void setProductName(String productName) {
         this.productName = productName;
     }
 
-    public String getProductName() 
-    {
+    public String getProductName() {
         return productName;
     }
-    public void setProductSpecifications(String productSpecifications) 
-    {
+
+    public void setProductSpecifications(String productSpecifications) {
         this.productSpecifications = productSpecifications;
     }
 
-    public String getProductSpecifications() 
-    {
+    public String getProductSpecifications() {
         return productSpecifications;
     }
-    public void setProductLevel(String productLevel) 
-    {
+
+    public void setProductLevel(String productLevel) {
         this.productLevel = productLevel;
     }
 
-    public String getProductLevel() 
-    {
+    public String getProductLevel() {
         return productLevel;
     }
-    public void setProductColour(String productColour) 
-    {
+
+    public void setProductColour(String productColour) {
         this.productColour = productColour;
     }
 
-    public String getProductColour() 
-    {
+    public String getProductColour() {
         return productColour;
     }
-    public void setLotNumber(String lotNumber) 
-    {
+
+    public void setLotNumber(String lotNumber) {
         this.lotNumber = lotNumber;
     }
 
-    public String getLotNumber() 
-    {
+    public String getLotNumber() {
         return lotNumber;
     }
-    public void setBoxNum(Long boxNum) 
-    {
+
+    public void setBoxNum(Long boxNum) {
         this.boxNum = boxNum;
     }
 
-    public Long getBoxNum() 
-    {
+    public Long getBoxNum() {
         return boxNum;
     }
-    public void setWeight(Double weight)
-    {
+
+    public void setWeight(Double weight) {
         this.weight = weight;
     }
 
-    public Double getWeight()
-    {
+    public Double getWeight() {
         return weight;
     }
-    public void setProductPrice(Double productPrice)
-    {
+
+    public void setProductPrice(Double productPrice) {
         this.productPrice = productPrice;
     }
 
-    public Double getProductPrice()
-    {
+    public Double getProductPrice() {
         return productPrice;
     }
-    public void setAmountReceivable(Double amountReceivable)
-    {
+
+    public void setAmountReceivable(Double amountReceivable) {
         this.amountReceivable = amountReceivable;
     }
 
-    public Double getAmountReceivable()
-    {
+    public Double getAmountReceivable() {
         return amountReceivable;
     }
-    public void setReceivedAmount(Double receivedAmount)
-    {
+
+    public void setReceivedAmount(Double receivedAmount) {
         this.receivedAmount = receivedAmount;
     }
 
-    public Double getReceivedAmount()
-    {
+    public Double getReceivedAmount() {
         return receivedAmount;
     }
-    public void setAmounts(Double amounts)
-    {
+
+    public void setAmounts(Double amounts) {
         this.amounts = amounts;
     }
 
-    public Double getAmounts()
-    {
+    public Double getAmounts() {
         return amounts;
     }
-    public void setPaymentMethod(String paymentMethod) 
-    {
+
+    public void setPaymentMethod(String paymentMethod) {
         this.paymentMethod = paymentMethod;
     }
 
-    public String getPaymentMethod() 
-    {
+    public String getPaymentMethod() {
         return paymentMethod;
     }
-    public void setBillingType(String billingType) 
-    {
+
+    public void setBillingType(String billingType) {
         this.billingType = billingType;
     }
 
-    public String getBillingType() 
-    {
+    public String getBillingType() {
         return billingType;
     }
-    public void setAccountsReceivableRemark(String accountsReceivableRemark) 
-    {
+
+    public void setAccountsReceivableRemark(String accountsReceivableRemark) {
         this.accountsReceivableRemark = accountsReceivableRemark;
     }
 
-    public String getAccountsReceivableRemark() 
-    {
+    public String getAccountsReceivableRemark() {
         return accountsReceivableRemark;
     }
-    public void setSettlementUnit(Long settlementUnit)
-    {
+
+    public void setSettlementUnit(Long settlementUnit) {
         this.settlementUnit = settlementUnit;
     }
 
-    public Long getSettlementUnit()
-    {
+    public Long getSettlementUnit() {
         return settlementUnit;
     }
-    public void setReturnReceipt(String returnReceipt) 
-    {
+
+    public void setReturnReceipt(String returnReceipt) {
         this.returnReceipt = returnReceipt;
     }
 
-    public String getReturnReceipt() 
-    {
+    public String getReturnReceipt() {
         return returnReceipt;
     }
-    public void setReturnReceiptDate(Date returnReceiptDate) 
-    {
+
+    public void setReturnReceiptDate(Date returnReceiptDate) {
         this.returnReceiptDate = returnReceiptDate;
     }
 
-    public Date getReturnReceiptDate() 
-    {
+    public Date getReturnReceiptDate() {
         return returnReceiptDate;
     }
-    public void setReturnReceiptRemark(String returnReceiptRemark) 
-    {
+
+    public void setReturnReceiptRemark(String returnReceiptRemark) {
         this.returnReceiptRemark = returnReceiptRemark;
     }
 
-    public String getReturnReceiptRemark() 
-    {
+    public String getReturnReceiptRemark() {
         return returnReceiptRemark;
     }
-    public void setNoticeNumber(String noticeNumber) 
-    {
+
+    public void setNoticeNumber(String noticeNumber) {
         this.noticeNumber = noticeNumber;
     }
 
-    public String getNoticeNumber() 
-    {
+    public String getNoticeNumber() {
         return noticeNumber;
     }
-    public void setStatus(String status) 
-    {
+
+    public void setStatus(String status) {
         this.status = status;
     }
 
-    public String getStatus() 
-    {
+    public String getStatus() {
         return status;
     }
-    public void setSpare1(String spare1) 
-    {
+
+    public void setSpare1(String spare1) {
         this.spare1 = spare1;
     }
 
-    public String getSpare1() 
-    {
+    public String getSpare1() {
         return spare1;
     }
-    public void setSpare2(String spare2) 
-    {
+
+    public void setSpare2(String spare2) {
         this.spare2 = spare2;
     }
 
-    public String getSpare2() 
-    {
+    public String getSpare2() {
         return spare2;
     }
-    public void setSpare3(String spare3) 
-    {
+
+    public void setSpare3(String spare3) {
         this.spare3 = spare3;
     }
 
-    public String getSpare3() 
-    {
+    public String getSpare3() {
         return spare3;
     }
-    public void setCreateById(Long createById) 
-    {
+
+    public void setCreateById(Long createById) {
         this.createById = createById;
     }
 
-    public Long getCreateById() 
-    {
+    public Long getCreateById() {
         return createById;
     }
-    public void setUpdateById(Long updateById) 
-    {
+
+    public void setUpdateById(Long updateById) {
         this.updateById = updateById;
     }
 
-    public Long getUpdateById() 
-    {
+    public Long getUpdateById() {
         return updateById;
     }
-    public void setDelFlag(String delFlag) 
-    {
+
+    public void setDelFlag(String delFlag) {
         this.delFlag = delFlag;
     }
 
-    public String getDelFlag() 
-    {
+    public String getDelFlag() {
         return delFlag;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("accountingType", getAccountingType())
-            .append("customerId", getCustomerId())
-            .append("accountsReceivableDate", getAccountsReceivableDate())
-            .append("saleNo", getSaleNo())
-            .append("saleProductNo", getSaleProductNo())
-            .append("productId", getProductId())
-            .append("productName", getProductName())
-            .append("productSpecifications", getProductSpecifications())
-            .append("productLevel", getProductLevel())
-            .append("productColour", getProductColour())
-            .append("lotNumber", getLotNumber())
-            .append("boxNum", getBoxNum())
-            .append("weight", getWeight())
-            .append("productPrice", getProductPrice())
-            .append("amountReceivable", getAmountReceivable())
-            .append("receivedAmount", getReceivedAmount())
-            .append("amounts", getAmounts())
-            .append("paymentMethod", getPaymentMethod())
-            .append("billingType", getBillingType())
-            .append("accountsReceivableRemark", getAccountsReceivableRemark())
-            .append("settlementUnit", getSettlementUnit())
-            .append("returnReceipt", getReturnReceipt())
-            .append("returnReceiptDate", getReturnReceiptDate())
-            .append("returnReceiptRemark", getReturnReceiptRemark())
-            .append("noticeNumber", getNoticeNumber())
-            .append("status", getStatus())
-            .append("spare1", getSpare1())
-            .append("spare2", getSpare2())
-            .append("spare3", getSpare3())
-            .append("remark", getRemark())
-            .append("createBy", getCreateBy())
-            .append("createById", getCreateById())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateById", getUpdateById())
-            .append("updateTime", getUpdateTime())
-            .append("delFlag", getDelFlag())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("accountingType", getAccountingType())
+                .append("customerId", getCustomerId())
+                .append("accountsReceivableDate", getAccountsReceivableDate())
+                .append("saleNo", getSaleNo())
+                .append("saleProductNo", getSaleProductNo())
+                .append("productId", getProductId())
+                .append("productName", getProductName())
+                .append("productSpecifications", getProductSpecifications())
+                .append("productLevel", getProductLevel())
+                .append("productColour", getProductColour())
+                .append("lotNumber", getLotNumber())
+                .append("boxNum", getBoxNum())
+                .append("weight", getWeight())
+                .append("productPrice", getProductPrice())
+                .append("amountReceivable", getAmountReceivable())
+                .append("receivedAmount", getReceivedAmount())
+                .append("amounts", getAmounts())
+                .append("paymentMethod", getPaymentMethod())
+                .append("billingType", getBillingType())
+                .append("accountsReceivableRemark", getAccountsReceivableRemark())
+                .append("settlementUnit", getSettlementUnit())
+                .append("returnReceipt", getReturnReceipt())
+                .append("returnReceiptDate", getReturnReceiptDate())
+                .append("returnReceiptRemark", getReturnReceiptRemark())
+                .append("noticeNumber", getNoticeNumber())
+                .append("status", getStatus())
+                .append("spare1", getSpare1())
+                .append("spare2", getSpare2())
+                .append("spare3", getSpare3())
+                .append("remark", getRemark())
+                .append("createBy", getCreateBy())
+                .append("createById", getCreateById())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateById", getUpdateById())
+                .append("updateTime", getUpdateTime())
+                .append("delFlag", getDelFlag())
+                .toString();
     }
 }

+ 187 - 145
zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOrder.java

@@ -1,6 +1,7 @@
 package com.zkqy.business.domain;
 
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.zkqy.common.core.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -9,140 +10,208 @@ import com.zkqy.common.annotation.Excel;
 
 /**
  * 销售订单对象 sale_order
- * 
+ *
  * @author zkqy
  * @date 2024-03-14
  */
-public class SaleOrder extends BaseEntity
-{
+public class SaleOrder extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 主键 */
+    /**
+     * 主键
+     */
     private Long id;
 
-    /** 销售编号(合同号) */
+    /**
+     * 销售编号(合同号)
+     */
     @Excel(name = "销售编号", readConverterExp = "合=同号")
     private String saleNo;
 
-    /** 客户编号 */
+    /**
+     * 客户编号
+     */
     @Excel(name = "客户编号")
     private String saleCustomNo;
 
-    /** 销售单日期 */
+    /**
+     * 销售单日期
+     */
     @Excel(name = "销售单日期")
     private String saleDate;
 
-    /** 预计下单时间(未使用) */
+    /**
+     * 预计下单时间(未使用)
+     */
     @Excel(name = "预计下单时间", readConverterExp = "未=使用")
     private Date saleEstimatedTime;
 
-    /** 交货日期 */
+    /**
+     * 交货日期
+     */
     @Excel(name = "交货日期")
     private String saleLeadTime;
 
-    /** 订单销售产品集合编号 */
+    /**
+     * 订单销售产品集合编号
+     */
     @Excel(name = "订单销售产品集合编号")
     private String saleProductsNo;
 
-    /** 合计金额(小写) */
+    /**
+     * 合计金额(小写)
+     */
     @Excel(name = "合计金额", readConverterExp = "小=写")
     private Long saleAmounts;
 
-    /** 合计金额(大写) */
+    /**
+     * 合计金额(大写)
+     */
     @Excel(name = "合计金额", readConverterExp = "大=写")
     private String saleAmountInWords;
 
-    /** 付款方式 */
+    /**
+     * 付款方式
+     */
     @Excel(name = "付款方式")
     private String salePayType;
 
-    /** 预计下单时间 */
+    /**
+     * 预计下单时间
+     */
     @Excel(name = "预计下单时间")
     private String saleOrderEstimatedTime;
 
-    /** 订单工艺要求编号 */
+    /**
+     * 订单工艺要求编号
+     */
     @Excel(name = "订单工艺要求编号")
     private String saleOrderTechnologyNo;
 
-    /** 业务员 */
+    /**
+     * 业务员
+     */
     @Excel(name = "业务员")
     private String salesman;
 
-    /** 业务主管 */
+    /**
+     * 业务主管
+     */
     @Excel(name = "业务主管")
     private String saleLeader;
 
-    /** 财务部 */
+    /**
+     * 财务部
+     */
     @Excel(name = "财务部")
     private String finance;
 
-    /** 生产部 */
+    /**
+     * 生产部
+     */
     @Excel(name = "生产部")
     private String production;
 
-    /** 批准人 */
+    /**
+     * 批准人
+     */
     @Excel(name = "批准人")
     private String saleApprover;
 
-    /** 状态 */
+    /**
+     * 状态
+     * 1:未提交 、2:审批中 、3:待生产 、4:生产中 、5:待出库 、6:已完成 、7:未通过 、8:审批中 、9:已出库 、100:待发货
+     */
     @Excel(name = "状态")
     private String status;
 
-    /** 订单类型 */
+    /**
+     * 订单类型
+     */
     @Excel(name = "订单类型")
     private String orderType;
 
-    /** 创建者id */
+    /**
+     * 创建者id
+     */
     @Excel(name = "创建者id")
     private Long createById;
 
-    /** 更新者id */
+    /**
+     * 更新者id
+     */
     @Excel(name = "更新者id")
     private Long updateById;
 
-    /** 删除标志(0代表存在 2代表删除) */
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
     private String delFlag;
 
-    /** 任务编码 */
+    /**
+     * 任务编码
+     */
     @Excel(name = "任务编码")
     private String taskProcessKey;
 
-    /** 任务节点编码 */
+    /**
+     * 任务节点编码
+     */
     @Excel(name = "任务节点编码")
     private String taskNodeKey;
 
-    /** 流程编码 */
+    /**
+     * 流程编码
+     */
     @Excel(name = "流程编码")
     private String processKey;
 
-    /** 定金 */
+    /**
+     * 定金
+     */
     @Excel(name = "定金")
     private String earnestMoney;
 
-    /** 交货日期 */
+    /**
+     * 交货日期
+     */
     @Excel(name = "交货日期")
     private String deliveryDate;
 
 
-    /** 批号 */
+    /**
+     * 批号
+     */
     private String lotNumber;
 
-    /** 完成时间 */
+    /**
+     * 完成时间
+     */
     private Date completionTime;
 
-    /** 加工单位 */
+    /**
+     * 加工单位
+     */
     private String processingUnit;
 
-    /** 联系人 */
+    /**
+     * 联系人
+     */
     private String contactPerson;
 
-    /** 地址 */
+    /**
+     * 地址
+     */
     private String address;
 
-    /** 领料类型 */
+    /**
+     * 领料类型
+     */
     private String materialType;
 
-    /** 外协订单付款方式 */
+    /**
+     * 外协订单付款方式
+     */
     private String outsourceSalePayType;
 
     //超级查询
@@ -182,247 +251,220 @@ public class SaleOrder extends BaseEntity
     public void setLotNumber(String lotNumber) {
         this.lotNumber = lotNumber;
     }
-    public void setId(Long id)
-    {
+
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setSaleNo(String saleNo) 
-    {
+
+    public void setSaleNo(String saleNo) {
         this.saleNo = saleNo;
     }
 
-    public String getSaleNo() 
-    {
+    public String getSaleNo() {
         return saleNo;
     }
-    public void setSaleCustomNo(String saleCustomNo) 
-    {
+
+    public void setSaleCustomNo(String saleCustomNo) {
         this.saleCustomNo = saleCustomNo;
     }
 
-    public String getSaleCustomNo() 
-    {
+    public String getSaleCustomNo() {
         return saleCustomNo;
     }
-    public void setSaleDate(String saleDate) 
-    {
+
+    public void setSaleDate(String saleDate) {
         this.saleDate = saleDate;
     }
 
-    public String getSaleDate() 
-    {
+    public String getSaleDate() {
         return saleDate;
     }
-    public void setSaleEstimatedTime(Date saleEstimatedTime) 
-    {
+
+    public void setSaleEstimatedTime(Date saleEstimatedTime) {
         this.saleEstimatedTime = saleEstimatedTime;
     }
 
-    public Date getSaleEstimatedTime() 
-    {
+    public Date getSaleEstimatedTime() {
         return saleEstimatedTime;
     }
-    public void setSaleLeadTime(String saleLeadTime) 
-    {
+
+    public void setSaleLeadTime(String saleLeadTime) {
         this.saleLeadTime = saleLeadTime;
     }
 
-    public String getSaleLeadTime() 
-    {
+    public String getSaleLeadTime() {
         return saleLeadTime;
     }
-    public void setSaleProductsNo(String saleProductsNo) 
-    {
+
+    public void setSaleProductsNo(String saleProductsNo) {
         this.saleProductsNo = saleProductsNo;
     }
 
-    public String getSaleProductsNo() 
-    {
+    public String getSaleProductsNo() {
         return saleProductsNo;
     }
-    public void setSaleAmounts(Long saleAmounts) 
-    {
+
+    public void setSaleAmounts(Long saleAmounts) {
         this.saleAmounts = saleAmounts;
     }
 
-    public Long getSaleAmounts() 
-    {
+    public Long getSaleAmounts() {
         return saleAmounts;
     }
-    public void setSaleAmountInWords(String saleAmountInWords) 
-    {
+
+    public void setSaleAmountInWords(String saleAmountInWords) {
         this.saleAmountInWords = saleAmountInWords;
     }
 
-    public String getSaleAmountInWords() 
-    {
+    public String getSaleAmountInWords() {
         return saleAmountInWords;
     }
-    public void setSalePayType(String salePayType) 
-    {
+
+    public void setSalePayType(String salePayType) {
         this.salePayType = salePayType;
     }
 
-    public String getSalePayType() 
-    {
+    public String getSalePayType() {
         return salePayType;
     }
-    public void setSaleOrderEstimatedTime(String saleOrderEstimatedTime) 
-    {
+
+    public void setSaleOrderEstimatedTime(String saleOrderEstimatedTime) {
         this.saleOrderEstimatedTime = saleOrderEstimatedTime;
     }
 
-    public String getSaleOrderEstimatedTime() 
-    {
+    public String getSaleOrderEstimatedTime() {
         return saleOrderEstimatedTime;
     }
-    public void setSaleOrderTechnologyNo(String saleOrderTechnologyNo) 
-    {
+
+    public void setSaleOrderTechnologyNo(String saleOrderTechnologyNo) {
         this.saleOrderTechnologyNo = saleOrderTechnologyNo;
     }
 
-    public String getSaleOrderTechnologyNo() 
-    {
+    public String getSaleOrderTechnologyNo() {
         return saleOrderTechnologyNo;
     }
-    public void setSalesman(String salesman) 
-    {
+
+    public void setSalesman(String salesman) {
         this.salesman = salesman;
     }
 
-    public String getSalesman() 
-    {
+    public String getSalesman() {
         return salesman;
     }
-    public void setSaleLeader(String saleLeader) 
-    {
+
+    public void setSaleLeader(String saleLeader) {
         this.saleLeader = saleLeader;
     }
 
-    public String getSaleLeader() 
-    {
+    public String getSaleLeader() {
         return saleLeader;
     }
-    public void setFinance(String finance) 
-    {
+
+    public void setFinance(String finance) {
         this.finance = finance;
     }
 
-    public String getFinance() 
-    {
+    public String getFinance() {
         return finance;
     }
-    public void setProduction(String production) 
-    {
+
+    public void setProduction(String production) {
         this.production = production;
     }
 
-    public String getProduction() 
-    {
+    public String getProduction() {
         return production;
     }
-    public void setSaleApprover(String saleApprover) 
-    {
+
+    public void setSaleApprover(String saleApprover) {
         this.saleApprover = saleApprover;
     }
 
-    public String getSaleApprover() 
-    {
+    public String getSaleApprover() {
         return saleApprover;
     }
-    public void setStatus(String status) 
-    {
+
+    public void setStatus(String status) {
         this.status = status;
     }
 
-    public String getStatus() 
-    {
+    public String getStatus() {
         return status;
     }
-    public void setOrderType(String orderType) 
-    {
+
+    public void setOrderType(String orderType) {
         this.orderType = orderType;
     }
 
-    public String getOrderType() 
-    {
+    public String getOrderType() {
         return orderType;
     }
-    public void setCreateById(Long createById) 
-    {
+
+    public void setCreateById(Long createById) {
         this.createById = createById;
     }
 
-    public Long getCreateById() 
-    {
+    public Long getCreateById() {
         return createById;
     }
-    public void setUpdateById(Long updateById) 
-    {
+
+    public void setUpdateById(Long updateById) {
         this.updateById = updateById;
     }
 
-    public Long getUpdateById() 
-    {
+    public Long getUpdateById() {
         return updateById;
     }
-    public void setDelFlag(String delFlag) 
-    {
+
+    public void setDelFlag(String delFlag) {
         this.delFlag = delFlag;
     }
 
-    public String getDelFlag() 
-    {
+    public String getDelFlag() {
         return delFlag;
     }
-    public void setTaskProcessKey(String taskProcessKey) 
-    {
+
+    public void setTaskProcessKey(String taskProcessKey) {
         this.taskProcessKey = taskProcessKey;
     }
 
-    public String getTaskProcessKey() 
-    {
+    public String getTaskProcessKey() {
         return taskProcessKey;
     }
-    public void setTaskNodeKey(String taskNodeKey) 
-    {
+
+    public void setTaskNodeKey(String taskNodeKey) {
         this.taskNodeKey = taskNodeKey;
     }
 
-    public String getTaskNodeKey() 
-    {
+    public String getTaskNodeKey() {
         return taskNodeKey;
     }
-    public void setProcessKey(String processKey) 
-    {
+
+    public void setProcessKey(String processKey) {
         this.processKey = processKey;
     }
 
-    public String getProcessKey() 
-    {
+    public String getProcessKey() {
         return processKey;
     }
-    public void setEarnestMoney(String earnestMoney) 
-    {
+
+    public void setEarnestMoney(String earnestMoney) {
         this.earnestMoney = earnestMoney;
     }
 
-    public String getEarnestMoney() 
-    {
+    public String getEarnestMoney() {
         return earnestMoney;
     }
-    public void setDeliveryDate(String deliveryDate) 
-    {
+
+    public void setDeliveryDate(String deliveryDate) {
         this.deliveryDate = deliveryDate;
     }
 
-    public String getDeliveryDate() 
-    {
+    public String getDeliveryDate() {
         return deliveryDate;
     }
 

+ 2 - 2
zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOtherCollection.java

@@ -71,8 +71,8 @@ public class SaleOtherCollection extends BaseEntity
     @Excel(name = "记账标志", readConverterExp = "0=:否;1:是")
     private String bookkeepingFlag;
 
-    /** 状态 */
-    @Excel(name = "状态")
+    /** 状态1.未提交 2审批中 3.未通过 4.已完成 */
+    @Excel(name = "状态1.未提交 2审批中 3.未通过 4.已完成")
     private String status;
 
     /** 创建者ID */

+ 101 - 80
zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleRegistrationCollection.java

@@ -1,6 +1,7 @@
 package com.zkqy.business.domain;
 
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.zkqy.common.core.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -9,65 +10,97 @@ import com.zkqy.common.annotation.Excel;
 
 /**
  * 收款登记对象 sale_registration_collection
- * 
+ *
  * @author zkqy
  * @date 2024-06-27
  */
-public class SaleRegistrationCollection extends BaseEntity
-{
+public class SaleRegistrationCollection extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 编号 */
+    /**
+     * 编号
+     */
     private Long id;
 
-    /** 客户编号 */
+    /**
+     * 客户编号
+     */
     @Excel(name = "客户编号")
     private Long customerId;
 
-    /** 付款方式 */
+    /**
+     * 付款方式
+     */
     @Excel(name = "付款方式")
     private String paymentMethod;
 
-    /** 金额 */
+    /**
+     * 金额
+     */
     @Excel(name = "金额")
     private Double amounts;
 
-    /** 收款类型 */
+    /**
+     * 收款类型
+     */
     @Excel(name = "收款类型")
     private String collectionMoneyType;
 
-    /** 收款日期 */
+    /**
+     * 收款日期
+     */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "收款日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date collectionMoneyDate;
 
-    /** 结算单位 */
+    /**
+     * 结算单位
+     */
     @Excel(name = "结算单位")
     private Long settlementUnitId;
 
-    /** 记账标志(0:否;1:是) */
+    /**
+     * 记账标志(0:否;1:是)
+     */
     @Excel(name = "记账标志", readConverterExp = "0=:否;1:是")
     private String bookkeepingFlag;
 
-    /** 状态 */
+    /**
+     * 状态
+     * <p>
+     * 1.未提交 2.审批中 3.未通过 4.已完成 5.登账撤销
+     */
     private String status;
 
-    /** 创建者ID */
+
+    /**
+     * 创建者ID
+     */
     private Long createById;
 
-    /** 更新者ID */
+    /**
+     * 更新者ID
+     */
     private Long updateById;
 
-    /** 删除标志(0:否;2:是) */
+    /**
+     * 删除标志(0:否;2:是)
+     */
     private String delFlag;
 
-    /** 贴息 */
+    /**
+     * 贴息
+     */
     private Double interestSubsidy;
 
-    /** 计息天数 */
+    /**
+     * 计息天数
+     */
     private String interestCountingDays;
 
-    /** 票据到期日 */
+    /**
+     * 票据到期日
+     */
     private Date dueDate;
 
     //开始时间
@@ -124,125 +157,113 @@ public class SaleRegistrationCollection extends BaseEntity
         this.endTime = endTime;
     }
 
-    public void setId(Long id)
-    {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setCustomerId(Long customerId) 
-    {
+
+    public void setCustomerId(Long customerId) {
         this.customerId = customerId;
     }
 
-    public Long getCustomerId() 
-    {
+    public Long getCustomerId() {
         return customerId;
     }
-    public void setPaymentMethod(String paymentMethod) 
-    {
+
+    public void setPaymentMethod(String paymentMethod) {
         this.paymentMethod = paymentMethod;
     }
 
-    public String getPaymentMethod() 
-    {
+    public String getPaymentMethod() {
         return paymentMethod;
     }
-    public void setAmounts(Double amounts)
-    {
+
+    public void setAmounts(Double amounts) {
         this.amounts = amounts;
     }
 
-    public Double getAmounts()
-    {
+    public Double getAmounts() {
         return amounts;
     }
-    public void setCollectionMoneyType(String collectionMoneyType) 
-    {
+
+    public void setCollectionMoneyType(String collectionMoneyType) {
         this.collectionMoneyType = collectionMoneyType;
     }
 
-    public String getCollectionMoneyType() 
-    {
+    public String getCollectionMoneyType() {
         return collectionMoneyType;
     }
-    public void setCollectionMoneyDate(Date collectionMoneyDate) 
-    {
+
+    public void setCollectionMoneyDate(Date collectionMoneyDate) {
         this.collectionMoneyDate = collectionMoneyDate;
     }
 
-    public Date getCollectionMoneyDate() 
-    {
+    public Date getCollectionMoneyDate() {
         return collectionMoneyDate;
     }
-    public void setSettlementUnitId(Long settlementUnitId) 
-    {
+
+    public void setSettlementUnitId(Long settlementUnitId) {
         this.settlementUnitId = settlementUnitId;
     }
 
-    public Long getSettlementUnitId() 
-    {
+    public Long getSettlementUnitId() {
         return settlementUnitId;
     }
-    public void setBookkeepingFlag(String bookkeepingFlag) 
-    {
+
+    public void setBookkeepingFlag(String bookkeepingFlag) {
         this.bookkeepingFlag = bookkeepingFlag;
     }
 
-    public String getBookkeepingFlag() 
-    {
+    public String getBookkeepingFlag() {
         return bookkeepingFlag;
     }
-    public void setCreateById(Long createById) 
-    {
+
+    public void setCreateById(Long createById) {
         this.createById = createById;
     }
 
-    public Long getCreateById() 
-    {
+    public Long getCreateById() {
         return createById;
     }
-    public void setUpdateById(Long updateById) 
-    {
+
+    public void setUpdateById(Long updateById) {
         this.updateById = updateById;
     }
 
-    public Long getUpdateById() 
-    {
+    public Long getUpdateById() {
         return updateById;
     }
-    public void setDelFlag(String delFlag) 
-    {
+
+    public void setDelFlag(String delFlag) {
         this.delFlag = delFlag;
     }
 
-    public String getDelFlag() 
-    {
+    public String getDelFlag() {
         return delFlag;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("customerId", getCustomerId())
-            .append("paymentMethod", getPaymentMethod())
-            .append("amounts", getAmounts())
-            .append("collectionMoneyType", getCollectionMoneyType())
-            .append("collectionMoneyDate", getCollectionMoneyDate())
-            .append("settlementUnitId", getSettlementUnitId())
-            .append("remark", getRemark())
-            .append("bookkeepingFlag", getBookkeepingFlag())
-            .append("createBy", getCreateBy())
-            .append("createById", getCreateById())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateById", getUpdateById())
-            .append("updateTime", getUpdateTime())
-            .append("delFlag", getDelFlag())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("customerId", getCustomerId())
+                .append("paymentMethod", getPaymentMethod())
+                .append("amounts", getAmounts())
+                .append("collectionMoneyType", getCollectionMoneyType())
+                .append("collectionMoneyDate", getCollectionMoneyDate())
+                .append("settlementUnitId", getSettlementUnitId())
+                .append("remark", getRemark())
+                .append("bookkeepingFlag", getBookkeepingFlag())
+                .append("createBy", getCreateBy())
+                .append("createById", getCreateById())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateById", getUpdateById())
+                .append("updateTime", getUpdateTime())
+                .append("delFlag", getDelFlag())
+                .toString();
     }
 }

+ 31 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/NewOldProductCodeListVO.java

@@ -0,0 +1,31 @@
+package com.zkqy.business.domain.vo;
+
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @author hanzihang
+ * @date 2024/7/19 下午5:18
+ */
+public class NewOldProductCodeListVO {
+
+    /**
+     * 新旧码单数据条
+     */
+    private ProductCodeListVO newVo, oldVo;
+
+    public ProductCodeListVO getNewVo() {
+        return newVo;
+    }
+
+    public void setNewVo(ProductCodeListVO newVo) {
+        this.newVo = newVo;
+    }
+
+    public ProductCodeListVO getOldVo() {
+        return oldVo;
+    }
+
+    public void setOldVo(ProductCodeListVO oldVo) {
+        this.oldVo = oldVo;
+    }
+}

+ 97 - 25
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleProductsVo.java

@@ -5,57 +5,129 @@ import com.zkqy.common.annotation.Excel;
 
 public class SaleProductsVo extends SaleProducts {
 
-    /** 客户名称 */
-    private  String customName;
-
-    /** 物料转码 */
-    private  String  materieEncoding;
-
-    /** 物料色号 */
-    private  String  materieColorNumber;
-
-    /** 产品规格 */
-    private  String productSpecifications;
-
-    /** 产品名称 */
+    /**
+     * 客户名称
+     */
+    private String customName;
+
+    /**
+     * 物料转码
+     */
+    private String materieEncoding;
+
+    /**
+     * 物料色号
+     */
+    private String materieColorNumber;
+
+    /**
+     * 产品规格
+     */
+    private String productSpecifications;
+
+    /**
+     * 产品名称
+     */
     private String productName;
 
-    /** 批号 */
+    /**
+     * 批号
+     */
     private String lotNumber;
 
-    /** 产品箱数 */
+    /**
+     * 产品箱数
+     */
     private Long boxNum;
 
-    /** 产品数量 */
+    /**
+     * 产品数量
+     */
     private Double productNumber;
 
-    /** 产品单价 */
+    /**
+     * 产品单价
+     */
     private String productUnitPrice;
 
-    /** 产品金额 */
+    /**
+     * 产品金额
+     */
     private String productAmounts;
 
-    /** 产品编号 */
+    /**
+     * 产品编号
+     */
     private Long productId;
 
-    /** 产品色号 */
+    /**
+     * 产品色号
+     */
     private String productColour;
 
-    /** 通知单号 */
+    /**
+     * 通知单号
+     */
     private String noticeNumber;
 
-    /** 产品等级 */
+    /**
+     * 产品等级
+     */
     private String productLevel;
 
-    /** 产品编号 */
+    /**
+     * 产品编号
+     */
     private String productNo;
 
-    /** 销售单号 */
+    /**
+     * 销售单号
+     */
     private String saleNo;
 
-    /** 色泽 */
+    /**
+     * 色泽
+     */
     private String colours;
 
+    /**
+     * 批次
+     */
+    private String batchNumber;
+
+    /**
+     * 批次状态 0正常 1 撤销登账
+     */
+    private String batchState;
+
+    /**
+     * 批次ID
+     */
+    private String batchId;
+
+    public String getBatchId() {
+        return batchId;
+    }
+
+    public void setBatchId(String batchId) {
+        this.batchId = batchId;
+    }
+
+    public String getBatchState() {
+        return batchState;
+    }
+
+    public void setBatchState(String batchState) {
+        this.batchState = batchState;
+    }
+
+    public String getBatchNumber() {
+        return batchNumber;
+    }
+
+    public void setBatchNumber(String batchNumber) {
+        this.batchNumber = batchNumber;
+    }
 
     @Override
     public String getProductNo() {

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductOutboundRecordBatchMapper.java

@@ -88,4 +88,11 @@ public interface ProductOutboundRecordBatchMapper
      */
     int deleteProductOutboundRecordBatchByOutBoundRecordId(Long outboundRecordId);
 
+    /**
+     * 批量更新订单批次产品状态
+     *
+     * @param ids 需要更新的数据主键集合
+     * @return 结果
+     */
+    public int updateBatchByIds(List<Long> ids);
 }

+ 25 - 34
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleOrderMapper.java

@@ -134,35 +134,25 @@ public interface SaleOrderMapper {
     /**
      * 查询打印出库单列表
      */
-    List<SaleProductsVo> printOutsourceOrderList(@Param("noticeNumber") String noticeNumber,@Param("saleNo") String saleNo);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+    List<SaleProductsVo> printOutsourceOrderList(@Param("noticeNumber") String noticeNumber, @Param("saleNo") String saleNo, @Param("batchNumber") String batchNumber);
 
+    /**
+     * 得到当前订单未阶段性完成的产品数据
+     */
+    List<SaleProductsVo> printOutsourceOrderListNowEnd(@Param("noticeNumber") String noticeNumber, @Param("saleNo") String saleNo);
 
 
     /**
      * 查询销售单下单前10名客户信息、单据总量和货品总量信息
      */
     @MapKey("customerNo")
-    List<Map<String,Object>> saleOrderTop10List(List<String> customerNoList);
+    List<Map<String, Object>> saleOrderTop10List(List<String> customerNoList);
 
     /**
      * 查询零售单单下单前10名客户信息、单据总量和货品总量信息
      */
     @MapKey("customerNo")
-    List<Map<String,Object>> saleRetailOrderTop10List(List<String> customerNoList);
+    List<Map<String, Object>> saleRetailOrderTop10List(List<String> customerNoList);
 
     /**
      * 查询销售单下单前10名客户编号
@@ -172,95 +162,96 @@ public interface SaleOrderMapper {
     /**
      * 根据客户单号查询销售单下单数量
      */
-    Map<String,Object> selectSaleOrderCountByCustomerNo(@Param("customerNo")String customerNo,@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    Map<String, Object> selectSaleOrderCountByCustomerNo(@Param("customerNo") String customerNo, @Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 根据客户单号查询零售单单下单数量
      */
-    Map<String,Object> selectRetailOrderCountByCustomerNo(@Param("customerNo")String customerNo,@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    Map<String, Object> selectRetailOrderCountByCustomerNo(@Param("customerNo") String customerNo, @Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 根据客户编号查询销售单下单货品数量
      */
-    List<Map<String,Object>> selectSaleOrderProductCountByCustomerNo(@Param("customerNo")String customerNo,@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> selectSaleOrderProductCountByCustomerNo(@Param("customerNo") String customerNo, @Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 根据客户编号查询零售单单下单货品数量
      */
-    List<Map<String,Object>> selectRetailOrderProductCountByCustomerNo(@Param("customerNo")String customerNo,@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> selectRetailOrderProductCountByCustomerNo(@Param("customerNo") String customerNo, @Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 按品钟查询已售货品数量最多得产品、年-月-日-季度筛选
      */
     @MapKey("productId")
-    List<Map<String,Object>> selectMaxProductCountByproductType(@Param("productType") String productType,@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> selectMaxProductCountByproductType(@Param("productType") String productType, @Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 每个销售员销售销售单货品总量、年-月-日-季度筛选
      */
     @MapKey("saleId")
-    List<Map<String,Object>> saleOrderProductCountBySalesman(@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> saleOrderProductCountBySalesman(@Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 每个销售员销售零售单货品总量、年-月-日-季度筛选
      */
     @MapKey("saleId")
-    List<Map<String,Object>> retailOrderProductCountBySalesman(@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> retailOrderProductCountBySalesman(@Param("timeType") String timeType, @Param("timeParam") String timeParam);
+
     /**
      * 每个销售员销售销售单单据总量、年-月-日-季度筛选
      */
     @MapKey("saleId")
-    List<Map<String,Object>> saleOrderCountBySalesman(@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> saleOrderCountBySalesman(@Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 每个销售员销售零售单单据总量、年-月-日-季度筛选
      */
     @MapKey("saleId")
-    List<Map<String,Object>> retailOrderCountBySalesman(@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> retailOrderCountBySalesman(@Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 销售单已销售产品中各类产品的总重量
      */
     @MapKey("productType")
-    List<Map<String,Object>> saleOrderProductWeightByProductType();
+    List<Map<String, Object>> saleOrderProductWeightByProductType();
 
     /**
      * 零售单已销售产品中各类产品的总重量
      */
     @MapKey("productType")
-    List<Map<String,Object>> retailOrderProductWeightByProductType();
+    List<Map<String, Object>> retailOrderProductWeightByProductType();
 
     /**
      * 销售单销量
      */
-    Map<String,Object> saleOrderSaleVolume(@Param("productType") String productType,@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    Map<String, Object> saleOrderSaleVolume(@Param("productType") String productType, @Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 零售单销量
      */
-    Map<String,Object> retailOrderSaleVolume(@Param("productType") String productType,@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    Map<String, Object> retailOrderSaleVolume(@Param("productType") String productType, @Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 产量
      */
-    Map<String,Object> productionVolume(@Param("productType") String productType,@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    Map<String, Object> productionVolume(@Param("productType") String productType, @Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /**
      * 销售排行   按时间可以进行查询、默认当月、可选择日、月、季度、年度进行筛选
      */
     @MapKey("productId")
-    List<Map<String,Object>> saleOrderRanking(@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> saleOrderRanking(@Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /***
      * 快销品,查询零售单中每个产品的销量
      */
     @MapKey("productId")
-    List<Map<String,Object>> retailFastSellingProduct(@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> retailFastSellingProduct(@Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
     /***
      * 快销品,查询零售单中每个产品的销量
      */
     @MapKey("productId")
-    List<Map<String,Object>> saleFastSellingProduct(@Param("timeType") String timeType,@Param("timeParam") String timeParam);
+    List<Map<String, Object>> saleFastSellingProduct(@Param("timeType") String timeType, @Param("timeParam") String timeParam);
 
 }

+ 10 - 9
zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleAccountsReceivableDetailService.java

@@ -1,20 +1,20 @@
 package com.zkqy.business.service;
 
 import java.util.List;
+
 import com.zkqy.business.domain.SaleAccountsReceivableDetail;
 import com.zkqy.business.domain.vo.FinishedProductInvoiceVo;
 
 /**
  * 应收帐明细Service接口
- * 
+ *
  * @author zkqy
  * @date 2024-06-27
  */
-public interface ISaleAccountsReceivableDetailService 
-{
+public interface ISaleAccountsReceivableDetailService {
     /**
      * 查询应收帐明细
-     * 
+     *
      * @param id 应收帐明细主键
      * @return 应收帐明细
      */
@@ -22,7 +22,7 @@ public interface ISaleAccountsReceivableDetailService
 
     /**
      * 查询应收帐明细列表
-     * 
+     *
      * @param saleAccountsReceivableDetail 应收帐明细
      * @return 应收帐明细集合
      */
@@ -30,7 +30,7 @@ public interface ISaleAccountsReceivableDetailService
 
     /**
      * 新增应收帐明细
-     * 
+     *
      * @param saleAccountsReceivableDetail 应收帐明细
      * @return 结果
      */
@@ -38,7 +38,7 @@ public interface ISaleAccountsReceivableDetailService
 
     /**
      * 修改应收帐明细
-     * 
+     *
      * @param saleAccountsReceivableDetail 应收帐明细
      * @return 结果
      */
@@ -46,7 +46,7 @@ public interface ISaleAccountsReceivableDetailService
 
     /**
      * 批量删除应收帐明细
-     * 
+     *
      * @param ids 需要删除的应收帐明细主键集合
      * @return 结果
      */
@@ -54,7 +54,7 @@ public interface ISaleAccountsReceivableDetailService
 
     /**
      * 删除应收帐明细信息
-     * 
+     *
      * @param id 应收帐明细主键
      * @return 结果
      */
@@ -72,6 +72,7 @@ public interface ISaleAccountsReceivableDetailService
 
     /**
      * 应收明细审核通过接口
+     *
      * @param saleAccountsReceivableDetail
      * @return
      */

+ 10 - 17
zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleOrderService.java

@@ -160,24 +160,17 @@ public interface ISaleOrderService {
     /**
      * 打印出库单列表
      */
-    List<SaleProductsVo> printOutsourceOrderList(String saleNo);
+    List<SaleProductsVo> printOutsourceOrderList(String saleNo, String batchNumber);
 
     /**
-     * 销售出库单打印接口
+     * 记录批次-新增应收明细
      */
-    int printOutsourceOrder(List<SaleAccountsReceivableDetail> saleAccountsReceivableDetailList);
-
-
-
-
-
-
-
-
-
-
-
+    int recordBatch(List<SaleAccountsReceivableDetail> saleAccountsReceivableDetailList);
 
+    /**
+     * 重新登账
+     */
+    int againRecordBatch(SaleAccountsReceivableDetail saleAccountsReceivableDetailList);
 
     /**
      * 查询销售单下单前10名客户信息单据数量货品总量
@@ -197,7 +190,7 @@ public interface ISaleOrderService {
     /**
      * 统计各销售员当月销售单量和单据货品总数量可选择日、月、季度、年度进行筛选
      */
-    List<Map<String, Object>> saleOrderCountBySalesman(Map<String, Object> map,Long tenantId);
+    List<Map<String, Object>> saleOrderCountBySalesman(Map<String, Object> map, Long tenantId);
 
     /**
      * 销售品类占比  各个已销售的产品中各类产品的占用百分比
@@ -212,10 +205,10 @@ public interface ISaleOrderService {
     /**
      * 销售排行   按时间可以进行查询、默认当月、可选择日、月、季度、年度进行筛选
      */
-    List<Map<String,Object>> saleOrderRanking(Map<String, Object> map);
+    List<Map<String, Object>> saleOrderRanking(Map<String, Object> map);
 
     /**
      * 当月快销产品统计、可选择日、月、季度、年度进行筛选
      */
-    List<Map<String,Object>> fastSellingProduct(Map<String, Object> map);
+    List<Map<String, Object>> fastSellingProduct(Map<String, Object> map);
 }

+ 192 - 69
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleAccountsReceivableDetailServiceImpl.java

@@ -1,12 +1,14 @@
 package com.zkqy.business.service.impl;
 
 import java.text.DecimalFormat;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
 
 import com.zkqy.business.domain.*;
 import com.zkqy.business.domain.vo.FinishedProductInvoiceVo;
+import com.zkqy.business.domain.vo.ProductCodeListVO;
 import com.zkqy.business.mapper.*;
 import com.zkqy.common.utils.DateUtils;
 import com.zkqy.common.utils.SecurityUtils;
@@ -18,13 +20,12 @@ import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 应收帐明细Service业务层处理
- * 
+ *
  * @author zkqy
  * @date 2024-06-27
  */
 @Service
-public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsReceivableDetailService 
-{
+public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsReceivableDetailService {
     @Autowired
     private SaleAccountsReceivableDetailMapper saleAccountsReceivableDetailMapper;
 
@@ -46,37 +47,49 @@ public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsRec
     @Autowired
     private ProductOutboundRecordMapper productOutboundRecordMapper;
 
+    @Autowired
+    private SaleRegistrationCollectionMapper saleRegistrationCollectionMapper;
+
     /**
      * 查询应收帐明细
-     * 
+     *
      * @param id 应收帐明细主键
      * @return 应收帐明细
      */
     @Override
-    public SaleAccountsReceivableDetail selectSaleAccountsReceivableDetailById(Long id)
-    {
+    public SaleAccountsReceivableDetail selectSaleAccountsReceivableDetailById(Long id) {
         return saleAccountsReceivableDetailMapper.selectSaleAccountsReceivableDetailById(id);
     }
 
     /**
      * 查询应收帐明细列表
-     * 
+     *
      * @param saleAccountsReceivableDetail 应收帐明细
      * @return 应收帐明细
      */
     @Override
-    public List<SaleAccountsReceivableDetail> selectSaleAccountsReceivableDetailList(SaleAccountsReceivableDetail saleAccountsReceivableDetail)
-    {
+    public List<SaleAccountsReceivableDetail> selectSaleAccountsReceivableDetailList(SaleAccountsReceivableDetail saleAccountsReceivableDetail) {
+        /**
+         * selectSaleAccountsReceivableDetailList_COUNT - [debug,137] - ==>  Preparing: select count(0) from ( SELECT sard.*, c.custom_name, csu.customer_name as settlementUnitName, fpi.id as finishedProductInvoiceId, fpi.invoice_number as invoiceNumber, fpi.invoice_type as invoiceType FROM `huaxian`.sale_accounts_receivable_detail sard LEFT JOIN `huaxian`.customer c ON sard.customer_id = c.id left join `huaxian`.customer_settlement_unit csu on csu.id = sard.settlement_unit left join `huaxian`.finished_product_invoice fpi on sard.id = fpi.accounts_receivable_detail_id and fpi.del_flag = '0' WHERE sard.del_flag = '0' and sard.status in ( ? ) order by sard.id asc ) tmp_count
+         * selectSaleAccountsReceivableDetailList_COUNT - [debug,137] - ==> Parameters: 1(String)
+         * selectSaleAccountsReceivableDetailList_COUNT - [debug,137] - <==      Total: 1
+         * selectSaleAccountsReceivableDetailList - [debug,137] - ==>  Preparing: SELECT sard.*, c.custom_name, csu.customer_name as settlementUnitName, fpi.id as finishedProductInvoiceId, fpi.invoice_number as invoiceNumber, fpi.invoice_type as invoiceType FROM `huaxian`.sale_accounts_receivable_detail sard LEFT JOIN `huaxian`.customer c ON sard.customer_id = c.id left join `huaxian`.customer_settlement_unit csu on csu.id = sard.settlement_unit left join `huaxian`.finished_product_invoice fpi on sard.id = fpi.accounts_receivable_detail_id and fpi.del_flag = '0' WHERE sard.del_flag = '0' and sard.status in ( ? ) order by sard.id asc LIMIT ?
+         * selectSaleAccountsReceivableDetailList - [debug,137] - ==> Parameters: 1(String), 10(Integer)
+         * selectSaleAccountsReceivableDetailList - [debug,137] - <==      Total: 4
+         * selectCustomerById - [debug,137] - ==>  Preparing: select id, custom_no, custom_name, custom_phone_number, custom_landine, custom_mail, custom_type, custom_grade, custom_address, custom_country_type, custom_district, salesman, contact_person, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key,amount from `huaxian`.customer where id = ?
+         * selectCustomerById - [debug,137] - ==> Parameters: 1(Long)
+         * selectCustomerById - [debug,137] - <==      Total: 1
+         */
         List<SaleAccountsReceivableDetail> list = saleAccountsReceivableDetailMapper.selectSaleAccountsReceivableDetailList(saleAccountsReceivableDetail);
-        if(saleAccountsReceivableDetail.getStatus().equals("1")){
+        if (saleAccountsReceivableDetail.getStatus().equals("1")) {
             //获取客户编号
             Set<Long> customerIds = list.stream().map(SaleAccountsReceivableDetail::getCustomerId).collect(Collectors.toSet());
-            for (Long customerId : customerIds){
+            for (Long customerId : customerIds) {
                 Customer customer = customerMapper.selectCustomerById(customerId);
                 //查询客户余额
                 Double amount = customer.getAmount();
-                for (SaleAccountsReceivableDetail detail : list){
-                    if (detail.getCustomerId().equals(customerId)){
+                for (SaleAccountsReceivableDetail detail : list) {
+                    if (detail.getCustomerId().equals(customerId)) {
                         amount += detail.getAmountReceivable();
                         detail.setAmounts(handlingWeight(amount));
                     }
@@ -89,26 +102,24 @@ public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsRec
 
     /**
      * 新增应收帐明细
-     * 
+     *
      * @param saleAccountsReceivableDetail 应收帐明细
      * @return 结果
      */
     @Override
-    public int insertSaleAccountsReceivableDetail(SaleAccountsReceivableDetail saleAccountsReceivableDetail)
-    {
+    public int insertSaleAccountsReceivableDetail(SaleAccountsReceivableDetail saleAccountsReceivableDetail) {
         saleAccountsReceivableDetail.setCreateTime(DateUtils.getNowDate());
         return saleAccountsReceivableDetailMapper.insertSaleAccountsReceivableDetail(saleAccountsReceivableDetail);
     }
 
     /**
      * 修改应收帐明细
-     * 
+     *
      * @param saleAccountsReceivableDetail 应收帐明细
      * @return 结果
      */
     @Override
-    public int updateSaleAccountsReceivableDetail(SaleAccountsReceivableDetail saleAccountsReceivableDetail)
-    {
+    public int updateSaleAccountsReceivableDetail(SaleAccountsReceivableDetail saleAccountsReceivableDetail) {
         saleAccountsReceivableDetail.setUpdateTime(DateUtils.getNowDate());
         saleAccountsReceivableDetail.setUpdateById(SecurityUtils.getUserId());
         saleAccountsReceivableDetail.setUpdateBy(SecurityUtils.getUsername());
@@ -117,25 +128,23 @@ public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsRec
 
     /**
      * 批量删除应收帐明细
-     * 
+     *
      * @param ids 需要删除的应收帐明细主键
      * @return 结果
      */
     @Override
-    public int deleteSaleAccountsReceivableDetailByIds(Long[] ids)
-    {
+    public int deleteSaleAccountsReceivableDetailByIds(Long[] ids) {
         return saleAccountsReceivableDetailMapper.deleteSaleAccountsReceivableDetailByIds(ids);
     }
 
     /**
      * 删除应收帐明细信息
-     * 
+     *
      * @param id 应收帐明细主键
      * @return 结果
      */
     @Override
-    public int deleteSaleAccountsReceivableDetailById(Long id)
-    {
+    public int deleteSaleAccountsReceivableDetailById(Long id) {
         return saleAccountsReceivableDetailMapper.deleteSaleAccountsReceivableDetailById(id);
     }
 
@@ -143,7 +152,7 @@ public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsRec
     @Transactional
     public int returnReceipt(List<SaleAccountsReceivableDetail> saleAccountsReceivableDetailList) {
         int rows = 0;
-        for (SaleAccountsReceivableDetail saleAccountsReceivableDetail : saleAccountsReceivableDetailList){
+        for (SaleAccountsReceivableDetail saleAccountsReceivableDetail : saleAccountsReceivableDetailList) {
             rows += saleAccountsReceivableDetailMapper.updateSaleAccountsReceivableDetail(saleAccountsReceivableDetail);
         }
         return rows;
@@ -168,7 +177,7 @@ public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsRec
         Customer customer = customerMapper.selectCustomerByCustomerNo(saleOrder.getSaleCustomNo());
         //客户余额
         Double amount = customer.getAmount();
-        for (SaleAccountsReceivableDetail detail : list){
+        for (SaleAccountsReceivableDetail detail : list) {
             //减后余额
             Double subtractAmount = amount - detail.getAmountReceivable();
             amount -= detail.getAmountReceivable();
@@ -221,7 +230,7 @@ public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsRec
         Customer customer2 = customerMapper.selectCustomerByCustomerNo(saleOrder1.getSaleCustomNo());
         //客户余额
         Double amount1 = customer2.getAmount();
-        for (SaleAccountsReceivableDetail detail : list){
+        for (SaleAccountsReceivableDetail detail : list) {
             //减后余额
             Double subtractAmount1 = amount1 + detail.getAmountReceivable();
             amount1 += detail.getAmountReceivable();
@@ -262,52 +271,107 @@ public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsRec
         return saleAccountsReceivableDetailMapper.updateSaleAccountsReceivableDetail(saleAccountsReceivableDetail);
     }
 
+
     @Override
     @Transactional
     public int reject(SaleAccountsReceivableDetail saleAccountsReceivableDetail) {
-        // 修改其他收款状态
-        SaleOtherCollection saleOtherCollection = new SaleOtherCollection();
-        saleOtherCollection.setId(saleAccountsReceivableDetail.getOtherCollectionId());
-        saleOtherCollection.setStatus(saleAccountsReceivableDetail.getStatus());
-        saleOtherCollectionMapper.updateSaleOtherCollection(saleOtherCollection);
-        // 删除收款明细
+        // 删除收款明细列表
         saleAccountsReceivableDetailMapper.deleteSaleAccountsReceivableDetailById(saleAccountsReceivableDetail.getId());
-
         // 计算客户余额
-        //查询该客户当前明细后所有的应收帐明细
-        List<SaleAccountsReceivableDetail> list = saleAccountsReceivableDetailMapper.selectAfterAccountsReceivableDetailList(saleAccountsReceivableDetail.getCustomerId(),saleAccountsReceivableDetail.getId());
-
-
+        // 查询该客户当前明细后所有的应收帐明细
+        List<SaleAccountsReceivableDetail> list = saleAccountsReceivableDetailMapper.selectAfterAccountsReceivableDetailList(saleAccountsReceivableDetail.getCustomerId(), saleAccountsReceivableDetail.getId());
         //根据客户编号查询客户信息和余额
         Customer customer = customerMapper.selectCustomerById(saleAccountsReceivableDetail.getCustomerId());
-        //客户余额
+        // 客户余额 其他收款计算
         Double amount = customer.getAmount();
-        amount -= saleAccountsReceivableDetail.getReceivedAmount();
+        if (saleAccountsReceivableDetail.getAccountingType().equals("2")) {
+            amount += saleAccountsReceivableDetail.getReceivedAmount();
+        } else {
+            amount -= saleAccountsReceivableDetail.getAmountReceivable();
+        }
         customer.setAmount(handlingWeight(amount));
         customerMapper.updateCustomer(customer);
-
-
-        for (SaleAccountsReceivableDetail detail : list){
-            //如果是账务类型是收款或其他收款
-            if(detail.getAccountingType().equals("2")){
-                //减后余额
-                Double addAmount = amount - detail.getReceivedAmount();
-                amount -= detail.getReceivedAmount();//已收
-                detail.setAmounts(handlingWeight(addAmount));
-                saleAccountsReceivableDetailMapper.updateSaleAccountsReceivableDetail(detail);
-
-            }else {
-                //加后余额
-                Double subtractAmount = amount + detail.getAmountReceivable();
-                amount += detail.getAmountReceivable();
-                detail.setAmounts(handlingWeight(subtractAmount));
-                saleAccountsReceivableDetailMapper.updateSaleAccountsReceivableDetail(detail);
+        // 当前客户所剩余额
+        Double finalAmount = amount;
+        // 上次余额
+        Double lastAmount;
+        if (saleAccountsReceivableDetail.getAccountingType().equals("2")) {  // 收款类型
+            lastAmount = handlingWeight(saleAccountsReceivableDetail.getAmounts() + saleAccountsReceivableDetail.getReceivedAmount());
+        } else {
+            lastAmount = handlingWeight(saleAccountsReceivableDetail.getAmounts() - saleAccountsReceivableDetail.getAmountReceivable());
+        }
+        /**
+         * 化纤财务反逻辑
+         * 负数为客户真实余额
+         * 正数为欠款 例如:客户A
+         * 100 // 标识当前客户欠款100
+         * -100 // 标识当前客户还有100没花
+         * 所加减取反
+         */
+        // 循环修改驳回数据条后所有余额
+        for (SaleAccountsReceivableDetail item : list) {
+            // 账务类型: 销售应收 1 // 收款 2 // 其他应收 3 // 贴息 4
+            if (item.getAccountingType().equals("2")) {
+                // 撤销操作                     恢复余额 = 历史上次余额 - 收款
+                lastAmount = handlingWeight(lastAmount - item.getReceivedAmount());
+                item.setAmounts(lastAmount);
+                saleAccountsReceivableDetailMapper.updateSaleAccountsReceivableDetail(item);
+            } else {
+                // 撤销操作                     恢复余额 = 历史上次余额 + 应收
+                lastAmount = handlingWeight(lastAmount + item.getAmountReceivable());
+                item.setAmounts(lastAmount);
+                saleAccountsReceivableDetailMapper.updateSaleAccountsReceivableDetail(item);
             }
         }
 
+        switch (saleAccountsReceivableDetail.getAccountingType()) {
+            case "1": // 销售应收
+                // 处理被撤销的订单产品
+                this.cancelAccountEntry(saleAccountsReceivableDetail);
+                break;
+            case "2": // 收款
+            case "4": // 贴息
+                // 处理收款登记数据条状态(客户充值)
+                SaleRegistrationCollection saleRegistrationCollection = new SaleRegistrationCollection();
+                saleRegistrationCollection.setId(Long.valueOf(saleAccountsReceivableDetail.getDataId()));
+                saleRegistrationCollection.setStatus("5"); // 撤销登账
+                saleRegistrationCollectionMapper.updateSaleRegistrationCollection(saleRegistrationCollection);
+                break;
+            case "3": // 其他应收
+                // 修改其他应收数据条状态 sale_other_collection 修改后该数据条可再次提交
+                SaleOtherCollection saleOtherCollection = new SaleOtherCollection();
+                saleOtherCollection.setId(saleAccountsReceivableDetail.getOtherCollectionId());
+                saleOtherCollection.setStatus("3");  // 未通过状态
+                saleOtherCollectionMapper.updateSaleOtherCollection(saleOtherCollection);
+                break;
+
+        }
         return 1;
+
+//        for (SaleAccountsReceivableDetail detail : list) {
+//            //如果是账务类型是收款或其他收款
+//            if (detail.getAccountingType().equals("2")) {
+//                //减后余额
+//                Double addAmount = amount - detail.getReceivedAmount();
+//                detail.setAmounts(handlingWeight(addAmount));
+//                saleAccountsReceivableDetailMapper.updateSaleAccountsReceivableDetail(detail);
+//            } else {
+//                //加后余额
+//                Double subtractAmount = amount + detail.getAmountReceivable();
+//                detail.setAmounts(handlingWeight(subtractAmount));
+//                saleAccountsReceivableDetailMapper.updateSaleAccountsReceivableDetail(detail);
+//            }
+//        }
+//
+//        return 1;
     }
 
+    /**
+     * 撤销登账(只处理订单)
+     *
+     * @param saleAccountsReceivableDetail
+     * @return
+     */
     @Transactional
     @Override
     public int cancelAccountEntry(SaleAccountsReceivableDetail saleAccountsReceivableDetail) {
@@ -315,26 +379,85 @@ public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsRec
         // 查询当前批次出库记录编号
         List<Long> ids = productOutboundRecordBatchMapper.selectOutboundRecordIdByBatchNumber(saleAccountsReceivableDetail.getBatchNumber(),
                 saleAccountsReceivableDetail.getNoticeNumber());
+
         // 根据编号查询出库记录
         List<ProductOutboundRecord> productOutboundRecords = productOutboundRecordMapper.selectProductOutboundRecordListByIds(ids);
 
-        for (ProductOutboundRecord productOutboundRecord : productOutboundRecords){
+        for (ProductOutboundRecord productOutboundRecord : productOutboundRecords) {
             if (productOutboundRecord.getProductId() == saleAccountsReceivableDetail.getProductId() &&
-                productOutboundRecord.getProductColour().equals(saleAccountsReceivableDetail.getProductColour()) &&
+                    productOutboundRecord.getProductColour().equals(saleAccountsReceivableDetail.getProductColour()) &&
                     productOutboundRecord.getLevels().equals(saleAccountsReceivableDetail.getProductLevel()) &&
-                            productOutboundRecord.getLotNum().equals(saleAccountsReceivableDetail.getLotNumber())){
+                    productOutboundRecord.getLotNum().equals(saleAccountsReceivableDetail.getLotNumber())) {
                 // 删除当前出库编号
                 productOutboundRecordBatchMapper.deleteProductOutboundRecordBatchByOutBoundRecordId(productOutboundRecord.getId());
             }
         }
-        // 删除收款明细
-        saleAccountsReceivableDetailMapper.deleteSaleAccountsReceivableDetailById(saleAccountsReceivableDetail.getId());
 
-
-
-        // 修改客户余额
-
-        return 0;
+//        // 删除收款明细
+//        saleAccountsReceivableDetailMapper.deleteSaleAccountsReceivableDetailById(saleAccountsReceivableDetail.getId());
+//
+//        // 修改客户余额
+//
+//        //根据客户编号查询客户信息和余额
+//        Customer customer = customerMapper.selectCustomerById(saleAccountsReceivableDetail.getCustomerId());
+//
+//        // 客户余额 其他收款计算
+//        Double amount = customer.getAmount();
+//        amount += saleAccountsReceivableDetail.getAmountReceivable();
+//        customer.setAmount(handlingWeight(amount));
+//        customerMapper.updateCustomer(customer);
+//
+//        // 修改—》应收明细列表-》余额数据
+//
+//        // 查询该客户当前明细后所有的应收帐明细
+//        List<SaleAccountsReceivableDetail> list = saleAccountsReceivableDetailMapper.selectAfterAccountsReceivableDetailList(saleAccountsReceivableDetail.getCustomerId(), saleAccountsReceivableDetail.getId());
+//
+//        // 当前客户所剩余额
+//        Double finalAmount = amount;
+//
+//        // 上次余额
+//        Double lastAmount = handlingWeight(saleAccountsReceivableDetail.getAmounts() + saleAccountsReceivableDetail.getAmountReceivable());
+//
+//        // 循环修改驳回数据条后所有余额
+//        for (SaleAccountsReceivableDetail item : list) {
+//            // 撤销操作                 恢复余额 = 历史上次余额 + 应收
+//            lastAmount = handlingWeight(lastAmount - item.getAmountReceivable());
+//            item.setAmounts(lastAmount);
+//            saleAccountsReceivableDetailMapper.updateSaleAccountsReceivableDetail(item);
+//        }
+        // ------
+        // 修改订单状态(撤销登账状态)
+        SaleOrder saleOrder = new SaleOrder();
+        saleOrder.setSaleNo(saleAccountsReceivableDetail.getSaleNo());
+        // 撤销登账状态
+        saleOrder.setStatus("11");
+        saleOrderMapper.updateSaleOrderBySaleNo(saleOrder);
+
+        // 得到当前批次的所有出库单
+        List<ProductCodeListVO> productCodeListVOList = productOutboundRecordMapper.selectOutboundDetails(saleAccountsReceivableDetail.getNoticeNumber());
+
+        List<Long> outIds = new ArrayList<>();
+        productCodeListVOList.forEach(item -> {
+            if (item.getProductId().equals(saleAccountsReceivableDetail.getProductId())) {
+                outIds.add(item.getId());
+            }
+        });
+        String result = outIds.stream()
+                .map(String::valueOf)
+                .collect(Collectors.joining(","));
+        // 修改当前批次状态
+        ProductOutboundRecordBatch productOutboundRecordBatch = new ProductOutboundRecordBatch();
+        productOutboundRecordBatch.setSaleNo(saleAccountsReceivableDetail.getSaleNo());
+        productOutboundRecordBatch.setBatchNumber(saleAccountsReceivableDetail.getBatchNumber());
+        productOutboundRecordBatch.setOutboundRecordIds(result);
+        // 得到当前出库产品批次的所有出库记录
+        List<ProductOutboundRecordBatch> BatchList = productOutboundRecordBatchMapper.selectProductOutboundRecordBatchList(productOutboundRecordBatch);
+        List<Long> bIds = BatchList.stream()
+                .map(ProductOutboundRecordBatch::getId)
+                .collect(Collectors.toList());
+        // 更新当前订单出库批次状态
+        productOutboundRecordBatchMapper.updateBatchByIds(bIds);
+        return 1;
     }
 
 
@@ -344,4 +467,4 @@ public class SaleAccountsReceivableDetailServiceImpl implements ISaleAccountsRec
         return Double.parseDouble(df.format(weight));
     }
 
-}
+}

+ 154 - 110
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java

@@ -331,6 +331,7 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
     @Transactional
     public int updateOrder(SaleOrder saleOrder) {
         ProductInvoice productInvoice1 = new ProductInvoice();
+        // 发货单/通知单-》完成状态
         productInvoice1.setStatus("2");
         productInvoice1.setSaleOrderNo(saleOrder.getSaleNo());
         productInvoiceMapper.updateProductInvoiceBySaleNo(productInvoice1);
@@ -384,19 +385,19 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
     public int editOutsourceOrder(SaleOrderVO vo) {
         SaleOrder saleOrder = new SaleOrder();
         BeanUtils.copyBeanProp(saleOrder, vo);
-        if(vo.getSaleProductsList().size() > 0){
+        if (vo.getSaleProductsList().size() > 0) {
             //修改销售单货品
             LinkedList<SaleProducts> addSaleProductsList = new LinkedList<>();
             LinkedList<SaleProducts> editSaleProductsList = new LinkedList<>();
             Set<Long> ids = new HashSet<>();
-            for (SaleProducts saleProducts : vo.getSaleProductsList()){
-                if(saleProducts.getId() != null){
+            for (SaleProducts saleProducts : vo.getSaleProductsList()) {
+                if (saleProducts.getId() != null) {
                     editSaleProductsList.add(saleProducts);
                     ids.add(saleProducts.getId());
                     saleProducts.setUpdateBy(SecurityUtils.getUsername());
                     saleProducts.setUpdateById(SecurityUtils.getUserId());
                     saleProducts.setUpdateTime(DateUtils.getNowDate());
-                }else {
+                } else {
                     saleProducts.setCreateBy(SecurityUtils.getUsername());
                     saleProducts.setCreateById(SecurityUtils.getUserId());
                     saleProducts.setCreateTime(DateUtils.getNowDate());
@@ -404,13 +405,13 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
                 }
                 Set<Long> allId = saleProductsMapper.selectSaleProductsIdsBySaleNo(vo.getSaleNo());
                 allId.removeAll(ids);
-                if(allId.size() > 0){
+                if (allId.size() > 0) {
                     saleProductsMapper.deleteSaleProductsByIds(new ArrayList<>(allId));
                 }
-                if(addSaleProductsList.size() > 0){
+                if (addSaleProductsList.size() > 0) {
                     saleProductsMapper.batchInsertSaleProducts(addSaleProductsList);
                 }
-                if (editSaleProductsList.size() > 0){
+                if (editSaleProductsList.size() > 0) {
                     editSaleProductsList.forEach(s -> {
                         saleProductsMapper.updateSaleProducts(s);
                     });
@@ -441,21 +442,33 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
     }
 
     @Override
-    public List<SaleProductsVo> printOutsourceOrderList(String saleNo) {
+    public List<SaleProductsVo> printOutsourceOrderList(String saleNo, String batchNumber) {
         //根据销售编号获取通知单信息
         ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceBySaleOrderNo(saleNo);
-        if(productInvoice == null){
+        if (productInvoice == null) {
             return new ArrayList<>();
         }
-        //获取最后一个批次出库的产品
-        List<SaleProductsVo> saleProductsVos = saleOrderMapper.printOutsourceOrderList(productInvoice.getNoticeNumber(),saleNo);
+        // 获取当前订单出库产品信息
+        List<SaleProductsVo> saleProductsVos = saleOrderMapper.printOutsourceOrderList(productInvoice.getNoticeNumber(), saleNo, batchNumber);
         return saleProductsVos;
     }
 
+    /**
+     * 订单产品新增应收明细
+     * 记录批次
+     *
+     * @param saleAccountsReceivableDetailList
+     * @return
+     */
     @Override
     @Transactional
-    public int printOutsourceOrder(List<SaleAccountsReceivableDetail> saleAccountsReceivableDetailList) {
-        // 查询当前批次出库记录
+    public int recordBatch(List<SaleAccountsReceivableDetail> saleAccountsReceivableDetailList) {
+        //  // 得到当前订单出库单
+        //  ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceBySaleOrderNo(saleNo);
+        //  // 获取当前订单出库产品信息
+        //  List<SaleProductsVo> saleProductsVos = saleOrderMapper.printOutsourceOrderList(productInvoice.getNoticeNumber(), saleNo, "没用");
+        //  List<SaleAccountsReceivableDetail> saleAccountsReceivableDetailList = saleOrderMapper.printOutsourceOrder(saleNo);
+        // 查询当前批次出库记录  -- 根据通知单号获取批次号
         Long batchNumber = productOutboundRecordBatchMapper.selectBatchNumberByNoticeNumber(saleAccountsReceivableDetailList.get(0).getNoticeNumber());
         //根据销售单号查询销售单详情
         SaleOrder saleOrder = saleOrderMapper.selectSaleOrderBySaleNo(saleAccountsReceivableDetailList.get(0).getSaleNo());
@@ -463,29 +476,36 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
         Customer customer = customerMapper.selectCustomerByCustomerNo(saleOrder.getSaleCustomNo());
         //客户余额
         Double amount = customer.getAmount();
-
-        for (SaleAccountsReceivableDetail saleAccountsReceivableDetail : saleAccountsReceivableDetailList){
-            saleAccountsReceivableDetail.setCustomerId(customer.getId());
+        for (SaleAccountsReceivableDetail item : saleAccountsReceivableDetailList) {
+            item.setCustomerId(customer.getId());
             //加后余额
-            Double subtractAmount = amount + saleAccountsReceivableDetail.getAmountReceivable();
-            amount += saleAccountsReceivableDetail.getAmountReceivable();
-            saleAccountsReceivableDetail.setAmounts(handlingWeight(subtractAmount));
-            saleAccountsReceivableDetail.setBatchNumber(batchNumber);
-            saleAccountsReceivableDetail.setCreateBy(SecurityUtils.getUsername());
-            saleAccountsReceivableDetail.setCreateById(SecurityUtils.getUserId());
-            saleAccountsReceivableDetail.setCreateTime(DateUtils.getNowDate());
+            Double subtractAmount = amount + item.getAmountReceivable();
+            amount += item.getAmountReceivable();
+            item.setAmounts(handlingWeight(subtractAmount));
+            item.setBatchNumber(batchNumber);
+            item.setCreateBy(SecurityUtils.getUsername());
+            item.setCreateById(SecurityUtils.getUserId());
+            item.setCreateTime(DateUtils.getNowDate());
+            // 当前产品出库记录的唯一标识
+            item.setDataId(item.getId().toString());
         }
-        if (saleAccountsReceivableDetailList.size() > 0 ){
+        if (saleAccountsReceivableDetailList.size() > 0) {
+            // 新增应收帐明细
             saleAccountsReceivableDetailMapper.batchInsertSaleAccountsReceivableDetail(saleAccountsReceivableDetailList);
         }
         // 记录已发货品信息
         List<Long> list = productOutboundRecordMapper.selectOutboundRecordNo(saleAccountsReceivableDetailList.get(0).getNoticeNumber());
-        if(list.size() > 0){
+        if (list.size() > 0) {
             List<ProductOutboundRecordBatch> productOutboundRecordBatchList = new ArrayList<>();
-            for (Long id : list){
+            for (Long id : list) {
                 ProductOutboundRecordBatch productOutboundRecordBatch = new ProductOutboundRecordBatch();
+                // 当前批次
                 productOutboundRecordBatch.setBatchNumber(batchNumber);
+                // 销售单编号
+                productOutboundRecordBatch.setSaleNo(saleAccountsReceivableDetailList.get(0).getSaleNo());
+                // 出库单ID
                 productOutboundRecordBatch.setOutboundRecordId(id);
+                // 通知单编号
                 productOutboundRecordBatch.setNoticeNumber(saleAccountsReceivableDetailList.get(0).getNoticeNumber());
                 productOutboundRecordBatch.setCreateBy(SecurityUtils.getUsername());
                 productOutboundRecordBatch.setCreateById(SecurityUtils.getUserId());
@@ -495,22 +515,49 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
             //新增批次出库记录
             productOutboundRecordBatchMapper.batchInsertProductOutboundRecordBatch(productOutboundRecordBatchList);
         }
-        //修改客户余额
-//        customer.setAmount(handlingWeight(amount));
-//        return customerMapper.updateCustomer(customer);
+        //修改客户余额 审核通过修改客户余额
+        // customer.setAmount(handlingWeight(amount));
+        // return customerMapper.updateCustomer(customer);
         return 1;
     }
 
+    @Override
+    @Transactional
+    public int againRecordBatch(SaleAccountsReceivableDetail saleAccountsReceivableDetail) {
+        //根据客户Id查询客户信息和余额
+        Customer customer = customerMapper.selectCustomerById(saleAccountsReceivableDetail.getCustomerId());
+        //客户余额
+        Double amount = customer.getAmount();
+        saleAccountsReceivableDetail.setCustomerId(customer.getId());
+        //加后余额
+        Double subtractAmount = amount + saleAccountsReceivableDetail.getAmountReceivable();
+        amount += saleAccountsReceivableDetail.getAmountReceivable();
+        saleAccountsReceivableDetail.setAmounts(handlingWeight(subtractAmount));
+        saleAccountsReceivableDetail.setCreateBy(SecurityUtils.getUsername());
+        saleAccountsReceivableDetail.setCreateById(SecurityUtils.getUserId());
+        saleAccountsReceivableDetail.setCreateTime(DateUtils.getNowDate());
+        // 当前产品出库记录的唯一标识
+        // saleAccountsReceivableDetailList.setDataId(saleAccountsReceivableDetailList.getId().toString());
+        List<SaleAccountsReceivableDetail> list = new ArrayList<>();
+        list.add(saleAccountsReceivableDetail);
+        // 新增应收帐明细
+        saleAccountsReceivableDetailMapper.batchInsertSaleAccountsReceivableDetail(list);
+        // 修改当前订单出库
+        ProductOutboundRecordBatch productOutboundRecordBatch = new ProductOutboundRecordBatch();
+        productOutboundRecordBatch.setId(Long.valueOf(saleAccountsReceivableDetail.getBatchId()));
+        productOutboundRecordBatch.setBatchState('0');
+        productOutboundRecordBatchMapper.updateProductOutboundRecordBatch(productOutboundRecordBatch);
+
+        // 判断修改订单状态
+        if (saleAccountsReceivableDetail.isOrderUpdate()) {
+            SaleOrder saleOrder = new SaleOrder();
+            saleOrder.setSaleNo(saleAccountsReceivableDetail.getSaleNo());
+            saleOrder.setStatus("9");  // 已出库
+            saleOrderMapper.updateSaleOrderBySaleNo(saleOrder);
+        }
 
-
-
-
-
-
-
-
-
-
+        return 1;
+    }
 
 
     @Override
@@ -518,34 +565,33 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
         List<Map<String, Object>> list = new ArrayList<>();
         //查询下单前10名客户编号
         List<String> customerNoList = saleOrderMapper.saleOrderTop10CustomerNoList();
-        if(customerNoList.size() > 0){
+        if (customerNoList.size() > 0) {
             //查询销售单数量
             List<Map<String, Object>> saleOrderList = saleOrderMapper.saleOrderTop10List(customerNoList);
             //查询零售单数量
             List<Map<String, Object>> retailList = saleOrderMapper.saleRetailOrderTop10List(customerNoList);
 
-            for (Map<String, Object> map : saleOrderList){
+            for (Map<String, Object> map : saleOrderList) {
 
                 Map<String, Object> result = new HashMap<>();
-                result.put("customerNo",map.get("customerNo"));
-                result.put("customerName",map.get("customerName"));
-//                result.put("orderCount",map.get("orderCount"));
+                result.put("customerNo", map.get("customerNo"));
+                result.put("customerName", map.get("customerName"));
+                // result.put("orderCount",map.get("orderCount"));
                 Long orderCount = (Long) map.get("orderCount");
                 Double weight = (Double) map.get("weight");
-                for (Map<String, Object> retail : retailList){
-                    if(map.get("customerNo").toString().equals(retail.get("customerNo").toString())){
+                for (Map<String, Object> retail : retailList) {
+                    if (map.get("customerNo").toString().equals(retail.get("customerNo").toString())) {
                         weight = weight + (Double) retail.get("weight");
-                        map.put("weight",handlingWeight(weight));
+                        map.put("weight", handlingWeight(weight));
                         orderCount += (Long) retail.get("orderCount");
-                        map.put("orderCount",orderCount);
+                        map.put("orderCount", orderCount);
                     }
                 }
-                result.put("weight",handlingWeight(weight));
-                result.put("orderCount",orderCount);
+                result.put("weight", handlingWeight(weight));
+                result.put("orderCount", orderCount);
                 list.add(result);
             }
         }
-
         return list;
     }
 
@@ -553,29 +599,29 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
     public Map<String, Object> customerStatistics(Map<String, Object> map) {
         Map<String, Object> result = new HashMap<>();
         //销售单数量
-        Map<String, Object> saleOrderCount = saleOrderMapper.selectSaleOrderCountByCustomerNo(map.get("customerNo").toString(),map.get("timeType").toString(),map.get("timeParam").toString());
+        Map<String, Object> saleOrderCount = saleOrderMapper.selectSaleOrderCountByCustomerNo(map.get("customerNo").toString(), map.get("timeType").toString(), map.get("timeParam").toString());
         //零售单数量
-        Map<String, Object> retailOrderCount = saleOrderMapper.selectRetailOrderCountByCustomerNo(map.get("customerNo").toString(),map.get("timeType").toString(),map.get("timeParam").toString());
+        Map<String, Object> retailOrderCount = saleOrderMapper.selectRetailOrderCountByCustomerNo(map.get("customerNo").toString(), map.get("timeType").toString(), map.get("timeParam").toString());
 
         Long saleCount = saleOrderCount.get("orderCount") == null ? 0L : (Long) saleOrderCount.get("orderCount");
         Long retailCount = retailOrderCount.get("orderCount") == null ? 0L : (Long) retailOrderCount.get("orderCount");
 
-        result.put("orderCount",saleCount + retailCount);
+        result.put("orderCount", saleCount + retailCount);
 
 
 //        result.put("orderCount",saleOrderCount);
 
         //各个货品重量
         //销售单
-        List<Map<String, Object>> saleList = saleOrderMapper.selectSaleOrderProductCountByCustomerNo(map.get("customerNo").toString(),map.get("timeType").toString(), map.get("timeParam").toString());
+        List<Map<String, Object>> saleList = saleOrderMapper.selectSaleOrderProductCountByCustomerNo(map.get("customerNo").toString(), map.get("timeType").toString(), map.get("timeParam").toString());
         //零售单
-        List<Map<String, Object>> retailList = saleOrderMapper.selectRetailOrderProductCountByCustomerNo(map.get("customerNo").toString(),map.get("timeType").toString(), map.get("timeParam").toString());
+        List<Map<String, Object>> retailList = saleOrderMapper.selectRetailOrderProductCountByCustomerNo(map.get("customerNo").toString(), map.get("timeType").toString(), map.get("timeParam").toString());
 
 
         List<Map<String, Object>> addList = new ArrayList<>();
 
         //筛选出销售单中不存在的零售单货品
-        for (Map<String, Object> retailItem : retailList){
+        for (Map<String, Object> retailItem : retailList) {
             String saleProductId = retailItem.get("productId").toString();
             String saleProductColour = retailItem.get("productColour").toString();
             String customerNo = retailItem.get("customerNo").toString();
@@ -585,36 +631,34 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
                                     saleProductColour.equals(saleItem.get("productColour").toString()) &&
                                     customerNo.equals(saleItem.get("customerNo").toString())
                     );
-            if(!exists){
+            if (!exists) {
                 addList.add(retailItem);
             }
 
         }
 
-        for (Map<String, Object> saleItem : saleList){
+        for (Map<String, Object> saleItem : saleList) {
             String saleProductId = saleItem.get("productId").toString();
             String saleProductColour = saleItem.get("productColour").toString();
             String customerNo = saleItem.get("customerNo").toString();
             Double weight = (Double) saleItem.get("weight");
 
-            for (Map<String, Object> retailItem : retailList){
-                if(retailItem.get("productId").toString().equals(saleProductId) && retailItem.get("productColour").toString().equals(saleProductColour) && customerNo.equals(retailItem.get("customerNo").toString())){
+            for (Map<String, Object> retailItem : retailList) {
+                if (retailItem.get("productId").toString().equals(saleProductId) && retailItem.get("productColour").toString().equals(saleProductColour) && customerNo.equals(retailItem.get("customerNo").toString())) {
                     Double weight1 = (Double) retailItem.get("weight");
                     weight += weight1;
-                    saleItem.put("weight",handlingWeight(weight));
+                    saleItem.put("weight", handlingWeight(weight));
                     break;
                 }
             }
 
         }
-        if(addList.size() > 0){
+        if (addList.size() > 0) {
             saleList.addAll(addList);
         }
 
 
-
-
-        result.put("productInfo",saleList);
+        result.put("productInfo", saleList);
 
         return result;
 //        return saleOrderCount;
@@ -733,7 +777,7 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
     }
 
     @Override
-    public List<Map<String, Object>> saleOrderCountBySalesman(Map<String, Object> map,Long tenantId) {
+    public List<Map<String, Object>> saleOrderCountBySalesman(Map<String, Object> map, Long tenantId) {
         Map<String, Object> result = new HashMap<>();
         //销售单量
         List<Map<String, Object>> saleCount = saleOrderMapper.saleOrderCountBySalesman(map.get("timeType").toString(), map.get("timeParam").toString());
@@ -745,73 +789,73 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
         List<Map<String, Object>> retailProductCount = saleOrderMapper.retailOrderProductCountBySalesman(map.get("timeType").toString(), map.get("timeParam").toString());
 
         List<Map<String, Object>> addList = new ArrayList<>();
-        for (Map<String, Object> retailItem : retailCount){
+        for (Map<String, Object> retailItem : retailCount) {
             String saleSalesman = retailItem.get("saleId").toString();
             boolean exists = saleCount.stream()
                     .anyMatch(saleItem ->
                             saleSalesman.equals(saleItem.get("saleId").toString())
                     );
-            if(!exists){
+            if (!exists) {
                 addList.add(retailItem);
             }
         }
 
-        for (Map<String, Object> saleItem : saleCount){
+        for (Map<String, Object> saleItem : saleCount) {
             String saleId = saleItem.get("saleId").toString();
             Long orderCount = (Long) saleItem.get("orderCount");
 
-            for (Map<String, Object> retailItem : retailCount){
-                if(retailItem.get("saleId").toString().equals(saleId)){
+            for (Map<String, Object> retailItem : retailCount) {
+                if (retailItem.get("saleId").toString().equals(saleId)) {
                     Long orderCount1 = (Long) retailItem.get("orderCount");
                     orderCount += orderCount1;
-                    saleItem.put("orderCount",orderCount);
+                    saleItem.put("orderCount", orderCount);
                     break;
                 }
             }
 
         }
-        if(addList.size() > 0){
+        if (addList.size() > 0) {
             saleCount.addAll(addList);
         }
         List<Map<String, Object>> addList1 = new ArrayList<>();
-        for (Map<String, Object> retailItem : retailProductCount){
+        for (Map<String, Object> retailItem : retailProductCount) {
             String saleSalesman = retailItem.get("saleId").toString();
             boolean exists = saleProductCount.stream()
                     .anyMatch(saleItem ->
                             saleSalesman.equals(saleItem.get("saleId").toString())
                     );
-            if(!exists){
+            if (!exists) {
                 addList1.add(retailItem);
             }
         }
 
-        for (Map<String, Object> saleItem : saleProductCount){
+        for (Map<String, Object> saleItem : saleProductCount) {
             String saleId = saleItem.get("saleId").toString();
             Double weight = (Double) saleItem.get("weight");
-            for (Map<String, Object> retailItem : retailProductCount){
-                if(retailItem.get("saleId").toString().equals(saleId)){
+            for (Map<String, Object> retailItem : retailProductCount) {
+                if (retailItem.get("saleId").toString().equals(saleId)) {
                     Double weight1 = (Double) retailItem.get("weight");
                     weight += weight1;
-                    saleItem.put("weight",handlingWeight(weight));
+                    saleItem.put("weight", handlingWeight(weight));
                 }
             }
         }
-        if (addList1.size() > 0){
+        if (addList1.size() > 0) {
             saleProductCount.addAll(addList1);
         }
 
         List<SysUser> salesmanList = iSysUserService.selectUserListByRoleKey("salesman", tenantId);
-        for (Map<String, Object> saleItem : saleCount){
+        for (Map<String, Object> saleItem : saleCount) {
             String saleId = saleItem.get("saleId").toString();
-            for (Map<String, Object> retailItem : saleProductCount){
-                if(retailItem.get("saleId").toString().equals(saleId)){
-                    saleItem.put("weight",retailItem.get("weight"));
+            for (Map<String, Object> retailItem : saleProductCount) {
+                if (retailItem.get("saleId").toString().equals(saleId)) {
+                    saleItem.put("weight", retailItem.get("weight"));
                     break;
                 }
             }
-            for (SysUser sysUser : salesmanList){
-                if(sysUser.getUserId().toString().equals(saleId)){
-                    saleItem.put("salesman",sysUser.getNickName());
+            for (SysUser sysUser : salesmanList) {
+                if (sysUser.getUserId().toString().equals(saleId)) {
+                    saleItem.put("salesman", sysUser.getNickName());
                     break;
                 }
             }
@@ -831,28 +875,28 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
 
         List<Map<String, Object>> addList = new ArrayList<>();
 
-        for (Map<String, Object> retailItem : retailWeight){
+        for (Map<String, Object> retailItem : retailWeight) {
             String productType = retailItem.get("productType").toString();
             boolean exists = saleWeight.stream()
                     .anyMatch(saleItem ->
                             productType.equals(saleItem.get("productType").toString())
                     );
-            if(!exists){
+            if (!exists) {
                 addList.add(retailItem);
             }
         }
-        for (Map<String, Object> saleItem : saleWeight){
+        for (Map<String, Object> saleItem : saleWeight) {
             String productType = saleItem.get("productType").toString();
             Double weight = (Double) saleItem.get("weight");
-            for (Map<String, Object> retailItem : retailWeight){
-                if(retailItem.get("productType").toString().equals(productType)){
+            for (Map<String, Object> retailItem : retailWeight) {
+                if (retailItem.get("productType").toString().equals(productType)) {
                     Double weight1 = (Double) retailItem.get("weight");
                     weight += weight1;
-                    saleItem.put("weight",handlingWeight(weight));
+                    saleItem.put("weight", handlingWeight(weight));
                 }
             }
         }
-        if (addList.size() > 0){
+        if (addList.size() > 0) {
             saleWeight.addAll(addList);
         }
 
@@ -876,18 +920,18 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
     @Override
     public Map<String, Object> productionMarketingRatio(Map<String, Object> map) {
         //销售单销量
-        Map<String, Object> saleOrderSaleVolume = saleOrderMapper.saleOrderSaleVolume(map.get("productType").toString(),map.get("timeType").toString(), map.get("timeParam").toString());
+        Map<String, Object> saleOrderSaleVolume = saleOrderMapper.saleOrderSaleVolume(map.get("productType").toString(), map.get("timeType").toString(), map.get("timeParam").toString());
         //零售单销量
-        Map<String, Object> retailOrderSaleVolume = saleOrderMapper.retailOrderSaleVolume(map.get("productType").toString(),map.get("timeType").toString(), map.get("timeParam").toString());
+        Map<String, Object> retailOrderSaleVolume = saleOrderMapper.retailOrderSaleVolume(map.get("productType").toString(), map.get("timeType").toString(), map.get("timeParam").toString());
         //产量
-        Map<String, Object> productionVolume = saleOrderMapper.productionVolume(map.get("productType").toString(),map.get("timeType").toString(), map.get("timeParam").toString());
+        Map<String, Object> productionVolume = saleOrderMapper.productionVolume(map.get("productType").toString(), map.get("timeType").toString(), map.get("timeParam").toString());
 
-        Double saleWeight = (Double)saleOrderSaleVolume.get("weight");
+        Double saleWeight = (Double) saleOrderSaleVolume.get("weight");
         double sale = saleWeight != null ? saleWeight : 0.0;
-        Double retailWeight = (Double)retailOrderSaleVolume.get("weight");
+        Double retailWeight = (Double) retailOrderSaleVolume.get("weight");
         double retail = retailWeight != null ? retailWeight : 0.0;
 
-        Double productionWeight = (Double)productionVolume.get("weight");
+        Double productionWeight = (Double) productionVolume.get("weight");
         double production = productionWeight != null ? productionWeight : 0.0;
         Double totalWeight = sale + retail + production;
 
@@ -898,13 +942,13 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
         Double productionProportion = (production / totalWeight) * 100;
         Double roundedPercentage1 = Math.round(productionProportion * 100.0) / 100.0;
 
-        if(roundedPercentage > 0){
+        if (roundedPercentage > 0) {
 
         }
 
         Map<String, Object> result = new HashMap<>();
-        result.put("salesProportion",roundedPercentage);
-        result.put("productionProportion",roundedPercentage1);
+        result.put("salesProportion", roundedPercentage);
+        result.put("productionProportion", roundedPercentage1);
         return result;
     }
 
@@ -921,7 +965,7 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
         List<Map<String, Object>> saleList = saleOrderMapper.saleFastSellingProduct(map.get("timeType").toString(), map.get("timeParam").toString());
 
         List<Map<String, Object>> addList = new ArrayList<>();
-        for (Map<String, Object> retailItem : retailList){
+        for (Map<String, Object> retailItem : retailList) {
             String productId = retailItem.get("productId").toString();
             String productColour = retailItem.get("productColour").toString();
             boolean exists = saleList.stream()
@@ -929,24 +973,24 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
                             productId.equals(saleItem.get("productId").toString()) &&
                                     productColour.equals(saleItem.get("productColour").toString())
                     );
-            if(!exists){
+            if (!exists) {
                 addList.add(retailItem);
             }
         }
 
-        for (Map<String, Object> saleItem : saleList){
+        for (Map<String, Object> saleItem : saleList) {
             String productId = saleItem.get("productId").toString();
             String productColour = saleItem.get("productColour").toString();
             Double weight = (Double) saleItem.get("weight");
-            for (Map<String, Object> retailItem : retailList){
-                if(retailItem.get("productId").toString().equals(productId) && retailItem.get("productColour").toString().equals(productColour)){
+            for (Map<String, Object> retailItem : retailList) {
+                if (retailItem.get("productId").toString().equals(productId) && retailItem.get("productColour").toString().equals(productColour)) {
                     Double weight1 = (Double) retailItem.get("weight");
                     weight += weight1;
-                    saleItem.put("weight",handlingWeight(weight));
+                    saleItem.put("weight", handlingWeight(weight));
                 }
             }
         }
-        if (addList.size() > 0){
+        if (addList.size() > 0) {
             saleList.addAll(addList);
         }
 

+ 30 - 29
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleRegistrationCollectionServiceImpl.java

@@ -19,13 +19,12 @@ import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 收款登记Service业务层处理
- * 
+ *
  * @author zkqy
  * @date 2024-06-27
  */
 @Service
-public class SaleRegistrationCollectionServiceImpl implements ISaleRegistrationCollectionService 
-{
+public class SaleRegistrationCollectionServiceImpl implements ISaleRegistrationCollectionService {
     @Autowired
     private SaleRegistrationCollectionMapper saleRegistrationCollectionMapper;
 
@@ -37,37 +36,34 @@ public class SaleRegistrationCollectionServiceImpl implements ISaleRegistrationC
 
     /**
      * 查询收款登记
-     * 
+     *
      * @param id 收款登记主键
      * @return 收款登记
      */
     @Override
-    public SaleRegistrationCollection selectSaleRegistrationCollectionById(Long id)
-    {
+    public SaleRegistrationCollection selectSaleRegistrationCollectionById(Long id) {
         return saleRegistrationCollectionMapper.selectSaleRegistrationCollectionById(id);
     }
 
     /**
      * 查询收款登记列表
-     * 
+     *
      * @param saleRegistrationCollection 收款登记
      * @return 收款登记
      */
     @Override
-    public List<SaleRegistrationCollection> selectSaleRegistrationCollectionList(SaleRegistrationCollection saleRegistrationCollection)
-    {
+    public List<SaleRegistrationCollection> selectSaleRegistrationCollectionList(SaleRegistrationCollection saleRegistrationCollection) {
         return saleRegistrationCollectionMapper.selectSaleRegistrationCollectionList(saleRegistrationCollection);
     }
 
     /**
      * 新增收款登记
-     * 
+     *
      * @param saleRegistrationCollection 收款登记
      * @return 结果
      */
     @Override
-    public int insertSaleRegistrationCollection(SaleRegistrationCollection saleRegistrationCollection)
-    {
+    public int insertSaleRegistrationCollection(SaleRegistrationCollection saleRegistrationCollection) {
         saleRegistrationCollection.setCreateTime(DateUtils.getNowDate());
         saleRegistrationCollection.setCreateBy(SecurityUtils.getUsername());
         saleRegistrationCollection.setCreateById(SecurityUtils.getUserId());
@@ -76,13 +72,12 @@ public class SaleRegistrationCollectionServiceImpl implements ISaleRegistrationC
 
     /**
      * 修改收款登记
-     * 
+     *
      * @param saleRegistrationCollection 收款登记
      * @return 结果
      */
     @Override
-    public int updateSaleRegistrationCollection(SaleRegistrationCollection saleRegistrationCollection)
-    {
+    public int updateSaleRegistrationCollection(SaleRegistrationCollection saleRegistrationCollection) {
         saleRegistrationCollection.setUpdateTime(DateUtils.getNowDate());
         saleRegistrationCollection.setUpdateBy(SecurityUtils.getUsername());
         saleRegistrationCollection.setUpdateById(SecurityUtils.getUserId());
@@ -91,25 +86,23 @@ public class SaleRegistrationCollectionServiceImpl implements ISaleRegistrationC
 
     /**
      * 批量删除收款登记
-     * 
+     *
      * @param ids 需要删除的收款登记主键
      * @return 结果
      */
     @Override
-    public int deleteSaleRegistrationCollectionByIds(Long[] ids)
-    {
+    public int deleteSaleRegistrationCollectionByIds(Long[] ids) {
         return saleRegistrationCollectionMapper.deleteSaleRegistrationCollectionByIds(ids);
     }
 
     /**
      * 删除收款登记信息
-     * 
+     *
      * @param id 收款登记主键
      * @return 结果
      */
     @Override
-    public int deleteSaleRegistrationCollectionById(Long id)
-    {
+    public int deleteSaleRegistrationCollectionById(Long id) {
         return saleRegistrationCollectionMapper.deleteSaleRegistrationCollectionById(id);
     }
 
@@ -122,17 +115,23 @@ public class SaleRegistrationCollectionServiceImpl implements ISaleRegistrationC
     @Transactional
     public int audit(SaleRegistrationCollection saleRegistrationCollection) {
 
+        // 销售应收 1
+        // 收款  2
+        // 其他应收 3
+        // 贴息  4
+
         //修改收款登记状态、已记账标志
         saleRegistrationCollection.setBookkeepingFlag("1");//已记账
         saleRegistrationCollectionMapper.updateSaleRegistrationCollection(saleRegistrationCollection);
         //修改客户余额
         //根据客户编号查询客户信息和余额
         Customer customer = customerMapper.selectCustomerById(saleRegistrationCollection.getCustomerId());
+
         //客户余额
         Double amount = customer.getAmount();
 
         //判断账务类型是否为贴息
-        if(saleRegistrationCollection.getPaymentMethod().equals("4")){
+        if (saleRegistrationCollection.getPaymentMethod().equals("4")) {
             // 账务类型贴息明细
             //加后余额
             Double addedBalance1 = amount + saleRegistrationCollection.getInterestSubsidy();
@@ -153,14 +152,16 @@ public class SaleRegistrationCollectionServiceImpl implements ISaleRegistrationC
             saleAccountsReceivableDetail.setStatus("2");
             saleAccountsReceivableDetail.setSettlementUnit(saleRegistrationCollection.getSettlementUnitId());//结算单位
             saleAccountsReceivableDetail.setReturnReceipt("0");
+            saleAccountsReceivableDetail.setDataId(saleRegistrationCollection.getId().toString());
             saleAccountsReceivableDetailMapper.insertSaleAccountsReceivableDetail(saleAccountsReceivableDetail);
 
             // 账务类型销售应收明细
             SaleAccountsReceivableDetail saleAccountsReceivableDetail1 = new SaleAccountsReceivableDetail();
-            saleAccountsReceivableDetail1.setAccountingType("1");// 账务类型 销售应收
-            saleAccountsReceivableDetail1.setAmountReceivable(saleRegistrationCollection.getAmounts());//应收金额
+            saleAccountsReceivableDetail1.setAccountingType("2");// 账务类型 收款
+            // saleAccountsReceivableDetail1.setAmountReceivable(saleRegistrationCollection.getAmounts());//应收金额
+            saleAccountsReceivableDetail1.setReceivedAmount(saleRegistrationCollection.getAmounts());
             //加后余额
-            Double addedBalance2 = amount + saleRegistrationCollection.getAmounts();
+            Double addedBalance2 = amount - saleRegistrationCollection.getAmounts();
             saleAccountsReceivableDetail1.setAmounts(handlingWeight(addedBalance2));//余额
             saleAccountsReceivableDetail1.setCustomerId(saleRegistrationCollection.getCustomerId());// 客户名称
             saleAccountsReceivableDetail1.setAccountsReceivableDate(saleRegistrationCollection.getCollectionMoneyDate()); // 日期
@@ -173,17 +174,17 @@ public class SaleRegistrationCollectionServiceImpl implements ISaleRegistrationC
             saleAccountsReceivableDetail1.setStatus("2");
             saleAccountsReceivableDetail1.setSettlementUnit(saleRegistrationCollection.getSettlementUnitId());//结算单位
             saleAccountsReceivableDetail1.setReturnReceipt("0");
-
+            saleAccountsReceivableDetail1.setDataId(saleRegistrationCollection.getId().toString());
             saleAccountsReceivableDetailMapper.insertSaleAccountsReceivableDetail(saleAccountsReceivableDetail1);
 
             customer.setAmount(handlingWeight(addedBalance2));
             return customerMapper.updateCustomer(customer);
-        }else {
+        } else {
             // 添加应收明细
             SaleAccountsReceivableDetail saleAccountsReceivableDetail = new SaleAccountsReceivableDetail();
             //减后余额
             Double addedBalance = amount - saleRegistrationCollection.getAmounts();
-            saleAccountsReceivableDetail.setAccountingType("2");// 账务类型
+            saleAccountsReceivableDetail.setAccountingType("2");// 账务类型  收款
             saleAccountsReceivableDetail.setReceivedAmount(saleRegistrationCollection.getAmounts());//已收金额
             saleAccountsReceivableDetail.setAmounts(handlingWeight(addedBalance));//余额
             saleAccountsReceivableDetail.setCustomerId(saleRegistrationCollection.getCustomerId());// 客户名称
@@ -199,10 +200,10 @@ public class SaleRegistrationCollectionServiceImpl implements ISaleRegistrationC
             saleAccountsReceivableDetail.setStatus("2");
             saleAccountsReceivableDetail.setSettlementUnit(saleRegistrationCollection.getSettlementUnitId());//结算单位
             saleAccountsReceivableDetail.setReturnReceipt("0");
+            saleAccountsReceivableDetail.setDataId(saleRegistrationCollection.getId().toString());
             saleAccountsReceivableDetailMapper.insertSaleAccountsReceivableDetail(saleAccountsReceivableDetail);
 
 
-
             customer.setAmount(handlingWeight(addedBalance));
             return customerMapper.updateCustomer(customer);
         }

+ 5 - 27
zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml

@@ -139,22 +139,11 @@
     <select id="selectProductCodeListList" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO"
             resultMap="ProductCodeListResultVO">
         SELECT
-        pcl.id,
-        pcl.qr_code,
-        p.product_name AS product_name,
-        p.product_specifications AS product_specifications,
-        pcl.lot_num,
-        pcl.product_colour,
+        pcl.*,
         pcl.product_colour as product_color,
-        pcl.levels,
-        pcl.canister_num,
-        pcl.box_num,
-        pcl.suttle,
-        pcl.gross_weight,
-        pcl.remark,
-        pcl.print_format,
         sc.direction_of_twist as directionOfTwist,
-        pcl.work_shifts
+        p.product_name AS product_name,
+        p.product_specifications AS product_specifications
         from
         {DBNAME}.product_code_list pcl
         left join {DBNAME}.production p on
@@ -182,22 +171,11 @@
     <select id="selectProductCodeListList1" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO"
             resultMap="ProductCodeListResultVO">
         SELECT
-        pcl.id,
-        pcl.qr_code,
+        pcl.*,
         p.product_name AS product_name,
         p.product_specifications AS product_specifications,
-        pcl.lot_num,
-        pcl.product_colour,
         pcl.product_colour as product_color,
-        pcl.levels,
-        pcl.canister_num,
-        pcl.box_num,
-        pcl.suttle,
-        pcl.gross_weight,
-        pcl.remark,
-        pcl.print_format,
-        sc.direction_of_twist as directionOfTwist,
-        pcl.work_shifts
+        sc.direction_of_twist as directionOfTwist
         from
         {DBNAME}.product_code_list pcl
         left join {DBNAME}.product_code_list parent on

+ 70 - 42
zkqy-custom-business/src/main/resources/mapper/business/ProductOutboundRecordBatchMapper.xml

@@ -1,62 +1,81 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zkqy.business.mapper.ProductOutboundRecordBatchMapper">
-    
+
     <resultMap type="com.zkqy.business.domain.ProductOutboundRecordBatch" id="ProductOutboundRecordBatchResult">
-        <result property="id"    column="id"    />
-        <result property="saleNo"    column="sale_no"    />
-        <result property="noticeNumber"    column="notice_number"    />
-        <result property="outboundRecordId"    column="outbound_record_id"    />
-        <result property="batchNumber"    column="batch_number"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createById"    column="create_by_id"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="delFlag"    column="del_flag"    />
+        <result property="id" column="id"/>
+        <result property="saleNo" column="sale_no"/>
+        <result property="noticeNumber" column="notice_number"/>
+        <result property="outboundRecordId" column="outbound_record_id"/>
+        <result property="batchNumber" column="batch_number"/>
+        <result property="batchState" column="batch_state"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createById" column="create_by_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="delFlag" column="del_flag"/>
     </resultMap>
 
     <sql id="selectProductOutboundRecordBatchVo">
-        select id, sale_no, notice_number, outbound_record_id, batch_number, create_by, create_by_id, create_time, del_flag from {DBNAME}.product_outbound_record_batch
+        select id,
+               sale_no,
+               notice_number,
+               outbound_record_id,
+               batch_number,
+               batch_state,
+               create_by,
+               batch_state,
+               create_by_id,
+               create_time,
+               del_flag
+        from {DBNAME}.product_outbound_record_batch
     </sql>
 
-    <select id="selectProductOutboundRecordBatchList" parameterType="com.zkqy.business.domain.ProductOutboundRecordBatch" resultMap="ProductOutboundRecordBatchResult">
+    <select id="selectProductOutboundRecordBatchList"
+            parameterType="com.zkqy.business.domain.ProductOutboundRecordBatch"
+            resultMap="ProductOutboundRecordBatchResult">
         <include refid="selectProductOutboundRecordBatchVo"/>
-        <where>  
-            <if test="saleNo != null  and saleNo != ''"> and sale_no = #{saleNo}</if>
-            <if test="noticeNumber != null  and noticeNumber != ''"> and notice_number = #{noticeNumber}</if>
-            <if test="outboundRecordId != null "> and outbound_record_id = #{outboundRecordId}</if>
-            <if test="batchNumber != null "> and batch_number = #{batchNumber}</if>
+        <where>
+            <if test="saleNo != null  and saleNo != ''">and sale_no = #{saleNo}</if>
+            <if test="noticeNumber != null  and noticeNumber != ''">and notice_number = #{noticeNumber}</if>
+            <if test="batchState != null  and batchState != ''">and batch_state = #{batchState}</if>
+            <if test="outboundRecordId != null ">and outbound_record_id = #{outboundRecordId}</if>
+            <if test="outboundRecordIds != null ">and outbound_record_id in (#{outboundRecordIds})</if>
+            <if test="batchNumber != null ">and batch_number = #{batchNumber}</if>
         </where>
     </select>
-    
+
     <select id="selectProductOutboundRecordBatchById" parameterType="Long" resultMap="ProductOutboundRecordBatchResult">
         <include refid="selectProductOutboundRecordBatchVo"/>
         where id = #{id}
     </select>
-        
-    <insert id="insertProductOutboundRecordBatch" parameterType="com.zkqy.business.domain.ProductOutboundRecordBatch" useGeneratedKeys="true" keyProperty="id">
+
+    <insert id="insertProductOutboundRecordBatch" parameterType="com.zkqy.business.domain.ProductOutboundRecordBatch"
+            useGeneratedKeys="true" keyProperty="id">
         insert into {DBNAME}.product_outbound_record_batch
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="saleNo != null">sale_no,</if>
             <if test="noticeNumber != null">notice_number,</if>
             <if test="outboundRecordId != null">outbound_record_id,</if>
             <if test="batchNumber != null">batch_number,</if>
+            <if test="batchState != null">batch_state,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createById != null">create_by_id,</if>
             <if test="createTime != null">create_time,</if>
             del_flag
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="saleNo != null">#{saleNo},</if>
             <if test="noticeNumber != null">#{noticeNumber},</if>
+            <if test="batchState != null">#{batchState},</if>
             <if test="outboundRecordId != null">#{outboundRecordId},</if>
             <if test="batchNumber != null">#{batchNumber},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createById != null">#{createById},</if>
             <if test="createTime != null">#{createTime},</if>
             '0'
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateProductOutboundRecordBatch" parameterType="com.zkqy.business.domain.ProductOutboundRecordBatch">
@@ -64,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="SET" suffixOverrides=",">
             <if test="saleNo != null">sale_no = #{saleNo},</if>
             <if test="noticeNumber != null">notice_number = #{noticeNumber},</if>
+            <if test="batchState != null">batch_state = #{batchState}</if>
             <if test="outboundRecordId != null">outbound_record_id = #{outboundRecordId},</if>
             <if test="batchNumber != null">batch_number = #{batchNumber},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
@@ -75,7 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteProductOutboundRecordBatchById" parameterType="Long">
-        delete from product_outbound_record_batch where id = #{id}
+        delete
+        from product_outbound_record_batch
+        where id = #{id}
     </delete>
 
     <delete id="deleteProductOutboundRecordBatchByIds" parameterType="String">
@@ -86,24 +108,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <select id="selectBatchNumberByNoticeNumber" resultType="long">
-        SELECT
-            IFNULL( MAX( batch_number ), 0 ) + 1
-        FROM
-            {DBNAME}.product_outbound_record_batch
+        SELECT IFNULL(MAX(batch_number), 0) + 1
+        FROM {DBNAME}.product_outbound_record_batch
         WHERE
             notice_number = #{noticeNumber}
     </select>
 
     <insert id="batchInsertProductOutboundRecordBatch">
         INSERT INTO {DBNAME}.product_outbound_record_batch (
-            sale_no,
-            notice_number,
-            outbound_record_id,
-            batch_number,
-            create_by,
-            create_by_id,
-            create_time,
-            del_flag
+        sale_no,
+        notice_number,
+        outbound_record_id,
+        batch_number,
+        create_by,
+        create_by_id,
+        create_time,
+        del_flag
         ) VALUES
         <foreach collection="list" item="item" separator=",">
             (
@@ -120,10 +140,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </insert>
 
     <select id="selectOutboundRecordIdByBatchNumber" resultType="long">
-        SELECT
-            outbound_record_id
-        FROM
-            {DBNAME}.`product_outbound_record_batch`
+        SELECT outbound_record_id
+        FROM {DBNAME}.`product_outbound_record_batch`
         WHERE
             del_flag = '0'
           AND notice_number = #{noticeNumber}
@@ -131,7 +149,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <delete id="deleteProductOutboundRecordBatchByOutBoundRecordId" parameterType="Long">
-        update {DBNAME}.product_outbound_record_batch set del_flag = '2' where outboundRecordId = #{outboundRecordId} and del_flag = '0'
+        update {DBNAME}.product_outbound_record_batch
+        set del_flag = '2'
+        where outboundRecordId = #{outboundRecordId} and del_flag = '0'
     </delete>
 
+
+    <update id="updateBatchByIds" parameterType="String">
+        update {DBNAME}.product_outbound_record_batch set batch_state = 1 where id in
+        <foreach item="id" collection="list" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
 </mapper>

+ 1 - 0
zkqy-custom-business/src/main/resources/mapper/business/ProductOutboundRecordMapper.xml

@@ -356,6 +356,7 @@
     <select id="selectOutboundDetails" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO" resultMap="ProductCodeListResultVO">
         SELECT
             r.*,
+            p.product_no,
             p.product_name,
             p.product_specifications,
             r.product_colour AS product_color,

+ 146 - 75
zkqy-custom-business/src/main/resources/mapper/business/SaleAccountsReceivableDetailMapper.xml

@@ -1,94 +1,152 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zkqy.business.mapper.SaleAccountsReceivableDetailMapper">
-    
+
     <resultMap type="com.zkqy.business.domain.SaleAccountsReceivableDetail" id="SaleAccountsReceivableDetailResult">
-        <result property="id"    column="id"    />
-        <result property="accountingType"    column="accounting_type"    />
-        <result property="customerId"    column="customer_id"    />
+        <result property="id" column="id"/>
+        <result property="accountingType" column="accounting_type"/>
+        <result property="customerId" column="customer_id"/>
         <result property="customName" column="custom_name"/>
-        <result property="accountsReceivableDate"    column="accounts_receivable_date"    />
-        <result property="saleNo"    column="sale_no"    />
-        <result property="saleProductNo"    column="sale_product_no"    />
+        <result property="accountsReceivableDate" column="accounts_receivable_date"/>
+        <result property="saleNo" column="sale_no"/>
+        <result property="saleProductNo" column="sale_product_no"/>
         <result property="registrationCollectionId" column="registration_collection_id"/>
-        <result property="productId"    column="product_id"    />
-        <result property="productName"    column="product_name"    />
-        <result property="productSpecifications"    column="product_specifications"    />
-        <result property="productLevel"    column="product_level"    />
-        <result property="productColour"    column="product_colour"    />
-        <result property="lotNumber"    column="lot_number"    />
-        <result property="boxNum"    column="box_num"    />
-        <result property="weight"    column="weight"    />
-        <result property="productPrice"    column="product_price"    />
-        <result property="amountReceivable"    column="amount_receivable"    />
-        <result property="receivedAmount"    column="received_amount"    />
-        <result property="amounts"    column="amounts"    />
-        <result property="paymentMethod"    column="payment_method"    />
-        <result property="billingType"    column="billing_type"    />
-        <result property="accountsReceivableRemark"    column="accounts_receivable_remark"    />
-        <result property="settlementUnit"    column="settlement_unit"    />
-        <result property="returnReceipt"    column="return_receipt"    />
-        <result property="returnReceiptDate"    column="return_receipt_date"    />
-        <result property="returnReceiptRemark"    column="return_receipt_remark"    />
-        <result property="noticeNumber"    column="notice_number"    />
-        <result property="status"    column="status"    />
-        <result property="spare1"    column="spare1"    />
-        <result property="spare2"    column="spare2"    />
-        <result property="spare3"    column="spare3"    />
-        <result property="remark"    column="remark"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createById"    column="create_by_id"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateById"    column="update_by_id"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="delFlag"    column="del_flag"    />
+        <result property="productId" column="product_id"/>
+        <result property="productName" column="product_name"/>
+        <result property="productSpecifications" column="product_specifications"/>
+        <result property="productLevel" column="product_level"/>
+        <result property="productColour" column="product_colour"/>
+        <result property="lotNumber" column="lot_number"/>
+        <result property="boxNum" column="box_num"/>
+        <result property="weight" column="weight"/>
+        <result property="productPrice" column="product_price"/>
+        <result property="amountReceivable" column="amount_receivable"/>
+        <result property="receivedAmount" column="received_amount"/>
+        <result property="amounts" column="amounts"/>
+        <result property="paymentMethod" column="payment_method"/>
+        <result property="billingType" column="billing_type"/>
+        <result property="accountsReceivableRemark" column="accounts_receivable_remark"/>
+        <result property="settlementUnit" column="settlement_unit"/>
+        <result property="returnReceipt" column="return_receipt"/>
+        <result property="returnReceiptDate" column="return_receipt_date"/>
+        <result property="returnReceiptRemark" column="return_receipt_remark"/>
+        <result property="noticeNumber" column="notice_number"/>
+        <result property="status" column="status"/>
+        <result property="spare1" column="spare1"/>
+        <result property="spare2" column="spare2"/>
+        <result property="spare3" column="spare3"/>
+        <result property="remark" column="remark"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createById" column="create_by_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateById" column="update_by_id"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="delFlag" column="del_flag"/>
         <result property="billingFlag" column="billing_flag"/>
         <result property="interestSubsidy" column="interest_subsidy"/>
         <result property="otherCollectionId" column="other_collection_id"/>
         <result property="batchNumber" column="batch_number"/>
+        <result property="dataId" column="data_id"/>
     </resultMap>
 
     <sql id="selectSaleAccountsReceivableDetailVo">
-        select id, accounting_type, customer_id, accounts_receivable_date, sale_no, sale_product_no, registration_collection_id,product_id, product_name, product_specifications, product_level, product_colour, lot_number, box_num, weight, product_price, amount_receivable, received_amount, amounts, payment_method, billing_type, accounts_receivable_remark, settlement_unit, return_receipt, return_receipt_date, return_receipt_remark, notice_number, status, spare1, spare2, spare3, remark, create_by, create_by_id, create_time, update_by, update_by_id, update_time, del_flag, billing_flag, interest_subsidy,other_collection_id,batch_number from {DBNAME}.sale_accounts_receivable_detail
+        select id,
+               accounting_type,
+               customer_id,
+               accounts_receivable_date,
+               sale_no,
+               sale_product_no,
+               registration_collection_id,
+               product_id,
+               product_name,
+               product_specifications,
+               product_level,
+               product_colour,
+               lot_number,
+               box_num,
+               weight,
+               product_price,
+               amount_receivable,
+               received_amount,
+               amounts,
+               payment_method,
+               billing_type,
+               accounts_receivable_remark,
+               settlement_unit,
+               return_receipt,
+               return_receipt_date,
+               return_receipt_remark,
+               notice_number,
+               status,
+               spare1,
+               spare2,
+               spare3,
+               remark,
+               create_by,
+               create_by_id,
+               create_time,
+               update_by,
+               update_by_id,
+               update_time,
+               del_flag,
+               billing_flag,
+               interest_subsidy,
+               other_collection_id,
+               batch_number,
+               data_id
+        from {DBNAME}.sale_accounts_receivable_detail
     </sql>
 
-    <select id="selectSaleAccountsReceivableDetailList" parameterType="com.zkqy.business.domain.SaleAccountsReceivableDetail" resultMap="SaleAccountsReceivableDetailResult">
+    <select id="selectSaleAccountsReceivableDetailList"
+            parameterType="com.zkqy.business.domain.SaleAccountsReceivableDetail"
+            resultMap="SaleAccountsReceivableDetailResult">
         SELECT
-            sard.*,
-            c.custom_name,
-            csu.customer_name as settlementUnitName,
-            fpi.id as finishedProductInvoiceId,
-            fpi.invoice_number as invoiceNumber,
-            fpi.invoice_type as invoiceType
+        sard.*,
+        c.custom_name,
+        csu.customer_name as settlementUnitName,
+        fpi.id as finishedProductInvoiceId,
+        fpi.invoice_number as invoiceNumber,
+        fpi.invoice_type as invoiceType
         FROM
         {DBNAME}.sale_accounts_receivable_detail sard
         LEFT JOIN {DBNAME}.customer c ON sard.customer_id = c.id
         left join {DBNAME}.customer_settlement_unit csu on csu.id = sard.settlement_unit
-        left join {DBNAME}.finished_product_invoice fpi on sard.id = fpi.accounts_receivable_detail_id and fpi.del_flag = '0'
+        left join {DBNAME}.finished_product_invoice fpi on sard.id = fpi.accounts_receivable_detail_id and fpi.del_flag
+        = '0'
         WHERE
         sard.del_flag = '0'
-        <if test="accountingType != null  and accountingType != ''"> and sard.accounting_type = #{accountingType}</if>
-        <if test="customerId != null "> and sard.customer_id = #{customerId}</if>
-        <if test="startTime != null and endTime != null "> and sard.accounts_receivable_date between #{startTime} and #{endTime}</if>
-        <if test="billingType != null  and billingType != ''"> and sard.billing_type = #{billingType}</if>
-        <if test="accountsReceivableRemark != null  and accountsReceivableRemark != ''"> and sard.accounts_receivable_remark like concat('%', #{accountsReceivableRemark}, '%')</if>
-        <if test="returnReceipt != null  and returnReceipt != ''"> and sard.return_receipt = #{returnReceipt}</if>
+        <if test="accountingType != null  and accountingType != ''">and sard.accounting_type = #{accountingType}</if>
+        <if test="customerId != null ">and sard.customer_id = #{customerId}</if>
+        <if test="startTime != null and endTime != null ">and sard.accounts_receivable_date between #{startTime} and
+            #{endTime}
+        </if>
+        <if test="billingType != null  and billingType != ''">and sard.billing_type = #{billingType}</if>
+        <if test="accountsReceivableRemark != null  and accountsReceivableRemark != ''">and
+            sard.accounts_receivable_remark like concat('%', #{accountsReceivableRemark}, '%')
+        </if>
+        <if test="returnReceipt != null  and returnReceipt != ''">and sard.return_receipt = #{returnReceipt}</if>
         <if test="status != null and status != ''">and sard.status in ( #{status} )</if>
-        order by sard.id asc
+        <if test="orderBy != null and orderBy != ''">order by sard.id ${orderBy}</if>
+
+
     </select>
-    
-    <select id="selectSaleAccountsReceivableDetailById" parameterType="Long" resultMap="SaleAccountsReceivableDetailResult">
+
+    <select id="selectSaleAccountsReceivableDetailById" parameterType="Long"
+            resultMap="SaleAccountsReceivableDetailResult">
         <include refid="selectSaleAccountsReceivableDetailVo"/>
         where id = #{id}
     </select>
-        
-    <insert id="insertSaleAccountsReceivableDetail" parameterType="com.zkqy.business.domain.SaleAccountsReceivableDetail" useGeneratedKeys="true" keyProperty="id">
+
+    <insert id="insertSaleAccountsReceivableDetail"
+            parameterType="com.zkqy.business.domain.SaleAccountsReceivableDetail" useGeneratedKeys="true"
+            keyProperty="id">
         insert into {DBNAME}.sale_accounts_receivable_detail
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="accountingType != null">accounting_type,</if>
+            <if test="dataId != null">data_id,</if>
             <if test="customerId != null">customer_id,</if>
             <if test="accountsReceivableDate != null">accounts_receivable_date,</if>
             <if test="saleNo != null">sale_no,</if>
@@ -127,9 +185,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="batchNumber != null">batch_number,</if>
             del_flag,
             billing_flag
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="accountingType != null">#{accountingType},</if>
+            <if test="dataId != null">#{dataId},</if>
             <if test="customerId != null">#{customerId},</if>
             <if test="accountsReceivableDate != null">#{accountsReceivableDate},</if>
             <if test="saleNo != null">#{saleNo},</if>
@@ -166,15 +225,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="interestSubsidy != null">#{interestSubsidy},</if>
             <if test="otherCollectionId != null">#{otherCollectionId},</if>
             <if test="batchNumber != null">#{batchNumber},</if>
-           '0',
-           '0'
-         </trim>
+            '0',
+            '0'
+        </trim>
     </insert>
 
-    <update id="updateSaleAccountsReceivableDetail" parameterType="com.zkqy.business.domain.SaleAccountsReceivableDetail">
+    <update id="updateSaleAccountsReceivableDetail"
+            parameterType="com.zkqy.business.domain.SaleAccountsReceivableDetail">
         update {DBNAME}.sale_accounts_receivable_detail
         <trim prefix="SET" suffixOverrides=",">
             <if test="accountingType != null">accounting_type = #{accountingType},</if>
+            <if test="dataId != null">data_id = #{dataId},</if>
             <if test="customerId != null">customer_id = #{customerId},</if>
             <if test="accountsReceivableDate != null">accounts_receivable_date = #{accountsReceivableDate},</if>
             <if test="saleNo != null">sale_no = #{saleNo},</if>
@@ -217,7 +278,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteSaleAccountsReceivableDetailById" parameterType="Long">
-        update {DBNAME}.sale_accounts_receivable_detail set del_flag = '2' where id = #{id}
+        update {DBNAME}.sale_accounts_receivable_detail
+        set del_flag = '2'
+        where id = #{id}
     </delete>
 
     <delete id="deleteSaleAccountsReceivableDetailByIds" parameterType="String">
@@ -266,6 +329,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         interest_subsidy,
         other_collection_id,
         batch_number,
+        data_id,
         del_flag,
         billing_flag
         ) VALUES
@@ -308,28 +372,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{item.interestSubsidy},
             #{item.otherCollectionId},
             #{item.batchNumber},
+            #{item.dataId},
             '0',
             '0'
             )
         </foreach>
     </insert>
 
-    <select id="selectAccountsReceivableDetailList" parameterType="com.zkqy.business.domain.SaleAccountsReceivableDetail" resultMap="SaleAccountsReceivableDetailResult">
+    <select id="selectAccountsReceivableDetailList"
+            parameterType="com.zkqy.business.domain.SaleAccountsReceivableDetail"
+            resultMap="SaleAccountsReceivableDetailResult">
         <include refid="selectSaleAccountsReceivableDetailVo"></include>
         where del_flag = '0'
-        <if test="accountingType != null  and accountingType != ''"> and accounting_type = #{accountingType}</if>
-        <if test="customerId != null "> and customer_id = #{customerId}</if>
-        <if test="startTime != null and endTime != null "> and accounts_receivable_date between #{startTime} and #{endTime}</if>
-        <if test="billingType != null  and billingType != ''"> and billing_type = #{billingType}</if>
-        <if test="accountsReceivableRemark != null  and accountsReceivableRemark != ''"> and accounts_receivable_remark like concat('%', #{accountsReceivableRemark}, '%')</if>
-        <if test="returnReceipt != null  and returnReceipt != ''"> and return_receipt = #{returnReceipt}</if>
+        <if test="accountingType != null  and accountingType != ''">and accounting_type = #{accountingType}</if>
+        <if test="customerId != null ">and customer_id = #{customerId}</if>
+        <if test="startTime != null and endTime != null ">and accounts_receivable_date between #{startTime} and
+            #{endTime}
+        </if>
+        <if test="billingType != null  and billingType != ''">and billing_type = #{billingType}</if>
+        <if test="accountsReceivableRemark != null  and accountsReceivableRemark != ''">and accounts_receivable_remark
+            like concat('%', #{accountsReceivableRemark}, '%')
+        </if>
+        <if test="returnReceipt != null  and returnReceipt != ''">and return_receipt = #{returnReceipt}</if>
         <if test="status != null and status != ''">and status in ( #{status} )</if>
         order by id asc
     </select>
 
     <select id="selectAfterAccountsReceivableDetailList" resultMap="SaleAccountsReceivableDetailResult">
         <include refid="selectSaleAccountsReceivableDetailVo"></include>
-        where del_flag = '0' and status = '2' and customer_id = #{customerId} and id &lt;#{id}
+        where del_flag = '0' and status = '2' and customer_id = #{customerId} and id >#{id}
         order by id asc
     </select>
 

+ 47 - 5
zkqy-custom-business/src/main/resources/mapper/business/SaleOrderMapper.xml

@@ -334,6 +334,8 @@
         so.sale_no,
         so.sale_date,
         c.custom_name,
+        c.custom_no,
+        c.id as saleCustomNo,
         so.sale_order_estimated_time,
         so.sale_lead_time,
         so.sale_amount_in_words,
@@ -402,6 +404,46 @@
     </update>
 
     <select id="printOutsourceOrderList" resultType="com.zkqy.business.domain.vo.SaleProductsVo">
+        select a.*,
+               b.productUnitPrice -- 产品单价
+        from (select p.id                         as productId,
+                     p.product_name               as productName,
+                     p.product_specifications     as productSpecifications,
+                     por.lot_num                  as lotNumber,
+                     count(box_num)               as boxNum,
+                     TRUNCATE(sum(por.suttle), 2) as productNumber,
+                     por.product_colour           as productColour,
+                     por.notice_number            as noticeNumber,
+                     pi.sale_order_no             as saleNo,
+                     p.product_no                 as productNo,
+                     por.levels                   as productLevel,
+                     batch.batch_number           as batchNumber,
+                     batch.batch_State            as batchState,
+                     batch.id                     as batchId
+              from `huaxian`.product_outbound_record por -- 成品出库记录表
+                       left join `huaxian`.production p on p.id = por.product_id -- 产品表
+                       left join `huaxian`.product_invoice pi on por.notice_number = pi.notice_number -- 产品发货单表
+                       left join `huaxian`.product_outbound_record_batch as batch
+                                 on batch.outbound_record_id = por.id and batch.del_flag = '0' -- 成品出库记录批次表
+              where por.del_flag = '0'
+                and pi.notice_number = #{noticeNumber} -- 通知单号
+              group by por.product_id, por.levels, por.lot_num, por.product_colour) as a
+                 left join (select sp.product_no                                      as productNo,        -- 产品编号
+                                   sp.product_unit_price                              as productUnitPrice, -- 产品单价
+                                   CONCAT(m.materie_encoding, m.materie_color_number) as productColour     -- 产品转码+色泽
+                            from `huaxian`.sale_order so -- 订单表
+                                     left join `huaxian`.sale_products sp
+                                               on so.sale_no = sp.sale_order_no and sp.del_flag = '0' -- 销售产品表
+                                     left join `huaxian`.production p
+                                               on sp.product_no = p.product_no and p.del_flag = '0' -- 产品表
+                                     left join `huaxian`.materiel m
+                                               on m.materiel_code = sp.colour_number and m.del_flag = '0' -- 物料信息表
+                            where so.del_flag = '0'
+                              and so.sale_no = #{saleNo}) as b -- 根据销售单编号得到当前订单包含的所有产品
+                           on a.productNo = b.productNo and a.productColour = b.productColour;
+    </select>
+
+    <select id="printOutsourceOrderListNowEnd" resultType="com.zkqy.business.domain.vo.SaleProductsVo">
         select
             a.* ,
             b.productUnitPrice
@@ -422,12 +464,12 @@
                 FROM
                     {DBNAME}.product_outbound_record por
                         left join {DBNAME}.production p on p.id = por.product_id
-                        LEFT JOIN {DBNAME}.product_invoice pi ON por.notice_number = pi.notice_number
+                    LEFT JOIN {DBNAME}.product_invoice pi ON por.notice_number = pi.notice_number
                 WHERE
                     por.del_flag = '0'
                   AND pi.notice_number = #{noticeNumber}
                   and por.id not in
-                      (select outbound_record_id from {DBNAME}.product_outbound_record_batch where del_flag = '0' and notice_number = #{noticeNumber})
+                    (select outbound_record_id from {DBNAME}.product_outbound_record_batch where del_flag = '0' and notice_number = #{noticeNumber})
                 group by por.product_id,por.levels,por.lot_num,por.product_colour
 
             ) as a left join
@@ -439,9 +481,9 @@
                 FROM
                     {DBNAME}.sale_order so
                         LEFT JOIN {DBNAME}.sale_products sp ON so.sale_no = sp.sale_order_no
-                        AND sp.del_flag = '0'
-                        left join {DBNAME}.production p on  sp.product_no = p.product_no and p.del_flag = '0'
-                        left join {DBNAME}.materiel m on m.materiel_code = sp.colour_number and m.del_flag = '0'
+                    AND sp.del_flag = '0'
+                    left join {DBNAME}.production p on  sp.product_no = p.product_no and p.del_flag = '0'
+                    left join {DBNAME}.materiel m on m.materiel_code = sp.colour_number and m.del_flag = '0'
                 where so.del_flag = '0'
                   and so.sale_no = #{saleNo}
             ) as b on a.productNo = b.productNo and a.productColour = b.productColour

+ 2 - 2
zkqy-framework/src/main/java/com/zkqy/framework/sso_oauth2/controller/OauthController.java

@@ -120,8 +120,8 @@ public class OauthController {
         request.getSession().setAttribute(Constants.SESSION_USER, sysUser);
         // 取
         SysUser user = (SysUser) request.getSession().getAttribute(Constants.SESSION_USER);
-        System.err.println(user);
-        System.err.println(sysUser);
+        // System.err.println(user);
+        // System.err.println(sysUser);
         // 存放redis用户信息数据
         redisCache.setCacheObject(authorizationCode, sysUser);
         return AjaxResult.success(authorizationCode, params);

+ 1 - 1
zkqy-framework/src/main/java/com/zkqy/framework/sso_oauth2/controller/ThirdPartLoginController.java

@@ -53,7 +53,7 @@ public class ThirdPartLoginController {
             map.put("redirect_uri", CALLBACK);
             map.put("code", code);
 //            map.put("client_id", "mestools");
-            map.put("client_id", "hmc");
+            map.put("client_id", "mestools");
 //            if(name.equals("")&&name!=null){
 //                map.put("client_id", "mestools");
 //            }else {