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

装箱修改

parent 15a55cfb
...@@ -124,7 +124,7 @@ export default { ...@@ -124,7 +124,7 @@ export default {
}, },
computed:{ computed:{
weight(){ weight(){
return (this.form.BRGEW-0) - (this.form.ZXNTGEW-0) return ((this.form.BRGEW-0) - (this.form.ZXNTGEW-0)).toFixed(2)
} }
}, },
methods: { methods: {
......
...@@ -33,20 +33,20 @@ ...@@ -33,20 +33,20 @@
prefixIcon="search" prefixIcon="search"
class="topSearch" class="topSearch"
v-model="blNum" v-model="blNum"
:disabled="form.ZZXFS == 'PL' || isEdit"
focus focus
placeholder="请扫描箱码" placeholder="请扫描箱码"
@change="handleInputNlpla" @change="handleInputNlpla"
:disabled="form.ZZXFS === 'PL'"
></uni-easyinput> ></uni-easyinput>
<uni-easyinput <uni-easyinput
prefixIcon="search" prefixIcon="search"
:disabled="isDisabled" :disabled="isEdit"
v-model="wxparams" v-model="wxparams"
:focus="isFocus" :focus="isFocus"
placeholder="请扫描产品包装条码/外箱码" placeholder="请扫描产品包装条码/外箱码"
@input="handleInputPlnr" @input="handleInputPlnr"
></uni-easyinput> ></uni-easyinput>
<checkbox-group style="margin-top: 10rpx;" @change="checkedChange"> <checkbox-group style="margin-top: 10rpx" @change="checkedChange">
<checkbox value="r1" :checked="checkedBox" />是否审核 <checkbox value="r1" :checked="checkedBox" />是否审核
</checkbox-group> </checkbox-group>
</view> </view>
...@@ -173,6 +173,7 @@ export default { ...@@ -173,6 +173,7 @@ export default {
ZXTEXT: "", ZXTEXT: "",
ZTEXT: "", ZTEXT: "",
}, },
upForm: {},
goodsList: [], goodsList: [],
}; };
}, },
...@@ -182,9 +183,13 @@ export default { ...@@ -182,9 +183,13 @@ export default {
* 重置 * 重置
*/ */
resetState() { resetState() {
this.goodsList = [] this.goodsList = [];
this.blNum = "";
this.wxparams = "";
this.form = { this.form = {
ZZXFS: "BL+PL", ZZXFS: "BL+PL",
PLNR: "",
ZCODE: "",
ZXSPE: "", //箱规格(cm) ZXSPE: "", //箱规格(cm)
ZXVOLUM: "", //体积(m132) ZXVOLUM: "", //体积(m132)
ZXNTGEW: "", //箱重(kg) ZXNTGEW: "", //箱重(kg)
...@@ -193,32 +198,32 @@ export default { ...@@ -193,32 +198,32 @@ export default {
LONG: "", //长 LONG: "", //长
WIDE: "", //宽 WIDE: "", //宽
HIGH: "", //高 HIGH: "", //高
updkz: "I", UPDKZ: "I",
datum: "", //扫描日期 DATUM: "", //扫描日期
uzeit: "", //扫描时间 UZEIT: "", //扫描时间
uname: "admin", //扫描人 UNAME: "admin", //扫描人
ZXTEXT: "", ZXTEXT: "",
ZTEXT: "", ZTEXT: "",
} };
this.isBL = false; this.isBL = false;
this.isEdit = false; this.isEdit = false;
}, },
checkedChange(){ checkedChange() {
this.checkedBox = !this.checkedBox this.checkedBox = !this.checkedBox;
}, },
searchCaseInfo(blpl) { searchCaseInfo(blpl, isMeter = false) {
// 判空 // 判空
if (!blpl) return; if (!blpl) return;
// 是否BL // 是否BL
const isBL = blpl.startsWith("BL"); const isBL = blpl.startsWith("BL");
this.isBL = isBL; this.isBL = isBL;
if (isBL && !this.blNum) { if (isBL) {
this.blNum = blpl this.blNum = blpl;
} }
// 验证是否有重复 // 验证是否有重复
if (this.goodsList.find((v) => v.ZCODE == blpl || v.PLNR == blpl)) { if (this.goodsList.find((v) => v.PLNR == blpl || v.ZCODE == blpl)) {
this.$u.toast("请勿重复扫描!"); // this.$u.toast("请勿重复扫描!");
return this.reset(); return this.reset();
} }
// 查询是否装箱 // 查询是否装箱
...@@ -227,12 +232,25 @@ export default { ...@@ -227,12 +232,25 @@ export default {
PLNR: isBL ? "" : blpl, PLNR: isBL ? "" : blpl,
}; };
this.$u.api.sapApi.sapCaseInfo(params).then(({ DATA: res }) => { 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; this.isEdit = !!res.length && isBL;
// 如果已经装箱 // 如果已经装箱
if (res.length) { if (res.length) {
this.isEdit = true;
// 扫描的PL // 扫描的PL
if (!isBL) { if (!isBL) {
const [plInfo] = res; const [plInfo] = res;
this.blNum = plInfo.ZCODE;
// 如果有规格,需要解析出长宽高 // 如果有规格,需要解析出长宽高
if (/^\d+\*\d+\*\d+$/.test(plInfo.ZXSPE)) { if (/^\d+\*\d+\*\d+$/.test(plInfo.ZXSPE)) {
const [LONG, WIDE, HIGH] = plInfo.ZXSPE.split("*"); const [LONG, WIDE, HIGH] = plInfo.ZXSPE.split("*");
...@@ -252,16 +270,18 @@ export default { ...@@ -252,16 +270,18 @@ export default {
} }
return v; 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 { } else {
this.isEdit = false;
if (!isBL) { if (!isBL) {
console.log("没有装箱的PL"); console.log("没有装箱的PL");
const plInfo = { PLNR: blpl, ZZXFS: this.form.ZZXFS, updkz: 'I' }; const plInfo = { PLNR: blpl, ZZXFS: this.form.ZZXFS, UPDKZ: "I" };
// 获取已经扫描过的最后一个PL信息,如果存在需要他的称重信息 // 获取已经扫描过的最后一个PL信息,如果存在需要他的称重信息
const lastPLInfo = this.goodsList.at(-1); const lastPLInfo = this.goodsList[this.goodsList.length - 1];
console.log("lastPLInfo", lastPLInfo);
const weightInfo = { const weightInfo = {
ZXVOLUM: "", ZXVOLUM: "",
ZXNTGEW: "", ZXNTGEW: "",
...@@ -282,12 +302,7 @@ export default { ...@@ -282,12 +302,7 @@ export default {
} }
this.goodsList.push({ ...plInfo, ...weightInfo }); this.goodsList.push({ ...plInfo, ...weightInfo });
} }
} console.log("goodsList", this.goodsList);
console.log(this.goodsList, "goodsList-----");
// 默认设置为扫描的第一项
if (!this.form.PLNR) {
this.form = this.goodsList[0];
} }
}); });
}, },
...@@ -302,11 +317,17 @@ export default { ...@@ -302,11 +317,17 @@ export default {
return; return;
} }
// 是否超过45kg // 是否超过45kg
const NTGEW = this.goodsList.reduce((acc, cur) => acc + +cur.NTGEW, 0); let BRGEW = this.form.BRGEW;
if (NTGEW > 45) { // 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({ uni.showModal({
title: "提示", title: "提示",
content: "重超过45KG,是否继续提交?", content: "重超过45KG,是否继续提交?",
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
console.log("用户点击确定"); console.log("用户点击确定");
...@@ -319,52 +340,80 @@ export default { ...@@ -319,52 +340,80 @@ export default {
} else { } else {
this.subRequest(); 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() { subRequest() {
const arr = []; 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) => { this.goodsList.forEach((ele) => {
arr.push({ arr.push({
...ele, ...ele,
werks: this.vuex_user_factory, ...this.form,
zxspe: ele.LONG + "*" + ele.WIDE + "*" + ele.HIGH, ZCODE: this.blNum,
ntgew: +ele.BRGEW - ele.ZXNTGEW, ZZXFS: this.form.ZZXFS,
zcode: this.form.ZZXFS === "PL" ? "" : this.blNum, PLNR: this.isEdit ? "" : ele.PLNR,
datum: parseTime(new Date(), "{y}{m}{d}"), WERKS: this.vuex_user_factory,
uzeit: parseTime(new Date(), "{h}{i}{s}"), ZXSPE:
zstatus: this.checkedBox ? 'Y': 'N', this.form.LONG + "*" + this.form.WIDE + "*" + this.form.HIGH,
UPDKZ: ele.ZCODE && ele.PLNR ? 'U' : 'I' 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) => { this.$u.api.sapApi.sapCasePlnr(arr).then((res) => {
if (!Array.isArray(res)) { if (!Array.isArray(res)) {
return; return;
} }
if (res.every((item) => item.TYPE === "S")) { if (res.every((item) => item.TYPE === "S")) {
this.$u.toast(res[0].MESSAGE); this.$u.toast(res[0].MESSAGE);
this.resetData(); this.upForm = { ...this.form };
this.$nextTick(() => {
this.resetState();
});
} }
const foundObject = res.find((item) => item.TYPE === "E"); const foundObject = res.find((item) => item.TYPE === "E");
if (foundObject && foundObject.MESSAGE) { if (foundObject && foundObject.MESSAGE) {
...@@ -398,8 +447,7 @@ export default { ...@@ -398,8 +447,7 @@ export default {
if (info) { if (info) {
this.form = info; this.form = info;
} }
this.searchCaseInfo(blpl) this.searchCaseInfo(blpl, true);
}, },
reset() { reset() {
setTimeout(() => { setTimeout(() => {
...@@ -442,6 +490,27 @@ export default { ...@@ -442,6 +490,27 @@ export default {
uni.navigateBack(); uni.navigateBack();
}, },
changeTab(index) { 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; 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