1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; 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">
    <!--引用layui样式文件-->
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <!--引用layui js文件-->
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <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>
    <style>
        .layui-col-xs4 {
            width: 12.333333%
        }
 
        .layui-col-xs8 {
            width: 55.666667%;
        }
    </style>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-col-md12">
            <div class="layui-card" style="padding: 1px">
                <div class="layui-card-body" style="padding: 1px;">
                    <form class="layui-form" action="" lay-filter="component-form-group">
                        <table class="" id="mainTable" lay-filter="mainTable"></table>
                    </form>
                </div>
            </div>
            <div class="layer-footer" style="z-index: 10; position: fixed; text-align: center; bottom: 0; width:100%; height:50px">
                <div class="layui-row">
                    <!--<div class="layui-col-xs3">
                <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdLoadData" id="cmdLoadData">提交</button>
            </div>
            <div class="layui-col-xs3">
                <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdDelete">删除</button>
            </div>-->
                    <div class="layui-col-xs3">
                        <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdCancel">退出</button>
                    </div>
                    <div class="layui-col-xs3">
                        <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdExport">导出</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
 
            //#region 公共变量
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element;
            var HBillType = '9999'
            var HMaker = sessionStorage["HUserName"]
            var HStockOrgID = sessionStorage["OrganizationID"]
            var option = [];
 
            var ins;                        //用于导出excel
            //#endregion
 
            //#region 判断是否登录 未登录则跳到登录页
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "../../../user/login.html"; });
            }
            //#endregion
 
            //#region 初始化界面
            set_ClearBill();
            //#endregion
 
 
 
            //#region 扫描客户物料条码
            //#region 显示客户物料条码列表信息
            function DisBillEntryList() {
                var ajaxLoad = layer.load();
 
                var colList = [];                                               //获取列信息
                var finalData = [];
                var returnCode = false;
                var errorMessage = "";
                //获取
                var initData = getUrlVars_JSON().data;
                for (var t = 0; t < initData.length; t++) {
                    var HInterID = initData[t].HInterID_Temp;
                    var HBillNo = decodeURIComponent(initData[t].HBillNo_Temp);
                    var HBillNo_Temp = HBillNo;
                    HBillNo += "' and HInterID = '" + HInterID;
 
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + '/WEBSController/Gy_getCusBarCodeBill_rushedBarCodeList_CodeList',
                        async: false,
                        data: { "HInterID": HInterID, "HBillNo": HBillNo, "HBillType": HBillType, "HOrgID": HStockOrgID },
                        success: function (data1) {
                            if (data1.count == 1) {
                                for (var i = 0; i < data1.data.length; i++) {
                                    if (data1.data[i].HBillNo == HBillNo_Temp) {
                                        finalData.push(data1.data[i]);
                                    }
                                }                                
                            } else {
                                returnCode = true;
                                errorMessage = "内码[" + HInterID + "]-单据号[" + HBillNo_Temp + "]:" + data1.Message + ";";
                            }
                        },
                        complete: function (XHR, TS) { XHR = null },//回收资源
                        error: function (e) {
                            returnCode = true;
                            errorMessage = "内码[" + HInterID + "]-单据号[" + HBillNo_Temp + "]:接口请求失败!";
                        }
                    });
 
                    if (returnCode) {
                        layer.alert(errorMessage, { icon: 5 });
                        layer.close(ajaxLoad);
                        return;
                    }
                }
 
                option.data = finalData;
                ins = table.render(option);
                layer.close(ajaxLoad);
            }
            //#endregion
            //#endregion
 
            //#region 功能控件
            //#region 退出功能控件
            form.on('submit(cmdCancel)', function () {
                layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                    Pub_Close(1);
                });
            })
            //#endregion
 
            //#region 导出功能控件
            form.on('submit(cmdExport)', function () {
                get_Export();
            })
            //#endregion
            //#endregion
 
            //#region 页面其它方法
            //#region 页面初始化方法
            function set_ClearBill() {
                set_InitGrid();     //初始化表格
 
                //查询数据
                DisBillEntryList();
            }
            //#endregion
 
            //#region 初始化表格方法
            function set_InitGrid() {
                option = {
                    elem: '#mainTable'
                    , height: 'full-50'
                    //, page: true
                    , cellMinWidth: 90
                    , limit: 10000000
                    //, limits: [50, 500, 5000, 20000]
                    , toolbar: '#toolbarDemo'
                    , data: []
                    , cols: [[
                        { type: 'checkbox', fixed: 'left' }
                        , { type: 'numbers', title: '序号', width: 100 }
                        , { field: 'HItemID', title: 'HItemID', hide: true }
                        , { field: 'HInterID', title: 'HInterID', hide: true }
                        , { field: 'HBillNo', title: '单据号', width: 125, sort: true }
                        , { field: 'HBillType', title: '单据类型', width: 125, sort: true, hide: true }
                        , { field: 'HBarCode', title: '条码编号', width: 125, sort: true }
                        , { field: 'HQty', title: '数量', width: 125, sort: true, hide: true }
                        , { field: 'HOrgID', title: 'HOrgID', sort: true, hide: true }
                        , { field: 'HDate', title: '日期', width: 125, sort: true }
                        , { field: 'HRelationInterID', title: 'HRelationInterID', width: 125, sort: true, hide: true }
                        , { field: 'HMaker', title: '扫码人', width: 125, sort: true }
                    ]]
                };
 
                table.render(option);
            }
            //#endregion
 
            //#region 获取参数_传递的JSON格式参数
            function getUrlVars_JSON() {
                var datajson;
                var str = window.location.search; //获取链接中传递的参数
                var arr = str.substring(str.lastIndexOf("=") + 1);
                datajson = $.parseJSON(decodeURI(arr));
                return datajson;
            }
            //#endregion
 
            //#region 导出Execel
            function get_Export() {
                table.exportFile(ins.config.id, option.data, "xls");
 
                //var ModRightNameCheck = "Xs_SeOrderBillList_ExportExcel";
 
                ////逻辑审核方法
                //$.ajax({
                //    type: "GET",
                //    url: GetWEBURL() + "/LMES/getReportByModRightNameCheck", //方法所在页面和方法名
                //    data: { "ModRightNameCheck": ModRightNameCheck, "user": sessionStorage["HUserName"] },
                //    success: function (result) {
                //        if (result.count == 1) {
                //            table.exportFile(ins.config.id, option.data, "xls");
                //        } else {
                //            layer.alert("当前模块没有导出权限!", { icon: 5 });
                //        }
                //    }, error: function () {
                //        layer.alert("接口请求失败!", { icon: 5 });
                //    }
                //});
            }
            //#endregion
            //#endregion
        });
 
    </script>
 
</body>
</html>