wxw
2025-05-12 c7c2f7aa20427204944ba80a2704232b2f281582
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
<!DOCTYPE html>
<html>
    <head>
        <meta 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">
    </head>
    <body>
 
        <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list"
            style="padding: 20px 30px 0 0;">
            <div class="layui-form-item">
                <label class="layui-form-label">当前班次</label>
                <div class="layui-input-inline" style="width: 20%;">
                    <input type="text" name="ClassNameNow" lay-verify="required" placeholder="当前班次" autocomplete="off"
                        class="layui-input" disabled="disabled" id="ClassNameNow">
                    <!-- <select name="ImportBillType" id="ImportBillType" lay-verify="required" lay-verify="" lay-search>
                        <option value=""></option>
                    </select> -->
                </div>
                <label class="layui-form-label">负&nbsp;&nbsp;责&nbsp;&nbsp;人</label>
                <div class="layui-input-inline" style="width: 20%;">
                    <input type="text" name="UserNameNow" lay-verify="required" placeholder="负责人" autocomplete="off"
                        class="layui-input" disabled="disabled" id="UserNameNow">
                </div>
                <button id="ClassOut" name="ClassOut" data-method="out" type="button" class="layui-btn" lay-submit
                    lay-filter="out">交班检测</button>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">接班班次</label>
                <div class="layui-input-inline" style="width: 20%;">
                    <input type="text" name="ImportDate" lay-verify="required" placeholder="请选择接班班次" autocomplete="off"
                        class="layui-input" id="test1" placeholder="yyyy-MM-dd">
                </div>
                <label class="layui-form-label">白班夜班</label>
                <div class="layui-input-inline" style="width: 20%;">
                    <select name="ImportSupplierName" id="ImportSupplierName" lay-verify="" lay-search>
                        <option value="白">白</option>
                        <option value="夜">夜</option>
                    </select>
                </div>
                <button id="ClassIn" name="ClassIn" data-method="in" type="button" class="layui-btn" lay-submit
                    lay-filter="ClassIn">接班确认</button>
            </div>
            <div class="layui-form-item">
                <label>&nbsp;&nbsp;&nbsp;&nbsp;交接班前须完成的工作:</label><br />
                <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.所有已分配的入库任务已完成;</label><br />
                <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.所有当班入库的单据已完成。</label>
            </div>
        </div>
 
        <script src="../../layuiadmin/layui/layui.js"></script>
        <script src="../../js/public.js"></script>
        <script src="../../js/jquery-3.5.1.min.js"></script>
        <script src="../../js/jquery.cookie.js"></script>
        <script>
            layui.config({
                base: '../../layuiadmin/' //静态资源所在路径
            }).extend({
                index: 'lib/index' //主入口模块
            }).use(['index', 'form', 'layer', 'laydate', 'table'], function() {
                var $ = layui.$,
                    form = layui.form,
                    laydate = layui.laydate,
                    table = layui.table,
                    layer = layui.layer;
                laydate.render({
                    elem: '#test1'
                });
                $('#ClassIn').addClass("layui-btn-disabled").attr("disabled", true);
                var day1 = new Date();
                var year = day1.getFullYear();
                var month = day1.getMonth() + 1;
                if (month < 10) {
                    month = '0' + month;
                }
                var day = day1.getDate();
                $("input[name='ImportDate']").val(year + '-' + month + '-' + day);
                refreshLable();
                var $ = layui.$;
                $('.layui-btn').on('click', function() {
                    var othis = $(this),
                        method = othis.data('method');
                    active[method] ? active[method].call(this, othis) : '';
                });
                var active = {
                    out: function() {
                        sendData(IP + "/Import/CheckCanSwichClass", {}, 'post', function(res) {
                            console.log(res);
                            if (res.code == 1) {
                                layer.msg(res.data, {
                                    icon: 1,
                                    time: 1000 //2秒关闭(如果不配置,默认是3秒)
                                }, function() {
                                    $('#ClassIn').removeClass("layui-btn-disabled").attr(
                                        "disabled", false);
                                });
                            } else {
                                layer.msg(res.data, {
                                 icon: 2,
                                    time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                }, function() {
                                    $('#ClassIn').addClass("layui-btn-disabled").attr("disabled",
                                        true);
                                });
                            };
                        });
                    },
                    in: function() {
                        var param = {
                            Msg: $("#ImportSupplierName").val(),
                            StartDate: $("input[name='ImportDate']").val(),
                            Type: $.cookie('userName'),
                        };
                        sendData(IP + "/Import/UpdateImportWmsClass", param, 'post', function(res) {
                            console.log(res);
                            if (res.code == 1) {
                                layer.msg('接班成功', {
                                    icon: 1,
                                    time: 1000 //2秒关闭(如果不配置,默认是3秒)
                                }, function() {
                                    $('#ClassIn').addClass("layui-btn-disabled").attr("disabled",
                                        true);
                                    refreshLable();
                                });
                            } else {
                                layer.msg(res.data, {
                                 icon: 2,
                                    time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                }, function() {
                                    $('#ClassIn').removeClass("layui-btn-disabled").attr(
                                        "disabled", false);
                                });
                            };
                        });
                    }
                };
 
                function refreshLable() {
                    sendData(IP + "/Import/GetCurrentClass", {}, 'post', function(res) {
                        if (res.code == 1) { //成功
                            $("#ClassNameNow").val(res.data.ClassName);
                            $("#UserNameNow").val(res.data.ClassLeader);
                        } else { //不成功
                            layer.msg("未找到当前班次", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {
                                $("#ClassNameNow").val(res.data.ClassName);
                                $("#UserNameNow").val(res.data.ClassLeader);
                            });
                        }
                    });
                }
 
                form.verify({
                    emptyNo: function(value) {
                        if (value == '') {
                            return '';
                        } else {
                            var ver = /^[0-9]+$/;
                            if (!ver.test(value)) {
                                return '只能输入正整数';
                            }
                        }
                    }
                });
                form.on('submit(form1)', function(data) {
                    data.field.aaa = "123";
                    console.log(data.field);
                    console.log(infoOptions.data);
                    if (infoOptions.data == 0) {
                        layer.msg("请添加明细!", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {
 
                        });
                        return;
                    }
                    var DataList = [];
                    for (var i in infoOptions.data) {
                        if (infoOptions.data[i].ImportQuantity == "") {
                            layer.msg("请输入入库数量!", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {
 
                            });
                            return;
                        }
                        if (infoOptions.data[i].ImportQuantity <= 0) {
                            layer.msg("入库数量必须大于0!", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {
 
                            });
                            return;
                        }
                        var goodStatus = "";
                        if (data.field.ImportGoodsStatus == "on") {
                            goodStatus = "合格"
                        } else {
                            goodStatus = "待检"
                        }
                        var item = {
                            ImportBillType: data.field.ImportBillType,
                            ImportCustomerName: data.field.ImportCustomerName,
                            ImportDate: data.field.ImportDate,
                            ImportDepartmentName: data.field.ImportDepartmentName,
                            ImportLoginName: data.field.ImportLoginName,
                            ImportProjectName: data.field.ImportProjectName,
                            ImportSupplierName: data.field.ImportSupplierName,
                            ImportWarehouseId: data.field.ImportWarehouseId,
                            ImportGoodsStatus: goodStatus,
                            ImportGoodsId: infoOptions.data[i].GoodId,
                            ImportProductionDate: infoOptions.data[i].ImportProductionDate,
                            ImportLotNo: infoOptions.data[i].ImportLotNo,
                            ImportQuantity: infoOptions.data[i].ImportQuantity
                        };
                        DataList.push(item); //属性
                    }
                    sendData(IP + "/Import/AddImportBill", DataList, 'post', function(res) {
                        console.log(res);
                        if (res.code == 1) { //成功
                            layer.msg(res.msg, {
                                icon: 1,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {
                                parent.location.reload();
                                parent.layer.close(layer.index);
                            });
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {});
                        }
                    });
                    return false;
                });
            })
        </script>
    </body>
</html>