zhao
2021-07-02 23ee356c6f260ecc1a48bbb8bd60932b979e4698
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
@{
    ViewBag.Title = "盘点审核";
    Layout = "~/Views/Shared/_LayoutVue.cshtml";
}
@section head
    {
    <style type="text/css">
        .block {
            text-align: right;
        }
    </style>
}
 
<div id="inList" v-cloak>
    <el-card class="box-card" style="height: 50px;">
        <el-form v-bind:model="formData" style="margin-top:5px;" label-width="85px" class="demo-ruleForm" v-bind:inline="true">
            <el-form-item label="盘点单号:">
                <el-input v-model="opNo" v-bind:disabled="true" size="mini"></el-input>
            </el-form-item>
            <el-form-item label="仓  库:">
                <el-input v-model="formData.stockName" v-bind:disabled="true" size="mini"></el-input>
            </el-form-item>
            <el-form-item label="创建人:">
                <el-input v-model="formData.creatorBy" v-bind:disabled="true" size="mini"></el-input>
            </el-form-item>
            <el-form-item label="创建时间:" v-if="showlocation">
                <el-input v-model="formData.createTime" v-bind:disabled="true" size="mini"></el-input>
            </el-form-item>
        </el-form>
    </el-card>
    <hh-table v-bind:coloptions="checkDtlCols"
              v-bind:paging="false"
              v-bind:notfirstload="true"
              v-bind:data="checkDtls"
              v-bind:check="false"
              v-on:clickrow="clickRow"
              v-on:loaded="loaded"
              v-on:selectall="selectall"
              ref="CheckMstList"
              v-bind:rowno="false"
              v-bind:dh="tableHeight"></hh-table>
 
    <el-footer style="position:fixed;bottom:50px;height:70px;width:100%">
        <el-row style="padding:20px;text-align:center">
            <label style="float:left;margin-left: 20px; margin-right: 10px;">审核意见:</label>
            <el-input id="auditContent" style="width: 30%; float: left;" type="textarea" rows="2" placeholder="请输入内容" v-model="textarea" onkeyup="this.value = this.value.replace(/\'|’|‘/g, '')"></el-input>
            <el-button style="float: left; margin-left: 10px; margin-top: 20px;" size="mini" type="primary" v-on:click="audit" v-show="true">审 核</el-button>
            <el-button style="float: left; margin-left: 10px; margin-top: 20px;" size="mini" type="danger" v-on:click="reaudit" v-show="true">驳 回</el-button>
        </el-row>
    </el-footer>
</div>
@section scripts{
    <script src="~/Content/js/linq.js_ver2.2.0.2/linq.js"></script>
    <script>
        var para = {
            url: {
                add: "@Url.Action("AddCheck")",
                update: "@Url.Action("UpdateCheck")",
                getMstAndDtl: "@Url.Action("GetMstAndDtl")",
                reAuditCheck: "@Url.Action("ReAuditCheck")",
                auditCheck:"@Url.Action("AuditCheck")"
            }
        };
 
        new Vue({
            mixins: [useAutoHeight],
            data: {//数据
                formData: {
                    checkType: "",
                    stockCode: "",
                    itemCode: "",
                    stockArea: "",
                    locationCode: "",
                    creatorBy: "",
                    createTime: "",
                    stockName: ""
                },
                showlocation: true,
                showOwner: false,
                showItemCode: false,
                readOnly: false,
                readonlydiy: true,
                checkDtlCols: [
                    { f: 'CN_N_ROW_NO', n: '行号', w: '45' },
                    { f: 'CN_S_TYPE', n: '状态', w: '60' },
                    { f: 'CN_S_AREA_NAME', n: '库区名称', w: '100' },
                    { f: 'CN_S_LOCATION_CODE', n: '货位' },
                    { f: 'CN_S_TRAY_CODE', n: '托盘号' },
                    { f: 'CN_S_PACK_CODE', n: '料箱码' },
                    { f: "CN_S_LOT_NO", n: "指令批号", w: "100" },
                    { f: "CN_S_FIGURE_NO", n: "工单号", w: "100" },
                    { f: 'CN_S_ITEM_CODE', n: '物料编码', hidden: true },
                    { f: 'CN_S_ITEM_NAME', n: '物料名称' },
                    { f: 'CN_F_QUANTITY', n: '数量', w: '70' },
                    { f: 'CN_F_WEIGHT', n: '重量', w: '70' },
                    { f: 'CN_S_MEASURE_UNIT', n: '单位', w: '70', hidden: true },
                    { f: 'CN_GUID', n: 'GUID', hidden: true },
                    { f: 'CN_S_CHECK_RESULT', n: '盘点类型', hidden: true },
                ],
                dtlUrl: "",
                cklistUrl: "",
                checkdtlDate: [], //盘点单子表行记录
                currentTitle: parent.$(".layui-tab-title li[class='layui-this'] cite").text(),
                opNo: GetUrlParam("opNo"),
                checkDtls: []
            },
 
            methods: {
                search: function () {
                    var $this = this;
                    $this.$refs.CheckMstList.loadData($this.formData);
                },
                selectall: function () {
                    $this = this;
                    if ($this.$refs.CheckMstList.selections.length > 0) {
                        //全选
                        $.each($this.$refs.CheckMstList.selections, function (i, row) {
                            var selected = ($this.checkdtlDate.indexOf(row) < 0);
                            if (selected) {
                                //选中
                                $this.checkdtlDate.push(row);
                            }
                        });
                    }
                    else {
                        //取消全选
                        $.each($this.$refs.CheckMstList.datas, function (i, row) {
                            var index = $this.checkdtlDate.indexOf(row);
                            $this.checkdtlDate.splice(index, 1);
                        });
                    }
                },
                stockSuccess: function (data) {
                    if (data.length == 1 && !this.formData.stockCode) {
                        this.formData.stockCode = data[0];
                    }
                },
 
                loaded: function () {
                    $this = this;
                    $this.checkdtlDate
                    $.each($this.checkdtlDate, function (index, row) {
                        $.each($this.$refs.CheckMstList.datas, function (i, r) {
                            if ($this.formData.checkType == "货位盘点") {
                                if (r.CN_S_LOCATION_CODE == row.CN_S_LOCATION_CODE) {
                                    $this.$nextTick(function () {
                                        $this.$refs.CheckMstList.toggleRowSelection($this.$refs.CheckMstList.datas[i]);
                                    });
                                }
                            }
                            else if (($this.formData.checkType == "物料盘点")) {
                                if (r.CN_S_ITEM_CODE == row.CN_S_ITEM_CODE
                                    && r.CN_S_ITEM_STATE == row.CN_S_ITEM_STATE
                                    && r.CN_S_OWNER == row.CN_S_OWNER) {
                                    $this.$nextTick(function () {
                                        $this.$refs.CheckMstList.toggleRowSelection($this.$refs.CheckMstList.datas[i]);
                                    });
                                }
                            }
                        });
                    });
                },
                clickRow: function (row, event, column) {
                    $this = this;
                    var selected = (this.$refs.CheckMstList.selections.length && this.$refs.CheckMstList.selections.indexOf(row) !== -1);
                    if (selected) {
                        //选中
                        $this.checkdtlDate.push(row);
                    }
                    else {
                        //取消选中
                        var type = $this.formData.checkType;
                        if (type == "物料盘点") {
                            $.each($this.checkdtlDate, function (i, r) {
                                if (r.CN_S_ITEM_CODE == row.CN_S_ITEM_CODE
                                        && r.CN_S_ITEM_STATE == row.CN_S_ITEM_STATE
                                        && r.CN_S_OWNER == row.CN_S_OWNER) {
                                    $this.checkdtlDate.splice(i, 1);
                                }
                            });
                        }
                        else if (type == "货位盘点") {
                            $.each($this.checkdtlDate, function (i, r) {
                                if (r.CN_S_LOCATION_CODE == row.CN_S_LOCATION_CODE) {
                                    $this.checkdtlDate.splice(i, 1);
                                }
                            });
                        }
                    }
                },
                selectSingleRowEvent: function (callBack) {
                    var selectRow = this.$refs.increaselist.selections;
                    if (selectRow.length <= 0) {
                        wms.warning("请选择一条记录");
                        return;
                    }
                    if (callBack)
                        callBack(selectRow[0]);
                },
                selectItem: function () {
                    var $this = this;
                    wms.showDialogList({
                        title: '选择物料',
                        show: true,
                        itemCols: $this.itemCols,
                        condition: 'item',
                        url: '/Basic/Common/ItemList',
                        btnSure: function (checkedItems) {
                            $this.formData.itemCode = checkedItems[0].CN_S_ITEM_CODE;
                        }
                    });
                },
                changeType: function () {
                    var $this = this;
                },
                loadData: function () {
                    ajaxManage({
                        url: para.url.getMstAndDtl + "?opNo=" + opNo,
                        type: "GET",
                        success: function (data) {
                            if (data.Success) {
 
                                console.log(data);
 
                                //$this.formData.checkType = data.Data.CN_S_TYPE;
 
                                //$.each(data.Data.dtls, function (i, r) {
                                //    r.CN_S_STOCK_CODE = data.Data.CN_S_STOCK_CODE;
                                //    r.CN_S_AREA_CODE = r.CN_S_STOCK_AREA;
                                //});
                                //$this.checkdtlDate = data.Data.dtls;
                                //$this.formData.stockcode = data.Data.CN_S_STOCK_CODE;
                            }
                            else {
                                wms.error(data.Msg);
                            }
                        }
                    });
                },
                audit: function () {
                    ajaxManage({
                        url: para.url.auditCheck + "?opNo=" + GetUrlParam("opNo"),
                        type: "GET",
                        success: function (data) {
                            if (data.Success) {
                                wms.success("审核成功");
                                parent.tab.tabDeleteRefresh(wms.currentTitle, GetUrlParam("currentTitle"));
                            }
                            else {
                                wms.error(data.Msg);
                            }
                        }
                    });
                },
                reaudit: function () {
                    var auditContent = $("#auditContent").val();
                    if (auditContent == "") {
                        wms.error("请输入审核意见!");
                        return;
                    }
                    ajaxManage({
                        url: para.url.reAuditCheck + "?opNo=" + GetUrlParam("opNo") + "&auditContent=" + auditContent,
                        type: "GET",
                        success: function (data) {
                            if (data.Success) {
                                wms.success("驳回成功");
                                parent.tab.tabDeleteRefresh(wms.currentTitle, GetUrlParam("currentTitle"));
                            }
                            else {
                                wms.error(data.Msg);
                            }
                        }
                    });
                }
            },
            mounted: function () {
                var $this = this;
                var opNo = GetUrlParam("opNo");
                if (opNo == "") {
                    $this.formData.checkType = "货位盘点";
                }
                else {
                    ajaxManage({
                        url: para.url.getMstAndDtl + "?opNo=" + opNo,
                        type: "GET",
                        success: function (data) {
                            if (data.Success) {
 
                                console.log(data.Data);
                                $this.checkDtls = data.Data.dtls;
                                $this.formData.createTime = data.Data.CN_T_CREATE.replace("T", " ").substring(0, 19);
                                $this.formData.creatorBy = data.Data.CN_S_CREATOR_BY;
                                $this.formData.stockName = data.Data.CN_S_STOCK_NAME;
                                //$this.formData.checkType = data.Data.CN_S_TYPE;
 
                                //$.each(data.Data.dtls, function (i, r) {
                                //    r.CN_S_STOCK_CODE = data.Data.CN_S_STOCK_CODE;
                                //    r.CN_S_AREA_CODE = r.CN_S_STOCK_AREA;
                                //});
                                //$this.checkdtlDate = data.Data.dtls;
                                //$this.formData.stockcode = data.Data.CN_S_STOCK_CODE;
                            }
                            else {
                                wms.error(data.Msg);
                            }
                        }
                    });
                }
            },
            computed: {
                tableHeight: function () {
                    return (this.autoHeight + 100) / 2 - 100;
                },
                tabHeight: function () {
                    return (this.autoHeight - 200) / 2;
                },
                tabTableHeight: function () {
                    return (this.autoHeight + 80) / 2;
                },
                areaUrl: function () {
                    if (this.formData.stockCode) {
                        this.formData.stockArea = "";
                        return '/Basic/Common/AreaList?stockCode=' + this.formData.stockCode + '&include=1';
                    } else {
                        this.formData.stockArea = "";
                    }
                    return '';
                }
            },
            el: '#inList'
        });
 
    </script>
}