Browse Source

签收模块修改

liujiankang 7 years ago
parent
commit
0513a88236

+ 1 - 9
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/ComplaintSignclosedInfo.java

@@ -16,7 +16,7 @@ public class ComplaintSignclosedInfo implements Serializable {
     private Integer signclosedId;//id
     private Integer signclosedType;//签收类型
     private String signclosedTypeName;//签收类型名称
-    private String machineNo;//机器编号
+
     private String signclosedLogistics;//寄回物流
     private String signclosedLogisticsNumber;//物流单号
     private String signclosedSendName;//寄件人姓名
@@ -66,14 +66,6 @@ public class ComplaintSignclosedInfo implements Serializable {
         this.signclosedTypeName = signclosedTypeName;
     }
 
-    public String getMachineNo() {
-        return machineNo;
-    }
-
-    public void setMachineNo(String machineNo) {
-        this.machineNo = machineNo;
-    }
-
     public String getSignclosedLogistics() {
         return signclosedLogistics;
     }

+ 9 - 1
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/SignclosedProductInfo.java

@@ -20,7 +20,7 @@ public class SignclosedProductInfo implements Serializable {
     private Integer signclosedProductType;//1 产品  2配件
     private Integer signclosedProductId;//关联产品id  (根据产品类型判断)
     private Integer signclosedProductColor;//关联产品颜色id
-
+    private String machineNo;//机器编号
 
     private String colorName;//颜色名称
     private String productNumber;//产品型号
@@ -112,4 +112,12 @@ public class SignclosedProductInfo implements Serializable {
     public void setProductNumber(String productNumber) {
         this.productNumber = productNumber;
     }
+
+    public String getMachineNo() {
+        return machineNo;
+    }
+
+    public void setMachineNo(String machineNo) {
+        this.machineNo = machineNo;
+    }
 }

+ 2 - 2
watero-rst-interface/src/main/java/com/iamberry/rst/faces/cm/ComplaintSignclosedInfoService.java

@@ -17,9 +17,8 @@ public interface ComplaintSignclosedInfoService {
      * @return
      */
     boolean insert(ComplaintSignclosedInfo record,
-               Map<String,Integer> colorNameMap,
-               Map<String,Integer> fittingsNameMap,
                Map<String,Integer> alreadyColorMap,
+               Map<String,String[]> machineNumberMap,
                Map<String,Integer> alreadyFittingsMap);
     /**
      * 查询单个签收记录
@@ -32,6 +31,7 @@ public interface ComplaintSignclosedInfoService {
      */
     boolean updateSignclosedById(ComplaintSignclosedInfo record,
                              Map<String,Integer> alreadyColorMap,
+                             Map<String,String[]> machineNumberMap,
                              Map<String,Integer> alreadyFittingsMap);
 
     /**

+ 54 - 36
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/ComplaintSignclosedInfoServiceImpl.java

@@ -37,16 +37,15 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
     @Override
     @Transactional
     public boolean insert(ComplaintSignclosedInfo record,
-                      Map<String,Integer> colorNameMap,
-                      Map<String,Integer> fittingsNameMap,
                       Map<String,Integer> alreadyColorMap,
+                      Map<String,String[]> machineNumberMap,
                       Map<String,Integer> alreadyFittingsMap) {
         boolean msg = true;
         int num = complaintSignclosedInfoMapper.insert(record);
         if(num < 1){
             msg = false;
         }else{
-            if(colorNameMap != null || colorNameMap.size() != 0){
+            /*if(colorNameMap != null || colorNameMap.size() != 0){
                 for (Map.Entry<String,Integer> entry : colorNameMap.entrySet()) {
                     AwaitingSignclosedProductInfo awaitingSignclosedInfo = new AwaitingSignclosedProductInfo();
                     //根据颜色id获取产品信息获取产品信息
@@ -81,23 +80,30 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
                     awaitingSignclosedInfo.setSignclosedCreateTime(new Date());
                     awaitingSignclosedProductMapper.insert(awaitingSignclosedInfo);
                 }
-            }
+            }*/
             if(alreadyColorMap != null || alreadyColorMap.size() != 0){
                 for (Map.Entry<String,Integer> entry : alreadyColorMap.entrySet()) {
+                    int i = 0;
                     SignclosedProductInfo signclosedProductInfo = new SignclosedProductInfo();
                     //根据颜色id获取产品信息获取产品信息
                     Product product = productMapper.getProductById(Integer.valueOf(entry.getKey()));
                     if(product == null){
                         return false;
                     }
-                    signclosedProductInfo.setSignclosedId(record.getSignclosedId());
-                    signclosedProductInfo.setProductName(product.getProductName());
-                    signclosedProductInfo.setProductNum(entry.getValue());
-                    signclosedProductInfo.setSignclosedProductType(1);
-                    signclosedProductInfo.setSignclosedProductId(product.getProductId());
-                    signclosedProductInfo.setSignclosedProductColor(Integer.valueOf(entry.getKey()));
-                    signclosedProductInfo.setSignclosedCreateTime(new Date());
-                    complaintSignclosedProductInfoMapper.insert(signclosedProductInfo);
+                    String[] machinenums = machineNumberMap.get("machineNumber"+entry.getKey());
+                    for (int j = 0;j<entry.getValue();j++){
+                        signclosedProductInfo.setSignclosedId(record.getSignclosedId());
+                        signclosedProductInfo.setProductName(product.getProductName());
+                        signclosedProductInfo.setProductNum(1);
+                        signclosedProductInfo.setSignclosedProductType(1);
+                        signclosedProductInfo.setSignclosedProductId(product.getProductId());
+                        signclosedProductInfo.setSignclosedProductColor(Integer.valueOf(entry.getKey()));
+                        signclosedProductInfo.setMachineNo(machinenums[i]);
+                        signclosedProductInfo.setSignclosedCreateTime(new Date());
+                        complaintSignclosedProductInfoMapper.insert(signclosedProductInfo);
+                        i++;
+                    }
+
                 }
             }
             if(alreadyFittingsMap != null || alreadyFittingsMap.size() != 0){
@@ -108,14 +114,16 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
                     if(fittingsInfo == null){
                         return false;
                     }
-                    signclosedProductInfo.setSignclosedId(record.getSignclosedId());
-                    signclosedProductInfo.setProductName(fittingsInfo.getFittingsName());
-                    signclosedProductInfo.setProductNum(entry.getValue());
-                    signclosedProductInfo.setSignclosedProductType(2);
-                    signclosedProductInfo.setSignclosedProductId(fittingsInfo.getFittingsId());
-                    signclosedProductInfo.setSignclosedProductColor(null);
-                    signclosedProductInfo.setSignclosedCreateTime(new Date());
-                    complaintSignclosedProductInfoMapper.insert(signclosedProductInfo);
+                    for (int j = 0;j<entry.getValue();j++){
+                        signclosedProductInfo.setSignclosedId(record.getSignclosedId());
+                        signclosedProductInfo.setProductName(fittingsInfo.getFittingsName());
+                        signclosedProductInfo.setProductNum(1);
+                        signclosedProductInfo.setSignclosedProductType(2);
+                        signclosedProductInfo.setSignclosedProductId(fittingsInfo.getFittingsId());
+                        signclosedProductInfo.setSignclosedProductColor(null);
+                        signclosedProductInfo.setSignclosedCreateTime(new Date());
+                        complaintSignclosedProductInfoMapper.insert(signclosedProductInfo);
+                    }
                 }
             }
         }
@@ -152,6 +160,7 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
     @Override
     public boolean updateSignclosedById(ComplaintSignclosedInfo record,
                                     Map<String,Integer> alreadyColorMap,
+                                    Map<String,String[]> machineNumberMap,
                                     Map<String,Integer> alreadyFittingsMap) {
         boolean msg = true;
         int num = complaintSignclosedInfoMapper.updateSignclosedById(record);
@@ -160,20 +169,27 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
         }else{
             if(alreadyColorMap != null || alreadyColorMap.size() != 0){
                 for (Map.Entry<String,Integer> entry : alreadyColorMap.entrySet()) {
+                    int i = 0;
                     SignclosedProductInfo signclosedProductInfo = new SignclosedProductInfo();
                     //根据颜色id获取产品信息获取产品信息
                     Product product = productMapper.getProductById(Integer.valueOf(entry.getKey()));
                     if(product == null){
                         return false;
                     }
-                    signclosedProductInfo.setSignclosedId(record.getSignclosedId());
-                    signclosedProductInfo.setProductName(product.getProductName());
-                    signclosedProductInfo.setProductNum(entry.getValue());
-                    signclosedProductInfo.setSignclosedProductType(1);
-                    signclosedProductInfo.setSignclosedProductId(product.getProductId());
-                    signclosedProductInfo.setSignclosedProductColor(Integer.valueOf(entry.getKey()));
-                    signclosedProductInfo.setSignclosedCreateTime(new Date());
-                    complaintSignclosedProductInfoMapper.insert(signclosedProductInfo);
+                    String[] machinenums = machineNumberMap.get("machineNumber"+entry.getKey());
+                    for (int j = 0;j<entry.getValue();j++){
+                        signclosedProductInfo.setSignclosedId(record.getSignclosedId());
+                        signclosedProductInfo.setProductName(product.getProductName());
+                        signclosedProductInfo.setProductNum(1);
+                        signclosedProductInfo.setSignclosedProductType(1);
+                        signclosedProductInfo.setSignclosedProductId(product.getProductId());
+                        signclosedProductInfo.setSignclosedProductColor(Integer.valueOf(entry.getKey()));
+                        signclosedProductInfo.setMachineNo(machinenums[i]);
+                        signclosedProductInfo.setSignclosedCreateTime(new Date());
+                        complaintSignclosedProductInfoMapper.insert(signclosedProductInfo);
+                        i++;
+                    }
+
                 }
             }
             if(alreadyFittingsMap != null || alreadyFittingsMap.size() != 0){
@@ -184,14 +200,16 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
                     if(fittingsInfo == null){
                         return false;
                     }
-                    signclosedProductInfo.setSignclosedId(record.getSignclosedId());
-                    signclosedProductInfo.setProductName(fittingsInfo.getFittingsName());
-                    signclosedProductInfo.setProductNum(entry.getValue());
-                    signclosedProductInfo.setSignclosedProductType(2);
-                    signclosedProductInfo.setSignclosedProductId(fittingsInfo.getFittingsId());
-                    signclosedProductInfo.setSignclosedProductColor(null);
-                    signclosedProductInfo.setSignclosedCreateTime(new Date());
-                    complaintSignclosedProductInfoMapper.insert(signclosedProductInfo);
+                    for (int j = 0;j<entry.getValue();j++){
+                        signclosedProductInfo.setSignclosedId(record.getSignclosedId());
+                        signclosedProductInfo.setProductName(fittingsInfo.getFittingsName());
+                        signclosedProductInfo.setProductNum(1);
+                        signclosedProductInfo.setSignclosedProductType(2);
+                        signclosedProductInfo.setSignclosedProductId(fittingsInfo.getFittingsId());
+                        signclosedProductInfo.setSignclosedProductColor(null);
+                        signclosedProductInfo.setSignclosedCreateTime(new Date());
+                        complaintSignclosedProductInfoMapper.insert(signclosedProductInfo);
+                    }
                 }
             }
         }

+ 4 - 2
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/awaitingSignclosedProductMapper.xml

@@ -80,17 +80,19 @@
       sp.product_id productId,
       sp.signclosed_id signclosedId,
       sp.product_name productName,
-      sp.product_num productNum,
+
       sp.signclosed_create_time signclosedCreateTime,
       sp.signclosed_update_time signclosedUpdateTime,
       sp.signclosed_product_type signclosedProductType,
       sp.signclosed_product_id signclosedProductId,
       sp.signclosed_product_color signclosedProductColor,
-      pc.color_name colorName
+      pc.color_name colorName,
+      count(1) productNum
       FROM
       tb_rst_complaint_awaiting_signclosed_product sp
       LEFT JOIN tb_rst_product_color pc on sp.signclosed_product_color = pc.color_id
       WHERE
       signclosed_id = #{signclosedId}
+      GROUP BY sp.product_name,pc.color_name
   </select>
 </mapper>

+ 8 - 13
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/complaintSignclosedInfoMapper.xml

@@ -5,7 +5,6 @@
     <id column="signclosed_id" property="signclosedId" jdbcType="INTEGER" />
     <result column="signclosed_type" property="signclosedType" jdbcType="BIT" />
     <result column="signclosed_type_name" property="signclosedTypeName" jdbcType="VARCHAR" />
-    <result column="machine_no" property="machineNo" jdbcType="VARCHAR" />
     <result column="signclosed_logistics" property="signclosedLogistics" jdbcType="VARCHAR" />
     <result column="signclosed_logistics_number" property="signclosedLogisticsNumber" jdbcType="VARCHAR" />
     <result column="signclosed_send_name" property="signclosedSendName" jdbcType="VARCHAR" />
@@ -28,7 +27,7 @@
     <result column="signclosed_update_time" property="signclosedUpdateTime" jdbcType="TIMESTAMP" />
   </resultMap>
   <sql id="Base_Column_List" >
-    signclosed_id, signclosed_type, signclosed_type_name, machine_no, signclosed_logistics, 
+    signclosed_id, signclosed_type, signclosed_type_name, signclosed_logistics,
     signclosed_logistics_number, signclosed_send_name, signclosed_send_tel, signclosed_addr_provinces, 
     signclosed_addr_city, signclosed_is_fittings, signclosed_date, signclosed_is_quality, 
     signclosed_is_into, signclosed_state, signclosed_objects_state, signclosed_customer_id, 
@@ -46,7 +45,6 @@
     <id column="signclosed_id" property="signclosedId"/>
     <result column="signclosed_type" property="signclosedType"/>
     <result column="signclosed_type_name" property="signclosedTypeName"/>
-    <result column="machine_no" property="machineNo"/>
     <result column="signclosed_logistics" property="signclosedLogistics"/>
     <result column="signclosed_logistics_number" property="signclosedLogisticsNumber"/>
     <result column="signclosed_send_name" property="signclosedSendName"/>
@@ -75,19 +73,20 @@
     sp.product_id productId,
     sp.signclosed_id signclosedId,
     sp.product_name productName,
-    sp.product_num productNum,
     sp.signclosed_create_time signclosedCreateTime,
     sp.signclosed_update_time signclosedUpdateTime,
     sp.signclosed_product_type signclosedProductType,
     sp.signclosed_product_id signclosedProductId,
     sp.signclosed_product_color signclosedProductColor,
     pc.color_name colorName,
-    pi.product_number productNumber
+    pi.product_number productNumber,
+    count(1) productNum
     from
     tb_rst_complaint_awaiting_signclosed_product sp
     LEFT JOIN tb_rst_product_color pc on sp.signclosed_product_color = pc.color_id
     LEFT JOIN tb_rst_product_info pi on sp.signclosed_product_id = pi.product_id
     where sp.signclosed_id = #{signclosedId}
+    GROUP BY sp.product_name,pc.color_name
   </select>
 
   <select id="listSignclosedById" resultType="SignclosedProductInfo" parameterType="Integer" >
@@ -95,26 +94,25 @@
     sp.product_id productId,
     sp.signclosed_id signclosedId,
     sp.product_name productName,
-    sp.product_num productNum,
     sp.signclosed_create_time signclosedCreateTime,
     sp.signclosed_update_time signclosedUpdateTime,
     sp.signclosed_product_type signclosedProductType,
     sp.signclosed_product_id signclosedProductId,
     sp.signclosed_product_color signclosedProductColor,
     pc.color_name colorName,
-    pi.product_number productNumber
+    count(1) productNum
     from
     tb_rst_complaint_signclosed_product sp
     LEFT JOIN tb_rst_product_color pc on sp.signclosed_product_color = pc.color_id
     LEFT JOIN tb_rst_product_info pi on sp.signclosed_product_id = pi.product_id
     where sp.signclosed_id = #{signclosedId}
+    GROUP BY sp.product_name,pc.color_name
   </select>
   <select id="listSignclosed" resultMap="complaintSignclosedInfoMap" parameterType="ComplaintSignclosedInfo" >
     SELECT
     cs.signclosed_id,
     cs.signclosed_type,
     cs.signclosed_type_name,
-    cs.machine_no,
     cs.signclosed_logistics,
     cs.signclosed_logistics_number,
     cs.signclosed_send_name,
@@ -171,7 +169,7 @@
 
   <insert id="insert" parameterType="ComplaintSignclosedInfo" useGeneratedKeys="true" keyProperty="signclosedId" >
     insert into tb_rst_complaint_signclosed (signclosed_type, signclosed_type_name,
-      machine_no, signclosed_logistics, signclosed_logistics_number, 
+      signclosed_logistics, signclosed_logistics_number,
       signclosed_send_name, signclosed_send_tel, 
       signclosed_addr_provinces, signclosed_addr_city, 
       signclosed_is_fittings, signclosed_date, signclosed_is_quality, 
@@ -181,7 +179,7 @@
       signclosed_desc
       )
     values (#{signclosedType,jdbcType=BIT}, #{signclosedTypeName,jdbcType=VARCHAR},
-      #{machineNo,jdbcType=VARCHAR}, #{signclosedLogistics,jdbcType=VARCHAR}, #{signclosedLogisticsNumber,jdbcType=VARCHAR}, 
+      #{signclosedLogistics,jdbcType=VARCHAR}, #{signclosedLogisticsNumber,jdbcType=VARCHAR},
       #{signclosedSendName,jdbcType=VARCHAR}, #{signclosedSendTel,jdbcType=VARCHAR}, 
       #{signclosedAddrProvinces,jdbcType=INTEGER}, #{signclosedAddrCity,jdbcType=INTEGER}, 
       #{signclosedIsFittings,jdbcType=BIT}, #{signclosedDate,jdbcType=DATE}, #{signclosedIsQuality,jdbcType=INTEGER}, 
@@ -200,9 +198,6 @@
       <if test="signclosedTypeName != null" >
         signclosed_type_name = #{signclosedTypeName,jdbcType=VARCHAR},
       </if>
-      <if test="machineNo != null" >
-        machine_no = #{machineNo,jdbcType=VARCHAR},
-      </if>
       <if test="signclosedLogistics != null" >
         signclosed_logistics = #{signclosedLogistics,jdbcType=VARCHAR},
       </if>

+ 13 - 5
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/complaintSignclosedProductInfoMapper.xml

@@ -11,10 +11,12 @@
     <result column="signclosed_product_type" property="signclosedProductType" jdbcType="INTEGER" />
     <result column="signclosed_product_id" property="signclosedProductId" jdbcType="INTEGER" />
     <result column="signclosed_product_color" property="signclosedProductColor" jdbcType="INTEGER" />
+    <result column="machine_no" property="machineNo" jdbcType="VARCHAR" />
+
   </resultMap>
   <sql id="Base_Column_List" >
     product_id, signclosed_id, product_name, product_num, signclosed_create_time,
-    signclosed_update_time,signclosed_product_type,signclosed_product_id,signclosed_product_color
+    signclosed_update_time,signclosed_product_type,signclosed_product_id,signclosed_product_color,machine_no
   </sql>
   <select id="getSignclosedById" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
@@ -33,6 +35,7 @@
 	sp.signclosed_product_type signclosedProductType,
 	sp.signclosed_product_id signclosedProductId,
 	sp.signclosed_product_color signclosedProductColor,
+	sp.machine_no machineNo,
     pc.color_name colorName,
     pi.product_number productNumber
     from
@@ -44,23 +47,25 @@
 
   <insert id="insert" parameterType="SignclosedProductInfo" >
     insert into tb_rst_complaint_signclosed_product (product_id, signclosed_id, product_name, 
-      product_num, signclosed_create_time, signclosed_update_time,signclosed_product_type,signclosed_product_id,signclosed_product_color
+      product_num, signclosed_create_time, signclosed_update_time,signclosed_product_type,signclosed_product_id,
+      signclosed_product_color,machine_no
       )
     values (#{productId,jdbcType=INTEGER}, #{signclosedId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, 
       #{productNum,jdbcType=INTEGER}, #{signclosedCreateTime,jdbcType=TIMESTAMP}, #{signclosedUpdateTime,jdbcType=TIMESTAMP}
-      ,#{signclosedProductType,jdbcType=INTEGER}, #{signclosedProductId,jdbcType=INTEGER}, #{signclosedProductColor,jdbcType=INTEGER}
+      ,#{signclosedProductType,jdbcType=INTEGER}, #{signclosedProductId,jdbcType=INTEGER},
+       #{signclosedProductColor,jdbcType=INTEGER},#{machineNo,jdbcType=VARCHAR}
       )
   </insert>
 
   <insert id="insertList" parameterType="SignclosedProductInfo" >
     insert into tb_rst_complaint_awaiting_signclosed_product
       (
-          signclosed_id, product_name,product_num,signclosed_product_type,signclosed_product_id,signclosed_product_color
+          signclosed_id, product_name,product_num,signclosed_product_type,signclosed_product_id,signclosed_product_color,machine_no
       )
     values
     <foreach collection="list" item="node" index="index" separator="," open="" close="">
       (
-        #{node.signclosedId}, #{node.productName},#{node.productNum},#{node.signclosedProductType}, #{node.signclosedProductId}, #{node.signclosedProductColor}
+        #{node.signclosedId}, #{node.productName},#{node.productNum},#{node.signclosedProductType}, #{node.signclosedProductId}, #{node.signclosedProductColor}, #{node.machineNo}
       )
     </foreach>
   </insert>
@@ -77,6 +82,9 @@
       <if test="productNum != null" >
         product_num = #{productNum,jdbcType=INTEGER},
       </if>
+      <if test="machineNo != null" >
+        machine_no = #{machineNo,jdbcType=VARCHAR},
+      </if>
       <if test="signclosedCreateTime != null" >
         signclosed_create_time = #{signclosedCreateTime,jdbcType=TIMESTAMP},
       </if>

+ 37 - 12
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminSignclosedController.java

@@ -113,19 +113,23 @@ public class AdminSignclosedController {
     public ResponseJson addSignclosed(HttpServletRequest request,ComplaintSignclosedInfo signclosedInfo) throws Exception {
         ResponseJson msg = new ResponseJson();
         if(signclosedInfo == null){
-            msg.setResultCode(500);
+            msg.setResultCode(200);
             msg.setReturnCode(500);
             return msg;
         }
 
         /**寄回产品**/
-        String[] colorName = request.getParameterValues("colorName");
-        String[] fittingsName = request.getParameterValues("fittingsName");
+        /*String[] colorName = request.getParameterValues("colorName");
+        String[] fittingsName = request.getParameterValues("fittingsName");*/
         /**签收产品**/
         String[] alreadyColorName = request.getParameterValues("alreadyColorName");
         String[] alreadyFittingsName = request.getParameterValues("alreadyFittingsName");
-
-        Map<String,Integer> colorNameMap = new HashMap<>();
+        if(alreadyColorName == null && alreadyFittingsName == null){
+            msg.setResultCode(200);
+            msg.setReturnCode(502);
+            return msg;
+        }
+        /*Map<String,Integer> colorNameMap = new HashMap<>();
         if(colorName != null && colorName.length> 0){
             for (int i = 0;i<colorName.length;i++){
                 colorNameMap.put(colorName[i],Integer.valueOf(request.getParameter("colorId"+colorName[i])));
@@ -136,11 +140,22 @@ public class AdminSignclosedController {
             for (int i = 0;i<fittingsName.length;i++){
                 fittingsNameMap.put(fittingsName[i],Integer.valueOf(request.getParameter("fittingsId"+fittingsName[i])));
             }
-        }
+        }*/
         Map<String,Integer> alreadyColorMap = new HashMap<>();
+        Map<String,String[]> machineNumberMap = new HashMap<>();
         if(alreadyColorName != null && alreadyColorName.length> 0){
             for (int i = 0;i<alreadyColorName.length;i++){
-                alreadyColorMap.put(alreadyColorName[i],Integer.valueOf(request.getParameter("alreadyColorId"+alreadyColorName[i])));
+                /**获取机器数量**/
+                String number = request.getParameter("alreadyColorId"+alreadyColorName[i]);
+                alreadyColorMap.put(alreadyColorName[i],Integer.valueOf(number));
+                /**获取机器编号数组**/
+                String[] machineNumbers = request.getParameterValues("machineNumber"+alreadyColorName[i]);
+                /*if(machineNumbers.length != Integer.valueOf(number)){
+                    msg.setResultCode(200);
+                    msg.setReturnCode(501);
+                    return msg;
+                }*/
+                machineNumberMap.put("machineNumber"+alreadyColorName[i],machineNumbers);
             }
         }
         Map<String, Integer> alreadyFittingsMap = new HashMap<>();
@@ -157,11 +172,11 @@ public class AdminSignclosedController {
         if(signclosedInfo.getSignclosedState() == 2){
             signclosedInfo.setSignclosedObjectsState(3);
         }
-        boolean num = complaintSignclosedInfoService.insert(signclosedInfo,colorNameMap,fittingsNameMap,alreadyColorMap,alreadyFittingsMap);
+        boolean num = complaintSignclosedInfoService.insert(signclosedInfo,alreadyColorMap,machineNumberMap,alreadyFittingsMap);
 
 
         if (!num) {
-            msg.setResultCode(500);
+            msg.setResultCode(200);
             msg.setReturnCode(500);
         } else {
             msg.setResultCode(200);
@@ -212,11 +227,21 @@ public class AdminSignclosedController {
         /**签收产品**/
         String[] alreadyColorName = request.getParameterValues("alreadyColorName");
         String[] alreadyFittingsName = request.getParameterValues("alreadyFittingsName");
-
+        if(alreadyColorName == null && alreadyFittingsName == null){
+            msg.setResultCode(200);
+            msg.setReturnCode(502);
+            return msg;
+        }
         Map<String,Integer> alreadyColorMap = new HashMap<>();
+        Map<String,String[]> machineNumberMap = new HashMap<>();
         if(alreadyColorName != null && alreadyColorName.length> 0){
             for (int i = 0;i<alreadyColorName.length;i++){
-                alreadyColorMap.put(alreadyColorName[i],Integer.valueOf(request.getParameter("alreadyColorId"+alreadyColorName[i])));
+                /**获取机器数量**/
+                String number = request.getParameter("alreadyColorId"+alreadyColorName[i]);
+                alreadyColorMap.put(alreadyColorName[i],Integer.valueOf(number));
+                /**获取机器编号数组**/
+                String[] machineNumbers = request.getParameterValues("machineNumber"+alreadyColorName[i]);
+                machineNumberMap.put("machineNumber"+alreadyColorName[i],machineNumbers);
             }
         }
         Map<String, Integer> alreadyFittingsMap = new HashMap<>();
@@ -231,7 +256,7 @@ public class AdminSignclosedController {
             signclosedInfo.setSignclosedDate(format.parse(signclosedDate));
         }
         signclosedInfo.setSignclosedState(1);
-        boolean num = complaintSignclosedInfoService.updateSignclosedById(signclosedInfo,alreadyColorMap,alreadyFittingsMap);
+        boolean num = complaintSignclosedInfoService.updateSignclosedById(signclosedInfo,alreadyColorMap,machineNumberMap,alreadyFittingsMap);
 
 
         if (!num) {

+ 78 - 40
watero-rst-web/src/main/webapp/WEB-INF/views/cm/signclosed/add_signclosed.ftl

@@ -179,48 +179,19 @@
                 <label class="form-label col-3 col-sm-3"><span class="c-red">*</span>签收产品:</label>
                 <div class="formControls col-8 col-sm-8 text-c" id="produceSelect">
                     <div>
-                        <input type="text" onchange="selectProduct();" class="input-text" style="width: 716px;" id="selectProcuct" name="selectProcuct" placeholder="请输入产品名称搜索">
+                        <input type="text" oninput="selectProduct();" onpropertychange="selectProduct();" class="input-text" style="width: 826px;" id="selectProcuct" name="selectProcuct" placeholder="请输入产品名称搜索">
                     </div>
 
-                    <table class="table table-border table-bg table-bordered">
+                    <table class="table table-border table-bg table-bordered" style="width: 826px;">
                         <thead>
                         <tr class="text-c">
-                            <th style="text-align: center;" width="100">产品名称</th>
-                            <th style="text-align: center;" width="100">产品颜色</th>
+                            <th style="text-align: center;" width="80">产品名称</th>
+                            <th style="text-align: center;" width="130">产品颜色</th>
                             <th style="text-align: center;" width="100">产品配件</th>
                         </tr>
                         </thead>
                         <tbody id="addProduct">
-                        <#if (productList?size > 0)>
-                            <#list productList as product>
-                        <tr >
-
-
-                            <td>${product.productName!''}</td>
-                            <td>
-                                <#if (product.colorList?size > 0)>
-                                    <#list product.colorList as colorList>
-                                        <input type="checkbox" id="" value="${colorList.colorId!''}" name="alreadyColorName" datatype="*">${colorList.colorName!''}
-                                        <input type="text" style="width: 50px;margin-left: 10px;" class="input-text" value="" placeholder="数量" id="alreadyColorId${colorList.colorId!''}" name="alreadyColorId${colorList.colorId!''}"><br>
-                                    </#list>
-                                <#else>
-                                暂无颜色,请先添加产品颜色
-                                </#if>
-                             </td>
-                            <td>
-                                <#if (product.fittingsList?size > 0)>
-                                    <#list product.fittingsList as fittingsList>
-                                        <input type="checkbox" id="" value="${fittingsList.fittingsId!''}" name="alreadyFittingsName" datatype="*">${fittingsList.fittingsName!''}
-                                        <input type="text" style="width: 50px;margin-left: 10px;" class="input-text" value="" placeholder="数量" id="alreadyFittingsId${fittingsList.fittingsId!''}" name="alreadyFittingsId${fittingsList.fittingsId!''}"><br>
-                                    </#list>
-                                <#else>
-                                    暂无配件,请先添加配件
-                                </#if>
-                            </td>
-
-                        </tr>
-                            </#list>
-                        </#if>
+                        <td colspan="3">暂无数据!</td>
                         </tbody>
                     </table>
                 </div>
@@ -336,7 +307,11 @@
     //动态回显产品js state
     function selectProduct(){
         var productName = $("#selectProcuct").val();
-        alert(productName);
+        if(productName == null || productName == ""){
+            var productTable = '<td colspan="3">暂无数据!</td>';
+            $("#addProduct").html(productTable);
+            return false;
+        }
         $.ajax({
             cache: true,
             type: "POST",
@@ -345,17 +320,76 @@
             async: false,
             success: function(data){
                 if (data.returnCode == 200) {
-                    layer.msg('查询成功',{icon: 5,time:1000});
-                } else {
-                    layer.msg('查询失败,请刷新页面再试',{icon: 5,time:1000});
+                    $("#addProduct").html("");
+                    $.each(data.returnMsg.productList,function(i,value) {
+                        var colorTable = '';
+                        var fittingsTable = '';
+
+                        /*var colorlength = value.colorList.length;
+                        var fittingslength = value.fittingsList.length;*/
+                        if(value.colorList != null) {
+                            if (value.colorList.length > 0) {
+                                $.each(value.colorList, function (i, value) {
+                                    colorTable = colorTable + '<td id="tdColorId' + value.colorId + '"><input type="checkbox" value="' + value.colorId + '" name="alreadyColorName" datatype="*">' + value.colorName + ''
+                                            + '<input type="text" style="width: 50px;margin-left: 10px;" class="input-text" oninput="generateInput(' + value.colorId + ')" onpropertychange="generateInput(' + value.colorId + ')"  placeholder="数量" id="alreadyColorId' + value.colorId + '" name="alreadyColorId' + value.colorId + '"><br>' +
+                                            '</td>'
+                                });
+                            }else{
+                                colorTable = '暂无颜色,请先添加产品颜色';
+                            }
+                        }else {
+                            colorTable = '暂无颜色,请先添加产品颜色';
+                        }
+                        if(value.fittingsList != null) {
+                            if (value.fittingsList.length > 0) {
+                                $.each(value.fittingsList, function (i, value) {
+                                    fittingsTable = fittingsTable + '<input type="checkbox" value="' + value.fittingsId + '" name="alreadyFittingsName" datatype="*">' + value.fittingsName + ''
+                                            + '<input type="text" style="width: 50px;margin-left: 10px;" class="input-text" value="" placeholder="数量" id="alreadyFittingsId' + value.fittingsId + '" name="alreadyFittingsId' + value.fittingsId + '"><br>'
+                                });
+                            }else{
+                                fittingsTable = '暂无配件,请先添加配件';
+                            }
+                        }else{
+                            fittingsTable = '暂无配件,请先添加配件';
+                        }
+                        var productTable = '<tr>'
+                                +'<td>'+value.productName+'</td>'
+                                +'<td><table border="0">'+colorTable+'</table></td>'
+                                +'<td>'+fittingsTable+'</td>'
+                                +'</tr>';
+                        $("#addProduct").append(productTable);
+                    });
+                }else{
+                    var productTable = '<td colspan="3">暂无数据!</td>';
+                    $("#addProduct").html(productTable);
+
                 }
             },
             error: function(XmlHttpRequest, textStatus, errorThrown){
-                layer.msg('添加错误',{icon: 5,time:1000});
+                layer.msg('查询错误,请刷新页面重试',{icon: 5,time:1000});
             }
         });
     }
 
+    //填写数量后动态生成相同数量的文本框
+    function generateInput(colorId){
+        var inputList = "";
+        var number = $("#alreadyColorId"+colorId).val();
+        var machineNumberName = "machineNumber"+colorId;
+        if(!/^\d+$/.test(number)){
+            layer.msg('请输入正确的数量',{icon: 5,time:1000});
+            $('input[name='+machineNumberName+']').remove();
+            return false;
+        }
+        $('input[name='+machineNumberName+']').remove();
+        for (var i = 1;i<=number;i++){
+            inputList = inputList + '<input type="text" class="input-text" style="width: 110px;" placeholder="机器编号" name="machineNumber' + colorId + '" >';
+        }
+
+
+        $("#tdColorId"+colorId).append(inputList);
+    }
+
     //动态回显产品js end
 
     $(function(){
@@ -448,7 +482,11 @@
                     layer.msg('添加成功',{icon: 1,time:1000},function () {
                         location.replace(location.href);
                     });
-                } else {
+                } else if(data.returnCode == 501) {
+                    layer.msg('机器编号未填写',{icon: 5,time:1000});
+                } else if(data.returnCode == 502) {
+                    layer.msg('请至少选择一件已签收的产品',{icon: 5,time:1000});
+                }else{
                     layer.msg('添加失败',{icon: 5,time:1000});
                 }
             },

+ 120 - 20
watero-rst-web/src/main/webapp/WEB-INF/views/cm/signclosed/complete_signclosed.ftl

@@ -78,38 +78,45 @@
             <div class="row cl">
                 <label class="form-label col-3 col-sm-3"><span class="c-red">*</span>寄回产品:</label>
                 <div class="formControls col-8 col-sm-8 text-c" id="produceSelect">
+                    <div>
+                        <input type="text" oninput="selectProduct();" onpropertychange="selectProduct();" class="input-text" style="width: 826px;" id="selectProcuct" name="selectProcuct" placeholder="请输入产品名称搜索">
+                    </div>
                     <table class="table table-border table-bg table-bordered">
                         <thead>
                         <tr class="text-c">
-                            <th style="text-align: center;" width="100">产品名称</th>
-                            <th style="text-align: center;" width="100">产品数量</th>
+                            <th style="text-align: center;" width="80">产品名称</th>
+                            <th style="text-align: center;" width="130">产品颜色</th>
+                            <th style="text-align: center;" width="100">产品配件</th>
                         </tr>
                         </thead>
                         <tbody id="addProduct">
                         <#if (signclosedList?size > 0)>
                             <#list signclosedList as signclosed>
-                            <tr >
+                            <tr>
                                 <#if signclosed.signclosedProductType == 1>
-                                    <td>
-                                        <input type="checkbox" id="" value="${signclosed.signclosedProductColor!''}" name="alreadyColorName" datatype="*">
-                                        ${signclosed.productName!''}-${signclosed.colorName!''}</td>
-                                    <td>
-                                        <input type="text" style="width: 50px;margin-left: 10px;" class="input-text" value="${signclosed.productNum!''}" placeholder="数量" id="alreadyColorId${signclosed.signclosedProductColor!''}" name="alreadyColorId${signclosed.signclosedProductColor!''}"><br>
-                                    </td>
-                                <#else>
-                                    <td>
-                                        <input type="checkbox" id="" value="${signclosed.signclosedProductId!''}" name="alreadyFittingsName" datatype="*">
-                                        ${signclosed.productName!''}</td>
-                                    <td>
-                                        <input type="text" style="width: 50px;margin-left: 10px;" class="input-text" value="${signclosed.productNum!''}" placeholder="数量" id="alreadyFittingsId${signclosed.signclosedProductId!''}" name="alreadyFittingsId${signclosed.signclosedProductId!''}"><br>
+                                <td>${signclosed.productName!''}</td>
+                                <td><table border="0">
+                                    <td id="tdColorId${signclosed.signclosedProductColor!''}"><input type="checkbox" value="${signclosed.signclosedProductColor!''}" name="alreadyColorName" datatype="*">${signclosed.colorName!''}
+                                    <input type="text" style="width: 50px;margin-left: 10px;" value="${signclosed.productNum!''}" class="input-text" oninput="generateInput( ${signclosed.signclosedProductColor!''})" onpropertychange="generateInput(${signclosed.signclosedProductColor!''})"  placeholder="数量" id="alreadyColorId${signclosed.signclosedProductColor!''}" name="alreadyColorId${signclosed.signclosedProductColor!''}"><br>
+                                        <#list 1..signclosed.productNum as t>
+                                            <input type="text" class="input-text" style="width: 110px;" placeholder="机器编号" name="machineNumber${signclosed.signclosedProductColor!''}" >
+                                        </#list>
+
                                     </td>
+                                </table></td>
+                                <td> </td>
+                                </#if>
+                                <#if signclosed.signclosedProductType == 2>
+                                <td></td>
+                                <td></td>
+                                <td><input type="checkbox" value="${signclosed.signclosedProductId!''}" name="alreadyFittingsName" datatype="*">${signclosed.productName!''}
+                                    <input type="text" style="width: 50px;margin-left: 10px;" class="input-text" value="${signclosed.productNum!''}" placeholder="数量" id="alreadyFittingsId${signclosed.signclosedProductId!''}" name="alreadyFittingsId${signclosed.signclosedProductId!''}"><br>
+                                </td>
                                 </#if>
-
                             </tr>
                             </#list>
-                        <#else>
-                        <tr><td class="td-manage text-c" colspan = "2">暂无数据</td></tr>
                         </#if>
+
                         </tbody>
                     </table>
                 </div>
@@ -185,7 +192,7 @@
             </div>
             <div class="row cl">
                 <div class="col-2 col-sm-2 col-offset-3">
-                    <input type="hidden" id="signclosedId" name="signclosedId" value="<#if ifcomplaintSignclosedInfo?? >${complaintSignclosedInfo.signclosedId!''}</#if>">
+                    <input type="hidden" id="signclosedId" name="signclosedId" value="<#if complaintSignclosedInfo?? >${complaintSignclosedInfo.signclosedId!''}</#if>">
                     <button onClick="add();" class="btn btn-block btn-primary size-XL" type="button">确认签收</button>
                 </div>
             </div>
@@ -202,6 +209,95 @@
 <#--<script type="text/javascript" src="${path}/common/lib/cm.lib/dimensions.js"></script>-->
 <script type="text/javascript" src="${path}/common/lib/cm.lib/suggest.js"></script>
 <script type="text/javascript">
+    //动态回显产品js state
+    function selectProduct(){
+        var productName = $("#selectProcuct").val();
+        if(productName == null || productName == ""){
+            var productTable = '<td colspan="3">暂无数据!</td>';
+            $("#addProduct").html(productTable);
+            return false;
+        }
+        $.ajax({
+            cache: true,
+            type: "POST",
+            url: "${path}/admin/signclosed/select_product",
+            data:{'productName':productName},
+            async: false,
+            success: function(data){
+                if (data.returnCode == 200) {
+                    $("#addProduct").html("");
+                    $.each(data.returnMsg.productList,function(i,value) {
+                        var colorTable = '';
+                        var fittingsTable = '';
+
+                        /*var colorlength = value.colorList.length;
+                        var fittingslength = value.fittingsList.length;*/
+                        if(value.colorList != null) {
+                            if (value.colorList.length > 0) {
+                                $.each(value.colorList, function (i, value) {
+                                    colorTable = colorTable + '<td id="tdColorId' + value.colorId + '"><input type="checkbox" value="' + value.colorId + '" name="alreadyColorName" datatype="*">' + value.colorName + ''
+                                            + '<input type="text" style="width: 50px;margin-left: 10px;" class="input-text" oninput="generateInput(' + value.colorId + ')" onpropertychange="generateInput(' + value.colorId + ')"  placeholder="数量" id="alreadyColorId' + value.colorId + '" name="alreadyColorId' + value.colorId + '"><br>' +
+                                            '</td>'
+                                });
+                            }else{
+                                colorTable = '暂无颜色,请先添加产品颜色';
+                            }
+                        }else {
+                            colorTable = '暂无颜色,请先添加产品颜色';
+                        }
+                        if(value.fittingsList != null) {
+                            if (value.fittingsList.length > 0) {
+                                $.each(value.fittingsList, function (i, value) {
+                                    fittingsTable = fittingsTable + '<input type="checkbox" value="' + value.fittingsId + '" name="alreadyFittingsName" datatype="*">' + value.fittingsName + ''
+                                            + '<input type="text" style="width: 50px;margin-left: 10px;" class="input-text" value="" placeholder="数量" id="alreadyFittingsId' + value.fittingsId + '" name="alreadyFittingsId' + value.fittingsId + '"><br>'
+                                });
+                            }else{
+                                fittingsTable = '暂无配件,请先添加配件';
+                            }
+                        }else{
+                            fittingsTable = '暂无配件,请先添加配件';
+                        }
+                        var productTable = '<tr>'
+                                +'<td>'+value.productName+'</td>'
+                                +'<td><table border="0">'+colorTable+'</table></td>'
+                                +'<td>'+fittingsTable+'</td>'
+                                +'</tr>';
+                        $("#addProduct").append(productTable);
+                    });
+                }else{
+                    var productTable = '<td colspan="3">暂无数据!</td>';
+                    $("#addProduct").html(productTable);
+
+                }
+            },
+            error: function(XmlHttpRequest, textStatus, errorThrown){
+                layer.msg('查询错误,请刷新页面重试',{icon: 5,time:1000});
+            }
+        });
+    }
+
+    //填写数量后动态生成相同数量的文本框
+    function generateInput(colorId){
+        var inputList = "";
+        var number = $("#alreadyColorId"+colorId).val();
+        var machineNumberName = "machineNumber"+colorId;
+        if(!/^\d+$/.test(number)){
+            layer.msg('请输入正确的数量',{icon: 5,time:1000});
+            $('input[name='+machineNumberName+']').remove();
+            return false;
+        }
+        $('input[name='+machineNumberName+']').remove();
+        for (var i = 1;i<=number;i++){
+            inputList = inputList + '<input type="text" class="input-text" style="width: 110px;" placeholder="机器编号" name="machineNumber' + colorId + '" >';
+        }
+
+
+        $("#tdColorId"+colorId).append(inputList);
+    }
+    //动态回显产品js end
+
+
+
     $(function(){
         var province = listProvince(null,null);
         var provinceHtml = '';
@@ -274,7 +370,11 @@
                     layer.msg('添加成功',{icon: 1,time:1000},function () {
                         location.replace(location.href);
                     });
-                } else {
+                } else if(data.returnCode == 501) {
+                    layer.msg('机器编号未填写',{icon: 5,time:1000});
+                } else if(data.returnCode == 502) {
+                    layer.msg('请至少选择一件已签收的产品',{icon: 5,time:1000});
+                }else {
                     layer.msg('添加失败',{icon: 5,time:1000});
                 }
             },