Browse Source

feat:新增打印接续相关逻辑代码

韩帛霖 11 months ago
parent
commit
5e99268c7a

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductCodeListController.java

@@ -60,6 +60,13 @@ public class ProductCodeListController extends BaseController {
         return getDataTable(list);
         return getDataTable(list);
     }
     }
 
 
+    @GetMapping("/listBySaleProductID")
+    @ApiOperation(value = "接续操作")
+    public TableDataInfo list(ProductCodeList productCodeList) {
+        startPage();
+        List<ProductCodeListVO> list = productCodeListService.selectProductCodeListBySaleProductId(productCodeList);
+        return getDataTable(list);
+    }
     /**
     /**
      * 导出产品码单列表
      * 导出产品码单列表
      */
      */

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

@@ -121,6 +121,19 @@ public class ProductCodeList extends BaseEntity
     /** 退库标识 */
     /** 退库标识 */
     private String withdrawingFlag;
     private String withdrawingFlag;
 
 
+    /**
+     * 销售产品Id
+     */
+    private String saleProductId;
+
+    public String getSaleProductId() {
+        return saleProductId;
+    }
+
+    public void setSaleProductId(String saleProductId) {
+        this.saleProductId = saleProductId;
+    }
+
     public String getWithdrawingFlag() {
     public String getWithdrawingFlag() {
         return withdrawingFlag;
         return withdrawingFlag;
     }
     }
@@ -486,5 +499,39 @@ public class ProductCodeList extends BaseEntity
         this.totalGrossWeight = totalGrossWeight;
         this.totalGrossWeight = totalGrossWeight;
     }
     }
 
 
-
+    public ProductCodeList(Long id, String qrCode, String lotNum, Long productId, String productColour, String levels, Integer canisterNum, Integer boxNum, Double suttle, Date productionDate, Long machineTool, Double grossWeight, String packaging, String workShifts, String foreignTradeNumber, Double canisterWeight, Double boxWeight, String tubeColor, String comPort, String printFormat, String packagingType, String storageLocation, Long warehouseregionId, String delFlag, Long createById, Long updateById, Integer totalCanisterNum, Integer totalBoxNum, Double totalSuttle, Double totalGrossWeight, String qrCodeId, String withdrawingFlag, String saleProductId) {
+        this.id = id;
+        this.qrCode = qrCode;
+        this.lotNum = lotNum;
+        this.productId = productId;
+        this.productColour = productColour;
+        this.levels = levels;
+        this.canisterNum = canisterNum;
+        this.boxNum = boxNum;
+        this.suttle = suttle;
+        this.productionDate = productionDate;
+        this.machineTool = machineTool;
+        this.grossWeight = grossWeight;
+        this.packaging = packaging;
+        this.workShifts = workShifts;
+        this.foreignTradeNumber = foreignTradeNumber;
+        this.canisterWeight = canisterWeight;
+        this.boxWeight = boxWeight;
+        this.tubeColor = tubeColor;
+        this.comPort = comPort;
+        this.printFormat = printFormat;
+        this.packagingType = packagingType;
+        this.storageLocation = storageLocation;
+        this.warehouseregionId = warehouseregionId;
+        this.delFlag = delFlag;
+        this.createById = createById;
+        this.updateById = updateById;
+        this.totalCanisterNum = totalCanisterNum;
+        this.totalBoxNum = totalBoxNum;
+        this.totalSuttle = totalSuttle;
+        this.totalGrossWeight = totalGrossWeight;
+        this.qrCodeId = qrCodeId;
+        this.withdrawingFlag = withdrawingFlag;
+        this.saleProductId = saleProductId;
+    }
 }
 }

+ 13 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductCodeListVO.java

@@ -273,6 +273,19 @@ public class ProductCodeListVO extends BaseEntity {
      */
      */
     private String inventoryType;
     private String inventoryType;
 
 
+    /**
+     * 销售产品Id
+     */
+    private String saleProductId;
+
+
+    public String getSaleProductId() {
+        return saleProductId;
+    }
+
+    public void setSaleProductId(String saleProductId) {
+        this.saleProductId = saleProductId;
+    }
 
 
     public String getInventoryType() {
     public String getInventoryType() {
         return inventoryType;
         return inventoryType;

+ 17 - 9
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductCodeListMapper.java

@@ -1,28 +1,36 @@
 package com.zkqy.business.mapper;
 package com.zkqy.business.mapper;
 
 
 import java.util.List;
 import java.util.List;
+
 import com.zkqy.business.domain.ProductCodeList;
 import com.zkqy.business.domain.ProductCodeList;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
 
 
 /**
 /**
  * 产品码单Mapper接口
  * 产品码单Mapper接口
- * 
+ *
  * @author zkqy
  * @author zkqy
  * @date 2024-04-01
  * @date 2024-04-01
  */
  */
-public interface ProductCodeListMapper 
-{
+public interface ProductCodeListMapper {
     /**
     /**
      * 查询产品码单
      * 查询产品码单
-     * 
+     *
      * @param id 产品码单主键
      * @param id 产品码单主键
      * @return 产品码单
      * @return 产品码单
      */
      */
     public ProductCodeList selectProductCodeListById(Long id);
     public ProductCodeList selectProductCodeListById(Long id);
 
 
+    /**
+     * 查询产品码单
+     *
+     * @param productCodeList 码单对象
+     * @return 产品码单
+     */
+    public List<ProductCodeListVO> selectProductCodeListBySaleProductId(ProductCodeList productCodeList);
+
     /**
     /**
      * 查询产品码单列表
      * 查询产品码单列表
-     * 
+     *
      * @param vo 产品码单
      * @param vo 产品码单
      * @return 产品码单集合
      * @return 产品码单集合
      */
      */
@@ -30,7 +38,7 @@ public interface ProductCodeListMapper
 
 
     /**
     /**
      * 新增产品码单
      * 新增产品码单
-     * 
+     *
      * @param productCodeList 产品码单
      * @param productCodeList 产品码单
      * @return 结果
      * @return 结果
      */
      */
@@ -38,7 +46,7 @@ public interface ProductCodeListMapper
 
 
     /**
     /**
      * 修改产品码单
      * 修改产品码单
-     * 
+     *
      * @param productCodeList 产品码单
      * @param productCodeList 产品码单
      * @return 结果
      * @return 结果
      */
      */
@@ -46,7 +54,7 @@ public interface ProductCodeListMapper
 
 
     /**
     /**
      * 删除产品码单
      * 删除产品码单
-     * 
+     *
      * @param id 产品码单主键
      * @param id 产品码单主键
      * @return 结果
      * @return 结果
      */
      */
@@ -54,7 +62,7 @@ public interface ProductCodeListMapper
 
 
     /**
     /**
      * 批量删除产品码单
      * 批量删除产品码单
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @param ids 需要删除的数据主键集合
      * @return 结果
      * @return 结果
      */
      */

+ 17 - 9
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductCodeListService.java

@@ -1,29 +1,37 @@
 package com.zkqy.business.service;
 package com.zkqy.business.service;
 
 
 import java.util.List;
 import java.util.List;
+
 import com.zkqy.business.domain.ProductCodeList;
 import com.zkqy.business.domain.ProductCodeList;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
 import com.zkqy.common.core.domain.AjaxResult;
 import com.zkqy.common.core.domain.AjaxResult;
 
 
 /**
 /**
  * 产品码单Service接口
  * 产品码单Service接口
- * 
+ *
  * @author zkqy
  * @author zkqy
  * @date 2024-04-01
  * @date 2024-04-01
  */
  */
-public interface IProductCodeListService 
-{
+public interface IProductCodeListService {
     /**
     /**
      * 查询产品码单
      * 查询产品码单
-     * 
+     *
      * @param id 产品码单主键
      * @param id 产品码单主键
      * @return 产品码单
      * @return 产品码单
      */
      */
     public ProductCodeListVO selectProductCodeListById(Long id);
     public ProductCodeListVO selectProductCodeListById(Long id);
 
 
+    /**
+     * 查询产品码单
+     *
+     * @param productCodeList 码单对象
+     * @return 产品码单
+     */
+    public List<ProductCodeListVO> selectProductCodeListBySaleProductId( ProductCodeList productCodeList);
+
     /**
     /**
      * 查询产品码单列表
      * 查询产品码单列表
-     * 
+     *
      * @param vo 产品码单
      * @param vo 产品码单
      * @return 产品码单集合
      * @return 产品码单集合
      */
      */
@@ -31,7 +39,7 @@ public interface IProductCodeListService
 
 
     /**
     /**
      * 新增产品码单
      * 新增产品码单
-     * 
+     *
      * @param vo 产品码单
      * @param vo 产品码单
      * @return 结果
      * @return 结果
      */
      */
@@ -39,7 +47,7 @@ public interface IProductCodeListService
 
 
     /**
     /**
      * 修改产品码单
      * 修改产品码单
-     * 
+     *
      * @param vo 产品码单
      * @param vo 产品码单
      * @return 结果
      * @return 结果
      */
      */
@@ -47,7 +55,7 @@ public interface IProductCodeListService
 
 
     /**
     /**
      * 批量删除产品码单
      * 批量删除产品码单
-     * 
+     *
      * @param ids 需要删除的产品码单主键集合
      * @param ids 需要删除的产品码单主键集合
      * @return 结果
      * @return 结果
      */
      */
@@ -55,7 +63,7 @@ public interface IProductCodeListService
 
 
     /**
     /**
      * 删除产品码单信息
      * 删除产品码单信息
-     * 
+     *
      * @param id 产品码单主键
      * @param id 产品码单主键
      * @return 结果
      * @return 结果
      */
      */

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListServiceImpl.java

@@ -4,6 +4,7 @@ import java.text.DecimalFormat;
 import java.time.LocalDate;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -73,6 +74,12 @@ public class ProductCodeListServiceImpl implements IProductCodeListService {
         return productCodeListVO;
         return productCodeListVO;
     }
     }
 
 
+    @Override
+    public List<ProductCodeListVO> selectProductCodeListBySaleProductId(ProductCodeList productCodeList) {
+        return productCodeListMapper.selectProductCodeListBySaleProductId(productCodeList);
+    }
+
+
     /**
     /**
      * 查询产品码单列表
      * 查询产品码单列表
      *
      *

+ 195 - 134
zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml

@@ -1,82 +1,82 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
 <!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.ProductCodeListMapper">
 <mapper namespace="com.zkqy.business.mapper.ProductCodeListMapper">
-    
     <resultMap type="com.zkqy.business.domain.ProductCodeList" id="ProductCodeListResult">
     <resultMap type="com.zkqy.business.domain.ProductCodeList" id="ProductCodeListResult">
-        <result property="id"    column="id"    />
-        <result property="qrCode"    column="qr_code"    />
-        <result property="lotNum"    column="lot_num"    />
-        <result property="productId"    column="product_id"    />
+        <result property="id" column="id"/>
+        <result property="qrCode" column="qr_code"/>
+        <result property="lotNum" column="lot_num"/>
+        <result property="productId" column="product_id"/>
         <result property="productColour" column="product_colour"/>
         <result property="productColour" column="product_colour"/>
-        <result property="levels"    column="levels"    />
-        <result property="canisterNum"    column="canister_num"    />
-        <result property="boxNum"    column="box_num"    />
-        <result property="suttle"    column="suttle"    />
-        <result property="productionDate"    column="production_date"    />
-        <result property="machineTool"    column="machine_tool"    />
-        <result property="grossWeight"    column="gross_weight"    />
-        <result property="packaging"    column="packaging"    />
-        <result property="workShifts"    column="work_shifts"    />
-        <result property="foreignTradeNumber"    column="foreign_trade_number"    />
-        <result property="canisterWeight"    column="canister_weight"    />
-        <result property="boxWeight"    column="box_weight"    />
-        <result property="tubeColor"    column="tube_color"    />
-        <result property="comPort"    column="com_port"    />
-        <result property="printFormat"    column="print_format"    />
-        <result property="packagingType"    column="packaging_type"    />
-        <result property="storageLocation"    column="storage_location"    />
-        <result property="warehouseregionId"    column="warehouseregion_id"    />
-        <result property="remark"    column="remark"    />
-        <result property="delFlag"    column="del_flag"    />
-        <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="levels" column="levels"/>
+        <result property="canisterNum" column="canister_num"/>
+        <result property="boxNum" column="box_num"/>
+        <result property="suttle" column="suttle"/>
+        <result property="productionDate" column="production_date"/>
+        <result property="machineTool" column="machine_tool"/>
+        <result property="grossWeight" column="gross_weight"/>
+        <result property="packaging" column="packaging"/>
+        <result property="workShifts" column="work_shifts"/>
+        <result property="foreignTradeNumber" column="foreign_trade_number"/>
+        <result property="canisterWeight" column="canister_weight"/>
+        <result property="boxWeight" column="box_weight"/>
+        <result property="tubeColor" column="tube_color"/>
+        <result property="comPort" column="com_port"/>
+        <result property="printFormat" column="print_format"/>
+        <result property="packagingType" column="packaging_type"/>
+        <result property="storageLocation" column="storage_location"/>
+        <result property="warehouseregionId" column="warehouseregion_id"/>
+        <result property="remark" column="remark"/>
+        <result property="delFlag" column="del_flag"/>
+        <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="totalCanisterNum" column="total_canister_num"/>
         <result property="totalCanisterNum" column="total_canister_num"/>
         <result property="totalBoxNum" column="total_box_num"/>
         <result property="totalBoxNum" column="total_box_num"/>
         <result property="totalSuttle" column="total_suttle"/>
         <result property="totalSuttle" column="total_suttle"/>
         <result property="totalGrossWeight" column="total_gross_weight"/>
         <result property="totalGrossWeight" column="total_gross_weight"/>
         <result property="qrCodeId" column="qr_code_id"/>
         <result property="qrCodeId" column="qr_code_id"/>
         <result property="withdrawingFlag" column="withdrawing_flag"/>
         <result property="withdrawingFlag" column="withdrawing_flag"/>
+        <result property="saleProductId" column="sale_product_id"/>
     </resultMap>
     </resultMap>
 
 
     <resultMap type="com.zkqy.business.domain.vo.ProductCodeListVO" id="ProductCodeListResultVO">
     <resultMap type="com.zkqy.business.domain.vo.ProductCodeListVO" id="ProductCodeListResultVO">
-        <result property="id"    column="id"    />
-        <result property="qrCode"    column="qr_code"    />
-        <result property="lotNum"    column="lot_num"    />
-        <result property="productId"    column="product_id"    />
+        <result property="id" column="id"/>
+        <result property="qrCode" column="qr_code"/>
+        <result property="lotNum" column="lot_num"/>
+        <result property="productId" column="product_id"/>
         <result property="productColour" column="product_colour"/>
         <result property="productColour" column="product_colour"/>
-        <result property="levels"    column="levels"    />
-        <result property="canisterNum"    column="canister_num"    />
-        <result property="boxNum"    column="box_num"    />
-        <result property="suttle"    column="suttle"    />
-        <result property="productionDate"    column="production_date"    />
-        <result property="machineTool"    column="machine_tool"    />
-        <result property="grossWeight"    column="gross_weight"    />
-        <result property="packaging"    column="packaging"    />
-        <result property="workShifts"    column="work_shifts"    />
-        <result property="foreignTradeNumber"    column="foreign_trade_number"    />
-        <result property="canisterWeight"    column="canister_weight"    />
-        <result property="boxWeight"    column="box_weight"    />
-        <result property="tubeColor"    column="tube_color"    />
-        <result property="comPort"    column="com_port"    />
-        <result property="printFormat"    column="print_format"    />
-        <result property="packagingType"    column="packaging_type"    />
-        <result property="storageLocation"    column="storage_location"    />
-        <result property="warehouseregionId"    column="warehouseregion_id"    />
-        <result property="remark"    column="remark"    />
-        <result property="delFlag"    column="del_flag"    />
-        <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="productName"    column="product_name"    />
+        <result property="levels" column="levels"/>
+        <result property="canisterNum" column="canister_num"/>
+        <result property="boxNum" column="box_num"/>
+        <result property="suttle" column="suttle"/>
+        <result property="productionDate" column="production_date"/>
+        <result property="machineTool" column="machine_tool"/>
+        <result property="grossWeight" column="gross_weight"/>
+        <result property="packaging" column="packaging"/>
+        <result property="workShifts" column="work_shifts"/>
+        <result property="foreignTradeNumber" column="foreign_trade_number"/>
+        <result property="canisterWeight" column="canister_weight"/>
+        <result property="boxWeight" column="box_weight"/>
+        <result property="tubeColor" column="tube_color"/>
+        <result property="comPort" column="com_port"/>
+        <result property="printFormat" column="print_format"/>
+        <result property="packagingType" column="packaging_type"/>
+        <result property="storageLocation" column="storage_location"/>
+        <result property="warehouseregionId" column="warehouseregion_id"/>
+        <result property="remark" column="remark"/>
+        <result property="delFlag" column="del_flag"/>
+        <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="productName" column="product_name"/>
         <result property="productColor" column="product_color"/>
         <result property="productColor" column="product_color"/>
         <result property="productSpecifications" column="product_specifications"/>
         <result property="productSpecifications" column="product_specifications"/>
         <result property="productType" column="product_type"/>
         <result property="productType" column="product_type"/>
@@ -85,49 +85,106 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="totalSuttle" column="total_suttle"/>
         <result property="totalSuttle" column="total_suttle"/>
         <result property="totalGrossWeight" column="total_gross_weight"/>
         <result property="totalGrossWeight" column="total_gross_weight"/>
         <result property="withdrawingFlag" column="withdrawing_flag"/>
         <result property="withdrawingFlag" column="withdrawing_flag"/>
+        <result property="saleProductId" column="sale_product_id"/>
     </resultMap>
     </resultMap>
 
 
     <sql id="selectProductCodeListVo">
     <sql id="selectProductCodeListVo">
-        select id, qr_code, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time ,
-               total_canister_num, total_box_num, total_suttle, total_gross_weight,product_colour,withdrawing_flag from {DBNAME}.product_code_list
+        select id,
+               qr_code,
+               lot_num,
+               product_id,
+               levels,
+               canister_num,
+               box_num,
+               suttle,
+               production_date,
+               machine_tool,
+               gross_weight,
+               packaging,
+               work_shifts,
+               foreign_trade_number,
+               canister_weight,
+               box_weight,
+               tube_color,
+               com_port,
+               print_format,
+               packaging_type,
+               storage_location,
+               warehouseregion_id,
+               remark,
+               del_flag,
+               create_by,
+               create_by_id,
+               create_time,
+               update_by,
+               update_by_id,
+               update_time,
+               total_canister_num,
+               total_box_num,
+               total_suttle,
+               total_gross_weight,
+               product_colour,
+               withdrawing_flag,
+               sale_product_id
+        from {DBNAME}.product_code_list
     </sql>
     </sql>
 
 
-    <select id="selectProductCodeListList" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO" resultMap="ProductCodeListResultVO">
+    <select id="selectProductCodeListList" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO"
+            resultMap="ProductCodeListResultVO">
         SELECT
         SELECT
-            pcl.id,
-            pcl.qr_code,
-            p.product_name AS product_name,
-            p.product_specifications AS product_specifications,
-            pcl.lot_num,
-            pcl.product_colour AS product_color,
-            pcl.levels,
-            sum( pcl.canister_num ) AS total_canister_num,
-            count( pcl.box_num ) AS total_box_num,
-            sum( pcl.suttle ) AS total_suttle,
-            sum( pcl.gross_weight ) AS total_gross_weight,
-            pcl.remark
-            FROM
-            {DBNAME}.product_code_list pcl
-            LEFT JOIN {DBNAME}.production p ON pcl.product_id = p.id
-            WHERE
-            pcl.del_flag = '0'
-            AND p.del_flag = '0'
-            <if test="qrCode != null  and qrCode != ''"> and pcl.qr_code = #{qrCode}</if>
-            <if test="lotNum != null  and lotNum != ''"> and pcl.lot_num = #{lotNum}</if>
-            <if test="productName != null and productName != ''"> and p.product_name = #{productName}</if>
-            <if test="productSpecifications != null and productSpecifications != ''"> and p.product_specifications = #{productSpecifications}</if>
-            <if test="productColor != null and productColor != ''"> and pcl.product_colour = #{productColor}</if>
-            GROUP BY
-            pcl.qr_code
-            order by pcl.id desc
+        pcl.id,
+        pcl.qr_code,
+        p.product_name AS product_name,
+        p.product_specifications AS product_specifications,
+        pcl.lot_num,
+        pcl.product_colour AS product_color,
+        pcl.levels,
+        sum( pcl.canister_num ) AS total_canister_num,
+        count( pcl.box_num ) AS total_box_num,
+        sum( pcl.suttle ) AS total_suttle,
+        sum( pcl.gross_weight ) AS total_gross_weight,
+        pcl.remark
+        FROM
+        {DBNAME}.product_code_list pcl
+        LEFT JOIN {DBNAME}.production p ON pcl.product_id = p.id
+        WHERE
+        pcl.del_flag = '0'
+        AND p.del_flag = '0'
+        <if test="qrCode != null  and qrCode != ''">and pcl.qr_code = #{qrCode}</if>
+        <if test="lotNum != null  and lotNum != ''">and pcl.lot_num = #{lotNum}</if>
+        <if test="productName != null and productName != ''">and p.product_name = #{productName}</if>
+        <if test="productSpecifications != null and productSpecifications != ''">and p.product_specifications =
+            #{productSpecifications}
+        </if>
+        <if test="productColor != null and productColor != ''">and pcl.product_colour = #{productColor}</if>
+        GROUP BY
+        pcl.qr_code
+        order by pcl.id desc
     </select>
     </select>
-    
+
     <select id="selectProductCodeListById" parameterType="Long" resultMap="ProductCodeListResult">
     <select id="selectProductCodeListById" parameterType="Long" resultMap="ProductCodeListResult">
         <include refid="selectProductCodeListVo"/>
         <include refid="selectProductCodeListVo"/>
         where id = #{id}
         where id = #{id}
     </select>
     </select>
-        
-    <insert id="insertProductCodeList" parameterType="com.zkqy.business.domain.ProductCodeList" useGeneratedKeys="true" keyProperty="id">
+
+    <select id="selectProductCodeListBySaleProductId" parameterType="com.zkqy.business.domain.ProductCodeList"
+            resultMap="ProductCodeListResult">
+        <include refid="selectProductCodeListVo"/>
+        where sale_product_id = #{saleProductId}
+        and lot_num = #{lotNum}
+        and levels = #{levels}
+        and machine_tool = #{machineTool}
+        and work_shifts = #{workShifts}
+        and del_flag = '0'
+
+        <!--        <if test="lotNum != null  and lotNum != ''">and lot_num = #{lotNum}</if>-->
+        <!--        <if test="levels != null  and levels != ''">and levels = #{levels},</if>-->
+        <!--        <if test="machineTool != null  and machineTool != ''">and machine_tool = #{machineTool},</if>-->
+        <!--        <if test="workShifts != null  and workShifts != ''">and work_shifts = #{workShifts}</if>-->
+    </select>
+
+    <insert id="insertProductCodeList" parameterType="com.zkqy.business.domain.ProductCodeList" useGeneratedKeys="true"
+            keyProperty="id">
         insert into {DBNAME}.product_code_list
         insert into {DBNAME}.product_code_list
         <trim prefix="(" suffix=")" suffixOverrides=",">
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>
             <if test="id != null">id,</if>
@@ -162,8 +219,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalGrossWeight != null">total_gross_weight,</if>
             <if test="totalGrossWeight != null">total_gross_weight,</if>
             <if test="productColour != null">product_colour,</if>
             <if test="productColour != null">product_colour,</if>
             <if test="withdrawingFlag != null">withdrawing_flag,</if>
             <if test="withdrawingFlag != null">withdrawing_flag,</if>
+            <if test="saleProductId != null">sale_product_id,</if>
             del_flag
             del_flag
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
             <if test="id != null">#{id},</if>
             <if test="qrCode != null">#{qrCode},</if>
             <if test="qrCode != null">#{qrCode},</if>
@@ -197,8 +255,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalGrossWeight != null">#{totalGrossWeight},</if>
             <if test="totalGrossWeight != null">#{totalGrossWeight},</if>
             <if test="productColour != null">#{productColour},</if>
             <if test="productColour != null">#{productColour},</if>
             <if test="withdrawingFlag != null">#{withdrawingFlag},</if>
             <if test="withdrawingFlag != null">#{withdrawingFlag},</if>
+            <if test="saleProductId != null">#{saleProductId},</if>
             '0'
             '0'
-         </trim>
+        </trim>
     </insert>
     </insert>
 
 
     <update id="updateProductCodeList" parameterType="com.zkqy.business.domain.ProductCodeList">
     <update id="updateProductCodeList" parameterType="com.zkqy.business.domain.ProductCodeList">
@@ -240,7 +299,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
     </update>
 
 
     <delete id="deleteProductCodeListById" parameterType="Long">
     <delete id="deleteProductCodeListById" parameterType="Long">
-        update {DBNAME}.product_code_list set del_flag = '2' where id = #{id}
+        update {DBNAME}.product_code_list
+        set del_flag = '2'
+        where id = #{id}
     </delete>
     </delete>
 
 
     <update id="deleteProductCodeListByIds" parameterType="String">
     <update id="deleteProductCodeListByIds" parameterType="String">
@@ -252,29 +313,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="selectFinishedProduct" resultType="com.zkqy.business.domain.vo.ProductCodeListVO">
     <select id="selectFinishedProduct" resultType="com.zkqy.business.domain.vo.ProductCodeListVO">
         SELECT
         SELECT
-            sp.id as id,
-            sp.lot_number AS lotNum,
-            p.product_name AS productName,
-            p.product_specifications AS productSpecifications,
-            concat(ml.materie_encoding,ml.materie_color_number) AS productColor,
-            p.id AS productId,
-            sc.direction_of_twist AS directionOfTwist
+        sp.id as id,
+        sp.lot_number AS lotNum,
+        p.product_name AS productName,
+        p.product_specifications AS productSpecifications,
+        concat(ml.materie_encoding,ml.materie_color_number) AS productColor,
+        p.id AS productId,
+        sc.direction_of_twist AS directionOfTwist
         FROM
         FROM
-            {DBNAME}.sale_products sp
-                LEFT JOIN {DBNAME}.production p ON sp.product_no = p.product_no
-                LEFT JOIN {DBNAME}.sale_craft sc ON sp.sale_order_no = sc.sale_order_no
-                left join {DBNAME}.materiel ml on sp.colour_number = ml.materiel_code
+        {DBNAME}.sale_products sp
+        LEFT JOIN {DBNAME}.production p ON sp.product_no = p.product_no
+        LEFT JOIN {DBNAME}.sale_craft sc ON sp.sale_order_no = sc.sale_order_no
+        left join {DBNAME}.materiel ml on sp.colour_number = ml.materiel_code
         WHERE
         WHERE
-            sp.del_flag = '0'
-          AND p.del_flag = '0'
-          AND sc.del_flag = '0'
-            and ml.del_flag = '0'
-            and sp.status in ('4','6')
-        <if test="machineTool != null"> and sp.production_line_no = #{machineTool}</if>
+        sp.del_flag = '0'
+        AND p.del_flag = '0'
+        AND sc.del_flag = '0'
+        and ml.del_flag = '0'
+        and sp.status in ('4','6')
+        <if test="machineTool != null">and sp.production_line_no = #{machineTool}</if>
     </select>
     </select>
 
 
     <select id="selectMaxCodeList" resultType="string">
     <select id="selectMaxCodeList" resultType="string">
-        select IFNULL(max(qr_code),0) from {DBNAME}.product_code_list where del_flag = '0'
+        select IFNULL(max(qr_code), 0)
+        from {DBNAME}.product_code_list
+        where del_flag = '0'
     </select>
     </select>
 
 
     <select id="selectProductCodeListByQrCode" parameterType="string" resultMap="ProductCodeListResult">
     <select id="selectProductCodeListByQrCode" parameterType="string" resultMap="ProductCodeListResult">
@@ -283,28 +346,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     </select>
 
 
     <select id="selectProductCodeInfoByQrCode" parameterType="string" resultMap="ProductCodeListResult">
     <select id="selectProductCodeInfoByQrCode" parameterType="string" resultMap="ProductCodeListResult">
-        SELECT
-            pcl.*,
-            pwr.qr_code_id
-        FROM
-            {DBNAME}.product_code_list pcl
-                LEFT JOIN {DBNAME}.product_warehousing_record pwr ON pcl.qr_code = pwr.qr_code
-                AND pcl.lot_num = pwr.lot_num
-                AND pcl.product_id = pwr.product_id
-                AND pcl.product_colour = pwr.product_colour
-                AND pcl.levels = pwr.levels
-                and pcl.box_num = pwr.box_num
-                and pwr.del_flag = '0'
+        SELECT pcl.*,
+               pwr.qr_code_id
+        FROM {DBNAME}.product_code_list pcl
+                LEFT JOIN {DBNAME}.product_warehousing_record pwr
+        ON pcl.qr_code = pwr.qr_code
+            AND pcl.lot_num = pwr.lot_num
+            AND pcl.product_id = pwr.product_id
+            AND pcl.product_colour = pwr.product_colour
+            AND pcl.levels = pwr.levels
+            and pcl.box_num = pwr.box_num
+            and pwr.del_flag = '0'
         where pcl.del_flag = '0' and pcl.qr_code = #{qrCode}
         where pcl.del_flag = '0' and pcl.qr_code = #{qrCode}
     </select>
     </select>
 
 
 
 
     <select id="getProductCodeListById" resultMap="ProductCodeListResultVO">
     <select id="getProductCodeListById" resultMap="ProductCodeListResultVO">
-        SELECT
-            *
-        FROM
-            {DBNAME}.product_code_list pcl
-                LEFT JOIN {DBNAME}.production p ON pcl.product_id = p.id
+        SELECT *
+        FROM {DBNAME}.product_code_list pcl
+                LEFT JOIN {DBNAME}.production p
+        ON pcl.product_id = p.id
         where pcl.del_flag = '0' and p.del_flag = '0' and pcl.id = #{id}
         where pcl.del_flag = '0' and p.del_flag = '0' and pcl.id = #{id}
     </select>
     </select>