From 7de00c5824ecfd39fec748386298ba0cedd4504e Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 16 一月 2024 16:06:10 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI

---
 WebTM/views/生产管理/生产完工单/Sc_MESEndWorkBillList.html |  509 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 326 insertions(+), 183 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\256\214\345\267\245\345\215\225/Sc_MESEndWorkBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\256\214\345\267\245\345\215\225/Sc_MESEndWorkBillList.html"
index 9193f41..8f5c8e7 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\256\214\345\267\245\345\215\225/Sc_MESEndWorkBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\256\214\345\267\245\345\215\225/Sc_MESEndWorkBillList.html"
@@ -40,6 +40,18 @@
                                         <input type="date" class="layui-input" id="HDate1">
                                     </div>
                                 </div>
+                                <div class="layui-inline">
+                                    <label class="layui-form-label">鍗曟嵁鍙�</label>
+                                    <div class="layui-input-block">
+                                        <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
+                                    <label class="layui-form-label">鐢熶骇璧勬簮</label>
+                                    <div class="layui-input-block">
+                                        <input type="text" class="layui-input" name="HSource" id="HSource">
+                                    </div>
+                                </div>
                                 <!--<div class="layui-inline">
                                     <label class="layui-form-label">鍗曟嵁绫诲瀷</label>
                                     <div class="layui-input-block">
@@ -72,23 +84,20 @@
                                             <span>鍏朵粬鏉′欢></span>
                                         </div>
                                     </div>
-                                    <div class="layui-inline">
-                                        <label class="layui-form-label">鍗曟嵁鍙�</label>
-                                        <div class="layui-input-block">
-                                            <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
-                                        </div>
-                                    </div>
+                                  
                                 </div>
                             </div>
                         </div>
                         <table class="" id="mainTable" lay-filter="mainTable"></table>
                         <script type="text/html" id="toolbarDemo">
                             <div class="layui-btn-container">
-                                <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-getCheckData"><i class="layui-icon layui-icon-tips"></i>棰勮</button>-->
-                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Add"><i class="layui-icon layui-icon-add-1"></i>鏂板</button>
+                                <button type="button" class="layui-btn layui-btn-sm layui-btn-disabled" lay-event="btn-Print"><i class="layui-icon layui-icon-print"></i>棰勮</button>
+                                <button type="button" class="layui-btn layui-btn-sm layui-btn-disabled" lay-event="btn-Add"><i class="layui-icon layui-icon-add-1"></i>鏂板</button>
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Edit"><i class="layui-icon layui-icon-edit"></i>缂栬緫</button>
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><i class="layui-icon layui-icon-delete"></i>鍒犻櫎</button>
-
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Refresh"><i class="layui-icon layui-icon-refresh-3"></i>鍒锋柊</button>
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Audit"><i class="layui-icon layui-icon-radio"></i>瀹℃牳</button>
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Exit"><i class="layui-icon layui-icon-logout"></i>閫�鍑�</button>
 
                             </div>
                         </script>
@@ -101,12 +110,20 @@
     <script src="../../../layuiadmin/Scripts/json2.js"></script>
     <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
     <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
+    <script src="../../../layuiadmin/PubCustom.js"></script>
+    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
     <script>
+        //鑾峰彇椤甸潰璺宠浆鍙傛暟  //鍗曟嵁缂栬緫鐘舵�侊細 1.鏃犳簮鍗曟柊澧灺� 聽2.鏈夋簮鍗曟柊澧灺� 聽3.缂栬緫聽 4.娴忚聽 5.鍙樻洿
+        var params = get_UrlVars();
+        if (typeof (params[params[0]]) == "undefined") {
+            var OperationType = 1;//鎿嶄綔绫诲瀷
+        }
         layui.config({
             base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
         }).extend({
             index: 'lib/index', //涓诲叆鍙fā鍧�
         }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate'], function () {
+            //#region 鍏叡鍙橀噺
             var $ = layui.$
                 , admin = layui.admin
                 , layer = layui.layer
@@ -118,71 +135,201 @@
                 , util = layui.util
             //鏌ヨ鏉′欢
             var sWhere = "";
+            var option = [];
+            //#endregion
 
-            var option = {
-                elem: '#mainTable'
-                , toolbar: '#toolbarDemo'
-                , height: 'full-50'
-                , page: true
-                , cellMinWidth: 90
-                , cols: [[
-                    { type: 'checkbox', fixed: 'left' }
-                    , { field: 'hmainid', title: '鍗曟嵁ID', hide: true }
-                    , { field: '鏃ユ湡', title: '鏃ユ湡', width: 160, templet: "<div>{{d.鏃ユ湡 ==null ?'':layui.util.toDateString(d.鏃ユ湡, 'yyyy-MM-dd')}}</div>" }
-                    , { field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�', width: 160 }
-                    , { field: '鍗曟嵁绫诲瀷', title: '鍗曟嵁绫诲瀷', width: 160 }
-                    , { field: '閮ㄩ棬浠g爜', title: '閮ㄩ棬浠g爜', width: 115 }
-                    , { field: '閮ㄩ棬鍚嶇О', title: '閮ㄩ棬鍚嶇О', width: 200 }
-                    , { field: '鐝粍浠g爜', title: '鐝粍浠g爜', width: 115 }
-                    , { field: '鐝粍鍚嶇О', title: '鐝粍鍚嶇О', width: 200 }
-                    , { field: '璧勬簮浠g爜', title: '璧勬簮浠g爜', width: 115 }
-                    , { field: '璧勬簮鍚嶇О', title: '璧勬簮鍚嶇О', width: 200 }
-                    , { field: '瀹屽伐鏃堕棿', title: '瀹屽伐鏃堕棿', width: 200, templet: "<div>{{d.瀹屽伐鏃堕棿 ==null ?'':layui.util.toDateString(d.瀹屽伐鏃堕棿, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '澶囨敞', title: '澶囨敞', width: 200 }
-                    , { field: '鍒跺崟浜�', title: '鍒跺崟浜�', width: 200 }
-                    , { field: '鍒跺崟鏃ユ湡', title: '鍒跺崟鏃ユ湡', width: 200, templet: "<div>{{d.鍒跺崟鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍒跺崟鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '瀹℃牳浜�', title: '瀹℃牳浜�', width: 200 }
-                    , { field: '瀹℃牳鏃ユ湡', title: '瀹℃牳鏃ユ湡', width: 200, templet: "<div>{{d.瀹℃牳鏃ユ湡 ==null ? '':layui.util.toDateString(d.瀹℃牳鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '淇敼浜�', title: '淇敼浜�', width: 200 }
-                    , { field: '淇敼鏃ユ湡', title: '淇敼鏃ユ湡', width: 200, templet: "<div>{{d.淇敼鏃ユ湡 ==null ?'':layui.util.toDateString(d.淇敼鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '鍏抽棴浜�', title: '鍏抽棴浜�', width: 200 }
-                    , { field: '鍏抽棴鏃ユ湡', title: '鍏抽棴鏃ユ湡', width: 200, templet: "<div>{{d.鍏抽棴鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍏抽棴鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '浣滃簾浜�', title: '浣滃簾浜�', width: 200 }
-                    , { field: '浣滃簾鏃ユ湡', title: '浣滃簾鏃ユ湡', width: 200, templet: "<div>{{d.浣滃簾鏃ユ湡 ==null ?'':layui.util.toDateString(d.浣滃簾鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                ]]
-            };
+            //#region 杩涘叆椤甸潰鍗冲姞杞�
 
-            var index = layer.load(0);
+            //鍒ゆ柇鎿嶄綔绫诲瀷
+            if (OperationType == 1) {//鏃犳簮鍗�
+                //鎶ュ伐骞冲彴瀹屽伐鍗曟煡鐪嬪垪琛�
+                set_ClearBill();
+            }
+            else {
+                layer.alert("鏈煡鎿嶄綔绫诲瀷锛�", { icon: 5 });
+            }
+            //#endregion
 
+            //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
             //澶村伐鍏锋爮浜嬩欢
             table.on('toolbar(mainTable)', function (obj) {
                 var checkStatus = table.checkStatus(obj.config.id);
                 switch (obj.event) {
-                    case 'btn-Add':
-                        //椤甸潰灞�-鑷畾涔�
-                        layer.open({
-                            type: 2,
-                            skin: 'layui-layer-rim', //鍔犱笂杈规
-                            title: '鏂板瀹屽伐鍗�',
-                            closeBtn: 1,
-                            shift: 2,
-                            area: ['100%', '100%'],
-                            maxmin: true,
-                            content: '../鐢熶骇瀹屽伐鍗�/Sc_Add_MESEndWorkBillList.html',
-                            end: function () {
-                                //鍒锋柊椤甸潰,
-                                location.reload();
-                            },
-                            success: function (layero, index) {
-
-                            }
-                        });
+                    case 'btn-Add': //set_AddNew();
                         break;
-                    case 'btn-Edit':
-                        var checkStatus = table.checkStatus('mainTable')
+                    case 'btn-Edit': set_ShowBill();
+                        break;
+                    case 'btn-Delete': set_DeleteBill();
+                        break;
+                    //鍒锋柊
+                    case 'get_Refresh': set_Refresh();
+                        break;
+                    //瀹℃牳鎸夐挳
+                    case 'btn-Audit': set_CheckBill();
+                        break;
+                    //閫�鍑�
+                    case 'get_Exit': Pub_Close(2);
+                        break;
+                };
+            });
+            //鏌ヨ鎸夐挳
+            form.on('submit(btnSearch)', function (data) {
+                var ajaxLoad = layer.load();
+                var HDate = $("#HDate").val();//寮�濮嬫棩鏈�
+                var HDate1 = $("#HDate1").val();//缁撴潫鏃ユ湡
+                var HBillNo = $("#HBillNo").val();//鍗曟嵁鍙�
+                var HSource = $("#HSource").val();//鐢熶骇璧勬簮
+                if (HDate) {
+                    sWhere += " and CONVERT(varchar(100),鏃ユ湡, 23) >= '" + HDate + "'";
+                }
+                if (HDate1) {
+                    sWhere += " and CONVERT(varchar(100),鏃ユ湡, 23) <= '" + HDate1 + "'";
+                }
+                if (HBillNo) {
+                    sWhere += " and 鍗曟嵁鍙� like '%" + HBillNo + "%'";
+                }
+                if (HSource) {
+                    sWhere += " and 璧勬簮浠g爜 like '%" + HSource + "%' or 璧勬簮鍚嶇О like '%" + HSource + "%'";
+                }
+                $.ajax({
+                    url: GetWEBURL() + '/Sc_MESEndWorkBill/GetMESEndWorkBill',
+                    type: "GET",
+                    data: { "sWhere": sWhere },
+                    success: function (data1) {
+                        if (data1.count == 1) {
+                            option.data = data1.data;
+                            table.render(option);
+                            layer.close(ajaxLoad);
+                        } else {
+                            layer.close(ajaxLoad);
+                            layer.alert(data1.code + data1.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.close(ajaxLoad);
+                        layer.alert("鎺ュ彛澶辨晥!", { icon: 5 });
+                    }
+                });
+                //璋冪敤鎺ュ彛鍚庢竻绌簊Where缂撳瓨
+                sWhere = "";
+            });
+
+            //閲嶇疆鎸夐挳
+            form.on('submit(btnReSearch)', function (data) {
+                $("#HDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
+                $("#HDate1").val(Format(new Date(), "yyyy-MM-dd"));
+                $("#HBillNo").val("");//鍗曟嵁鍙�
+                $("#HSource").val("");//鐢熶骇璧勬簮
+                $("#btnSearch").click();
+            });
+
+            //#endregion
+
+            //#region 鏈〉闈㈡墍鏈夎璋冪敤鏂规硶
+
+            // 鍒濆鍖栫晫闈�
+            function set_ClearBill() {
+                //鍒濆鍖栬〃鏍�
+                set_InitGrid();
+                //鏌ヨ
+                get_Display(sWhere);
+
+            }
+
+            //鍒濆鍖栬〃鏍�
+            function set_InitGrid() {
+                $("#HDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
+                $("#HDate1").val(Format(new Date(), "yyyy-MM-dd"));
+                 option = {
+                    elem: '#mainTable'
+                    , toolbar: '#toolbarDemo'
+                    , height: 'full-50'
+                    , page: true
+                    , cellMinWidth: 90
+                    , cols: [[
+                        { type: 'checkbox', fixed: 'left' }
+                        , { field: 'hmainid', title: '鍗曟嵁ID', hide: true }
+                        , { field: '鏃ユ湡', title: '鏃ユ湡', width: 160, templet: "<div>{{d.鏃ユ湡 ==null ?'':layui.util.toDateString(d.鏃ユ湡, 'yyyy-MM-dd')}}</div>" }
+                        , { field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�', width: 160 }
+                        , { field: '鍗曟嵁绫诲瀷', title: '鍗曟嵁绫诲瀷', width: 160 }
+                        , { field: 'HBillStatus', title: '鍗曟嵁鐘舵��', width: 160 }
+                        , { field: '閮ㄩ棬浠g爜', title: '閮ㄩ棬浠g爜', width: 115 }
+                        , { field: '閮ㄩ棬鍚嶇О', title: '閮ㄩ棬鍚嶇О', width: 200 }
+                        , { field: '鐝粍浠g爜', title: '鐝粍浠g爜', width: 115 }
+                        , { field: '鐝粍鍚嶇О', title: '鐝粍鍚嶇О', width: 200 }
+                        , { field: '璧勬簮浠g爜', title: '璧勬簮浠g爜', width: 115 }
+                        , { field: '璧勬簮鍚嶇О', title: '璧勬簮鍚嶇О', width: 200 }
+                        , { field: '瀹屽伐鏃堕棿', title: '瀹屽伐鏃堕棿', width: 200, templet: "<div>{{d.瀹屽伐鏃堕棿 ==null ?'':layui.util.toDateString(d.瀹屽伐鏃堕棿, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '澶囨敞', title: '澶囨敞', width: 200 }
+                        , { field: '鍒跺崟浜�', title: '鍒跺崟浜�', width: 200 }
+                        , { field: '鍒跺崟鏃ユ湡', title: '鍒跺崟鏃ユ湡', width: 200, templet: "<div>{{d.鍒跺崟鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍒跺崟鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '瀹℃牳浜�', title: '瀹℃牳浜�', width: 200 }
+                        , { field: '瀹℃牳鏃ユ湡', title: '瀹℃牳鏃ユ湡', width: 200, templet: "<div>{{d.瀹℃牳鏃ユ湡 ==null ? '':layui.util.toDateString(d.瀹℃牳鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '淇敼浜�', title: '淇敼浜�', width: 200 }
+                        , { field: '淇敼鏃ユ湡', title: '淇敼鏃ユ湡', width: 200, templet: "<div>{{d.淇敼鏃ユ湡 ==null ?'':layui.util.toDateString(d.淇敼鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '鍏抽棴浜�', title: '鍏抽棴浜�', width: 200 }
+                        , { field: '鍏抽棴鏃ユ湡', title: '鍏抽棴鏃ユ湡', width: 200, templet: "<div>{{d.鍏抽棴鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍏抽棴鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '浣滃簾浜�', title: '浣滃簾浜�', width: 200 }
+                        , { field: '浣滃簾鏃ユ湡', title: '浣滃簾鏃ユ湡', width: 200, templet: "<div>{{d.浣滃簾鏃ユ湡 ==null ?'':layui.util.toDateString(d.浣滃簾鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                    ]]
+                };
+            }
+
+            //鏌ヨ
+            function get_Display() {
+                //杩涘叆椤甸潰鏄剧ず鐨勭紦瀛樺垪琛�
+                var ajaxLoad = layer.load();
+                $.ajax({
+                    url: GetWEBURL() + '/Sc_MESEndWorkBill/GetMESEndWorkBill',
+                    type: "GET",
+                    data: { "sWhere": sWhere },
+                    success: function (data1) {
+                        if (data1.count == 1) {
+                            option.data = data1.data;
+                            table.render(option);
+                            layer.close(ajaxLoad);
+                        } else {
+                            layer.close(ajaxLoad);
+                            layer.alert(data1.code + data1.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.close(ajaxLoad);
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+
+            //鏂板
+            function set_AddNew() {
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '鏂板瀹屽伐鍗�',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['100%', '100%'],
+                    maxmin: true,
+                    content: '../鐢熶骇瀹屽伐鍗�/Sc_Add_MESEndWorkBillList.html?OperationType=1&linterid=&HSouceBillType=',
+                    end: function () {
+                        //鍒锋柊椤甸潰,
+                        location.reload();
+                    },
+                    success: function (layero, index) {
+
+                    }
+                });
+            }
+
+            //缂栬緫
+            function set_ShowBill() {
+               var checkStatus = table.checkStatus('mainTable')
                             , data = checkStatus.data;
                         if (checkStatus.data.length === 1) {
-                            var hID = data[0].hmainid.toString();
+                            var linterid = data[0].hmainid.toString();
+                            var HBillStatus = data[0].HBillStatus.toString();
+                            if (HBillStatus != "1") {
+                                layer.msg('鍗曟嵁鐘舵�佷笉涓烘湭瀹℃牳鐘舵��,涓嶅厑璁哥紪杈戯紒');
+                                return false;
+                            }
                             //if (AllowLoadData(sSubStr) != false) {//闈炵┖楠岃瘉
                             layer.open({
                                 type: 2
@@ -192,7 +339,7 @@
                                 , shade: 0.6 //閬僵閫忔槑搴�
                                 , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
                                 , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
-                                , content: '../鐢熶骇瀹屽伐鍗�/Sc_Add_MESEndWorkBillList.html?hID=' + hID
+                                , content: '../鐢熶骇瀹屽伐鍗�/Sc_Add_MESEndWorkBillList.html?OperationType=3&linterid=' + linterid + '&HSouceBillType='
                                 , resize: false,
                                 end: function () {
                                     //鍒锋柊椤甸潰,
@@ -206,133 +353,129 @@
                         } else {
                             layer.msg('璇烽�夋嫨涓�琛屾暟鎹紪杈戯紒');
                         }
+            }
 
-                        break;
-                    case 'btn-Delete':
-                        var checkStatus = table.checkStatus('mainTable')
-                            , data = checkStatus.data;
-                        if (checkStatus.data.length === 1) {
-                            var InterID = data[0].hmainid.toString();
-                            //閫昏緫鍒犻櫎鏂规硶
-                            layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) {
-                                $.ajax({
-                                    type: "GET",
-                                    url: GetWEBURL() + "Sc_MESEndWorkBill/DeltetMESEndWorkBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                                    data: { "HInterID": InterID },
-                                    success: function (result) {
-                                        if (result.count == 1) {
-                                            layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
-                                                // 寰楀埌frame绱㈠紩
-                                                var index = layer.getFrameIndex(window.name);
-                                                //鍏抽棴褰撳墠frame
-                                                layer.close(index);
-                                                //淇敼涓哄姛鍚庡埛鏂扮晫闈�
-                                                window.location.reload();
-                                            });
-
-                                        } else {
-                                            layer.alert(result.code + result.Message, { icon: 5 });
-                                        }
-                                    }, error: function () {
-                                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
-                                    }
-                                });
-                            })
-                        }
-                        else {
-                            layer.msg('璇烽�夋嫨涓�琛屾暟鎹垹闄わ紒');
-                        }
-                        break;
-                };
-            });
-
-            //杩涘叆椤甸潰鏄剧ず鐨勭紦瀛樺垪琛�
-            $.ajax({
-                //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
-                url: GetWEBURL() + '/Sc_MESEndWorkBill/GetMESEndWorkBill',
-                type: "GET",
-                data: { "sWhere": sWhere},
-                success: function (data1) {
-                    if (data1.count == 1) {
-                        option.data = data1.data;
-                        table.render(option);
-                        layer.close(index);
-                    } else {
-                        layer.close(index);
-                        layer.alert(data1.code + data1.Message, { icon: 5 });
+            //鍒犻櫎
+            function set_DeleteBill() {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1) {
+                    var InterID = data[0].hmainid.toString();
+                    var HBillStatus = data[0].HBillStatus.toString();
+                    if (HBillStatus != "1") {
+                        layer.msg('鍗曟嵁鐘舵�佷笉涓烘湭瀹℃牳鐘舵��,涓嶅厑璁哥紪杈戯紒');
+                        return false;
                     }
-                }, error: function () {
-                    layer.close(index);
-                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
-                }
-            });
+                    //閫昏緫鍒犻櫎鏂规硶
+                    layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) {
+                        $.ajax({
+                            type: "GET",
+                            url: GetWEBURL() + "Sc_MESEndWorkBill/DeltetMESEndWorkBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                            data: { "HInterID": InterID ,"UserName": sessionStorage["HUserName"]},
+                            success: function (result) {
+                                if (result.count == 1) {
+                                    layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
+                                        // 寰楀埌frame绱㈠紩
+                                        var index = layer.getFrameIndex(window.name);
+                                        //鍏抽棴褰撳墠frame
+                                        layer.close(index);
+                                        //淇敼涓哄姛鍚庡埛鏂扮晫闈�
+                                        window.location.reload();
+                                    });
 
-            //閲嶇疆鎸夐挳
-            form.on('submit(btnReSearch)', function (data) {
-                $("#HDate").val("");//寮�濮嬫棩鏈�
-                $("#HDate1").val("");//缁撴潫鏃ユ湡
-                $("#HBillNo").val("");//鍗曟嵁鍙�
+                                } else {
+                                    layer.alert(result.code + result.Message, { icon: 5 });
+                                }
+                            }, error: function () {
+                                layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                            }
+                        });
+                    })
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾暟鎹垹闄わ紒');
+                }
+            }
+
+            //鍒锋柊
+            function set_Refresh() {
                 $("#btnSearch").click();
-            });
+            }
 
-            //鏌ヨ鎸夐挳
-            form.on('submit(btnSearch)', function (data) {//閫夋嫨浠撲綅
-                var HDate = $("#HDate").val();//寮�濮嬫棩鏈�
-                var HDate1 = $("#HDate1").val();//缁撴潫鏃ユ湡
-                var HBillNo = $("#HBillNo").val();//鍗曟嵁鍙�
-                if (HDate) {
-                    sWhere += " and CONVERT(varchar(100),鏃ユ湡, 23) >= '" + HDate + "'";
-                }
-                if (HDate1) {
-                    sWhere += " and CONVERT(varchar(100),鏃ユ湡, 23) <= '" + HDate1 + "'";
-                }
-                if (HBillNo) {
-                    sWhere += " and 鍗曟嵁鍙� like '%" + HBillNo + "%'";
-                }
-                var index = layer.load(0);
-                $.ajax({
-                    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
-                    url: GetWEBURL() + '/Sc_MESEndWorkBill/GetMESEndWorkBill',
-                    type: "GET",
-                    data: { "sWhere": sWhere},
-                    success: function (data1) {
-                        if (data1.count == 1) {
-                            option.data = data1.data;
-                            table.render(option);
-                            layer.close(index);
-                            layer.alert("鏌ヨ鎴愬姛", { icon: 1 });
-                        } else {
-                            layer.close(index);
-                            layer.alert(data1.code + data1.Message, { icon: 5 });
+            //瀹℃牳
+            function set_CheckBill() {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1) {
+                    var InterID = data[0].hmainid.toString();
+                    //閫昏緫瀹℃牳鏂规硶
+                    $.ajax({
+                        type: "GET",
+                        url: GetWEBURL() + "/Sc_MESStopWorkBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
+                        success: function (result) {
+                            if (result.count == 1) {
+                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
+                                    // 寰楀埌frame绱㈠紩
+                                    var index = layer.getFrameIndex(window.name);
+                                    //鍏抽棴褰撳墠frame
+                                    layer.close(index);
+                                    //淇敼涓哄姛鍚庡埛鏂扮晫闈�
+                                    $("#btnSearch").trigger('click');
+                                });
+
+                            } else {
+                                layer.alert(result.code + result.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
                         }
-                    }, error: function () {
-                        layer.close(index);
-                        layer.alert("鎺ュ彛澶辨晥!", { icon: 5 });
-                    }
-                });
-                //璋冪敤鎺ュ彛鍚庢竻绌簊Where缂撳瓨
-                sWhere = "";
-                //$("#HBillType").val("");//鍗曟嵁绫诲瀷
-                //$("#HBillNo").val("");//鍗曟嵁鍙�
-                //$("#HSourceBillNo").val("");//婧愬崟鍙�
-                //$("#HCreateBy").val("");//鍒跺崟浜�
-                //$("#BenginHCreateDate").val("");//寮�濮嬪埗鍗曟椂闂�
-                //$("#EndHCreateDate").val("");//缁撴潫鍒跺崟鏃堕棿
-            });
+                    });
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾暟鎹鏍革紒');
+                }
+            }
 
-            //鐩戝惉琛屽弻鍑讳簨浠�
-            table.on('rowDouble(mainTable)', function (obj) {
-                layer.alert("鍙屽嚮浜嬩欢", { icon: 1 });
-            });
+            //鍙嶅鏍�
+            function set_AbandonCheck() {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1) {
+                    var InterID = data[0].hmainid.toString();
+                    //閫昏緫瀹℃牳鏂规硶
+                    $.ajax({
+                        type: "GET",
+                        url: GetWEBURL() + "/Sc_MESStopWorkBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        data: { "HInterID": InterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] },
+                        success: function (result) {
+                            if (result.count == 1) {
+                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
+                                    // 寰楀埌frame绱㈠紩
+                                    var index = layer.getFrameIndex(window.name);
+                                    //鍏抽棴褰撳墠frame
+                                    layer.close(index);
+                                    //淇敼涓哄姛鍚庡埛鏂扮晫闈�
+                                    $("#btnSearch").trigger('click');
+                                });
+
+                            } else {
+                                layer.alert(result.code + result.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                        }
+                    });
+
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾暟鎹弽瀹℃牳锛�');
+                }
+
+            }
 
 
-            //laydate.render({
-            //    elem: '#HDate'
-            //    , type: 'datetime'
-            //    , trigger: 'click'
-            //    , format:'yyyy-MM-dd HH:mm'
-            //});
-
+            //#endregion
 
             //浠ヤ笂鏄痩ayui妯″潡
         });

--
Gitblit v1.9.1