Browse Source

x增加机器打印列表功能

liujiankang 7 years ago
parent
commit
bad78f28d2

+ 2 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/pts/MachineService.java

@@ -26,4 +26,6 @@ public interface MachineService {
 
     //查询数据库最大的机器id
     Integer maxMachineId();
+
+    List<PtsMachine> listPrintOrder(PtsMachine ptsMachine);
 }

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

@@ -50,4 +50,9 @@ public class MachineServiceImpl implements MachineService {
         return machineMapper.maxMachineId();
     }
 
+    @Override
+    public List<PtsMachine> listPrintOrder(PtsMachine ptsMachine) {
+        return machineMapper.listMachine(ptsMachine);
+    }
+
 }

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

@@ -14,34 +14,35 @@
 
     <update id="updateMachine" parameterType="PtsMachine" >
         UPDATE tb_rst_pts_machine
-        SET
-        <if test="machineSalesDate != null and machineSalesDate != ''" >
-            machine_sales_date = #{machineSalesDate},
-        </if>
-        <if test="machineSalesState != null and machineSalesState != ''" >
-            machine_sales_state = #{machineSalesState},
-        </if>
-        <if test="machineStatus != null and machineStatus != ''" >
-            machine_status = #{machineStatus},
-        </if>
-        <if test="machineIsPrint != null and machineIsPrint != ''" >
-            machine_is_print = #{machineIsPrint},
-        </if>
-        <if test="machineCompoundImg != null and machineCompoundImg != ''" >
-            machine_compound_img = #{machineCompoundImg},
-        </if>
-        <if test="machineProcessState != null and machineCompoundImg != ''" >
-            machine_process_state = #{machineProcessState},
-        </if>
-        <if test="machineSoftwareVersion != null and machineSoftwareVersion != ''" >
-            machine_software_version = #{machineSoftwareVersion},
-        </if>
-        <if test="machineHardwareVersion != null and machineHardwareVersion != ''" >
-            machine_hardware_version = #{machineHardwareVersion},
-        </if>
-        <if test="machineUpdateTime != null and machineUpdateTime != ''" >
-            machine_update_time = #{machineUpdateTime}
-        </if>
+        <set>
+            <if test="machineSalesDate != null and machineSalesDate != ''" >
+                machine_sales_date = #{machineSalesDate},
+            </if>
+            <if test="machineSalesState != null and machineSalesState != ''" >
+                machine_sales_state = #{machineSalesState},
+            </if>
+            <if test="machineStatus != null and machineStatus != ''" >
+                machine_status = #{machineStatus},
+            </if>
+            <if test="machineIsPrint != null and machineIsPrint != ''" >
+                machine_is_print = #{machineIsPrint},
+            </if>
+            <if test="machineCompoundImg != null and machineCompoundImg != ''" >
+                machine_compound_img = #{machineCompoundImg},
+            </if>
+            <if test="machineProcessState != null and machineCompoundImg != ''" >
+                machine_process_state = #{machineProcessState},
+            </if>
+            <if test="machineSoftwareVersion != null and machineSoftwareVersion != ''" >
+                machine_software_version = #{machineSoftwareVersion},
+            </if>
+            <if test="machineHardwareVersion != null and machineHardwareVersion != ''" >
+                machine_hardware_version = #{machineHardwareVersion},
+            </if>
+            <if test="machineUpdateTime != null and machineUpdateTime != ''" >
+                machine_update_time = #{machineUpdateTime}
+            </if>
+        </set>
         <where>
             <if test="machineId != null">
                 machine_id = #{machineId}

+ 38 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachineController.java

@@ -91,4 +91,42 @@ public class AdminMachineController {
         }
         return  machineService.listLatestMachine(Integer.valueOf(machineId));
     }
+
+    /**
+     * 修改机器打印状态为已打印
+     * @param request
+     * @return
+     */
+    @RequiresPermissions("machine:update_print:machine")
+    @ResponseBody
+    @RequestMapping("/_update_print")
+    public Integer updateMachinPrintState(HttpServletRequest request){
+        String machineId = request.getParameter("machineId");
+        if(machineId == null){
+            return null;
+        }
+        PtsMachine ptsMachine = new PtsMachine();
+        ptsMachine.setMachineId(Integer.valueOf(machineId));
+        ptsMachine.setMachineIsPrint(2);
+        return machineService.updateMachine(ptsMachine);
+    }
+
+    /**
+     * 查询机器打印列表
+     * @author LJK
+     * @date 2017年8月31日16:08:15
+     * @return
+     */
+    @RequiresPermissions("machine:select_all:machine")
+    @RequestMapping("/_machine_print_list")
+    public ModelAndView listPrintOrder(PtsMachine ptsMachine){
+        ModelAndView mv = new ModelAndView("pts/machine/machine_print_List");
+        List<PtsMachine> machineList = machineService.listPrintOrder(ptsMachine);
+        //查询最新一条机器id
+        Integer machineId = machineService.maxMachineId();
+        mv.addObject("machineId",machineId);
+        mv.addObject("machineIsPrint",ptsMachine.getMachineIsPrint() == null?"1":ptsMachine.getMachineIsPrint());
+        mv.addObject("machineList", machineList);
+        return mv;
+    }
 }

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

@@ -79,7 +79,7 @@
 					<#list page.dataList as list>
 						<tr>
 							<td class="text-c" width="100">${list.machineBarcode }</td>
-							<td class="text-c" width="100"><div id="${100000 + list_index}" onclick="print('${list.machineBarcode }','${list.machineQrcode }')"><img style="width: 50px;height: 50px;" src="${list.machineQrcode }"></td>
+							<td class="text-c" width="100"><div id="${100000 + list_index}" onclick="print('${list.machineBarcode }','${list.machineQrcode }','${list.machineId }')"><img style="width: 50px;height: 50px;" src="${list.machineQrcode }"></td>
                             <td class="text-c" width="100">
 							<#if list.machineIsPrint == 1>
                                     未打印
@@ -141,7 +141,7 @@
                 $("#settingNumber").val(printNumber);
                 alert("设置成功!");
             }
-			function print(machineBarcode,machineQrcode){
+			function print(machineBarcode,machineQrcode,machineId){
                 var settingNumber = $("#settingNumber").val();
                 for (var i=0;i<settingNumber;i++){
                     code128(machineBarcode);
@@ -162,6 +162,7 @@
                 }
                 $("#printlist").printArea();
                 $("#printlist").html("");
+                updatePrint(machineId);
             }
 
             ref = setInterval(function(){
@@ -245,6 +246,21 @@
                 }
                 return   year+"-"+month+"-"+date;
             }
+
+            function updatePrint(machineId){
+                $.ajax({
+                    "type" : "post",
+                    "url" : "${path}/admin/machine/_update_print",
+                    "dataType" : "json",
+                    "data" :{machineId : machineId},
+                    "success" : function(data) {
+
+                    },
+                    "error":function(data){
+                        alert("操作失败,请联系管理员!");
+                    }
+                });
+            }
         </script>
 	</body>
 </html>

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

@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta charset="UTF-8">
+		<title></title>
+		<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(images/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>
+		<#include "/base/list_base.ftl">
+	</head>
+	<body>
+		<div class="text-c" style="margin-top: 20px;">
+			<form action="${path}/admin/machine/_machine_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="text" id="printNumber" name="printNumber" value="3" placeholder="打印数量" style="margin-top: 10px;"/>
+                <input class="my-input" type="hidden" id="settingNumber" name="settingNumber" value="3"/>
+                <button type="button" class="my-btn-search" onclick="setting();" style="margin-right: 50px;margin-top: 10px;">打印</button>
+
+			</form>
+		</div>
+		<div class="mt-2" style="margin: 20px;">
+			<table class="table table-border table-bordered table-bg table-hover table-sort">
+				<thead>
+				<tr class="text-c">
+					<th width="10">机器条码(点击打印)</th>
+					<th width="20">操作</th>
+				</tr>
+				</thead>
+				<tbody id="listid">
+					<#list machineList as list>
+						<tr>
+							<td class="text-c" width="10">${list.machineBarcode }</td>
+							<!-- 遍历操作 -->
+							<td class="td-manage text-c">
+								<#--<a onclick="print(${100000 + st.index},${list.numberId},${list.numberIsPrint})" title="打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe652;</i></a>
+								<a onclick="downLoad();" title="下载" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe640;</i></a>-->
+							</td>
+						</tr>
+					</#list>
+				</tbody>
+			</table>
+			<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">
+                </div>
+			</div>
+		</div>
+        <script type="text/javascript" src="${path}/common/lib/jquery/1.9.1/jquery.PrintArea.js"></script>
+        <script type="text/javascript" src="${path}/common/lib/jquery/1.9.1/jquery-barcode.js"></script>
+        <script type="text/javascript" src="${path}/common/static/h-ui.admin/js/H-ui.js"></script>
+
+		<script type="text/javascript">
+            if(${machineIsPrint} == 1){
+                $("#notPrint").attr("class", "current");
+            }
+            if(${machineIsPrint} == 2){
+                $("#havePrint").attr("class", "current");
+            }
+            function selectIsPrint(printState) {
+                if(printState == 1){
+                    $("#notPrint").attr("class", "current");
+                    $("#havePrint").removeClass("current");
+                }else if(printState == 2){
+                    $("#havePrint").attr("class", "current");
+                    $("#notPrint").removeClass("current");
+                }
+                window.location.href=root_path + '/admin/machine/_machine_print_list?machineIsPrint='+printState;
+            }
+
+
+
+            function   formatDate(now)   {
+                var time = new Date(now);
+                var   year=time.getFullYear();
+                var   month=time.getMonth()+1;
+                var   date=time.getDate();
+                var   hour=time.getHours();
+                var   minute=time.getMinutes();
+                var   second=time.getSeconds();
+                if(month < 10){
+                    month = "0"+month;
+                }
+                if(date < 10){
+                    date = "0"+date;
+                }
+                if(minute < 10){
+                    minute = "0"+minute;
+                }
+                return   year+"-"+month+"-"+date;
+            }
+        </script>
+	</body>
+</html>