var vm = new Vue({
|
el: '#app',
|
data: function () {
|
return {
|
isLoading: false,
|
userInfo: {
|
"loginGuid": '',
|
"loginAccount": '',
|
},
|
UserName: Cookies.get('loginName'),//用户名称
|
Bar: "",//物料条码
|
XbarInfo: [],
|
shdh: "",//送货单号
|
gys: [],//供应商
|
ItemList: [], //材料列表
|
BarList: [],//条码列表
|
showButton: false,//右上角菜单触发
|
ttrre1: false,
|
ttrre2: false,
|
//ttrre: "true",
|
dhdGuid:"",
|
}
|
},
|
mounted() {
|
var that = this;
|
this.userInfo = {
|
loginGuid: this.GetLoginInfor().loginGuid,
|
loginAccount: this.GetLoginInfor().loginAccount,
|
};
|
},
|
methods: {
|
GetItemsShdh() {
|
var that = this;
|
|
if (that.shdh.length <= 0) {
|
that.$toast.fail("送货单号不能为空!");
|
that.$refs.shdh.focus();
|
return;
|
}
|
|
that.isLoading = true;
|
that.AxiosHttp("post", 'MesXkyShd/GetShdhItems', {
|
shdh: that.shdh
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
|
that.ItemList = json.data.tbBillList;
|
that.dhdGuid = json.data.tbBillList[0].ddhid;
|
that.BarList = json.data.tbMesItems;
|
that.$refs.Bar.focus();
|
}
|
else {
|
that.$toast.fail(json.message);
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$toast.fail("网络错误,请重试!");
|
});
|
},
|
Scandhdsh() {
|
// 添加防抖判断
|
if (this.isLoading) {
|
return;
|
}
|
|
var that = this;
|
if (that.Bar.length <= 0) {
|
that.$toast.fail("物料条码不能为空!");
|
that.$refs.Bar.focus();
|
return;
|
}
|
|
|
if (that.shdh.length <= 0) {
|
that.$toast.fail("送货单号不能为空!");
|
that.$refs.shdh.focus();
|
return;
|
}
|
|
that.isLoading = true;
|
that.AxiosHttp("post", 'MesXkyShd/ScanBar', {
|
shdh: that.shdh,
|
barcode: that.Bar,
|
userName: that.userInfo.loginAccount,
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
// that.scanInfo = json.data.tbBillList;
|
that.$notify({ type: 'success', message: json.message });
|
that.GetItemsShdh();
|
}
|
else {
|
that.$toast.fail(json.message);
|
}
|
that.isLoading = false;
|
that.$refs.Bar.focus();
|
that.Bar = "";
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$toast.fail("网络错误,请重试!");
|
});
|
},
|
submit() {
|
// 添加防抖判断
|
if (this.ttrre1 || this.ttrre2) {
|
return;
|
}
|
var that = this;
|
if (!that.shdh ||that.shdh.length <= 0) {
|
that.$toast.fail("送货单号不能为空!");
|
that.$refs.shdh.focus();
|
return;
|
}
|
|
if (!that.dhdGuid || that.dhdGuid.length <= 0) { // 添加null检查
|
that.$toast.fail("SRM送货单还未生成MES送货单!");
|
that.$refs.shdh.focus();
|
return;
|
}
|
|
//that.ttrre = true; // 提交状态设为true时,自动禁用遮罩点击
|
that.ttrre1 = true; // 提交状态设为true时,自动禁用遮罩点击
|
console.log(that.dhdGuid);
|
that.AxiosHttp("post", 'MesInvItemArnManager/EditModelSubmit', {
|
guid: that.dhdGuid
|
}, true, 1).then(function (res1) {
|
if (res1.rtnData.outSum == 1) {
|
that.$notify({ type: 'success', message: '提交成功' });
|
} else {
|
that.$toast.fail(res1.rtnData.outMsg);
|
}
|
that.ttrre1 = false // 完成后恢复可关闭状态
|
that.showButton = false;
|
}).catch(function (error) {
|
that.$toast.fail("网络错误,请重试!");
|
that.ttrre1 = false // 异常时也恢复状态
|
that.showButton = false;
|
});
|
},
|
Fsubmit() {
|
// 添加防抖判断
|
if (this.ttrre1 || this.ttrre2) {
|
return;
|
}
|
var that = this;
|
|
if (that.shdh.length <= 0) {
|
that.$toast.fail("送货单号不能为空!");
|
that.$refs.shdh.focus();
|
return;
|
}
|
|
if (that.dhdGuid.length <= 0) {
|
that.$toast.fail("SRM送货单还未生成MES送货单!");
|
that.$refs.shdh.focus();
|
return;
|
}
|
|
//that.ttrre = true;
|
that.ttrre2 = true;
|
console.log(that.dhdGuid);
|
that.AxiosHttp("post", 'MesInvItemArnManager/EditModelSubmitF', {
|
guid: that.dhdGuid
|
}, true, 1).then(function (res1) {
|
if (res1.rtnData.outSum == 1) {
|
that.$notify({ type: 'success', message: '撤回成功' });
|
} else {
|
that.$toast.fail(res1.rtnData.outMsg);
|
}
|
that.ttrre2 = false;
|
that.showButton = false; // 完成后关闭弹窗
|
}).catch(function (error) {
|
that.$toast.fail("网络错误,请重试!");
|
that.ttrre2 = false
|
that.showButton = false; // 完成后关闭弹窗
|
console.log(error);
|
});
|
},
|
}
|
})
|