|
@@ -96,114 +96,114 @@
|
|
|
onLoad(() => {})
|
|
|
const handleScanCode = () => {
|
|
|
// 引入原生插件
|
|
|
- // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
|
|
|
- // if (mpaasScanModule) {
|
|
|
- // // 调用插件的 mpaasScan 方法
|
|
|
- // mpaasScanModule.mpaasScan({
|
|
|
- // // 扫码识别类型,参数可多选,qrCode、barCode,
|
|
|
- // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
|
|
|
- // scanType: ["qrCode", "barCode"],
|
|
|
- // // 是否隐藏相册,默认false不隐藏
|
|
|
- // hideAlbum: false,
|
|
|
- // },
|
|
|
- // (ret) => {
|
|
|
- // console.log(ret)
|
|
|
- // const result = {
|
|
|
- // carrierCode: ret.resp_result,
|
|
|
- // processCode: ''
|
|
|
- // }
|
|
|
- // if (!result.carrierCode || result.carrierCode == "") {
|
|
|
- // uni.showToast({
|
|
|
- // icon: "none",
|
|
|
- // title: "请扫载具码",
|
|
|
- // duration: 1000
|
|
|
- // })
|
|
|
- // return
|
|
|
- // }
|
|
|
- // //判断该箱是否绑定批次
|
|
|
+ const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
|
|
|
+ if (mpaasScanModule) {
|
|
|
+ // 调用插件的 mpaasScan 方法
|
|
|
+ mpaasScanModule.mpaasScan({
|
|
|
+ // 扫码识别类型,参数可多选,qrCode、barCode,
|
|
|
+ // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
|
|
|
+ scanType: ["qrCode", "barCode"],
|
|
|
+ // 是否隐藏相册,默认false不隐藏
|
|
|
+ hideAlbum: false,
|
|
|
+ },
|
|
|
+ (ret) => {
|
|
|
+ console.log(ret)
|
|
|
+ const result = {
|
|
|
+ carrierCode: ret.resp_result,
|
|
|
+ processCode: ''
|
|
|
+ }
|
|
|
+ if (!result.carrierCode || result.carrierCode == "") {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: "请扫载具码",
|
|
|
+ duration: 1000
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //判断该箱是否绑定批次
|
|
|
|
|
|
- // result.processCode = store.outsourcedCode;
|
|
|
- // // console.log(result.processCode)
|
|
|
- // /************************ 根据扫码查询到的数据和需要检查的工序查询信息 ************************/
|
|
|
- // getCarrierInfo(result).then(response => {
|
|
|
- // if (response.code == 200) {
|
|
|
- // // 判断是哪种返回值 假设是想信息则给lot附检查箱信息
|
|
|
- // // 假设是dayworkCarriers 则 判断是几个批次,假设为多批,则弹出选择框。
|
|
|
- // if (response.data.dayworkCarriers != null) {
|
|
|
- // if (response.data.dayworkCarriers.length > 1) {
|
|
|
- // query.value = result;
|
|
|
- // selectProcessInspection.value.open(response.data.dayworkCarriers)
|
|
|
- // } else {
|
|
|
- // // console.log(response)
|
|
|
- // uni.showLoading({
|
|
|
- // title: '加载中'
|
|
|
- // });
|
|
|
- // // 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
|
|
|
- // // 需要定义一个请求方法, 从后端获取
|
|
|
- // getLotInfo(result).then(res => {
|
|
|
- // if (res.code == 200) {
|
|
|
- // console.log(res)
|
|
|
+ result.processCode = store.outsourcedCode;
|
|
|
+ // console.log(result.processCode)
|
|
|
+ /************************ 根据扫码查询到的数据和需要检查的工序查询信息 ************************/
|
|
|
+ getCarrierInfo(result).then(response => {
|
|
|
+ if (response.code == 200) {
|
|
|
+ // 判断是哪种返回值 假设是想信息则给lot附检查箱信息
|
|
|
+ // 假设是dayworkCarriers 则 判断是几个批次,假设为多批,则弹出选择框。
|
|
|
+ if (response.data.dayworkCarriers != null) {
|
|
|
+ if (response.data.dayworkCarriers.length > 1) {
|
|
|
+ query.value = result;
|
|
|
+ selectProcessInspection.value.open(response.data.dayworkCarriers)
|
|
|
+ } else {
|
|
|
+ // console.log(response)
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ });
|
|
|
+ // 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
|
|
|
+ // 需要定义一个请求方法, 从后端获取
|
|
|
+ getLotInfo(result).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ console.log(res)
|
|
|
|
|
|
- // if(res.data.dayworkItemList.length == 0) {
|
|
|
- // uni.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: "该批次当天没有报工",
|
|
|
- // duration: 2000
|
|
|
- // })
|
|
|
- // }else{
|
|
|
- // getUser(res.data.dayworkItemList)
|
|
|
- // getEquipment(res.data.dayworkItemList)
|
|
|
- // lot.value = {
|
|
|
- // ...lot.value,
|
|
|
- // ...res.data
|
|
|
- // };
|
|
|
- // lot.value.carrierCode = result.carrierCode
|
|
|
- // carrierCode.value = result.carrierCode;
|
|
|
- // // console.log("res", res);
|
|
|
- // uni.hideLoading();
|
|
|
- // // 判断是否批次号和检查箱码都扫完
|
|
|
- // checkSave()
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // uni.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: res.msg,
|
|
|
- // duration: 2000
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }).catch(err => {
|
|
|
- // uni.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: err.message,
|
|
|
- // duration: 2000
|
|
|
- // })
|
|
|
- // })
|
|
|
+ if(res.data.dayworkItemList.length == 0) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: "该批次当天没有报工",
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ getUser(res.data.dayworkItemList)
|
|
|
+ getEquipment(res.data.dayworkItemList)
|
|
|
+ lot.value = {
|
|
|
+ ...lot.value,
|
|
|
+ ...res.data
|
|
|
+ };
|
|
|
+ lot.value.carrierCode = result.carrierCode
|
|
|
+ carrierCode.value = result.carrierCode;
|
|
|
+ // console.log("res", res);
|
|
|
+ uni.hideLoading();
|
|
|
+ // 判断是否批次号和检查箱码都扫完
|
|
|
+ checkSave()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: res.msg,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: err.message,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
- // }
|
|
|
- // } else if (response.data.inspectionCarrier != null) {
|
|
|
- // console.log(response)
|
|
|
- // lot.value.inspectionCarrierCode = response.data.inspectionCarrier.code
|
|
|
- // lot.value.inspectionCarrierId = response.data.inspectionCarrier.id
|
|
|
- // // 判断是否批次号和检查箱码都扫完
|
|
|
- // checkSave()
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // uni.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: response.msg,
|
|
|
- // duration: 2000
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }).catch(err => {
|
|
|
- // uni.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: err.message,
|
|
|
- // duration: 2000
|
|
|
- // })
|
|
|
- // })
|
|
|
- // }
|
|
|
- // )
|
|
|
- // } else {
|
|
|
+ }
|
|
|
+ } else if (response.data.inspectionCarrier != null) {
|
|
|
+ console.log(response)
|
|
|
+ lot.value.inspectionCarrierCode = response.data.inspectionCarrier.code
|
|
|
+ lot.value.inspectionCarrierId = response.data.inspectionCarrier.id
|
|
|
+ // 判断是否批次号和检查箱码都扫完
|
|
|
+ checkSave()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: response.msg,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: err.message,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ )
|
|
|
+ } else {
|
|
|
const result = {
|
|
|
carrierCode: '000257'
|
|
|
}
|
|
@@ -285,7 +285,7 @@
|
|
|
duration: 2000
|
|
|
})
|
|
|
})
|
|
|
- // }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
function checkSave() {
|
|
@@ -347,21 +347,45 @@
|
|
|
uni.showLoading({
|
|
|
title: '加载中'
|
|
|
});
|
|
|
- getLotInfo(query.value).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- lot.value = res.data;
|
|
|
- lot.value.carrierCode = query.value.carrierCode
|
|
|
- carrierCode.value = query.value.carrierCode;
|
|
|
- console.log("res", res);
|
|
|
- uni.hideLoading();
|
|
|
- } else {
|
|
|
+ getLotInfo(query.value).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ console.log(res)
|
|
|
+
|
|
|
+ if(res.data.dayworkItemList.length == 0) {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
- title: res.msg,
|
|
|
+ title: "该批次当天没有报工",
|
|
|
duration: 2000
|
|
|
})
|
|
|
+ }else{
|
|
|
+ console.log("888")
|
|
|
+ getUser(res.data.dayworkItemList)
|
|
|
+ getEquipment(res.data.dayworkItemList)
|
|
|
+ lot.value = {
|
|
|
+ ...lot.value,
|
|
|
+ ...res.data
|
|
|
+ };
|
|
|
+ lot.value.carrierCode = query.value.carrierCode
|
|
|
+ carrierCode.value = query.value.carrierCode;
|
|
|
+ // console.log("res", res);
|
|
|
+ uni.hideLoading();
|
|
|
+ // 判断是否批次号和检查箱码都扫完
|
|
|
+ checkSave()
|
|
|
}
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: res.msg,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: err.message,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
//确定后,将批次id,批次号,传递过去
|