Browse Source

添加翻新机

wangxiaoming 7 years ago
parent
commit
2bd3cd416a

+ 10 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/pts/Produce.java

@@ -31,6 +31,8 @@ public class Produce implements Serializable {
 
     private List<ProduceProcess>  process = new ArrayList<ProduceProcess>();  //工序集合
 
+    private PtsBatch ptsBatch;      //批次
+
     private String json;  //传入json值
 
     public Integer getProduceId() {
@@ -153,6 +155,14 @@ public class Produce implements Serializable {
         this.wechatMpId = wechatMpId;
     }
 
+    public PtsBatch getPtsBatch() {
+        return ptsBatch;
+    }
+
+    public void setPtsBatch(PtsBatch ptsBatch) {
+        this.ptsBatch = ptsBatch;
+    }
+
     @Override
     public String toString() {
         return "Produce{" +

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

@@ -257,10 +257,10 @@
            question_id = #{questionId}
         </if>
         <if test="startTime!=null and startTime!='' ">
-           and customer_create_time &gt;= #{startTime}
+           and DATE_FORMAT(customer_create_time,'%Y-%m-%d') &gt;= #{startTime}
         </if>
         <if test="endTime!=null and endTime!=''">
-           and customer_create_time &lt;= #{endTime}
+           and DATE_FORMAT(customer_create_time,'%Y-%m-%d') &lt;= #{endTime}
         </if>
       </where>
   </select>

+ 5 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/pts/mapper/ptsBatchMapper.xml

@@ -49,10 +49,14 @@
             t.batch_desc AS batchDesc,
             t.batch_create_time AS batchCreateTime,
             t.batch_update_time AS batchUpdateTime,
-            t.batch_software_version_id AS batchSoftwareVersionId
+            t.batch_software_version_id AS batchSoftwareVersionId,
+            trpmv.machine_version_no AS softwareVersionNo,
+            trpb.bom_version AS  bomVersion,
+            trpb.bom_name AS  bomName
         FROM
             tb_rst_pts_batch t
         LEFT JOIN tb_rst_pts_bom trpb ON t.bom_id = trpb.bom_id
+        LEFT JOIN tb_rst_pts_machine_version trpmv ON t.batch_software_version_id = trpmv.machine_version_id
         <where>
             <if test="produceId !=null">
                 AND t.produce_id = #{produceId}

+ 11 - 16
watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachineController.java

@@ -559,21 +559,16 @@ public class AdminMachineController {
     @RequestMapping("/_to_add_renovation")
     public ModelAndView toAddRenovationMachine() {
         ModelAndView mv = new ModelAndView("pts/machine/addRenovationMachine");
-        //查询所有状态为可用的批次
-        List<PtsBatch> listptsBatch = ptsBatchService.listPtsBatchByStatus();
-        mv.addObject("listptsBatch", listptsBatch);
-        //查询所有软件版本
-//        PtsMachineVersion ptsMachineVersion = new PtsMachineVersion();
-//        ptsMachineVersion.setMachineVersionType(1);
-//        List<PtsMachineVersion> ListVersion = machineVersionService.listMachineVersion(ptsMachineVersion);
-//        mv.addObject("listVersion", ListVersion);
-        //根据第一个批次查询所有bom
-//        if (listptsBatch.size() > 0) {
-//            PtsBom ptsBom = new PtsBom();
-//            ptsBom.setBomId(listptsBatch.get(0).getBomId());
-//            List<PtsBom> listBom = ptsBomService.listBom(ptsBom);
-//            mv.addObject("listBom", listBom);
-//        }
+
+        //查询所有产品
+        List<Produce> produceList = produceService.getProduceList();
+        mv.addObject("produceList", produceList);
+
+        for(int i=0;i<produceList.size();i++){
+            Integer produceId = produceList.get(i).getProduceId();
+            PtsBatch ptsBatch = ptsBatchService.getUseBatch(produceId);
+            produceList.get(i).setPtsBatch(ptsBatch);
+        }
         return mv;
     }
 
@@ -607,7 +602,7 @@ 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) {
         ResponseJson rj = new ResponseJson();
         if (batchId == null || isRefurbishment == null || machineLine == null) {
             rj.setReturnCode(500);

+ 2 - 2
watero-rst-web/src/main/webapp/WEB-INF/views/cm/report/customer_picChart.ftl

@@ -34,7 +34,7 @@
 <tfoot>
 </tfoot>
 <#--<script type="text/javascript" src="${path}/common/lib/echarts/3.8/echarts.js"></script>-->
-<script type="text/javascript" src="${path}/common/lib/echarts/3.8/macarons.js"></script>
+<#--<script type="text/javascript" src="${path}/common/lib/echarts/3.8/macarons.js"></script>-->
 <script type="text/javascript" src="${path}/common/lib/echarts/3.8/echarts.common.min.js"></script>
 <script type="text/javascript">
 
@@ -85,7 +85,7 @@
             },
             tooltip : {
                 trigger: 'item',
-                formatter: "{a} <br/>{b} : {c} ({d}%)"
+                formatter: "{b} <br/>数量: {c} ({d}%)"
             },
             legend: {
                 //orient: 'vertical',

+ 38 - 7
watero-rst-web/src/main/webapp/WEB-INF/views/cm/report/customer_report.ftl

@@ -44,7 +44,7 @@
 
     <div class="cl bg-1 bk-gray " style="margin-top: 20px;">
         <span class="l" style="margin-left: 10px; height: 30px;line-height: 30px;font-weight: bold;">
-           合计:<span id="allNumber">0</span>
+           合计共收到多少个客诉问题:<span id="allNumber">0</span>
         </span>
     </div>
     <div class="mt-20" id="createTable" style="margin-top: 0px;">
@@ -58,6 +58,8 @@
     /*是否开启问题数量为0的展示   true 显示,false:不显示*/
     var isEnabledZeroShow = false;
 
+    var period = "";
+
     $(function (){
         showTime();
 
@@ -89,6 +91,13 @@
     function getStatistics() {
         var startTime = $("#startTime").val();
         var endTime = $("#endTime").val();
+
+        var startTimes = startTime.split("-");
+        var startTimeHtml = startTimes[0] + "年" + startTimes[1] + "月" +startTimes[2]+"日";
+        var endTimes = endTime.split("-");
+        var endTimeHtml = endTimes[0] + "年" + endTimes[1] + "月" +endTimes[2]+"日";
+        period = startTimeHtml + "&nbsp;-&nbsp;" + endTimeHtml;
+
         var index = layer.load(1, {
             shade: [0.5,'#fff'] //0.1透明度的白色背景
         });
@@ -173,7 +182,7 @@
                 "width: 32%;text-align: left !important;",
                 "display: none;",
                 "width: 8%;",
-                "width: 10%;"
+                "width: 10%;background: linear-gradient(to left, #fffcfc, #ff84d4);background-repeat: no-repeat;"
             ];
 
             if (table_array.length > 0) {
@@ -190,6 +199,9 @@
                             case 4:
                                 str += '<td class="text-c" style="'+ style_array[i] +'"><a href="javascript:void(0);" style="color: #06c;" onclick="showPieChart(' + table_array[index][i+1] + ',\'small\')">' + table_array[index][i] + '<a></td>';
                                 break;
+                            case 10:
+                                str += '<td class="text-c" style="'+ style_array[i] +'background-size: ' + table_array[index][i] + ' 100%;">' + table_array[index][i] + '</td>';
+                                break;
                             default:
                                 str += '<td class="text-c" style="'+ style_array[i] +'">' + table_array[index][i] + '</td>';
                                 break;
@@ -206,16 +218,32 @@
             arrayColumn.push(0);
             arrayColumn.push(1);
             arrayColumn.push(2);
-            arrayColumn.push(3);
+//            arrayColumn.push(3);
             arrayColumn.push(4);
             arrayColumn.push(5);
-            arrayColumn.push(6);
+//            arrayColumn.push(6);
 
             //合并单元格
             $(table).mergeCell({
                 // 目前只有cols这么一个配置项, 用数组表示列的索引,从0开始
                 cols: arrayColumn
             });
+
+            $(table).find("tbody").find("tr").each(function (index, domEle){
+                var tdRowspan = $(this).find("td").eq(1).attr("rowspan");
+                var tdIsStyle = $(this).find("td").eq(1).css("display")=="none"
+                $(this).find("td").eq(3).attr("rowspan",tdRowspan);
+                if(tdIsStyle){
+                    $(this).find("td").eq(3).css("display","none");
+                }
+                var td4Rowspan = $(this).find("td").eq(4).attr("rowspan");
+                var td4IsStyle = $(this).find("td").eq(4).css("display")=="none"
+                $(this).find("td").eq(6).attr("rowspan",td4Rowspan);
+                if(td4IsStyle){
+                    $(this).find("td").eq(6).css("display","none");
+                }
+            });
+
         },
         creat_tbody : function (allTableArray,allNum){
 
@@ -229,7 +257,7 @@
                                 var question = small.questionInfoList[k];
                                 if(!isEnabledZeroShow &&  question.questionNum != 0){
                                     var tb_array = new Array();
-                                    tb_array.push("2017-2018");
+                                    tb_array.push(period);
                                     tb_array.push(allTableArray[i].complaintClassName);
                                     tb_array.push(allTableArray[i].complaintId);
                                     tb_array.push(allTableArray[i].complaintNum)
@@ -254,8 +282,11 @@
             $.fn.mergeCell = function(options) {
                 return this.each(function() {
                     var cols = options.cols;
-                    for (var i = cols.length - 1; cols[i] != undefined; i--) {
-                        mergeCell($(this), cols[i]);
+//                    for (var i = cols.length - 1; cols[i] != undefined; i--) {
+//                        mergeCell($(this), cols[i]);
+//                    }
+                    for (var j = 0; j<cols.length; j++) {
+                        mergeCell($(this), cols[j]);
                     }
                     dispose($(this));
                 })

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

@@ -32,10 +32,21 @@
     <form   class="form form-horizontal" id="form-admin-add">
         <div class="input-box">
             <span class="input-dic spanhidth">产品:</span>
+            <input type="hidden" id="batchId" name="batchId" value="">
             <select class="my-select" name="produceId" id="produceId">
             <#if (produceList ?size > 0)>
                 <#list produceList as list>
-                    <option value ="${list.produceId}">${list.produceName}</option>
+                    <option value ="${list.produceId!''}"
+                        <#if list.ptsBatch?? >
+                                isBacth="1"
+                                bacth = "${list.ptsBatch.batchNo!''}"
+                                batchId = "${list.ptsBatch.batchId!''}"
+                                softwareVersionNo="${list.ptsBatch.softwareVersionNo!''}"
+                                bomName="${list.ptsBatch.bomName!''}"
+                        <#else >
+                            isBacth="2"
+                        </#if>
+                    >${list.produceName!''}</option>
                 </#list>
             <#else >
                 <option value ="">暂无产品,请先添加产品</option>
@@ -44,44 +55,16 @@
         </div>
         <div class="input-box">
             <span class="input-dic spanhidth">批次:</span>
-            <select class="my-select" name="batchId" id="batchId">
-            <#if (listptsBatch ?size > 0)>
-                <#list listptsBatch as list>
-                    <option value ="${list.batchId}">${list.batchNo}</option>
-                </#list>
-            <#else >
-                <option value ="">暂无批次,请先添加批次</option>
-            </#if>
-            </select><br>
+            <span class="input-dic spanhidth" id="ptsBatch" style="width: 76%;text-align: left;padding-left: 10px;height: 30px;"></span>
             <span style="margin-left: 15.5%">请对照生产计划部给到的纸制生产计划信息。</span>
         </div>
         <div class="input-box">
             <span class="input-dic spanhidth">软件版本:</span>
-            <select class="my-select" name="versionId" id="versionId">
-            <#if (listVersion ?size > 0)>
-                <#list listVersion as list>
-                    <option value ="${list.machineVersionId}">${list.machineVersionName}</option>
-                </#list>
-            <#else >
-                <option value ="">暂无软件版本,请先添加软件版本</option>
-            </#if>
-            </select>
+            <span class="input-dic spanhidth" id="softwareVersionNo" style="width: 76%;text-align: left;padding-left: 10px;height: 30px;"></span>
         </div>
         <div class="input-box">
             <span class="input-dic spanhidth">Bom单:</span>
-            <select class="my-select" name="bomId" id="bomId">
-            <#if listBom??>
-                <#if (listBom ?size > 0)>
-                    <#list listBom as list>
-                        <option value ="${list.bomId}">${list.bomName}</option>
-                    </#list>
-                <#else >
-                    <option value ="">暂无Bom,请先添加Bom单</option>
-                </#if>
-            <#else >
-                <option value ="">暂无Bom,请先添加Bom单</option>
-            </#if>
-            </select>
+            <span class="input-dic spanhidth" id="bomName" style="width: 76%;text-align: left;padding-left: 10px;height: 30px;"></span>
         </div>
         <div class="input-box">
             <span class="input-dic" style="margin-top: 0">是否翻新机:</span>
@@ -107,26 +90,46 @@
 <#--<script type="text/javascript" src="${path}/common/admin/js/tips.js"></script>-->
 <script type="text/javascript">
 
-    /*监听批次修改Bom  bom单*/
-    $("#batchId").change(function(){
-        var batchId = $(this).val();
-        getBom(batchId);
-    });
-    /*监听产品修改批次  bom单*/
+    $(function(){
+        setHtml();
+    })
+
+    /*监听产品修改*/
     $("#produceId").change(function(){
-        var produceId = $(this).val();
-        getProduce(produceId);
+        setHtml();
     });
 
+    function setHtml(){
+        var flag = false;
+        var isBacth = $("#produceId").find("option:selected").attr("isBacth");
+        if(isBacth == 1){
+            var ptsBatch = $("#produceId").find("option:selected").attr("bacth");
+            var softwareVersionNo = $("#produceId").find("option:selected").attr("softwareVersionNo");
+            var bomName = $("#produceId").find("option:selected").attr("bomName");
+            var batchId = $("#produceId").find("option:selected").attr("batchId");
+            $("#ptsBatch").html(ptsBatch);
+            $("#ptsBatch").css("color","#000");
+            $("#softwareVersionNo").html(softwareVersionNo);
+            $("#bomName").html(bomName);
+            $("#batchId").val(batchId);
+        }else{
+            $("#ptsBatch").css("color","#d00");
+            $("#ptsBatch").html("请添加对应产品的正在使用状态的批次!");
+            $("#softwareVersionNo").html("");
+            $("#bomName").html("");
+            $("#batchId").val("");
+        }
+    }
+
     /*获取bom信息,赋值在页面上*/
-    function getBom(batchId){
-        var bom = new Object();
-        $.ajax({
-            type: "POST",
-            data: {
-                batchId : batchId
-            },
-            url: "${path}/admin/machine/select_bom",
+    /* function getBom(batchId){
+         var bom = new Object();
+         $.ajax({
+             type: "POST",
+             data: {
+                 batchId : batchId
+             },
+             url: "${path}/admin/machine/select_bom",
             async: false,
             success: function(data){
                 if (data.returnCode == 200) {
@@ -145,10 +148,10 @@
             });
 
         }
-    }
+    }*/
 
     /*获取批次信息,赋值在页面上*/
-    function getProduce(produceId){
+   /* function getProduce(produceId){
         var listptsBatch = new Object();
         $.ajax({
             type: "POST",
@@ -178,27 +181,14 @@
             });
 
         }
-    }
+    }*/
     function dataCharm() {
 
         var batchId = $("#batchId").val();
         if(batchId == null || batchId == "" || typeof(batchId)=="undefined"){
-            layer.msg("必须选择一个批次,没有批次请到批次列表添加批次",{icon: 5,time:3000});
+            layer.msg("该产品没有可用的批次,请联系生产部门添加批次信息!",{icon: 5,time:5000});
             return false;
         }
-
-        var versionId = $("#versionId").val();
-        if(versionId == null || versionId == "" || typeof(versionId)=="undefined"){
-            layer.msg("必须选择一个软件版本,没有软件版本请到产品列表中添加软件版本",{icon: 5,time:3000});
-            return false;
-        }
-
-        var bomId = $("#bomId").val();
-        if(bomId == null || bomId == "" || typeof(bomId)=="undefined"){
-            layer.msg("必须选择一个Bom单,没有Bom单请到Bom单列表添加Bom单",{icon: 5,time:3000});
-            return false;
-        }
-
         var machineLine = $("#machineLine").val();
         if(machineLine == null || machineLine == "" || typeof(machineLine)=="undefined"){
             layer.msg("拉线不能为空",{icon: 5,time:3000});

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

@@ -29,7 +29,7 @@
 					<#--<button type="button" class="my-btn-search" onclick="setting();" style="cursor:pointer; margin-right: 50px;">设置</button>-->
                     <#-- <button type="button" class="my-btn-search" onclick="batch_add_machine('批量添加机器','${path}/admin/machine/_to_add_batch','','550');" style="cursor:pointer; margin-right: 50px;">添加机器</button>
                      &nbsp; &nbsp;-->
-                     <button type="button" class="my-btn-search" onclick="add_renovationmachine('批量添加机器','${path}/admin/machine/_to_add_renovation','570','450');" style="cursor:pointer; margin-right: 50px;">添加机器</button>
+                     <button type="button" class="my-btn-search" onclick="add_renovationmachine('批量添加机器','${path}/admin/machine/_to_add_renovation','570','550');" style="cursor:pointer; margin-right: 50px;">添加机器</button>
 
 					<input class="my-input" type="text" name="machineBarcode" value="${machineBarcode!''}" placeholder="请输入机器编号"/>
 					<select class="my-select" name="machineIsPrint">