yusijie
2024-03-29 ae5cfe81fd2b9f38c2e9ccfcdeaa7be2b28ad5dc
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<!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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-card" style="padding: 1%">
            <div class="layui-card-body" style="padding: 15px;">
                <form class="layui-form" action="" lay-filter="component-form-group">
                    <div class="layui-form-item">
                        <label class="layui-form-label">数量</label>
                        <div class="layui-input-inline">
                            <input type="text" name="HQty" id="HQty" lay-verify="HQty" autocomplete="off" style="width:100%" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-tab">
                        <ul class="layui-tab-title" lay-filter="tab-all">
                            <li lay-id="1">条码明细</li>
                            <li lay-id="2">条码档案</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <table class="layui-hide" id="mx-table" lay-filter="mx-table"></table>
                                <div class="layui-card-header"></div>
                                <div class="layui-form-item">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdChange">调整</button>
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdDel">删除</button>
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdCancel">退出</button>
                                </div>
                            </div>
                            <div class="layui-tab-item">
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:60px;padding-left:0px;">条形码</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="HBarcode" id="HBarcode" lay-verify="HBarcode" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:60px;padding-left:0px;">物料档案</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="HM" id="HM" lay-verify="HM" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:60px;padding-left:0px;">往来单位</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="HSupName" id="HSupName" lay-verify="HSupName" autocomplete="off" class="layui-input">
                                        <input type="hidden" name="HSupID" id="HSupID" lay-verify="HSupID" autocomplete="off" class="layui-input">
                                    </div>
 
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:60px;padding-left:0px;">部门</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="HDeptName" id="HDeptName" lay-verify="HDeptName" autocomplete="off" class="layui-input">
                                        <input type="hidden" name="HDeptID" id="HDeptID" lay-verify="HDeptID" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:60px;padding-left:0px;">仓库</label>
                                    <div class="layui-input-inline mobile">
                                        <input type="text" name="HWHNAME" id="HWHNAME" lay-verify="HWHNAME" autocomplete="off" class="layui-input">
                                        <input type="hidden" name="HWHID" id="HWHID" lay-verify="HWHID" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:60px;padding-left:0px;">仓位</label>
                                    <div class="layui-input-inline mobile">
                                        <input type="text" name="HSCWHNAME" id="HSCWHNAME" lay-verify="HSCWHNAME" autocomplete="off" class="layui-input">
                                        <input type="hidden" name="HSCWID" id="HSCWID" lay-verify="HSCWID" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item" style="margin-bottom: 20px;">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="button1">返回</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../../layuiadmin/Scripts/json2.js" type="text/javascript"></script>
    <script src="../../layuiadmin/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../layuiadmin/Scripts/webConfig.js"></script>
    <script>
      
 
        //layui.config({
        //    base: '../../layuiadmin/' //静态资源所在路径
        //}).extend({
        //    index: 'lib/index' //主入口模块
        //}).use(['index', 'form', 'table'], function () {
        //    var $ = layui.$
        //    , admin = layui.admin
        //    , layer = layui.layer
        //    , table = layui.table
        //    , form = layui.form;
 
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element;
 
 
          
            //获取页面跳转参数
            var HMTONo = ''
            var HSourceInterID = 0
            var HSourceEntryID = 0
            var HQty = 0
            var HAuxPropID = 0
            var HBatchNo = ''
 
            var params = getUrlVars();
            if (typeof (params[params[0]]) == "undefined") {
                var OperationType = 1;//操作类型
            } else {
                var HInterID = params[params[0]];//单据ID
                var HMaterID = params[params[1]];//物料ID
                //var HAuxPropID = params[params[2]];//辅助属性
                //var HMTONo = params[params[3]];//计划跟踪号
                //var HWhID = params[params[4]];//仓库ID
                //var HSPID = params[params[5]];//仓位ID
                //var HSCWHID = params[params[6]];//调出仓库ID
                //var HSCSPID = params[params[7]];//调出仓位ID
                //var HBatchNo = params[params[8]];//批次
                //var HSourceInterID = params[params[2]];//源单主ID
                //var HSourceEntryID = params[params[3]];//源单子ID
                //var HBillType = params[params[6]];//单据类型
                //var HQty = params[params[6]];//条码
                var sBillType = params[params[2]];//单据类型
 
 
                //var HBillType = ''
 
                //var sBillType = '';//单据类型
 
                var sWhere = " and HInterID=" + HInterID + " and HMaterID=" + HMaterID + "";
                $.ajax({
                    url: GetWEBURL() + "/Kf_BarCodeEditDlg/Kf_BarCodeEditDlg_Json",
                    type: "GET",
                    data: { "sWhere": sWhere },
                    success: function (d) {
                        HMTONo = d.data[0].HMTONo
                        HSourceInterID = d.data[0].HSourceInterID
                        HSourceEntryID = d.data[0].HSourceEntryID
                        HBatchNo = d.data[0].HBatchNo
                        //HSourceInterID = 11
                        //HSourceEntryID = 11
                        HQty = d.data[0].HQty
                        HAuxPropID = d.data[0].HAuxPropID
                        //sBillType = d.data[0].HBillType
                        tableRender();
                    }
                })
 
 
            }
            function tableRender() {
                table.render({
                    elem: '#mx-table'
                    //, url: 'http://localhost:8083/Web/GetHBarCodeShowBillSub'
                    , url: GetWEBURL() + "/Web/GetHBarCodeShowBillSub"
                    , where: {
                        "HInterID": HInterID, "HMaterID": HMaterID, "HAuxPropID": HAuxPropID, "HMTONo": HMTONo, "HWhID": 0, "HSPID": 0, "HSCWhID": 0
                        , "HSCSPID": 0, "HBatchNo": HBatchNo, "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID, "sBillType": sBillType, sWhere: ''
                    },
                    cols: [[
                        { type: 'radio' }
                        , { field: 'HSonNo', title: '序号', width: 100 }
                        , { field: 'HBarCode', title: '条形码', width: 200 }
                        , { field: 'HQty', title: '数量', width: 100 }
                        , { field: 'HBatchNo', title: '批次', width: 150 }
                        , { field: 'HMTONo', title: '计划跟踪单号', width: 150 }
                    ]]
                    // , data: [linterid]
                });
            }
           
 
 
            form.on('submit(cmdCancel)', function () {
                var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
            })
            //function Pub_Close(closeType) {
            //    if (closeType == 1) {
            //        //关闭弹窗
            //        var index = parent.layer.getFrameIndex(window.name);
            //        parent.layer.close(index);
            //    } else if (closeType == 2) {
            //        //关闭页签
            //        parent.layui.admin.events.closeThisTabs();
            //    }
            //}
 
 
            //#region 删除
            form.on('submit(cmdDel)', function () {
                var checkStatus = table.checkStatus('mx-table')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var HBarCode = data[0].HBarCode.toString();
                    //逻辑删除方法
                    layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                        $.ajax({
                            type: "GET",
                            url: GetWEBURL() + "Kf_BarCodeEditDlg/DeltetBill", //方法所在页面和方法名
                            data: { "HInterID": HInterID, "HBarCode": HBarCode, "HBillType": sBillType },
                            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('请选择一行数据删除!');
                }
            })
 
 
            //调整
            form.on('submit(cmdChange)', function () {//编辑
                var checkStatus = table.checkStatus('mx-table')
                    , data = checkStatus.data;
                var sQty = data[0].HQty.toString();
                var iQty = $('#HQty').val();
                var HBarCode = data[0].HBarCode.toString();
                var sWhID = data[0].HWHID;
                var sSPID = data[0].HStockPlaceID;
                var sBatchNo = data[0].HBatchNo;
                var HMTONo = data[0].HMTONo;
                //if (iQty > sQty)
                //{
                    var EndQty = iQty - sQty;
                //}
 
                    $.ajax(
                        {
                            type: "Get",
                            //url: "http://61.130.49.162:9090/WMSAPI///ProductIn/Delete_Json", //方法所在页面和方法名
                            url: GetWEBURL() + "/Kf_BarCodeEditDlg/GetCheckQtyByBarCodeBill",
                            async: true,
                            data: {
                                "HInterID": HInterID, "HBillType": sBillType, "sBatchNo": sBatchNo, "sBarCode": HBarCode, "sSCWhID": 0
                                , "sSCSPID": 0, "sAuxPropID": HAuxPropID, "sMTONo": HMTONo, "iQty": iQty
                                , "HMaterID": HMaterID, "sWhID": sWhID, "sSPID": sSPID, "HSourceInterID": HSourceInterID
                                , "HSourceEntryID": HSourceEntryID, "EndQty": EndQty, "sQty": sQty
                            },
                            dataType: "json",
                            success: function (data) {
                                if (data.count == 1) { // 说明验证成功了
                                    table.render({
                                        elem: '#mx-table'
                                        //, url: 'http://localhost:8083/Web/GetHBarCodeShowBillSub'
                                        , url: GetWEBURL() + "/Web/GetHBarCodeShowBillSub"
                                        , where: {
                                            "HInterID": HInterID, "HMaterID": HMaterID, "HAuxPropID": HAuxPropID, "HMTONo": HMTONo, "HWhID": sWhID, "HSPID": sSPID, "HSCWHID": 0
                                            , "HSCSPID": 0, "HBatchNo": sBatchNo, "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID, "sBillType": sBillType, sWhere: ''
 
                                        },
                                        cols: [[
                                            { type: 'radio' }
                                            , { field: 'HSonNo', title: '序号', width: 100 }
                                            , { field: 'HBarCode', title: '条形码', width: 200 }
                                            , { field: 'HQty', title: '数量', width: 100 }
                                            , { field: 'HBatchNo', title: '批次', width: 150 }
                                            , { field: 'HMTONo', title: '计划跟踪单号', width: 150 }
                                        ]]
                                        // , data: [linterid]
                                    });
                                    alert("编辑成功!");
                                }
                                else {
                                    layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                }
                            },
                            error: function (err) {
                                layer.msg('错误' + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            }
                        });
 
                //    layer.open({
                //        type: 2
                //        , area: ['100%', '100%']
                //        , title: '明细列表'
                //        , shade: 0.6 //遮罩透明度
                //        , maxmin: true //允许全屏最小化
                //        , anim: 0 //0-6的动画形式,-1不开启
                //        , content: ['../../../views/公共页面/Kf_BarCodeEditDlg.html?HInterID=' + HInterID + '&HMaterID = ' + HMaterID + '&HAuxPropID = ' + HAuxPropID + '& HMTONo = ' + HMTONo + '&HWhID = ' + HWhID + '&HSPID = ' + HSPID + '&HSCWHID = ' + HSCWHID + '&HSCSPID= ' + HSCSPID + '&HBatchNo= ' + HBatchNo + '&HSourceInterID= ' + HSourceInterID + '&HSourceEntryID= ' + HSourceEntryID + '&HBillType=  ' + HBillType + '&HBarCode=  ' + HBarCode + ''
                //            , 'yes']
                //        , resize: false
                //        , cancel: function () {
                //            //$(".layui-btn").removeClass("layui-btn-disabled");
                //        }
                //    })
                //} else {
                //    layer.msg('请选择一行数据编辑!');
                //}
            })
            function getUrlVars() {
                var vars = [], hash;
                //var hashes = decodeURIComponent(window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'));
                //var hashes1 = decodeURIComponent(window.location.href);
                //var hashes = hashes1.indexOf('?') + 1.split('&');
 
                var hashes = window.location.href.slice(decodeURIComponent(window.location.href.indexOf('?') + 1)).split('&');
 
                for (var i = 0; i < hashes.length; i++) {
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = hash[1];
                }
                return vars;
            }
        })
 
 
    </script>
</body>
</html>