南骏 池
8 天以前 7ae27d18e908f643d873b5312bf88df5cfdb7503
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
var vm = new Vue({
    el: '#app', // 指定Vue实例挂载到ID为'app'的DOM元素上
    data: function () {
        return {
            isLoading: false, // 加载状态标志
            userInfo: { // 用户信息对象
                "loginGuid": '', // 用户登录GUID
                "loginAccount": '', // 用户登录账号
            },
            formData: { // 表单数据对象
                barcode: "", // 物料条码
                itemNo: "", // 物料编码
                sumQuantity: 0, // 条码数量
 
                DepotId: "",// 仓库ID
                DepotCode: "", // 仓库编码
                depotName: "", // 仓库名称
                depotSectionsCode: "" //库位
 
                // 注意:这里只显示了部分字段,实际代码中可能还有更多字段
            },
            itemInsFormData: {}, // 物料实例表单数据
            tableData: [], // 表格数据
            itemTableData: [], // 物料表格数据
            barMessage: "", // 条码消息
 
            Message: "", // 通用消息
            messageCenter: {}, // 消息中心
            messageId: 0, // 消息ID
 
            showClearIcon: false, // 是否显示清除图标
            focus1: true, // 焦点控制1
            focus2: false, // 焦点控制2
            isActive: 0, // 活动状态
            index: 0, // 索引
            currentTab: 0, // 当前标签页
            contentScrollW: 0, // 导航区宽度
            scrollLeft: 0, // 横向滚动条位置
            fullHeight: "", // 全屏高度
            kwInfo: {},
        }
    },
    mounted() { // Vue实例挂载完成后执行
        var that = this;
        // 初始化用户信息
        this.userInfo = {
            loginGuid: this.GetLoginInfor().loginGuid, // 从GetLoginInfor方法获取登录GUID
            loginAccount: this.GetLoginInfor().loginAccount, // 从GetLoginInfor方法获取登录账号
        };
    },
    methods: { // 方法定义
        // 已注释的getModel方法
        //getModel() {
        //    var that = this;
        //    that.isLoading = true;
        //    that.AxiosHttp("post", 'MesDepotSections/GetSectionName', {
        //        sectionCode: that.formData.sectionCode
        //    }, false)
        //        .then(function (res) {
        //            var json = res;
        //            if (json.status == 0) {
        //                that.formData.sectionName = json.data.tbBillList;
        //            }
        //            else {
        //                that.$toast.fail(json.message);
        //                that.formData.sectionName = "";
        //            }
        //            that.isLoading = false;
        //        })
        //        .catch(function (error) {
        //            that.isLoading = false;
        //            that.$toast.fail("网络错误,请重试!");
        //            console.log(error);
        //            that.$refs.daa001.focus();
        //        });
        //},
 
        // 获取条码扫描信息的方法
        getScan() {
            var that = this;
 
            that.isLoading = true; // 设置加载状态为true
            // 发送POST请求获取条码信息
            that.AxiosHttp("post", 'Kwbg/GetBarInfo', {
                barcode: that.formData.barcode, // 传递条码参数
            }, false)
                .then(function (res) { // 请求成功处理
                    var json = res;
                    if (json.status == 0) { // 如果返回状态为0表示成功
                        // 更新表单数据
                        console.log(json.data.tbBillList);
                        console.log(json.data.tbBillList[0]);
                        that.kwInfo = json.data.tbBillList[0]; 
                        // 已注释的代码:设置其他数据
                        //that.itemInsFormData = json.data.tbBillList.itemIns;
                        //that.itemTableData = json.data.tbBillList.itemInDetails;
                        //that.tableData = json.data.tbBillList.invItemInCDetails;
                        //that.barMessage = json.data.tbBillList.message;
                        //that.$refs.barcode.focus();
                        //that.formData.barcode = null;
 
                        that.$refs.kwbg.focus(); // 将焦点移动到拆分数量输入框
                    }
                    else { // 如果返回状态不为0表示失败
                        that.$toast.fail(json.message); // 显示错误提示
                        that.$refs.barcode.focus(); // 将焦点移回条码输入框
                        that.formData.barcode = null; // 清空条码输入
                    }
                    //that.$notify({ type: 'success', message: json.message }); // 已注释的成功通知
                    that.isLoading = false; // 设置加载状态为false
                })
                .catch(function (error) { // 请求失败处理
                    that.isLoading = false; // 设置加载状态为false
                    that.$toast.fail("网络错误,请重试!"); // 显示网络错误提示
                    console.log(error); // 输出错误到控制台
                    that.$refs.barcode.focus(); // 将焦点移回条码输入框
                });
        },
 
 
 
        // 执行库位变更的方法
        getBianGeng() {
            if (this.isLoading) { // 如果正在加载中,直接返回
                return;
            }
 
            var that = this;
 
            // 验证库位变更条件
            if (!that.formData.kwbg || that.formData.kwbg.trim() === "") {
                that.$toast.fail("变更库位不能为空!");
                return;
            }
            if (that.formData.kwbg === that.formData.depotSectionsCode) {
                that.$toast.fail("当前库位不能等于变更库位!");
                return;
            }
            if (!that.formData.barcode || that.formData.barcode.trim() === "") {
                that.$toast.fail("条码不能为空!");
                return;
            }
 
            that.isLoading = true; // 设置加载状态为true
            // 发送POST请求执行库位变更操作
            that.AxiosHttp("post", 'Kwbg/ChangeDepotSection', {
                userName: that.userInfo.loginAccount, // 用户名
                barcode: that.formData.barcode, // 条码
                OldDepotSectionCode: that.kwInfo.depoT_SECTIONS_CODE, // 原库位编码
                NewDepotSectionCode: that.formData.kwbg // 新库位编码
            }, false)
                .then(function (res) { // 请求成功处理
                    var json = res;
                    if (json.status == 0) { // 如果返回状态为0表示成功
                        // 已注释的代码:设置模式信息
                        // that.modeInfo = json.data.tbBillList;
 
                        // 调用打印方法
                        //that.sendPrintMessage(json.data.tbBillList);
 
                        that.$refs.barcode.focus(); // 将焦点移回条码输入框
                        that.formData.barcode = null; // 清空条码输入
                        that.formData.kwbg = null; // 清空‘库位变更’
                        that.$notify({ type: 'success', message: json.message }); // 显示成功通知
                    }
                    else { // 如果返回状态不为0表示失败
                        that.$toast.fail(json.message); // 显示错误提示
                        that.$refs.kwbg.focus(); // 将焦点移回‘库位变更’输入框
                    }
                    that.isLoading = false; // 设置加载状态为false
                })
                .catch(function (error) { // 请求失败处理
                    that.isLoading = false; // 设置加载状态为false
                    that.$toast.fail("网络错误,请重试!"); // 显示网络错误提示
                    console.log(error); // 输出错误到控制台
                });
        },
 
        // 已注释的清除代码方法
        //cleraCode() {
        //    this.formData.sectionCode = null;
        //},
 
        // 处理数字输入的方法,限制只能输入数字和小数点
        //handleNumberInput3(value) {
        //    this.formData.kwbg = value.replace(/[^\d.]/g, '')  // 1. 去除非数字和小数点
        //        .replace(/(\..*)\./g, '$1')               // 2. 禁止多个小数点
        //        .replace(/^\./g, '');                     // 3. 禁止小数点开头
        //},
    }
})