Commit 0abe899b authored by 何远江's avatar 何远江

装箱修改

parent 15a55cfb
......@@ -124,7 +124,7 @@ export default {
},
computed:{
weight(){
return (this.form.BRGEW-0) - (this.form.ZXNTGEW-0)
return ((this.form.BRGEW-0) - (this.form.ZXNTGEW-0)).toFixed(2)
}
},
methods: {
......
......@@ -33,20 +33,20 @@
prefixIcon="search"
class="topSearch"
v-model="blNum"
:disabled="form.ZZXFS == 'PL' || isEdit"
focus
placeholder="请扫描箱码"
@change="handleInputNlpla"
:disabled="form.ZZXFS === 'PL'"
></uni-easyinput>
<uni-easyinput
prefixIcon="search"
:disabled="isDisabled"
:disabled="isEdit"
v-model="wxparams"
:focus="isFocus"
placeholder="请扫描产品包装条码/外箱码"
@input="handleInputPlnr"
></uni-easyinput>
<checkbox-group style="margin-top: 10rpx;" @change="checkedChange">
<checkbox-group style="margin-top: 10rpx" @change="checkedChange">
<checkbox value="r1" :checked="checkedBox" />是否审核
</checkbox-group>
</view>
......@@ -173,6 +173,7 @@ export default {
ZXTEXT: "",
ZTEXT: "",
},
upForm: {},
goodsList: [],
};
},
......@@ -182,9 +183,13 @@ export default {
* 重置
*/
resetState() {
this.goodsList = []
this.goodsList = [];
this.blNum = "";
this.wxparams = "";
this.form = {
ZZXFS: "BL+PL",
PLNR: "",
ZCODE: "",
ZXSPE: "", //箱规格(cm)
ZXVOLUM: "", //体积(m132)
ZXNTGEW: "", //箱重(kg)
......@@ -193,32 +198,32 @@ export default {
LONG: "", //长
WIDE: "", //宽
HIGH: "", //高
updkz: "I",
datum: "", //扫描日期
uzeit: "", //扫描时间
uname: "admin", //扫描人
UPDKZ: "I",
DATUM: "", //扫描日期
UZEIT: "", //扫描时间
UNAME: "admin", //扫描人
ZXTEXT: "",
ZTEXT: "",
}
};
this.isBL = false;
this.isEdit = false;
},
checkedChange(){
this.checkedBox = !this.checkedBox
checkedChange() {
this.checkedBox = !this.checkedBox;
},
searchCaseInfo(blpl) {
searchCaseInfo(blpl, isMeter = false) {
// 判空
if (!blpl) return;
// 是否BL
const isBL = blpl.startsWith("BL");
this.isBL = isBL;
if (isBL && !this.blNum) {
this.blNum = blpl
if (isBL) {
this.blNum = blpl;
}
// 验证是否有重复
if (this.goodsList.find((v) => v.ZCODE == blpl || v.PLNR == blpl)) {
this.$u.toast("请勿重复扫描!");
if (this.goodsList.find((v) => v.PLNR == blpl || v.ZCODE == blpl)) {
// this.$u.toast("请勿重复扫描!");
return this.reset();
}
// 查询是否装箱
......@@ -227,12 +232,25 @@ export default {
PLNR: isBL ? "" : blpl,
};
this.$u.api.sapApi.sapCaseInfo(params).then(({ DATA: res }) => {
if (isMeter && !res.length) {
this.$u.toast("当前条码未装箱,请先进行装箱!");
} else if (isMeter && res.length) {
// 如果扫码有数据,判断是否有称重信息
console.log("-------object--------", this.upForm);
const itm = res[0];
const keys = ["LONG", "WIDE", "HIGH", "BRGEW", "ZXNTGEW"];
if (!keys.some((v) => !!itm[v])) {
keys.forEach((v) => (itm[v] = this.upForm[v]));
}
}
this.isEdit = !!res.length && isBL;
// 如果已经装箱
if (res.length) {
this.isEdit = true;
// 扫描的PL
if (!isBL) {
const [plInfo] = res;
this.blNum = plInfo.ZCODE;
// 如果有规格,需要解析出长宽高
if (/^\d+\*\d+\*\d+$/.test(plInfo.ZXSPE)) {
const [LONG, WIDE, HIGH] = plInfo.ZXSPE.split("*");
......@@ -252,16 +270,18 @@ export default {
}
return v;
});
this.form = this.goodsList[0];
}
this.checkedBox = res[0].ZSTATUS == 'Y'
this.checkedBox = res[0].ZSTATUS == "Y";
this.form = this.goodsList[0];
} else {
this.isEdit = false;
if (!isBL) {
console.log("没有装箱的PL");
const plInfo = { PLNR: blpl, ZZXFS: this.form.ZZXFS, updkz: 'I' };
const plInfo = { PLNR: blpl, ZZXFS: this.form.ZZXFS, UPDKZ: "I" };
// 获取已经扫描过的最后一个PL信息,如果存在需要他的称重信息
const lastPLInfo = this.goodsList.at(-1);
const lastPLInfo = this.goodsList[this.goodsList.length - 1];
console.log("lastPLInfo", lastPLInfo);
const weightInfo = {
ZXVOLUM: "",
ZXNTGEW: "",
......@@ -282,12 +302,7 @@ export default {
}
this.goodsList.push({ ...plInfo, ...weightInfo });
}
}
console.log(this.goodsList, "goodsList-----");
// 默认设置为扫描的第一项
if (!this.form.PLNR) {
this.form = this.goodsList[0];
console.log("goodsList", this.goodsList);
}
});
},
......@@ -302,11 +317,17 @@ export default {
return;
}
// 是否超过45kg
const NTGEW = this.goodsList.reduce((acc, cur) => acc + +cur.NTGEW, 0);
if (NTGEW > 45) {
let BRGEW = this.form.BRGEW;
// if (this.form.ZZXFS === "BL+PL") {
// BRGEW = ;
// } else {
// console.log(this.goodsList, "---------2222");
// this.goodsList.reduce((acc, cur) => acc + +cur.BRGEW, 0);
// }
if (BRGEW > 45) {
uni.showModal({
title: "提示",
content: "重超过45KG,是否继续提交?",
content: "重超过45KG,是否继续提交?",
success: (res) => {
if (res.confirm) {
console.log("用户点击确定");
......@@ -319,52 +340,80 @@ export default {
} else {
this.subRequest();
}
// if (
// !this.form.long ||
// !this.form.wide ||
// !this.form.high ||
// !this.form.brgew ||
// !this.form.zxntgew
// ) {
// uni.showModal({
// title: "提示",
// content: "还未填写计量称重信息!是否继续提交?",
// success: (res) => {
// if (res.confirm) {
// console.log("用户点击确定");
// this.subRequest();
// } else if (res.cancel) {
// console.log("用户点击取消");
// }
// },
// });
// } else {
// }
},
// 请求发送
subRequest() {
const arr = [];
if (this.form.ZZXFS != "PL" && this.isEdit) {
// 只传一条数据
const itm = this.goodsList[0];
arr.push({
...itm,
ZZXFS: this.form.ZZXFS,
ZCODE: this.blNum,
PLNR: this.isEdit ? "" : itm.PLNR,
werks: this.vuex_user_factory,
ZXSPE: itm.LONG + "*" + itm.WIDE + "*" + itm.HIGH,
ZXVOLUM: ((+itm.LONG * +itm.WIDE * +itm.HIGH) / 1000000).toFixed(6),
NTGEW: (+itm.BRGEW - itm.ZXNTGEW).toFixed(2),
DATUM: parseTime(new Date(), "{y}{m}{d}"),
UZEIT: parseTime(new Date(), "{h}{i}{s}"),
ZSTATUS: this.checkedBox ? "Y" : "N",
UPDKZ: itm.ZCODE && itm.PLNR ? "U" : "I",
});
} else if (this.form.ZZXFS == "BL+PL" && !this.isEdit) {
this.goodsList.forEach((ele) => {
arr.push({
...ele,
werks: this.vuex_user_factory,
zxspe: ele.LONG + "*" + ele.WIDE + "*" + ele.HIGH,
ntgew: +ele.BRGEW - ele.ZXNTGEW,
zcode: this.form.ZZXFS === "PL" ? "" : this.blNum,
datum: parseTime(new Date(), "{y}{m}{d}"),
uzeit: parseTime(new Date(), "{h}{i}{s}"),
zstatus: this.checkedBox ? 'Y': 'N',
UPDKZ: ele.ZCODE && ele.PLNR ? 'U' : 'I'
...this.form,
ZCODE: this.blNum,
ZZXFS: this.form.ZZXFS,
PLNR: this.isEdit ? "" : ele.PLNR,
WERKS: this.vuex_user_factory,
ZXSPE:
this.form.LONG + "*" + this.form.WIDE + "*" + this.form.HIGH,
ZXVOLUM: (
(this.form.LONG * this.form.WIDE * this.form.HIGH) /
1000000
).toFixed(6),
NTGEW: (+this.form.BRGEW - this.form.ZXNTGEW).toFixed(2),
DATUM: parseTime(new Date(), "{y}{m}{d}"),
UZEIT: parseTime(new Date(), "{h}{i}{s}"),
UNAME: this.vuex_user.userName,
ZSTATUS: this.checkedBox ? "Y" : "N",
UPDKZ: ele.ZCODE && ele.PLNR ? "U" : "I",
});
});
} else {
this.goodsList.forEach((ele) => {
arr.push({
...ele,
ZCODE: this.blNum,
ZZXFS: this.form.ZZXFS,
PLNR: this.isEdit ? "" : ele.PLNR,
WERKS: this.vuex_user_factory,
ZXSPE: ele.LONG + "*" + ele.WIDE + "*" + ele.HIGH,
ZXVOLUM: ((ele.LONG * ele.WIDE * ele.HIGH) / 1000000).toFixed(6),
NTGEW: (+ele.BRGEW - ele.ZXNTGEW).toFixed(2),
DATUM: parseTime(new Date(), "{y}{m}{d}"),
UZEIT: parseTime(new Date(), "{h}{i}{s}"),
UNAME: this.vuex_user.userName,
ZSTATUS: this.checkedBox ? "Y" : "N",
UPDKZ: ele.ZCODE && ele.PLNR ? "U" : "I",
});
});
}
this.$u.api.sapApi.sapCasePlnr(arr).then((res) => {
if (!Array.isArray(res)) {
return;
}
if (res.every((item) => item.TYPE === "S")) {
this.$u.toast(res[0].MESSAGE);
this.resetData();
this.upForm = { ...this.form };
this.$nextTick(() => {
this.resetState();
});
}
const foundObject = res.find((item) => item.TYPE === "E");
if (foundObject && foundObject.MESSAGE) {
......@@ -398,8 +447,7 @@ export default {
if (info) {
this.form = info;
}
this.searchCaseInfo(blpl)
this.searchCaseInfo(blpl, true);
},
reset() {
setTimeout(() => {
......@@ -442,6 +490,27 @@ export default {
uni.navigateBack();
},
changeTab(index) {
/**
* 当装箱方式为PL时,如果有多个未装箱的,必须先提交装箱关联,才能进行称重
*/
/**
* 当称重切换装箱关联时
* ...
* 当装箱关联切换称重且有装箱关联数据时
* 1、装箱方式为BL+PL时
* -称重中应显当前BL的称重信息
* 2、装箱方式为 PL 时
* -如果只有一条PL时可以直接为当前PL进行称重
* -如果有多条PL时,必须提交装箱关联才能称重
*/
if (index == 1) {
if (this.form.ZZXFS == "PL" && this.goodsList.length > 1) {
return this.$u.toast("请先提交多个装箱关联!");
} else if (this.goodsList.length == 1 || this.form.ZZXFS == "BL+PL") {
this.form = this.goodsList[0] || this.form;
}
}
this.current = index;
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment