var vm = new Vue({
|
el: '#app',
|
data: function () {
|
return {
|
isLoading: false,
|
userInfo: {
|
"loginGuid": '',
|
"loginAccount": '',
|
},
|
scanFormData: {
|
itemOutNo: "",
|
barcode: "",
|
itemNo: "",
|
quantity:0
|
},
|
formData: {},
|
ItemDetail: [],
|
codeTableData: [],
|
itemOutNoList: [],
|
itemOutNoStr: [],
|
invItemOutId: '',
|
|
barMessage: "",
|
|
Message: "",
|
messageCenter: {},
|
messageId: 0,
|
|
show: false,
|
|
scanInfo: { barcodeNum: "", splitNum: "", barcode: "" },
|
ip: "",
|
port: "",
|
oldBarInfo: [],
|
cfBarInfo: [],
|
}
|
},
|
mounted() {
|
var that = this;
|
this.userInfo = {
|
loginGuid: this.GetLoginInfor().loginGuid,
|
loginAccount: this.GetLoginInfor().loginAccount,
|
};
|
that.beginload();
|
//that.show = false;
|
},
|
methods: {
|
getItemOutNo() {
|
var that = this;
|
|
that.isLoading = true;
|
that.AxiosHttp("post", 'MesCgthSq/GetMesCgthSq', {
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
that.itemOutNoList = json.data.tbBillList;
|
that.itemOutNoStr = that.itemOutNoList.map(s => {
|
return { name: s.billNo }
|
});
|
that.show = true;
|
}
|
else {
|
that.$playSound('error');
|
that.$toast.fail(json.message);
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$playSound('error');
|
that.$toast.fail("网络错误,请重试!");
|
console.log(error);
|
});
|
|
},
|
beginload() {
|
var that = this;
|
|
that.isLoading = true;
|
that.AxiosHttp("post", 'MesCgthSq/GetMesCgthSq', {
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
that.itemOutNoList = json.data.tbBillList;
|
}
|
else {
|
that.$playSound('error');
|
that.$toast.fail(json.message);
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$playSound('error');
|
that.$toast.fail("网络错误,请重试!");
|
console.log(error);
|
});
|
|
},
|
onSelect(item) {
|
// 默认情况下点击选项时不会自动收起
|
// 可以通过 close-on-click-action 属性开启自动收起
|
this.show = false;
|
|
//let staf = this.stafList.filter(it => it.staffName === item.name);
|
|
this.scanFormData.itemOutNo = item.name;
|
|
let itemOut = this.itemOutNoList.filter(it => it.billNo == item.name);
|
|
this.invItemOutId = itemOut[0].id;
|
|
this.getItem();
|
|
},
|
getItem() {
|
var that = this;
|
that.isLoading = true;
|
|
let itemOut = this.itemOutNoList.filter(it => it.billNo == that.scanFormData.itemOutNo);
|
|
//this.invItemOutId = itemOut[0].id;
|
|
that.AxiosHttp("post", 'MesCgthSq/GetSumItem', {
|
//id: that.invItemOutId,
|
billNo: that.scanFormData.itemOutNo,
|
barcode: that.scanFormData.barcode,
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
that.ItemDetail = json.data.tbBillList;
|
that.$refs.barcode.focus();
|
}
|
else {
|
that.$playSound('error');
|
that.$toast.fail(json.message);
|
that.ItemDetail = [];
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$playSound('error');
|
that.$toast.fail("网络错误,请重试!");
|
that.ItemDetail = [];
|
});
|
},
|
|
SaveBarCodes() {
|
|
//if (!this.scanFormData.barcode) {
|
|
//}
|
var that = this;
|
|
that.isLoading = true;
|
that.AxiosHttp("post", 'MesCgthSq/ScanCode', {
|
billNo: that.scanFormData.itemOutNo,
|
userName: that.userInfo.loginAccount,
|
barcode: that.scanFormData.barcode,
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
//if (json.data.tbBillList) {
|
// //this.ToErp();
|
//} else {
|
|
//}
|
that.scanFormData.quantity = json.data.tbBillList.barcodeNum
|
that.getItem();
|
that.$refs.barcode.focus();
|
that.scanFormData.barcode = null;
|
that.$playSound('success');
|
that.$notify({ type: 'success', message: json.message });
|
}
|
else if (json.status == 2) {
|
that.$refs.splitNum.focus();
|
that.scanInfo.splitNum = json.data.tbBillList.splitNum;
|
that.scanFormData.quantity = json.data.tbBillList.barcodeNum;
|
}
|
else {
|
that.$playSound('error');
|
that.$toast.fail(json.message);
|
that.$refs.barcode.focus();
|
that.scanFormData.barcode = null;
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$playSound('error');
|
that.$toast.fail("网络错误,请重试!");
|
console.log(error);
|
that.$refs.barcode.focus();
|
});
|
},
|
getChaiFen() {
|
//this.isPrinterPopupVisible = true; // 显示弹窗
|
|
if (this.isLoading) {
|
return;
|
}
|
|
var that = this;
|
if (that.scanFormData.itemOutNo.length <= 0) {
|
that.$playSound('error');
|
that.$toast.fail("申请单号不能为空!");
|
return;
|
}
|
if (that.scanInfo.splitNum * 1 <= 0) {
|
that.$playSound('error');
|
that.$toast.fail("拆分数量不能为空!");
|
return;
|
}
|
if (that.scanFormData.barcode.length * 1 <= 0) {
|
that.$playSound('error');
|
that.$toast.fail("物料条码不能为空!");
|
return;
|
}
|
//that.ip = "";
|
//that.prot = "";
|
//that.getPrintInfo();
|
|
//if (that.ip.length <= 0 || that.prot.length <= 0) {
|
// alert(that.ip);
|
// alert(that.prot);
|
// return;
|
//}
|
|
that.isLoading = true;
|
that.AxiosHttp("post", 'MesCgthSq/ScanCodeCF', {
|
billNo: that.scanFormData.itemOutNo,
|
userName: that.userInfo.loginAccount,
|
barcode: that.scanFormData.barcode,
|
Num: that.scanInfo.splitNum,
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
// that.modeInfo = json.data.tbBillList;
|
that.scanInfo.splitNum = null;
|
that.scanFormData.quantity = null;
|
that.scanFormData.barcode = null;
|
that.$notify({ type: 'success', message: json.message });
|
that.$playSound('success');
|
|
that.sendMessage(json.data.tbBillList);
|
|
that.$refs.barcode.focus();
|
that.getItem();
|
}
|
else {
|
that.$playSound('error');
|
that.$toast.fail(json.message);
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
|
that.$toast.fail("网络错误,请重试!");
|
that.$playSound('error');
|
});
|
},
|
}
|
})
|