浏览代码

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

wangxiaoming 7 年之前
父节点
当前提交
b1dd53d55a
共有 17 个文件被更改,包括 865 次插入81 次删除
  1. 68 48
      iamberry-common-core/src/main/java/com/iamberry/wechat/core/entity/member/Member.java
  2. 11 3
      iamberry-wechat-service/src/main/java/com/iamberry/wechat/service/warranty/WarrantyServiceImpl.java
  3. 43 0
      iamberry-wechat-web/src/main/java/com/iamberry/wechat/handles/warranty/WarrantyCardHandler.java
  4. 79 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/tools/QrCodeUtil.java
  5. 8 1
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/pts/MachineService.java
  6. 22 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/pts/MachineServiceImpl.java
  7. 8 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/pts/mapper/MachineMapper.java
  8. 96 4
      watero-rst-service/src/main/java/com/iamberry/rst/service/pts/mapper/machineMapper.xml
  9. 3 0
      watero-rst-service/src/main/java/com/iamberry/rst/util/SmsConfig.java
  10. 115 20
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachineController.java
  11. 4 3
      watero-rst-web/src/main/resources/platform.properties
  12. 12 0
      watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/addRenovationMachine.ftl
  13. 39 2
      watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/machine_List.ftl
  14. 355 0
      watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/tooth_print_List.ftl
  15. 1 0
      watero-rst-web/src/main/webapp/WEB-INF/views/pts/produce/save_produce.ftl
  16. 1 0
      watero-rst-web/src/main/webapp/WEB-INF/views/pts/produce/update_produce.ftl
  17. 二进制
      watero-rst-web/src/main/webapp/common/images/pts/toothImages/addparts.jpg

文件差异内容过多而无法显示
+ 68 - 48
iamberry-common-core/src/main/java/com/iamberry/wechat/core/entity/member/Member.java


+ 11 - 3
iamberry-wechat-service/src/main/java/com/iamberry/wechat/service/warranty/WarrantyServiceImpl.java

@@ -9,8 +9,10 @@ import com.iamberry.wechat.face.mq.EfastOrderService;
 import com.iamberry.wechat.face.warranty.WarrantyService;
 import com.iamberry.wechat.service.mapper.ProductInfoMapper;
 import com.iamberry.wechat.service.mapper.WarrantyMapper;
+import com.iamberry.wechat.service.member.dao.MemberDao;
 import com.iamberry.wechat.tools.ResultInfo;
 import net.sf.json.JSONArray;
+import org.elasticsearch.common.inject.assistedinject.AssistedInject;
 import org.hibernate.validator.constraints.URL;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -35,7 +37,8 @@ public class WarrantyServiceImpl implements WarrantyService {
     private SystemService systemService;
     @Autowired
     private WarrantyMapper warrantyMapper;
-
+    @Autowired
+    private MemberDao memberDao;
     @Override
     public boolean addWarrantyList(String txtOrderId, Member member, String cardWatero,
                                    String cardProvince, String cardCity, String cardDistrict) throws Exception {
@@ -104,9 +107,14 @@ public class WarrantyServiceImpl implements WarrantyService {
                 }
             }
         }
+        //修改用户信息
+        int count = memberDao.updateMemberByUserId(member);
         //批量添加质保卡信息
-        int num = warrantyMapper.addWarrantyCardList(cardList);
-        if (num > 0) {
+        int num = 1;
+        if (cardList != null && cardList.size() > 0) {
+            num = warrantyMapper.addWarrantyCardList(cardList);
+        }
+        if (num > 0 && count > 0) {
             return true;
         } else {
             return false;

+ 43 - 0
iamberry-wechat-web/src/main/java/com/iamberry/wechat/handles/warranty/WarrantyCardHandler.java

@@ -250,4 +250,47 @@ public class WarrantyCardHandler {
         }
         return map;
     }
+
+    /**
+     * 根据经纬度通过腾讯地址位置
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/get_location_by_qq")
+    public ResultMsg getLocationByQq(HttpServletRequest request) throws Exception {
+        ResultMsg msg = new ResultMsg();
+        Map<String,Object> map = new HashMap<String,Object>();
+        //纬度
+        String latitude = request.getParameter("latitude");
+        //经度
+        String longitude = request.getParameter("longitude");
+        if (!StringUtils.isNotEmpty(latitude)) {
+            msg.setResultCode(ResultInfo.ERRORCODE);
+            msg.setStatus(false);
+            msg.setMessage("纬度不能为空!");
+            return msg;
+        }
+        if (!StringUtils.isNotEmpty(longitude)) {
+            msg.setResultCode(ResultInfo.ERRORCODE);
+            msg.setStatus(false);
+            msg.setMessage("经度不能为空!");
+            return msg;
+        }
+        JSONObject json = new JSONObject(
+                HttpUtility.httpsGet(MessageFormat.format(NameUtils.getConfig("LOCATION_QQ_URL"),latitude,longitude)));
+        JSONObject resultJson = json.getJSONObject("result");
+        JSONObject locationJson = resultJson.getJSONObject("ad_info");
+        String numberProvince = locationJson.getString("province");
+        String numberCity = locationJson.getString("city");
+        String numberDistrict = locationJson.getString("district");
+        map.put("numberProvince",numberProvince);
+        map.put("numberCity",numberCity);
+        map.put("numberDistrict",numberDistrict);
+        msg.setData(map);
+        msg.setResultCode(ResultInfo.SUCCESSCODE);
+        msg.setStatus(true);
+        return msg;
+    }
 }

+ 79 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/tools/QrCodeUtil.java

@@ -0,0 +1,79 @@
+package com.iamberry.rst.core.tools;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.common.BitMatrix;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Hashtable;
+
+/**
+ * Created by Administrator on 2017/8/9.
+ */
+public class QrCodeUtil {
+
+   private static final int BLACK = 0xFF000000;
+   private static final int WHITE = 0xFFFFFFFF;
+   public static BufferedImage toBufferedImage(BitMatrix matrix) {
+        int width = matrix.getWidth();
+        int height = matrix.getHeight();
+        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+        for (int x = 0; x < width; x++) {
+            for (int y = 0; y < height; y++) {
+                image.setRGB(x, y, matrix.get(x, y) ? BLACK : WHITE);
+            }
+        }
+        return image;
+   }
+    public static void writeToFile(BitMatrix matrix, String format, File file) throws IOException {
+        BufferedImage image = toBufferedImage(matrix);
+        if (!ImageIO.write(image, format, file)) {
+            throw new IOException("Could not write an image of format " + format + " to " + file);
+        }
+    }
+    public static void writeToStream(BitMatrix matrix, String format, OutputStream stream) throws IOException {
+        BufferedImage image = toBufferedImage(matrix);
+        if (!ImageIO.write(image, format, stream)) {
+        throw new IOException("Could not write an image of format " + format);
+        }
+    }
+
+    /**
+     * 创建个人二维码
+     * @param url   扫描二维码所访问的链接
+     * @param path  生成二维码路径
+     * @throws Exception
+     */
+    public static boolean createQrCode(String url,String path,Integer width,Integer height) throws Exception {
+        if(width == null){
+            width = 500;
+        }
+        if(height == null){
+            height = 500;
+        }
+        //二维码的图片格式
+        String format = "png";
+        //二维码保存路径
+        StringBuilder str = new StringBuilder(path);
+        str.append(format);
+
+        File outputFile = new File(str.toString());
+        //判断该二维码是否存在,如果存在,则不生成
+        if (outputFile.exists()) {
+            return false;
+        }
+        Hashtable hints = new Hashtable();
+        //内容所使用编码
+        hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
+        BitMatrix bitMatrix = new MultiFormatWriter().encode(url,
+                BarcodeFormat.QR_CODE, width, height, hints);
+        //生成二维码
+        writeToFile(bitMatrix, format, outputFile);
+        return true;
+    }
+}

+ 8 - 1
watero-rst-interface/src/main/java/com/iamberry/rst/faces/pts/MachineService.java

@@ -32,15 +32,22 @@ public interface MachineService {
 
     //查询最新机器
     List<PtsMachine> listLatestMachine(Integer machineId);
+    //查询最新机器
+    List<PtsMachine> listLatestTooth(Integer machineId);
 
     //查询数据库最大的机器id
     Integer maxMachineId();
-
+    //查询数据库最大的牙刷id
+    Integer maxToothId();
     List<PtsMachine> listPrintOrder(PtsMachine ptsMachine);
 
+    List<PtsMachine> listPrintOrderTooth(PtsMachine ptsMachine);
+
     //分页查询机器打印列表
     PagedResult<PtsMachine> getPrintOrderList(int pageNO, int pageSize, PtsMachine ptsMachine, boolean isTotalNum);
 
+    //分页查询机器打印列表
+    PagedResult<PtsMachine> getPrintOrderToothList(int pageNO, int pageSize, PtsMachine ptsMachine, boolean isTotalNum);
     //机器集合 -- webapp  模糊查询code
     List<PtsMachine> listMachineWebApp(PtsMachine ptsMachine);
 

+ 22 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/pts/MachineServiceImpl.java

@@ -53,16 +53,31 @@ public class MachineServiceImpl implements MachineService {
     }
 
     @Override
+    public List<PtsMachine> listLatestTooth(Integer machineId) {
+        return machineMapper.listLatestTooth(machineId);
+    }
+
+    @Override
     public Integer maxMachineId() {
         return machineMapper.maxMachineId();
     }
 
     @Override
+    public Integer maxToothId() {
+        return machineMapper.maxToothId();
+    }
+
+    @Override
     public List<PtsMachine> listPrintOrder(PtsMachine ptsMachine) {
         return machineMapper.listMachine(ptsMachine);
     }
 
     @Override
+    public List<PtsMachine> listPrintOrderTooth(PtsMachine ptsMachine) {
+        return machineMapper.listMachineTooth(ptsMachine);
+    }
+
+    @Override
     public PagedResult<PtsMachine> getPrintOrderList(int pageNO, int pageSize, PtsMachine ptsMachine, boolean isTotalNum) {
         PageHelper.startPage(pageNO, pageSize, isTotalNum);
         List<PtsMachine> list = machineMapper.listMachine(ptsMachine);
@@ -70,6 +85,13 @@ public class MachineServiceImpl implements MachineService {
     }
 
     @Override
+    public PagedResult<PtsMachine> getPrintOrderToothList(int pageNO, int pageSize, PtsMachine ptsMachine, boolean isTotalNum) {
+        PageHelper.startPage(pageNO, pageSize, isTotalNum);
+        List<PtsMachine> list = machineMapper.listMachineTooth(ptsMachine);
+        return PageUtil.getPage(list);
+    }
+
+    @Override
     public List<PtsMachine> ListPtsMachine(PtsMachine ptsMachine) {
         return machineMapper.listMachine(ptsMachine);
     }

+ 8 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/pts/mapper/MachineMapper.java

@@ -26,6 +26,9 @@ public interface MachineMapper {
     //查询机器列表
     List<PtsMachine> listMachine(PtsMachine ptsMachine);
 
+    //查询电动牙刷列表
+    List<PtsMachine> listMachineTooth(PtsMachine ptsMachine);
+
     //机器集合--> 仓储查询机器
     List<PtsMachine> ListPtsMachineToSignclosed(PtsMachine ptsMachine);
 
@@ -37,10 +40,15 @@ public interface MachineMapper {
 
     //查询最新机器
     List<PtsMachine> listLatestMachine(Integer machineId);
+    //查询最新机器
+    List<PtsMachine> listLatestTooth(Integer machineId);
 
     //查询数据库最大的机器id
     Integer maxMachineId();
 
+    //查询数据库最大的牙刷id
+    Integer maxToothId();
+
     //获取单个机器生产流程日志
     List<PtsMachineLogs> listMachineLogs(Integer machineId);
 

+ 96 - 4
watero-rst-service/src/main/java/com/iamberry/rst/service/pts/mapper/machineMapper.xml

@@ -108,18 +108,72 @@
         LEFT JOIN tb_rst_pts_produce pi ON t.machine_produce_id = pi.produce_id
         <where>
             <if test="machineBarcode != null and machineBarcode != ''">
-                machine_barcode = #{machineBarcode}
+                t.machine_barcode = #{machineBarcode}
             </if>
             <if test="machineIsPrint != null and machineIsPrint != ''">
-               AND machine_is_print = #{machineIsPrint}
+               AND t.machine_is_print = #{machineIsPrint}
             </if>
             <if test="machineProcessState != null and machineProcessState != ''">
-                AND machine_process_state = #{machineProcessState}
+                AND t.machine_process_state = #{machineProcessState}
+            </if>
+            <if test="machineProduceType != null and machineProduceType != 0">
+                AND t.machine_produce_type = #{machineProduceType}
+            </if>
+            <if test="machineProduceType != null and machineProduceType == 0">
+                AND t.machine_produce_type in(1,2)
             </if>
             AND  t.machine_status = 1
         </where>
         order by machine_id desc
     </select>
+    <!--查询电动牙刷信息-->
+    <select id="listMachineTooth" parameterType="PtsMachine" resultType="PtsMachine">
+        SELECT
+        t.machine_id machineId,
+        t.machine_qrcode machineQrcode,
+        t.machine_barcode machineBarcode,
+        t.machine_sales_date machineSalesDate,
+        t.machine_sales_state machineSalesState,
+        t.machine_status machineStatus,
+        t.machine_produced_time machineProducedTime,
+        t.machine_sub_time machineSubTime,
+        t.machine_is_print machineIsPrint,
+        t.machine_compound_img machineCompoundImg,
+        t.machine_process_state machineProcessState,
+        t.machine_software_version machineSoftwareVersion,
+        t.machine_hardware_version machineHardwareVersion,
+        t.machine_create_time machineCreateTime,
+        t.machine_update_time machineUpdateTime,
+        t.machine_produce_type machineProduceType,
+        t.machine_produce_id machineProduceId,
+        t.machine_is_retreading machineIsRetreading,
+        trpb.bom_version AS machineHardwareVersionName,
+        trpmv.machine_version_no AS machineSoftwareVersionName,
+        pi.produce_name AS produceName,
+        pi.produce_pattern AS producePattern,
+        pi.produce_model AS produceModel
+        FROM  tb_rst_pts_machine t
+        LEFT JOIN tb_rst_pts_bom trpb ON t.machine_bom_id = trpb.bom_id
+        LEFT JOIN tb_rst_pts_machine_version trpmv ON t.machine_software_version = trpmv.machine_version_id
+        LEFT JOIN tb_rst_pts_produce pi ON t.machine_produce_id = pi.produce_id
+        <where>
+            <if test="machineBarcode != null and machineBarcode != ''">
+                t.machine_barcode = #{machineBarcode}
+            </if>
+            <if test="machineIsPrint != null and machineIsPrint != ''">
+                AND t.machine_is_print = #{machineIsPrint}
+            </if>
+            <if test="machineProcessState != null and machineProcessState != ''">
+                AND t.machine_process_state = #{machineProcessState}
+            </if>
+            <if test="machineProduceType != null and machineProduceType != ''">
+                AND t.machine_produce_type = #{machineProduceType}
+            </if>
+            AND  t.machine_status = 1
+            AND t.machine_produce_type = 3
+        </where>
+        order by machine_id desc
+    </select>
 
     <select id="ListPtsMachineToSignclosed" parameterType="PtsMachine" resultType="PtsMachine">
         SELECT
@@ -206,13 +260,51 @@
         LEFT JOIN tb_rst_pts_machine_version trpmv ON t.machine_software_version = trpmv.machine_version_id
         LEFT JOIN tb_rst_pts_produce pi ON t.machine_produce_id = pi.produce_id
         where machine_id > #{machineId}
+        and t.machine_produce_type in(1,2)
+        order by t.machine_id asc
+    </select>
+
+    <select id="listLatestTooth" parameterType="Integer" resultType="PtsMachine">
+        SELECT
+        t.machine_id machineId,
+        t.machine_qrcode machineQrcode,
+        t.machine_barcode machineBarcode,
+        t.machine_sales_date machineSalesDate,
+        t.machine_sales_state machineSalesState,
+        t.machine_status machineStatus,
+        t.machine_produced_time machineProducedTime,
+        t.machine_sub_time machineSubTime,
+        t.machine_is_print machineIsPrint,
+        t.machine_compound_img machineCompoundImg,
+        t.machine_process_state machineProcessState,
+        t.machine_software_version machineSoftwareVersion,
+        t.machine_hardware_version machineHardwareVersion,
+        t.machine_create_time machineCreateTime,
+        t.machine_update_time machineUpdateTime,
+        t.machine_produce_type machineProduceType,
+        t.machine_produce_id machineProduceId,
+        t.machine_is_retreading machineIsRetreading,
+        trpb.bom_version AS machineHardwareVersionName,
+        trpmv.machine_version_no AS machineSoftwareVersionName,
+        pi.produce_name AS produceName,
+        pi.produce_pattern AS producePattern,
+        pi.produce_model AS produceModel
+        FROM  tb_rst_pts_machine t
+        LEFT JOIN tb_rst_pts_bom trpb ON t.machine_bom_id = trpb.bom_id
+        LEFT JOIN tb_rst_pts_machine_version trpmv ON t.machine_software_version = trpmv.machine_version_id
+        LEFT JOIN tb_rst_pts_produce pi ON t.machine_produce_id = pi.produce_id
+        where machine_id > #{machineId}
+        AND  t.machine_produce_type = 3
         order by t.machine_id asc
     </select>
 
     <select id="maxMachineId" resultType="Integer">
-        select * from tb_rst_pts_machine ORDER BY machine_id DESC  limit 1
+        select * from tb_rst_pts_machine where machine_produce_type in(1,2) ORDER BY machine_id DESC  limit 1
     </select>
 
+    <select id="maxToothId" resultType="Integer">
+        select * from tb_rst_pts_machine where machine_produce_type = 3 ORDER BY machine_id DESC  limit 1
+    </select>
     <select id="listMachineLogs" parameterType="Integer" resultType="PtsMachineLogs">
         select
          logs_id logsId,

+ 3 - 0
watero-rst-service/src/main/java/com/iamberry/rst/util/SmsConfig.java

@@ -55,6 +55,8 @@ public class SmsConfig {
     public static String ADD_CUSTOMER_SUCCESS_SHANGDUO="";
     /* 添加客诉成功提醒  -- 优尼雅 */
     public static String ADD_CUSTOMER_SUCCESS_YULIA="";
+    /* 扫描牙刷二维码访问地址 */
+    public static String scanningQrCode="";
 
 
 
@@ -91,6 +93,7 @@ public class SmsConfig {
             ADD_CUSTOMER_SUCCESS_WATERO=pro.getProperty("ADD_CUSTOMER_SUCCESS_WATERO");
             ADD_CUSTOMER_SUCCESS_SHANGDUO=pro.getProperty("ADD_CUSTOMER_SUCCESS_SHANGDUO");
             ADD_CUSTOMER_SUCCESS_YULIA=pro.getProperty("ADD_CUSTOMER_SUCCESS_YULIA");
+            scanningQrCode=pro.getProperty("scanningQrCode");
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 115 - 20
watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachineController.java

@@ -4,6 +4,7 @@ import com.iamberry.rst.core.page.PageRequest;
 import com.iamberry.rst.core.page.PagedResult;
 import com.iamberry.rst.core.pts.*;
 import com.iamberry.rst.core.tools.QRCJson;
+import com.iamberry.rst.core.tools.QrCodeUtil;
 import com.iamberry.rst.core.tools.WeixinUtil;
 import com.iamberry.rst.faces.pts.*;
 import com.iamberry.wechat.tools.NameUtils;
@@ -18,14 +19,19 @@ import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.ContextLoader;
+import org.springframework.web.context.WebApplicationContext;
 import org.springframework.web.servlet.ModelAndView;
 
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.xml.crypto.Data;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.util.*;
 
+import static com.iamberry.rst.util.SmsConfig.scanningQrCode;
+
 /**
  * Created by LJK on 2017/8/29.
  */
@@ -88,6 +94,11 @@ public class AdminMachineController {
             sb.append(ptsMachine.getMachineProcessState());
             mv.addObject("machineProcessState", ptsMachine.getMachineProcessState());
         }
+        if (ptsMachine.getMachineProduceType() != null && ptsMachine.getMachineProduceType() != -1) {
+            sb.append("&machineProduceType=");
+            sb.append(ptsMachine.getMachineProduceType());
+            mv.addObject("machineProduceType", ptsMachine.getMachineProduceType());
+        }
 
         PageRequest<PtsMachine> pageRequest = new PageRequest<PtsMachine>(ptsMachine, pageNO, pageSize, pageTotal == null);
         PagedResult<PtsMachine> pagedResult = machineService.listMachine(pageRequest);
@@ -124,6 +135,22 @@ public class AdminMachineController {
         }
         return machineService.listLatestMachine(Integer.valueOf(machineId));
     }
+    /**
+     * 查询最新牙刷信息
+     *
+     * @param request
+     * @return
+     */
+    @RequiresPermissions("machine:latest_all:machine")
+    @ResponseBody
+    @RequestMapping("/_LatestTooth_list")
+    public List<PtsMachine> listLatestTooth(HttpServletRequest request) {
+        String machineId = request.getParameter("machineId");
+        if (machineId == null || machineId.equals("")) {
+            return null;
+        }
+        return machineService.listLatestTooth(Integer.valueOf(machineId));
+    }
 
     /**
      * 修改机器打印状态为已打印
@@ -160,9 +187,8 @@ public class AdminMachineController {
                                          @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
         ModelAndView mv = new ModelAndView("pts/machine/machine_print_List");
         mv.addObject("machineIsPrint", ptsMachine.getMachineIsPrint() == null ? "1" : String.valueOf(ptsMachine.getMachineIsPrint()));
-
         StringBuilder sb = new StringBuilder("/admin/machine/_machine_print_list?pageSize=" + pageSize);
-
+        ptsMachine.setMachineProduceType(0);
         if (ptsMachine == null || ptsMachine.getMachineIsPrint() == null || ptsMachine.getMachineIsPrint() == 1) { //未打印
             List<PtsMachine> machineList = machineService.listPrintOrder(ptsMachine);
             mv.addObject("machineList", machineList);
@@ -188,6 +214,48 @@ public class AdminMachineController {
         return mv;
     }
 
+
+    /**
+     * 查询电动牙刷打印列表
+     *
+     * @return
+     * @author LJK
+     * @date 2017年8月31日16:08:15
+     */
+    @RequiresPermissions("machine:select_all:machine")
+    @RequestMapping("/_tooth_print_list")
+    public ModelAndView listPrintTooth(HttpServletRequest request, PtsMachine ptsMachine,
+                                         @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
+                                         @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
+                                         @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
+        ModelAndView mv = new ModelAndView("pts/machine/tooth_print_List");
+        mv.addObject("machineIsPrint", ptsMachine.getMachineIsPrint() == null ? "1" : String.valueOf(ptsMachine.getMachineIsPrint()));
+
+        StringBuilder sb = new StringBuilder("/admin/machine/_tooth_print_list?pageSize=" + pageSize);
+        if (ptsMachine == null || ptsMachine.getMachineIsPrint() == null || ptsMachine.getMachineIsPrint() == 1) { //未打印
+            List<PtsMachine> machineList = machineService.listPrintOrderTooth(ptsMachine);
+            mv.addObject("machineList", machineList);
+        } else {  //已打印
+            PagedResult<PtsMachine> pagedResult = machineService.getPrintOrderToothList(pageNO, pageSize, ptsMachine, totalNum == 0);
+            if (totalNum != 0) {
+                pagedResult.setTotal(totalNum);
+                pagedResult.setPages((int) Math.ceil((double) totalNum / pageSize));
+            }
+            sb.append("&machineIsPrint=");
+            if (ptsMachine.getMachineIsPrint() != null && ptsMachine.getMachineIsPrint() == 2) {
+                sb.append(ptsMachine.getMachineIsPrint());
+            }
+            sb.append("&totalNum=");
+            sb.append(totalNum == 0 ? pagedResult.getTotal() : totalNum);
+            sb.append("&pageNO=");
+            mv.addObject("page", pagedResult);
+            mv.addObject("url", sb.toString());
+        }
+        //查询最新一条机器id
+        Integer machineId = machineService.maxToothId();
+        mv.addObject("machineId", machineId);
+        return mv;
+    }
     /**
      * 查询机器关联的产品信息
      *
@@ -492,20 +560,23 @@ public class AdminMachineController {
         String num = null;
         for (int i = 0; i < Integer.valueOf(number); i++) {
             machineNumber = machineNumber + i;
-            switch (String.valueOf(machineNumber + 1).length()) {
+            switch (String.valueOf(machineNumber).length()) {
                 case 0:
-                    num = "0001";
+                    num = "00001";
                     break;
                 case 1:
-                    num = "000" + String.valueOf(machineNumber);
+                    num = "0000" + String.valueOf(machineNumber);
                     break;
                 case 2:
-                    num = "00" + String.valueOf(machineNumber);
+                    num = "000" + String.valueOf(machineNumber);
                     break;
                 case 3:
-                    num = "0" + String.valueOf(machineNumber);
+                    num = "00" + String.valueOf(machineNumber);
                     break;
                 case 4:
+                    num = "00" + String.valueOf(machineNumber);
+                    break;
+                case 5:
                     num = String.valueOf(machineNumber);
                     break;
             }
@@ -609,12 +680,13 @@ public class AdminMachineController {
     @ResponseBody
     @RequiresPermissions("machine:add:batch")
     @RequestMapping("/add_renovationMachine")
-    public ResponseJson addRenovationMachine(HttpServletRequest request, Integer batchId, Integer number,Integer isRefurbishment,String machineLine) {
+    public ResponseJson addRenovationMachine(HttpServletRequest request, Integer batchId, Integer number,Integer isRefurbishment,String machineLine,Integer productType) {
         ResponseJson rj = new ResponseJson();
-        if (batchId == null || isRefurbishment == null || machineLine == null) {
+        if (batchId == null || isRefurbishment == null || machineLine == null || productType == null) {
             rj.setReturnCode(500);
             return rj;
         }
+
         PtsBatch ptsBatch = new PtsBatch();
         ptsBatch.setBatchId(batchId);
         ptsBatch = ptsBatchService.getPtsBatch(ptsBatch);
@@ -631,9 +703,6 @@ public class AdminMachineController {
         if (number == null || number < 1) {
             number = ptsBatch.getBatchQuantity();
         }
-
-        /*获取公众号信息*/
-        WechatMp wechatMp = produceService.getWechatMpById(produce.getWechatMpId());
         ArrayList<PtsMachine> ptsList = new ArrayList<PtsMachine>();
         //生成条形码前缀
         String berQrcode = generationBarCode(produce);
@@ -653,25 +722,51 @@ public class AdminMachineController {
             machineNumber++;
             switch (String.valueOf(machineNumber).length()) {
                 case 0:
-                    num = "0001";
+                    num = "00001";
                     break;
                 case 1:
-                    num = "000" + String.valueOf(machineNumber);
+                    num = "0000" + String.valueOf(machineNumber);
                     break;
                 case 2:
-                    num = "00" + String.valueOf(machineNumber);
+                    num = "000" + String.valueOf(machineNumber);
                     break;
                 case 3:
-                    num = "0" + String.valueOf(machineNumber);
+                    num = "00" + String.valueOf(machineNumber);
                     break;
                 case 4:
+                    num = "00" + String.valueOf(machineNumber);
+                    break;
+                case 5:
                     num = String.valueOf(machineNumber);
                     break;
             }
-            String json = String.format(NameUtils.QR_LIMIT_STR_SCENE, ResultInfo.barCodePrefix + berQrcode + num);
-            QRCJson qrc = WeixinUtil.createQrcodeByWechatMp(json,wechatMp.getWechatMpAppid(),wechatMp.getWechatMpAppsecret(),wechatMp.getWechatMpPubno());
+            String qrCodeUrl = null;
+            //判断机器是水机or牙刷
+            if(productType == 3){
+                //获取项目地址
+                WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();
+                ServletContext servletContext = webApplicationContext.getServletContext();
+                String realPath = servletContext.getRealPath(ResultInfo.QRCODE_TOOTH_IMAGE);
+                boolean bl = false;
+                try {
+                    bl = QrCodeUtil.createQrCode(scanningQrCode+berQrcode+num,realPath+"/"+berQrcode+num+".",430,430);
+                }catch (Exception e){
+                    e.printStackTrace();
+                }
+                    if(bl){
+                        StringBuffer url = request.getRequestURL();
+                        String tempContextUrl = url.delete(url.length() - request.getRequestURI().length(), url.length()).append(request.getContextPath()).append("/").toString();
+                        qrCodeUrl = tempContextUrl +ResultInfo.QRCODE_TOOTH_IMAGE+ "/"+berQrcode+num+".png";
+                    }
+            }else{
+                  /*获取公众号信息*/
+                WechatMp wechatMp = produceService.getWechatMpById(produce.getWechatMpId());
+                String json = String.format(NameUtils.QR_LIMIT_STR_SCENE, ResultInfo.barCodePrefix + berQrcode + num);
+                QRCJson qrc = WeixinUtil.createQrcodeByWechatMp(json,wechatMp.getWechatMpAppid(),wechatMp.getWechatMpAppsecret(),wechatMp.getWechatMpPubno());
+                qrCodeUrl = qrc.getUrl();
+            }
             PtsMachine ptsMachine = new PtsMachine();
-            ptsMachine.setMachineQrcode(qrc.getUrl());//二维码
+            ptsMachine.setMachineQrcode(qrCodeUrl);//二维码
             ptsMachine.setMachineBarcode(berQrcode + num);//条形码
             ptsMachine.setMachineStatus(1);//机器状态
             ptsMachine.setMachineProducedTime(new Date());//生产时间
@@ -679,7 +774,7 @@ public class AdminMachineController {
             ptsMachine.setMachineCompoundImg("合成的图片url");
             ptsMachine.setMachineProcessState(1);//生成流程状态1.正常2.异常
             ptsMachine.setMachineCreateTime(new Date());//创建时间
-            ptsMachine.setMachineProduceType(produce.getProduceType());//产品类型
+            ptsMachine.setMachineProduceType(productType);//产品类型
             ptsMachine.setMachineNfcId(productNfcId);
             //ptsMachine.setMachineHardwareVersion(ptsBom.getBomId());
             ptsMachine.setMachineSoftwareVersion(ptsBatch.getBatchSoftwareVersionId());

+ 4 - 3
watero-rst-web/src/main/resources/platform.properties

@@ -51,9 +51,9 @@ RELATION_SEND_WATERO=\u3010\u7F8E\u56FDWaterO\u3011\u5C0A\u656C\u7684\u5BA2\u623
 RELATION_SEND_SHANGDUO=\u3010\u4E0A\u6735\u5FAE\u5546\u57CE\u3011\u5C0A\u656C\u7684\u5BA2\u6237\uFF0C\u60A8\u7533\u8BF7\u7684{0}\u5DF2\u5904\u7406\u53D1\u8D27\uFF0C\u7269\u6D41\u4FE1\u606F\uFF1A{1}\u3002
 RELATION_SEND_YULIA=\u3010YULIA\u51C0\u6C34\u673A\u3011\u5C0A\u656C\u7684\u5BA2\u6237\uFF0C\u60A8\u7533\u8BF7\u7684{0}\u5DF2\u5904\u7406\u53D1\u8D27\uFF0C\u7269\u6D41\u4FE1\u606F\uFF1A{1}\u3002
 
-ADD_CUSTOMER_SUCCESS_WATERO=\u3010\u7f8e\u56fd\u0057\u0061\u0074\u0065\u0072\u004f\u3011\u5c0a\u656c\u7684\u5ba2\u6237\u60a8\u597d\uff0c\u5df2\u6536\u5230\u60a8\u7684\u552e\u540e\u7533\u8bf7\uff0c\u6211\u4eec\u6b63\u79ef\u6781\u5904\u7406\uff0c\u5904\u7406\u65b9\u5f0f\u4e3a\uff1a{0}\uff0c\u795d\u60a8\u751f\u6d3b\u6109\u5feb\uff08{1}\uff09
-ADD_CUSTOMER_SUCCESS_SHANGDUO=\u3010\u4e0a\u6735\u5fae\u5546\u57ce\u3011\u5c0a\u656c\u7684\u5ba2\u6237\u60a8\u597d\uff0c\u5df2\u6536\u5230\u60a8\u7684\u552e\u540e\u7533\u8bf7\uff0c\u6211\u4eec\u6b63\u79ef\u6781\u5904\u7406\uff0c\u5904\u7406\u65b9\u5f0f\u4e3a\uff1a{0}\uff0c\u795d\u60a8\u751f\u6d3b\u6109\u5feb\uff08{1}\uff09
-ADD_CUSTOMER_SUCCESS_YULIA=\u3010\u0059\u0055\u004c\u0049\u0041\u51c0\u6c34\u673a\u3011\u5c0a\u656c\u7684\u5ba2\u6237\u60a8\u597d\uff0c\u5df2\u6536\u5230\u60a8\u7684\u552e\u540e\u7533\u8bf7\uff0c\u6211\u4eec\u6b63\u79ef\u6781\u5904\u7406\uff0c\u5904\u7406\u65b9\u5f0f\u4e3a\uff1a{0}\uff0c\u795d\u60a8\u751f\u6d3b\u6109\u5feb\uff08{1}\uff09
+ADD_CUSTOMER_SUCCESS_WATERO=\u3010\u7F8E\u56FDWaterO\u3011\u5C0A\u656C\u7684\u5BA2\u6237\u60A8\u597D\uFF0C\u5DF2\u6536\u5230\u60A8\u7684\u552E\u540E\u7533\u8BF7\uFF0C\u6211\u4EEC\u6B63\u79EF\u6781\u5904\u7406\uFF0C\u5904\u7406\u65B9\u5F0F\u4E3A\uFF1A{0}\uFF0C\u795D\u60A8\u751F\u6D3B\u6109\u5FEB\uFF08{1}\uFF09
+ADD_CUSTOMER_SUCCESS_SHANGDUO=\u3010\u4E0A\u6735\u5FAE\u5546\u57CE\u3011\u5C0A\u656C\u7684\u5BA2\u6237\u60A8\u597D\uFF0C\u5DF2\u6536\u5230\u60A8\u7684\u552E\u540E\u7533\u8BF7\uFF0C\u6211\u4EEC\u6B63\u79EF\u6781\u5904\u7406\uFF0C\u5904\u7406\u65B9\u5F0F\u4E3A\uFF1A{0}\uFF0C\u795D\u60A8\u751F\u6D3B\u6109\u5FEB\uFF08{1}\uFF09
+ADD_CUSTOMER_SUCCESS_YULIA=\u3010YULIA\u51C0\u6C34\u673A\u3011\u5C0A\u656C\u7684\u5BA2\u6237\u60A8\u597D\uFF0C\u5DF2\u6536\u5230\u60A8\u7684\u552E\u540E\u7533\u8BF7\uFF0C\u6211\u4EEC\u6B63\u79EF\u6781\u5904\u7406\uFF0C\u5904\u7406\u65B9\u5F0F\u4E3A\uFF1A{0}\uFF0C\u795D\u60A8\u751F\u6D3B\u6109\u5FEB\uFF08{1}\uFF09
 
 #---SMS end---#
 #weixin
@@ -84,3 +84,4 @@ SUCCESSINFO=SUCCESS
 
 #cm-website-send-msg
 website=https://rst.iamberry.com/QA
+scanningQrCode=https://w.iamberry.com/tooth/wechat/qr/

+ 12 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/addRenovationMachine.ftl

@@ -75,6 +75,18 @@
                 <input type="radio" id="radio-11" name="isRefurbishment" value="2" checked />否
             </label>
         </div>
+        <div class="input-box">
+            <span class="input-dic" style="margin-top: 0">产品类型:</span>
+            <label for="radio-10">
+                <input type="radio" id="radio-10" name="productType" value="1" checked/>净水机
+            </label>
+            <label for="radio-11" style="margin-left: 50px;">
+                <input type="radio" id="radio-11" name="productType" value="2"/>冲奶机
+            </label>
+            <label for="radio-12" style="margin-left: 50px;">
+                <input type="radio" id="radio-12" name="productType" value="3"/>电动牙刷
+            </label>
+        </div>
 
         <div class="input-box"><span class="input-dic spanhidth">拉线:</span><input class="my-input" type="text" style="width: 76%;"  name="machineLine" id="machineLine" value="A1"/> </div>
         <div class="input-box"><span class="input-dic spanhidth">机器数量:</span><input class="my-input" type="text" style="width: 76%;"  name="number" id="number" value="4" placeholder="每次最少生成一个机器"/> </div>

+ 39 - 2
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/machine_List.ftl

@@ -69,6 +69,31 @@
 							<option value ="2">异常</option>
 						</#if>
 					</select>
+                        <select class="my-select" name="machineProduceType">
+                            <option value ="">产品类型</option>
+
+                        <#if machineProduceType??>
+                            <#if machineProduceType == 1>
+                                <option value ="1" selected>净水机</option>
+                            <#else >
+                                <option value ="1">净水机<</option>
+                            </#if>
+                            <#if machineProduceType == 2>
+                                <option value ="2" selected>冲奶机</option>
+                            <#else >
+                                <option value ="2">冲奶机</option>
+                            </#if>
+                            <#if machineProduceType == 3>
+                                <option value ="3" selected>电动牙刷</option>
+                            <#else >
+                                <option value ="3">电动牙刷</option>
+                            </#if>
+                        <#else >
+                            <option value ="1">净水机</option>
+                            <option value ="2">冲奶机</option>
+                            <option value ="3">电动牙刷</option>
+                        </#if>
+                        </select>
 					<button type="submit" style="cursor:pointer; " class="my-btn-search">搜索</button>
 			</form>
 		</div>
@@ -87,6 +112,7 @@
                     <th width="40">硬件版本</th>
                     <th width="40">软件版本</th>
                     <th width="40">是否是翻新机</th>
+                    <th width="40">产品类型</th>
 					<th width="150">操作</th>
 				</tr>
 				</thead>
@@ -138,10 +164,21 @@
                                 </#if>
                             </td>
+                            <td class="text-c" width="100">
+                                <#if list.machineProduceType == 1>
+                                    净水机
+                                </#if>
+                                <#if list.machineProduceType == 2>
+                                    冲奶机
+                                </#if>
+                                <#if list.machineProduceType == 3>
+                                    电动牙刷
+                                </#if>
+                            </td>
 							<!-- 遍历操作 -->
 							<td class="td-manage text-c">
                                 <a onclick="machineLogs(${list.machineId});" title="生产流程" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe667;</i></a>
-                                <a onclick="print('${list.machineBarcode }','${list.machineQrcode }','${list.machineId }','${list.machineProduceType }')" title="打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe652;</i></a>
+                                <#--<a onclick="print('${list.machineBarcode }','${list.machineQrcode }','${list.machineId }','${list.machineProduceType }')" title="打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe652;</i></a>-->
                             </td>
 						</tr>
 					</#list>
@@ -308,7 +345,7 @@
                                         +'<td class="text-c" width="50">'+machineIsRetreading+'</td>'
                             			+'<td class="td-manage text-c">'
                                         +'<a onclick="machineLogs('+value.machineId+');" title="生产流程" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe667;</i></a>'
-                                        +'<a onclick="print('+'\''+value.machineBarcode+'\''+','+'\''+value.machineQrcode+'\''+','+'\''+value.machineId+'\''+','+'\''+value.machineProduceType+'\''+')" title="打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe652;</i></a>'
+                                        /*+'<a onclick="print('+'\''+value.machineBarcode+'\''+','+'\''+value.machineQrcode+'\''+','+'\''+value.machineId+'\''+','+'\''+value.machineProduceType+'\''+')" title="打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe652;</i></a>'*/
                                         +'</td></tr>');
 							});
 						}

+ 355 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/tooth_print_List.ftl

@@ -0,0 +1,355 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/html">
+	<head>
+		<meta charset="UTF-8">
+		<title></title>
+        <#include "/base/list_base.ftl">
+		<style>
+            *{padding: 0;margin: 0;}
+			.my-input{border: 1px solid rgba(0,0,0,.1);padding: 1px 5px;height: 32px;margin-right: 10px;}
+			.my-input::-webkit-input-placeholder,.my-select{color: #dcdcdc;}
+			.my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;height: 34px;margin: 0 10px; -webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/select-1.png) right center no-repeat;background-size:auto 100%;}
+			.my-btn-search{border: 1px solid #32a3d8;padding: 1px 25px;height: 32px;background-color: #32a3d8;color: #fff;}
+            .barcodeImg{margin:10px 0px}
+			.isprint{width: 200px;height:50px;}
+            .background{background-color: #0a6999}
+		</style>
+	</head>
+	<body>
+    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
+        <span class="c-gray en">&gt;</span> PST管理
+        <span class="c-gray en">&gt;</span> 电动牙刷打印列表
+        <a class="btn radius r" style="line-height:1.6em;margin-top:3px;background: #32a3d8;color: #fff;border:1px solid #32a3d8;" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
+    </nav>
+		<div class="text-c" style="margin-top: 20px;">
+			<form action="${path}/admin/machine/_tooth_print_list" method="post">
+
+				<#--<div id="havePrint" class="isprint background" onclick="selectIsPrint(1);"><span>未打印</span></div>
+                <div id="notPrint" class="isprint" onclick="selectIsPrint(2);"><span>已打印</span></div>-->
+                    <div id="HuiTab-demo1" class="HuiTab">
+                        <div class="tabBar cl">
+                            <span id="notPrint" onclick="selectIsPrint(1);" class="allOrder">未打印</span>
+                            <span id="havePrint" onclick="selectIsPrint(2);" class="returnOrderEtc">已打印</span>
+                        </div>
+                    </div>
+                <input class="my-input" type="hidden" id="machineIsPrint" name="machineIsPrint" />
+               <#-- <input  class="my-input" type="text" value="每个二维码打印数量:" readonly="readonly" style="border: 0;margin-top: 8px;margin-right: 0"/>
+                <input class="my-input" type="text" id="settingNumber" name="printNumber" value="3" placeholder="打印数量" style="margin-top: 10px;"/>-->
+                <button type="button" class="my-btn-search" onclick="printList();" style="cursor:pointer; margin-right: 50px;margin-top: 10px;">打印</button>
+                <button id="updatePrintId" type="button" class="my-btn-search" onclick="batchUpdatePring();" style="cursor:pointer; margin-right: 50px;margin-top: 10px;">修改为已打印</button>
+			</form>
+		</div>
+		<div class="mt-2" style="margin: 20px; " >
+            <div style="width: 55%;margin: 0 auto; ">
+                <table class="table table-border table-bordered table-bg table-hover table-sort" >
+                    <thead>
+                    <tr class="text-c">
+                        <th width="1"><input name='checkbox2' type='checkbox' value='' id="all" ></th>
+                        <th width="40">设备尾号</th>
+                        <th width="40">产品条码</th>
+                        <th width="70">产品名/型号</th>
+                        <th width="10">生产时间</th>
+                        <th width="20">操作</th>
+                    </tr>
+                    </thead>
+                    <tbody id="listid">
+                        <#if machineIsPrint == '1'>
+                            <#assign machineList = machineList />
+                        <#else >
+                            <#assign machineList = page.dataList />
+                        </#if>
+                        <#if machineList?? &&  (machineList?size > 0) >
+                        <#list machineList as list>
+                            <tr class="text-c" id="${list.machineBarcode }">
+                                <td width="2">
+                                    <input name='checkbox' type='checkbox' value='${list.machineBarcode }' machineId='${list.machineId }'>
+                                    <input type="hidden" value="${list.machineId + 1000000 }" id="${list.machineBarcode + 'Id'}">
+                                    <input type="hidden" value="${list.machineQrcode}" id="machineQrcode${list.machineId }">
+                                    <input type="hidden" value="${list.machineProduceType}" id="machineProduceType${list.machineId }">
+                                </td>
+                                <td class="text-c" style="font-size: 24px" width="10">${list.machineBarcode?substring(list.machineBarcode?length-5) }</td>
+                                <td class="text-c" width="10">${list.machineBarcode }</td>
+                                <td class="text-c" width="6">
+                                ${list.produceName }/${list.producePattern }-${list.produceModel }
+                                </td>
+                                <td>${(list.machineCreateTime?string("yyyy-MM-dd HH:mm:ss"))!''}</td>
+                                <!-- 遍历操作 -->
+                                <td class="td-manage text-c">
+                                    <#if machineIsPrint == '1'>
+                                        <a onclick="updatePrint('${list.machineBarcode}',true);" title="修改为已打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6a7;</i></a>
+                                    </#if>
+                                    <a onclick="barCodePrint('${list.machineBarcode }','${list.machineId }');" title="打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe652;</i></a>
+                                </td>
+                            </tr>
+                        </#list>
+                        <#else>
+                        <tr id="noMachineTr"><td colspan="6" class="td-manage text-c" >暂时没有机器,请添加!</td></tr>
+                        </#if>
+                    </tbody>
+                </table>
+
+                <#if machineIsPrint == '2'>
+                    <tfoot>
+                        <div style="margin-top: 20px"><#include "/base/page_util.ftl"></div>
+                    </tfoot>
+                </#if>
+            </div>
+			<input type="hidden" value="${machineId!''}" name="machineId" id="machineId">
+            <input type="hidden" value="" name="codeId" id="codeId">
+            <div style="position: absolute;top: 80px;height: 23px;display:none;" id="bcTarget" class="barcodeImg"></div>
+			<div  style="display:none;" >
+				<div id="printlist" style="margin-left: 75px;">
+                </div>
+			</div>
+		</div>
+        <script type="text/javascript" src="${path}/common/lib/jquery.PrintArea/jquery.PrintArea.js"></script>
+        <script type="text/javascript" src="${path}/common/lib/jquery/1.9.1/jquery-barcode.js"></script>
+
+		<script type="text/javascript">
+            $("#all").on('click',function(){
+                console.log($(this).prop('checked'));
+                if($(this).prop('checked')){
+                    $("input[name='checkbox']").prop("checked","true");
+                }else{
+                    $("input[name='checkbox']").removeAttr("checked");
+                }
+
+            });
+                if(${machineIsPrint} == '1'){
+                    $("#notPrint").attr("class", "current");
+                    $("#machineIsPrint").val(1);
+                }
+                if(${machineIsPrint} == '2'){
+                    $("#havePrint").attr("class", "current");
+                    $("#machineIsPrint").val(2);
+                    $("#updatePrintId").hide();//隐藏修改打印按钮
+                }
+
+            function selectIsPrint(printState) {
+                if(printState == 1){
+                    $("#notPrint").attr("class", "current");
+                    $("#havePrint").removeClass("current");
+                }else if(printState == 2){
+                    $("#havePrint").attr("class", "current");
+                    $("#notPrint").removeClass("current");
+                }
+
+                $("#machineIsPrint").val(printState);
+                window.location.href=root_path + '/admin/machine/_tooth_print_list?machineIsPrint='+printState;
+            }
+                //生成128条形码
+                function code128(barcode){
+                    $("#codeId").val(barcode);
+                    $("#bcTarget").empty().barcode($("#codeId").val(), "code128",{
+                        barWidth:1, barHeight:23,showHRI:false
+                    });
+
+                }
+            function  printList() {
+                var machineBarcode = null;
+                var machineQrcode = null;
+                var machineProduceType = null;
+                var prints = "";
+                /*var numbers = 0;*/
+                var settingNumber = $("#settingNumber").val();
+                var is = null;
+                var L = null;
+                var R = null;
+                var selectNum = $("#listid").find("input[name='checkbox']:checked").length;
+                $("input[name='checkbox']:checkbox:checked").each(function (index,element) {
+                    prints += $(this).val();
+                    /*numbers = numbers+parseInt(settingNumber);*/
+                    is = (index+1)%2;
+                    var machineId = $(this).attr("machineId");
+                    machineBarcode = $(this).val();
+                    machineQrcode = $("#machineQrcode"+machineId).val();
+                    machineProduceType = $("#machineProduceType"+machineId).val();
+                    if(is == 1){
+                        R = null;
+                        L = '<img style="position: absolute;float: left; width: 55px;height: 55px;" src="'+machineQrcode+'" />';
+                        if(selectNum == index+1){
+                            $("#printlist").append('<div style="width: 138px;height: 100px;position: relative;margin-bottom: 4px;">'+
+                                    L+
+                                    R+
+                                    '</div>');
+                        }
+                    }
+                    if(is == 0){
+                        R = '<img style="position: absolute;float: left;margin-left: 63px; width: 55px;height: 55px;" src="'+machineQrcode+'" />';
+                        $("#printlist").append('<div style="width: 138px; height: 100px;position: relative;margin-bottom: 4px;">'+
+                                L+
+                                R+
+                                '</div>');
+                    }
+
+                    if(${machineIsPrint} == '1')
+                    {
+                        updatePrint(machineBarcode,false);
+                        $("#" + machineBarcode).remove();
+                    }
+                });
+                /*numbers = numbers - parseInt(settingNumber);*/
+                /*计算总打印数量*/
+               /* var num = $("#settingNumber").val();
+                var selectNum = $("#listid").find("input[name='checkbox']:checked").length;
+                var machinePrintNumber = parseInt(num)*parseInt(selectNum);
+*/
+                /*if(machinePrintNumber > 24){
+                    layer.msg('一次最多支持打印24张条形码', {icon: 2, time: 2000});
+                }else */if (prints != ""){
+                    $("#printlist").printArea();
+                    $("#printlist").html("");
+                    layer.closeAll();
+                } else {
+                    layer.msg('未选中需要打印的条形码', {icon: 2, time: 2000});
+                }
+
+                $("#printlist").html("");  //未打印成功,需要清除数据
+                prints = "";
+            }
+            //动态刷新是否有最新的机器
+            ref = setInterval(function(){
+                latestMachine();
+            },2000);
+            function  latestMachine() {
+                var machineIsPrint = $("#machineIsPrint").val();
+                if(machineIsPrint == 1){
+                    $.ajax({
+                        cache: true,
+                        type: "POST",
+                        url: "${path}/admin/machine/_LatestTooth_list",
+                        data:{machineId : $("#machineId").val()},// 你的formid
+                        success: function(data){
+                            if(data != null){
+                                $("#noMachineTr").remove();
+                                $.each(data,function(i,value) {
+                                    if(i+1 == data.length){
+                                        $("#machineId").val(value.machineId);
+                                    }
+                                    var machineName = value.produceName+"/"+value.producePattern+"-"+value.produceModel;
+                                    /*var machineType = "";
+                                    if(value.machineProduceType == 1){
+                                        machineType = "净水机";
+                                    }
+                                    if(value.machineProduceType == 2){
+                                        machineType = "冲奶机";
+                                    }*/
+                                    var private = value.machineBarcode.substr(value.machineBarcode.length-5);
+                                    var machineCreateTime = formatDate(value.machineCreateTime,"yyyy-MM-dd HH:mm:ss");
+                                    $("#listid").prepend('<tr class="text-c"><td width="2"> ' +
+                                            '<input name="checkbox" type="checkbox" value="'+value.machineBarcode+'"  machineId="'+value.machineId+'"> ' +
+                                            '<input type="hidden" value="'+value.machineId + 1000000 +'" id="'+value.machineBarcode + 'Id'+'"></td>' +
+                                            '<input type="hidden" value="'+value.machineQrcode+'" id="'+'machineQrcode'+value.machineId+'">' +
+                                            '<input type="hidden" value="'+value.machineProduceType+'" id="'+'machineProduceType'+value.machineId+'">' +
+                                            '<td class="text-c" style="font-size: 24px" width="10">'+private+'</td>' +
+                                            '<td class="text-c" width="10">'+value.machineBarcode+'</td>' +
+                                            '<td class="text-c" width="10">'+machineName+'</td>' +
+                                            '<td>'+machineCreateTime+'</td>' +
+                                            '<td class="td-manage text-c"> <a onclick="updatePrint('+value.machineBarcode+',true);" title="修改为已打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6a7;</i></a>' +
+                                            '<a onclick="barCodePrint('+'\''+value.machineBarcode+'\''+','+'\''+value.machineId+'\''+',);" title="打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe652;</i></a> </td></tr>');
+
+
+                                });
+                            }
+
+                        },
+                        error: function(){
+                            console.log("查询最新机器失败!");
+                        }
+                    });
+                }
+
+            }
+
+
+                function updatePrint(machineBarcode,type){
+                    $.ajax({
+                        "type" : "post",
+                        "url" : "${path}/admin/machine/_update_print",
+                        "dataType" : "json",
+                        "data" :{machineBarcode : machineBarcode},
+                        "success" : function(data) {
+                            $("#"+machineBarcode).remove();
+                            if(type){
+                                layer.msg('修改成功', {icon: 1, time: 2000});
+                            }
+                        },
+                        "error":function(data){
+                            layer.msg('操作失败', {icon: 2, time: 2000});
+                        }
+                    });
+                }
+
+                function machineLogs(machineId) {
+                    window.location.href=root_path + '/admin/machine/_machine_logs_list?machineId='+machineId;
+                }
+
+            function batchUpdatePring(){
+                var a = new Array();
+                $("input[name='checkbox']:checkbox:checked").each(function(i) {
+                    a[i] = $(this).val().substring(0, 13);
+                })
+                $.ajax({
+                    "type" : "post",
+                    "url" : "${path}/admin/machine/_batchUpdate_print",
+                    "dataType" : "json",
+                    "data" :{machineBarcodes : ""+a},
+                    /*"data" :{machineBarcodes : JSON.stringify(a)},*/
+                    "success" : function(data) {
+                        layer.msg('修改成功!', {icon: 1,time:2000});
+                        location.replace(location.href);
+                    },
+                    "error":function(data){
+                        /*alert("操作失败,请联系管理员!");*/
+                        layer.msg('操作失败!', {icon: 2,time:2000});
+                    }
+                });
+            }
+
+            //单个打印条形码
+             function barCodePrint(barCode,machineId){
+                 var  machineBarcode = barCode;
+                 var machineQrcode = $("#machineQrcode"+machineId).val();
+                     $("#printlist").append('<div style="width: 420px;height: 180px;position: relative;">'+
+                             '<img style="position: absolute;float: left; width: 170px;height: 170px;" src="'+machineQrcode+'" />'+
+                             '</div>');
+                     if(${machineIsPrint} == '1')
+                     {
+                         updatePrint(machineBarcode,false);
+                         $("#" + machineBarcode).remove();
+                     }
+                     $("#printlist").printArea();
+                     $("#printlist").html("");
+            }
+
+            /*获取产品信息*/
+            function getProduce(machineId){
+                var produce = new Object();
+                produce.producePattern = "";
+                produce.produceModel = "";
+                produce.produceFeature = "";
+                produce.produceName = "";
+                $.ajax({
+                    type: "POST",
+                    url: "${path}/admin/machine/_getProduce_print",
+                    async: false,
+                    data:{machineId : machineId},
+                    success: function(data){
+                        if(data != null){
+                            produce.producePattern = data.producePattern;
+                            produce.produceModel = data.produceModel;
+                            produce.produceFeature = data.produceFeature;
+                            produce.produceName = data.produceName;
+                        }
+                    },
+                    error: function(){
+                        console.log("查询产品型号信息失败!");
+                    }
+                });
+                return produce;
+            }
+        </script>
+
+
+	</body>
+</html>

+ 1 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/pts/produce/save_produce.ftl

@@ -64,6 +64,7 @@
                 <div class="input-box"><span class="input-dic">产品类型</span>
                     <label><input type="radio" name="produceType" value="1" checked>净水机</label>
                     <label><input type="radio" name="produceType" value="2">冲奶机</label>
+                    <label><input type="radio" name="produceType" value="3">电动牙刷</label>
                 </div>
 
                 <div class="input-box"><span class="input-dic">产品状态</span>

+ 1 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/pts/produce/update_produce.ftl

@@ -67,6 +67,7 @@
             <div class="input-box"><span class="input-dic">产品类型</span>
                 <label><input type="radio" name="produceType" value="1" <#if produce.produceType == 1>checked</#if>>净水机</label>
                 <label><input type="radio" name="produceType" value="2" <#if produce.produceType == 2>checked</#if>>冲奶机</label>
+                <label><input type="radio" name="produceType" value="3" <#if produce.produceType == 3>checked</#if>>电动牙刷</label>
             </div>
             <div class="input-box"><span class="input-dic">产品状态</span>
                 <label><input type="radio" name="produceStatus" value="1" <#if produce.produceStatus == 1>checked</#if>>正在使用</label>

二进制
watero-rst-web/src/main/webapp/common/images/pts/toothImages/addparts.jpg