Explorar el Código

客诉页面优化

liujiankang hace 7 años
padre
commit
359cdc7eb1

+ 26 - 4
watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachineController.java

@@ -559,8 +559,15 @@ public class AdminMachineController {
     @RequestMapping("/_to_add_renovation")
     public ModelAndView toAddRenovationMachine() {
         ModelAndView mv = new ModelAndView("pts/machine/addRenovationMachine");
-        //查询所有状态为可用的批次
-        List<PtsBatch> listptsBatch = ptsBatchService.listPtsBatchByStatus();
+        //查询所有产品
+        List<Produce> produceList = produceService.getProduceList();
+        mv.addObject("produceList", produceList);
+        List<PtsBatch> listptsBatch = null;
+        if(produceList.size() > 0){
+            PtsBatch ptsBatch = new PtsBatch();
+            ptsBatch.setProduceId(produceList.get(0).getProduceId());
+            listptsBatch = ptsBatchService.listPtsBatch(ptsBatch);
+        }
         mv.addObject("listptsBatch", listptsBatch);
         //查询所有软件版本
         PtsMachineVersion ptsMachineVersion = new PtsMachineVersion();
@@ -568,7 +575,7 @@ public class AdminMachineController {
         List<PtsMachineVersion> ListVersion = machineVersionService.listMachineVersion(ptsMachineVersion);
         mv.addObject("listVersion", ListVersion);
         //根据第一个批次查询所有bom
-        if (listptsBatch.size() > 0) {
+        if (listptsBatch!= null && listptsBatch.size() > 0) {
             PtsBom ptsBom = new PtsBom();
             ptsBom.setBomId(listptsBatch.get(0).getBomId());
             List<PtsBom> listBom = ptsBomService.listBom(ptsBom);
@@ -838,6 +845,21 @@ public class AdminMachineController {
         rj.setResultMsg("取消出库操作成功");
         return rj;
     }
-
+    @ResponseBody
+    @RequiresPermissions("machine:select_all:machine")
+    @RequestMapping("/select_Batch")
+    public ResponseJson selectBatch(HttpServletRequest request,Integer productId){
+        ResponseJson responseJson = new ResponseJson();
+        if(productId == null){
+            responseJson = new ResponseJson(500, "ERROR", 500);
+            return responseJson;
+        }
+        PtsBatch ptsBatch = new PtsBatch();
+        ptsBatch.setProduceId(productId);
+        List<PtsBatch> listptsBatch = ptsBatchService.listPtsBatch(ptsBatch);
+        ResponseJson rj = new ResponseJson(200, "SUCCESS", 200);
+        rj.addResponseKeyValue("listptsBatch",listptsBatch);
+        return rj;
+    }
 }
 

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

@@ -30,6 +30,18 @@
 <body>
 <div class="pd-20">
 	<form   class="form form-horizontal" id="form-admin-add">
+        <div class="input-box">
+            <span class="input-dic spanhidth">产品:</span>
+            <select class="my-select" name="produceId" id="produceId">
+            <#if (produceList ?size > 0)>
+                <#list produceList as list>
+                    <option value ="${list.produceId}">${list.produceName}</option>
+                </#list>
+            <#else >
+                <option value ="">暂无产品,请先添加产品</option>
+            </#if>
+            </select>
+        </div>
             <div class="input-box">
                 <span class="input-dic spanhidth">批次:</span>
 				<select class="my-select" name="batchId" id="batchId">
@@ -99,7 +111,11 @@
         var batchId = $(this).val();
         getBom(batchId);
     });
-
+    /*监听产品修改批次  bom单*/
+    $("#produceId").change(function(){
+        var produceId = $(this).val();
+        getProduce(produceId);
+    });
 
     /*获取bom信息,赋值在页面上*/
     function getBom(batchId){
@@ -130,6 +146,38 @@
         }
     }
 
+    /*获取批次信息,赋值在页面上*/
+    function getProduce(produceId){
+        var listptsBatch = new Object();
+        $.ajax({
+            type: "POST",
+            data: {
+                productId : produceId
+            },
+            url: "${path}/admin/machine/select_Batch",
+            async: false,
+            success: function(data){
+                if (data.returnCode == 200) {
+                    listptsBatch = data.returnMsg.listptsBatch;
+                }
+            },
+            error: function(XmlHttpRequest, textStatus, errorThrown){
+            }
+        });
+
+        if(listptsBatch != null){
+            $("#bomId").empty();
+            $("#batchId").empty();
+            $.each(listptsBatch,function(n,value) {
+                if(n == 0){
+                    getBom(value.batchId);
+                }
+                var appoption = "<option value='"+value.batchId+"'>"+value.batchNo+"</option>";
+                $("#batchId").append(appoption);
+            });
+
+        }
+    }
  function dataCharm() {
 
          var batchId = $("#batchId").val();