Explorar o código

机器设备修改

pangjl %!s(int64=5) %!d(string=hai) anos
pai
achega
bd744207dd

+ 19 - 15
src/main/java/com/minpay/mt/machine/action/MachineManageAction.java

@@ -34,6 +34,7 @@ import com.startup.minpay.frame.target.MINParam;
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.FileItemFactory;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.omg.CORBA.COMM_FAILURE;
 
 import java.io.*;
 import java.util.HashMap;
@@ -1604,27 +1605,30 @@ public class MachineManageAction implements IMINAction {
         MINActionResult res = new MINActionResult();
         //获取当前时间
         String nowTime = DateUtil.getCurrentDateTimeString();
+        if (CommonUtil.isEmpty(line)){
+            line = "0";
+        }
+        if (CommonUtil.isEmpty(row)){
+            row = "0";
+        }
         // 获取操作员信息
         User user = session.getUser();
-        VmProEquRelExample example = new VmProEquRelExample();
-        example.createCriteria().andIdEqualTo(equId).andCargoWayLineEqualTo(CommonUtil.subtract(line,"1")).andCargoWayRowEqualTo(CommonUtil.subtract(row,"1"));
-        List<VmProEquRel> List = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmProEquRelMapper.class).selectByExample(example);
-        if (List.size()>0){
-            throw new MINBusinessException("货道已存在");
+        VmEquipmentInf vmEquipmentInf = Service.lookup(IMINDataBaseService.class)
+                                        .getMybatisMapper(VmEquipmentInfMapper.class)
+                                        .selectByPrimaryKey(equId);
+        if (null == vmEquipmentInf){
+            throw new MINBusinessException("机器不存在");
         }
-        String id = Service.lookup(IPublicService.class).getSequence("VM_PROEQUREL_ID");
-        VmProEquRel vmProEquRel = new VmProEquRel();
-        vmProEquRel.setId(id);
-        vmProEquRel.setEquipmentId(equId);
-        vmProEquRel.setCargoWayLine(CommonUtil.subtract(line,"1"));
-        vmProEquRel.setCargoWayRow(CommonUtil.subtract(row,"1"));
-        vmProEquRel.setExeitState("00");
-        vmProEquRel.setCreateTime(nowTime);
-        vmProEquRel.setCreateUser(user.getId());
-        Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmProEquRelMapper.class).insertSelective(vmProEquRel);
+        vmEquipmentInf.setRows(CommonUtil.add(vmEquipmentInf.getRows(),row));
+        vmEquipmentInf.setLines(CommonUtil.add(vmEquipmentInf.getLines(),line));
+        Service.lookup(IMINDataBaseService.class)
+                .getMybatisMapper(VmEquipmentInfMapper.class)
+                .updateByPrimaryKeySelective(vmEquipmentInf);
 		/*// 记录操作日志
 		String logInfo = "操作员:" + user.getName() + "添加商品,商品编号:" + id;
 		Service.lookup(ILogService.class).logging(session, logInfo);*/
+		res.set("row",vmEquipmentInf.getRows());
+        res.set("line",vmEquipmentInf.getLines());
         return res;
     }
     /**

+ 170 - 0
src/main/webapp/admin/machineManage/addProEquRel.html

@@ -0,0 +1,170 @@
+
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>增加设备</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+</head>
+
+<body class="content">
+
+    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
+    </fieldset>
+
+    <form class="layui-form" action="">
+		<div style="padding-bottom:60px; ">
+         <div class="layui-form-item">
+            <div class="layui-inline">
+                <label class="layui-form-label">*货道行:</label>
+                <div class="layui-input-inline">
+                    <input type="tel" name="line" id = "line" lay-verify="line"  placeholder="请输入要新增的货道行,默认为0"autocomplete="off" class="layui-input">
+                    <input type="hidden" name="equId" id="equId">
+                </div>
+            </div>
+             <div class="layui-inline">
+                 <label class="layui-form-label">*货道列:</label>
+                 <div class="layui-input-inline">
+                     <input type="tel" name="row" id = "row" lay-verify="row"  placeholder="请输入要新增的货道列,默认为0"autocomplete="off" class="layui-input">
+                 </div>
+             </div>
+        </div>
+            <div class="layui-form-item box-button" >
+            <div class="layui-input-block">
+                <button class="layui-btn" lay-submit="" lay-filter="demo1">提交</button>
+          <button  class="layui-btn"  id="cancel">取消</button>
+            </div>
+        </div>
+		</div>
+    </form>
+      <script src="../../js/min-loader-next.js"></script>
+    <script>
+        var equId = getQueryString("equId");
+        $('#equId').val(equId)
+	    layui.use('form', function(){
+            var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
+            //监听取消
+	      	$('#cancel').on('click', function(){
+	      	    	 parent.layer.close(parent.layer.index); 
+	      	   		});
+    	});  
+    
+	    	
+        
+        function renderForm(){
+			 layui.use('form', function(){
+				 var form = layui.form();//高版本建议把括号去掉,有的低版本,需要加()
+				 form.render();
+			 });
+		 }
+        layui.use(['form', 'layedit', 'laydate','layer'], function() {
+            var form = layui.form,
+            layer = layui.layer,
+            layedit = layui.layedit,
+            laydate = layui.laydate;
+            //日期
+            laydate.render({
+                elem: '#date'
+            });
+            laydate.render({
+                elem: '#date1'
+            });
+            //创建一个编辑器
+            var editIndex = layedit.build('LAY_demo_editor');
+            
+            //自定义验证规则
+            /* form.verify({
+            	logonname: function(value) {
+                    if (isEmpty(value)) {
+                 		return   '用户名不能为空!';
+                 	} 
+                },
+                name: function(value) {
+                    if (isEmpty(value)) {
+                 		return   '姓名不能为空!';
+                 	} 
+                },
+                roleid: function(value) {
+                    if (isEmpty(value)) {
+                 		return   '请选择角色!';
+                 	} 
+                },
+                branchid: function(value) {
+                    if (isEmpty(value)) {
+                 		return   '请选择部门!';
+                 	} 
+                }
+            }); */
+            
+           
+            //监听指定开关
+          /*   form.on('switch(switchTest)', function(data) {
+                layer.msg('开关checked:' + (this.checked ? 'true' : 'false'), {
+                    offset: '6px'
+                });
+                layer.tips('温馨提示:请注意开关状态的文字可以随意定义,而不仅仅是ON|OFF', data.othis)
+            }); */
+
+         
+            form.verify({
+            	
+            	// line: function(value) {
+            	// 	if(isEmpty(value)){
+    		    // 		return '请输入货道行!';
+                //     }
+                //     if(!new RegExp("^[1-9]$|^([1-9]\\d{1})$|^([1][0][0])$").test(value)){
+    		    // 		return '请输入1~100的正整数!';
+                //     }
+                //
+                //
+                // }
+                // ,row: function(value) {
+                //     if(isEmpty(value)){
+                //         return '请输入货道列!';
+                //     }
+                //     if(!new RegExp("^[1-9]$|^([1-9]\\d{1})$|^([1][0][0])$").test(value)){
+                //         return '请输入1~100的正整数!';
+                //     }
+                //
+                //
+                // }
+            });
+           
+            //监听提交
+			form.on('submit(demo1)', function(data) {
+				$.request({
+					action : '../../MachineManageAction/addProEquRelLineRow',
+					data :  data.field ,
+					success : function(data) {
+						 layer.alert('保存成功!',  function(){
+						     debugger;
+                             parentPass(data);
+						});
+					},
+					error : function(data2) {
+						layer.alert(data2.MINErrorMessage, {
+	  						icon: 5,
+	  						title: "提示"
+	  					}); 
+						// window.location.href='index.html';
+					}
+				});	
+                return false;
+			});
+            
+            
+            
+        });
+        function parentPass(data){
+            window.parent.childRetunData(data);
+            parent.layer.close(parent.layer.index);
+        }
+        initSelect('stt', "IM_USER_STATE", "stt", '0', true);
+    </script>
+
+</body>
+
+</html>

+ 15 - 6
src/main/webapp/admin/machineManage/machineDetail.html

@@ -27,6 +27,10 @@
 </form>
 <script>
 	var rowData = layui.sessionData("ROW_DATA").NOW_ROW;
+	var temLine = rowData.temLine;
+	var temRow = rowData.temRow;
+	var id = rowData.id;
+	debugger;
 	layui.use('laydate', function(){
 		var laydate = layui.laydate;
 	 	/* laydate.render({
@@ -45,14 +49,14 @@
 	layui.use('form', function(){
 		var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
 		var html = '';
-		for(var i = 0 ; i < rowData.temLine ; i++){
+		for(var i = 0 ; i < temLine ; i++){
 			html += '<div class="layui-row layui-col-space15">';
 			html+='<div class="layui-inline">'+
 				'<div class="layui-card" style="width: 70px;height: 350px;text-align: center;">'+
 				'<div class="layui-card-body"style="top:165px;">第'+(i+1)+'层</div>'+
 					'</div>'+
 				'</div>';
-			for(var j = 0 ; j < rowData.temRow; j++){
+			for(var j = 0 ; j < temRow; j++){
 				html += '<div class="layui-inline" id="C'+i+'B'+j+'D">'+
      	 				'<div class="layui-card" style="width: 200px;height: 350px;text-align: center;" id="C'+i+'B'+j+'C">'+
         				'<div class="layui-card-header">第'+(i+1)+'层第'+(j+1)+'列<a href="javascript:void(0)" onclick="delEquProRel('+i+','+j+')"><i class="layui-icon" style="float:right" id="C'+i+'B'+j+'X">&#x1006;</i><a></div>'+
@@ -150,13 +154,12 @@
 		form.on('submit(demo5)', function(data) {
 			layer.open({
 				type: 2,
-				title: '新增货道',
+				title: '新增货道,货道行:'+temLine+'行,货道列:'+temRow,
 				shade: 0.8,
 				//maxmin: true, //开启最大化最小化按钮
 				area: ['75%', '75%'],
 				content: 'addProEquRel.html?&equId='+rowData.id
 			});
-			return false;
 		});
 		form.on('submit(demo6)', function(data) {
 			reload();
@@ -193,9 +196,9 @@
 	//添加
 	$(document).on('click','#addUser',function(){
 		var html = '';
-		for(var i = 0 ; i < rowData.temLine ; i++){
+		for(var i = 0 ; i < temLine ; i++){
 			html += '<div class="layui-row layui-col-space15">';
-			for(var j = 0 ; j < rowData.temRow ; j++){
+			for(var j = 0 ; j < temRow ; j++){
 				html += '<div class="layui-inline">'+
      	 				'<div class="layui-card" style="width: 200px;height: 200px;text-align: center;">'+
         				'<div class="layui-card-header">第'+(i+1)+'层第'+(j+1)+'列</div>'+
@@ -368,6 +371,12 @@
 	function reload() {
 		window.location.reload();
 	}
+	function childRetunData(data) {
+		debugger;
+		layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:{"temLine":data.line,"temRow":data.row,"id":id}});
+
+		window.location.reload();
+	}
 </script>