物流管理问题修改

master
zhangdi 4 days ago
parent 4b2d71345c
commit c870d44475
  1. 1
      README.md
  2. 3
      manifest.json
  3. 318
      pages/logistics/delivery.vue
  4. 136
      pages/logistics/intoStock.vue
  5. 292
      pages/logistics/packaging.vue
  6. 66
      pages/logistics/weighing.vue

@ -0,0 +1 @@
打包证书密码 zhgd_pda

@ -102,6 +102,9 @@
"router" : { "router" : {
"mode" : "hash", "mode" : "hash",
"base" : "./" "base" : "./"
},
"devServer" : {
"https" : false
} }
} }
} }

@ -24,6 +24,8 @@
</view> </view>
</view> </view>
</uni-forms-item> </uni-forms-item>
<!-- 1. 物料箱条码 (使用 oneInput) -->
<uni-forms-item label="物料箱条码:" label-width="100px"> <uni-forms-item label="物料箱条码:" label-width="100px">
<template #label> <template #label>
<view class="required-label"> <view class="required-label">
@ -35,40 +37,20 @@
<view class="input-box"> <view class="input-box">
<input <input
type="text" type="text"
v-model="boxCode" v-model="oneInput"
@confirm="handleBoxConfirm" @input="oneInputBlur"
placeholder="物料箱条码" placeholder="物料箱条码"
class="uni-input-border" class="uni-input-border"
confirm-type="done" confirm-type="done"
:focus="boxInputFocus" :focus="boxInputFocus"
:key="'box-' + boxInputFocus"
/> />
</view> </view>
</view> </view>
<!-- <button
@click="handleSubmit"
:disabled="!startData || !endCenter"
class="submit-btn"
:class="{ 'btn-disabled': !startData || !endCenter }"
>
配送
</button> -->
</view>
<!-- <view v-if="boxData" class="box-info">
<view class="info-section">
<text class="info-text">
包含订单:
<text class="info-value">{{ boxData.quantity }}</text>
</text>
<text class="info-text">
对应中心:
<text class="info-value-center">{{ boxData.wcName }}</text>
</text>
</view> </view>
<button @click="detailsFn()" class="details-btn">
明细 <text class="arrow"></text>
</button>
</view> -->
</uni-forms-item> </uni-forms-item>
<!-- 2. 起点站点/区域 (使用 twoInput) -->
<uni-forms-item <uni-forms-item
label="起点站点:" label="起点站点:"
label-width="100px" label-width="100px"
@ -82,18 +64,21 @@
</template> </template>
<input <input
type="text" type="text"
v-model="startCode" v-model="twoInput"
@confirm="handleStartConfirm" @input="twoInputBlur"
placeholder="站点码" placeholder="站点码"
class="uni-input-border" class="uni-input-border"
confirm-type="done" confirm-type="done"
:focus="startInputFocus" :focus="startInputFocus"
:key="'start-' + startInputFocus"
/> />
<view v-if="startData" class="start-confirm"> <view v-if="startData" class="start-confirm">
<text class="check-icon"></text> <text class="check-icon"></text>
<text class="confirm-text">已确认: {{ startData.stationName }}</text> <text class="confirm-text">已确认: {{ startData.stationName }}</text>
</view> </view>
</uni-forms-item> </uni-forms-item>
<!-- 叫料模式下的起点选择 (保持 Picker 不变但逻辑需适配) -->
<uni-forms-item label="起点区域:" label-width="100px" v-else> <uni-forms-item label="起点区域:" label-width="100px" v-else>
<template #label> <template #label>
<view class="required-label"> <view class="required-label">
@ -135,6 +120,8 @@
>暂无可配送物料</text >暂无可配送物料</text
> >
</uni-forms-item> </uni-forms-item>
<!-- 3. 终点区域 (使用 therrInput 用于叫料模式的扫码) -->
<uni-forms-item <uni-forms-item
label="终点区域:" label="终点区域:"
label-width="150px" label-width="150px"
@ -176,27 +163,32 @@
</text> </text>
</view> </view>
</picker> </picker>
<!-- 终点区域选择 - 无数据时显示提示 -->
<view v-else class="empty-tip-picker"> <view v-else class="empty-tip-picker">
<text class="empty-text">暂无数据</text> <text class="empty-text">暂无数据</text>
</view> </view>
</uni-forms-item> </uni-forms-item>
<!-- 叫料模式下的终点扫码 -->
<uni-forms-item label="终点区域:" label-width="150px" v-else> <uni-forms-item label="终点区域:" label-width="150px" v-else>
<template #label> <template #label>
<view class="required-label"> <view class="required-label">
<text class="required-mark">*</text> <text class="required-mark">*</text>
<text>终点区域</text> <text>终点区域</text>
</view> </view>
</template>
<input <input
type="text" type="text"
v-model="endStationCode" v-model="therrInput"
@input="therrInputBlur"
placeholder="请扫描区域码" placeholder="请扫描区域码"
class="uni-input-border" class="uni-input-border"
confirm-type="done" confirm-type="done"
:focus="endInputFocus"
:key="'end-' + endInputFocus"
/> />
</template>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
<view class="footer-action"> <view class="footer-action">
<button <button
@click="handleSubmit" @click="handleSubmit"
@ -212,38 +204,47 @@
<script> <script>
import ifrm from "@/pages/index/ifrm"; import ifrm from "@/pages/index/ifrm";
import inputBlur from '@/mixin/inputBlur.js'; // mixin
export default { export default {
mixins: [inputBlur], // mixin
components: { components: {
ifrm, ifrm,
}, },
data() { data() {
return { return {
boxCode: "", // boxCode, startCode, endStationCode mixin oneInput, twoInput, therrInput
startCode: "",
boxData: null, boxData: null,
startData: null, startData: null,
showDetails: false, showDetails: false,
//
boxInputFocus: true, boxInputFocus: true,
startInputFocus: false, startInputFocus: false,
endInputFocus: false, //
mockBoxes: {}, mockBoxes: {},
workCenters: [], workCenters: [],
yieldOrderList: [], // yieldOrderList: [],
scanMode: "bind", scanMode: "bind",
hasData: false, hasData: false,
workCenters: [], //
endAreas: [], // workCenters: [],
endCenter: "", // endAreas: [],
endArea: "", // endCenter: "",
endCenterIndex: 0, // endArea: "",
endAreaIndex: 0, // endCenterIndex: 0,
startAreas: [], // endAreaIndex: 0,
startStations: [], //
startArea: "蓝色周转盒放置区", // startAreas: [],
startStation: "", // startStations: [],
startAreaIndex: 0, // startArea: "蓝色周转盒放置区",
startStationIndex: 0, // startStation: "",
endStationCode: "", // startAreaIndex: 0,
startStationIndex: 0,
// endStationCode therrInput
}; };
}, },
computed: { computed: {
@ -252,25 +253,10 @@ export default {
return !this.startData || !this.endCenter; return !this.startData || !this.endCenter;
} }
if (this.scanMode == "unbind") { if (this.scanMode == "unbind") {
return !this.endStationCode || !this.startStation; //
return !this.startStation || !this.therrInput;
} }
// // return true;
// if (!this.endCenterIndex) {
// return false;
// }
// //
// if (this.scanMode == "bind") {
// console.log(4444444, !this.startData);
// // startData
// return !this.startData;
// } else if (this.scanMode == "unbind") {
// console.log(3333333333, !this.startStationIndex);
// // startStation
// return !this.startStationIndex;
// }
// return false;
}, },
}, },
mounted() { mounted() {
@ -280,17 +266,82 @@ export default {
this.$refs.ifrm.topMenuClick(btn); this.$refs.ifrm.topMenuClick(btn);
}, },
methods: { methods: {
// mixin
oneInputData(val) {
if (!val) return;
const code = val.trim();
this.handleBoxConfirmLogic(code);
},
// mixin
twoInputData(val) {
if (!val) return;
const code = val.trim();
this.handleStartConfirmLogic(code);
},
// mixin ()
therrInputData(val) {
if (!val) return;
// 使 therrInput
//
console.log("终点区域扫码结果:", val);
},
// handleBoxConfirm
handleBoxConfirmLogic(code) {
if (!code) return;
this.$u.api
.getQuantityLocation({ boxBarcode: code })
.then((res) => {
this.boxData = res.data;
uni.showToast({ title: '物料箱识别成功', icon: 'none' });
//
this.boxInputFocus = false;
if (this.scanMode === 'bind') {
this.startInputFocus = true;
} else {
//
// Picker(picker)
this.boxInputFocus = true;
}
})
.catch(err => {
uni.showToast({ title: err || '查询失败', icon: 'none' });
this.clearOneInput();
this.boxInputFocus = false;
this.$nextTick(() => { this.boxInputFocus = true; });
});
},
// handleStartConfirm
handleStartConfirmLogic(code) {
if (!code) return;
this.$u.api
.getStationName({ stationCode: code })
.then((res) => {
this.startData = res.data;
uni.showToast({ title: '起点站点确认', icon: 'none' });
// (Picker)
this.startInputFocus = false;
})
.catch(err => {
uni.showToast({ title: err || '站点查询失败', icon: 'none' });
this.clearTwoInput();
this.startInputFocus = false;
this.$nextTick(() => { this.startInputFocus = true; });
});
},
// //
handleStartAreaChange(e) { handleStartAreaChange(e) {
const index = e.detail.value; const index = e.detail.value;
this.startArea = this.startAreas[index].name; this.startArea = this.startAreas[index].name;
this.startAreaIndex = index; this.startAreaIndex = index;
//
this.startStation = ""; this.startStation = "";
this.startStationIndex = 0; this.startStationIndex = 0;
// stationCodeList
this.getStartStationsList(this.startAreas[index].id); this.getStartStationsList(this.startAreas[index].id);
}, },
@ -303,46 +354,35 @@ export default {
// //
getStartAreasList() { getStartAreasList() {
uni.showLoading({ uni.showLoading({ title: "加载中...", mask: true });
title: "加载中...",
mask: true,
});
this.$u.api this.$u.api
.getStationRegion() .getStationRegion()
.then((res) => { .then((res) => {
uni.hideLoading(); uni.hideLoading();
const list = res.data || []; const list = res.data || [];
this.startAreas = list.map((area) => ({ this.startAreas = list.map((area) => ({
id: area.stationRegion, id: area.stationRegion,
name: area.stationRegion, name: area.stationRegion,
stationCodeList: area.stationCodeList || [], stationCodeList: area.stationCodeList || [],
})); }));
// ""
const targetRegion = this.startAreas.find( const targetRegion = this.startAreas.find(
(item) => item.name == "蓝色周转盒放置区" (item) => item.name == "蓝色周转盒放置区"
); );
if (targetRegion) { if (targetRegion) {
//
const targetIndex = this.startAreas.findIndex( const targetIndex = this.startAreas.findIndex(
(item) => item.id === targetRegion.id (item) => item.id === targetRegion.id
); );
if (targetIndex !== -1) { if (targetIndex !== -1) {
this.startArea = targetRegion.name; this.startArea = targetRegion.name;
this.startAreaIndex = targetRegion.id; this.startAreaIndex = targetRegion.id;
//
const stationCodeList = targetRegion.stationCodeList || []; const stationCodeList = targetRegion.stationCodeList || [];
if (stationCodeList && stationCodeList.length > 0) { if (stationCodeList && stationCodeList.length > 0) {
this.startStations = stationCodeList.map((code) => ({ this.startStations = stationCodeList.map((code) => ({
id: code, id: code,
name: code, name: code,
})); }));
//
this.startStation = stationCodeList[0]; this.startStation = stationCodeList[0];
this.startStationIndex = 0; this.startStationIndex = 0;
} }
@ -350,36 +390,26 @@ export default {
} else { } else {
this.startArea = "蓝色周转盒放置区"; this.startArea = "蓝色周转盒放置区";
this.startAreaIndex = "蓝色周转盒放置区"; this.startAreaIndex = "蓝色周转盒放置区";
this.startStation = null this.startStation = null;
} }
}) })
.catch((err) => { .catch((err) => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({ title: "加载区域列表失败", icon: "none" });
title: "加载区域列表失败",
icon: "none",
});
}); });
}, },
// ID
getStartStationsList(areaId) { getStartStationsList(areaId) {
if (!areaId) { if (!areaId) {
this.startStations = []; this.startStations = [];
return; return;
} }
// startAreas stationCodeList
const area = this.startAreas.find((item) => item.id === areaId); const area = this.startAreas.find((item) => item.id === areaId);
if (area && area.stationCodeList && area.stationCodeList.length > 0) { if (area && area.stationCodeList && area.stationCodeList.length > 0) {
// stationCodeList picker
this.startStations = area.stationCodeList.map((code, index) => ({ this.startStations = area.stationCodeList.map((code, index) => ({
id: code, id: code,
name: code, name: code,
})); }));
//
if (this.startStations.length > 0) { if (this.startStations.length > 0) {
this.startStation = this.startStations[0].name; this.startStation = this.startStations[0].name;
this.startStationIndex = 0; this.startStationIndex = 0;
@ -390,28 +420,21 @@ export default {
this.startStationIndex = 0; this.startStationIndex = 0;
} }
}, },
//
handleEndChange(e) { handleEndChange(e) {
const index = e.detail.value; const index = e.detail.value;
const selectedWorkCenter = this.workCenters[index]; const selectedWorkCenter = this.workCenters[index];
this.endCenter = selectedWorkCenter.name; this.endCenter = selectedWorkCenter.name;
this.endCenterIndex = selectedWorkCenter.id; this.endCenterIndex = selectedWorkCenter.id;
//
this.endArea = ""; this.endArea = "";
this.endAreaIndex = 0; this.endAreaIndex = 0;
// stationRegionList
if ( if (
selectedWorkCenter.stationRegionList && selectedWorkCenter.stationRegionList &&
selectedWorkCenter.stationRegionList.length > 0 selectedWorkCenter.stationRegionList.length > 0
) { ) {
// stationRegionList
const firstItem = selectedWorkCenter.stationRegionList[0]; const firstItem = selectedWorkCenter.stationRegionList[0];
if (typeof firstItem === "object") { if (typeof firstItem === "object") {
//
this.endAreas = selectedWorkCenter.stationRegionList.map( this.endAreas = selectedWorkCenter.stationRegionList.map(
(region) => ({ (region) => ({
id: region.id, id: region.id,
@ -419,7 +442,6 @@ export default {
}) })
); );
} else { } else {
//
this.endAreas = selectedWorkCenter.stationRegionList.map( this.endAreas = selectedWorkCenter.stationRegionList.map(
(region, idx) => ({ (region, idx) => ({
id: idx, id: idx,
@ -427,8 +449,6 @@ export default {
}) })
); );
} }
//
if (this.endAreas.length > 0) { if (this.endAreas.length > 0) {
this.endArea = this.endAreas[0].name; this.endArea = this.endAreas[0].name;
this.endAreaIndex = this.endAreas[0].id; this.endAreaIndex = this.endAreas[0].id;
@ -438,27 +458,25 @@ export default {
} }
}, },
//
handleAreaChange(e) { handleAreaChange(e) {
const index = e.detail.value; const index = e.detail.value;
this.endArea = this.endAreas[index].name; this.endArea = this.endAreas[index].name;
this.endAreaIndex = index; this.endAreaIndex = index;
}, },
handleModeChange(mode) { handleModeChange(mode) {
this.scanMode = mode; this.scanMode = mode;
this.hasData = false; this.hasData = false;
// // 使 mixin
this.boxCode = ""; this.clearInput();
this.boxData = null;
this.boxInputFocus = true;
// this.boxData = null;
this.startCode = "";
this.startData = null; this.startData = null;
this.boxInputFocus = true;
this.startInputFocus = false; this.startInputFocus = false;
this.endInputFocus = false;
//
this.startArea = ""; this.startArea = "";
this.startStation = ""; this.startStation = "";
this.startAreaIndex = 0; this.startAreaIndex = 0;
@ -466,14 +484,12 @@ export default {
this.startAreas = []; this.startAreas = [];
this.startStations = []; this.startStations = [];
//
this.endCenter = ""; this.endCenter = "";
this.endArea = ""; this.endArea = "";
this.endCenterIndex = 0; this.endCenterIndex = 0;
this.endAreaIndex = 0; this.endAreaIndex = 0;
this.endAreas = []; this.endAreas = [];
//
if (mode === "unbind") { if (mode === "unbind") {
this.getStartAreasList(); this.getStartAreasList();
} }
@ -482,43 +498,18 @@ export default {
icon: "none", icon: "none",
}); });
}, },
//
detailsFn() { detailsFn() {
this.showDetails = true; this.showDetails = true;
this.$u.api this.$u.api
.boxbarcodeDetails({ boxBarcode: this.boxData.boxBarcode,isDetail:false }) .boxbarcodeDetails({ boxBarcode: this.boxData.boxBarcode, isDetail: false })
.then((res) => { .then((res) => {
this.yieldOrderList = res.data.yieldOrderList; this.yieldOrderList = res.data.yieldOrderList;
}); });
}, },
handleBoxConfirm() {
const code = this.boxCode.trim();
if (!code) return;
this.$u.api
.getQuantityLocation({ boxBarcode: this.boxCode })
.then((res) => {
this.boxData = res.data;
this.boxInputFocus = false;
this.startInputFocus = true;
});
},
handleStartConfirm() {
const code = this.startCode.trim();
if (!code) return;
this.$u.api
.getStationName({ stationCode: this.startCode })
.then((res) => {
console.log("起点站点", res.data);
this.startData = res.data;
this.startInputFocus = false;
});
},
//
getWorkCenterList() { getWorkCenterList() {
this.$u.api.getWorkCenter().then((res) => { this.$u.api.getWorkCenter().then((res) => {
console.log(res.data);
this.workCenters = res.data.map((c) => ({ this.workCenters = res.data.map((c) => ({
id: c.id, id: c.id,
name: c.wcName, name: c.wcName,
@ -528,61 +519,66 @@ export default {
}, },
handleSubmit() { handleSubmit() {
uni.showLoading({ uni.showLoading({ title: "提交中..." });
title: "提交中...",
});
let startStationCode = "";
let query_ = { let query_ = {
boxBarcode: this.boxBarcode || "", // boxBarcode: this.oneInput || (this.boxData ? this.boxData.boxBarcode : ""),
// startStationCode: startStationCode, //
// endWcId: this.endCenterIndex, //
// endStationCode: this.endStationCode, //
// stationRegion: this.endArea,
}; };
if (this.scanMode === "bind") { if (this.scanMode === "bind") {
// startData if (!this.startData) {
uni.hideLoading();
uni.showToast({ title: '请扫描起点站点', icon: 'none' });
return;
}
query_.startStationCode = this.startData.stationCode; query_.startStationCode = this.startData.stationCode;
query_.endWcId = this.endCenterIndex; query_.endWcId = this.endCenterIndex;
query_.stationRegion = this.endArea; query_.stationRegion = this.endArea;
} else if (this.scanMode === "unbind") { } else if (this.scanMode === "unbind") {
// if (!this.startStation) {
query_.startStationCode = this.startStation; uni.hideLoading();
query_.endStationCode = this.endStationCode; uni.showToast({ title: '请选择起点站点', icon: 'none' });
return;
} }
if (this.scanMode == "unbind" && this.endStationCode == "") { if (!this.therrInput) {
uni.showToast({ uni.hideLoading();
title: `请选择终点区域!`, uni.showToast({ title: '请扫描终点区域', icon: 'none' });
icon: "none",
});
return; return;
} }
query_.startStationCode = this.startStation;
query_.endStationCode = this.therrInput; // 使 mixin
}
this.$u.api this.$u.api
.boxBindingTesk(query_) .boxBindingTesk(query_)
.then((res) => { .then((res) => {
uni.showToast({ uni.showToast({
title: `成功配送${this.endCenter}!`, title: `成功配送!`,
icon: "none", icon: "none",
}); });
uni.hideLoading(); uni.hideLoading();
this.boxCode = ""; //
this.clearInput();
this.boxData = null; this.boxData = null;
this.startCode = "";
this.startData = null; this.startData = null;
this.endCenter = ""; this.endCenter = "";
this.endArea = "";
this.boxInputFocus = true; this.boxInputFocus = true;
this.startInputFocus = false; this.startInputFocus = false;
this.endInputFocus = false;
}) })
.catch((err) => { .catch((err) => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ title: err || '提交失败', icon: 'none' });
}); });
}, },
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.page-container { .page-container {
display: flex; display: flex;

@ -1,39 +1,45 @@
<template> <template>
<ifrm> <ifrm>
<uni-forms ref="wrForm" class="formBox" label-position="top"> <uni-forms ref="wrForm" class="formBox" label-position="top">
<!-- 1. 物料箱条码 (使用 oneInput) -->
<uni-forms-item label="物料箱条码:" label-width="100px"> <uni-forms-item label="物料箱条码:" label-width="100px">
<view class="bottom-input-row"> <view class="bottom-input-row">
<view class="weight-input-wrapper"> <view class="weight-input-wrapper">
<view class="input-box"> <view class="input-box">
<input <input
type="text" type="text"
v-model="boxCode" v-model="oneInput"
@confirm="handleBoxConfirm" @input="oneInputBlur"
placeholder="物料箱条码" placeholder="物料箱条码"
class="uni-input-border" class="uni-input-border"
confirm-type="done" confirm-type="done"
:focus="boxInputFocus" :focus="boxInputFocus"
:key="'box-' + boxInputFocus"
/> />
</view> </view>
</view> </view>
</view> </view>
</uni-forms-item> </uni-forms-item>
<!-- 2. 起点站点 (使用 twoInput) -->
<uni-forms-item label="起点站点:" label-width="100px"> <uni-forms-item label="起点站点:" label-width="100px">
<input <input
type="text" type="text"
v-model="startCode" v-model="twoInput"
@confirm="handleStartConfirm" @input="twoInputBlur"
placeholder="站点码" placeholder="站点码"
class="uni-input-border" class="uni-input-border"
confirm-type="done" confirm-type="done"
:focus="startInputFocus" :focus="startInputFocus"
:key="'start-' + startInputFocus"
/> />
<view v-if="startData" class="start-confirm"> <view v-if="startData" class="start-confirm">
<text class="check-icon"></text> <text class="check-icon"></text>
<text class="confirm-text">已确认: {{ startData.stationName }}</text> <text class="confirm-text">已确认: {{ startData.stationName }}</text>
</view> </view>
</uni-forms-item> </uni-forms-item>
<!-- 3. 终点区域 (保持 Picker 不变) -->
<uni-forms-item label="终点区域:" label-width="150px"> <uni-forms-item label="终点区域:" label-width="150px">
<picker <picker
mode="selector" mode="selector"
@ -58,39 +64,87 @@
</view> </view>
</ifrm> </ifrm>
</template> </template>
<script> <script>
import ifrm from "@/pages/index/ifrm"; import ifrm from "@/pages/index/ifrm";
import inputBlur from '@/mixin/inputBlur.js'; // mixin
export default { export default {
mixins: [inputBlur], // mixin
components: { components: {
ifrm, ifrm,
}, },
data() { data() {
return { return {
boxCode: "", // boxCode, startCode mixin oneInput, twoInput
boxInputFocus:true,
startCode: "", // boxInputFocus: true,
startInputFocus: true, // startInputFocus: false,
startData: null, startData: null,
workCenters: [], // workCenters: [],
endCenterIndex: null, endCenterIndex: null,
endCenter: "", // endCenter: "",
}; };
}, },
mounted() { mounted() {
this.getWorkCenterList(); this.getWorkCenterList();
}, },
methods: { methods: {
handleBoxConfirm() { // mixin
const code = this.boxCode.trim(); oneInputData(val) {
if (!val) return;
const code = val.trim();
this.handleBoxConfirmLogic(code);
},
// mixin
twoInputData(val) {
if (!val) return;
const code = val.trim();
this.handleStartConfirmLogic(code);
},
// handleBoxConfirm
handleBoxConfirmLogic(code) {
if (!code) return; if (!code) return;
// this.$u.api
// .getQuantityLocation({ boxBarcode: this.boxCode }) // API
// .then((res) => { // this.$u.api.getQuantityLocation({ boxBarcode: code }).then((res) => { ... });
// this.boxData = res.data;
uni.showToast({ title: '物料箱已扫描', icon: 'none' });
//
this.boxInputFocus = false; this.boxInputFocus = false;
this.startInputFocus = true; this.startInputFocus = true;
// });
}, },
// handleStartConfirm
handleStartConfirmLogic(code) {
if (!code) return;
this.$u.api
.getStationName({ stationCode: code })
.then((res) => {
console.log("起点站点", res.data);
this.startData = res.data;
uni.showToast({ title: '起点确认成功', icon: 'none' });
//
this.startInputFocus = false;
//
// this.clearTwoInput();
// this.startInputFocus = false;
// this.boxInputFocus = true;
})
.catch(err => {
uni.showToast({ title: err || '站点查询失败', icon: 'none' });
this.clearTwoInput();
this.startInputFocus = false;
this.$nextTick(() => { this.startInputFocus = true; });
});
},
// //
getWorkCenterList() { getWorkCenterList() {
this.$u.api.getWorkCenter().then((res) => { this.$u.api.getWorkCenter().then((res) => {
@ -105,35 +159,22 @@ export default {
(item) => item.name && item.name.includes("输送线终点") (item) => item.name && item.name.includes("输送线终点")
); );
if (defaultItemIndex !== -1) { if (defaultItemIndex !== -1) {
this.endCenterIndex = this.workCenters[defaultItemIndex].id; // Picker this.endCenterIndex = this.workCenters[defaultItemIndex].id;
this.endCenter = this.workCenters[defaultItemIndex].name; this.endCenter = this.workCenters[defaultItemIndex].name;
} }
}); });
}, },
handleEndChange(e) { handleEndChange(e) {
const index = e.detail.value; const index = e.detail.value;
const selectedWorkCenter = this.workCenters[index]; const selectedWorkCenter = this.workCenters[index];
this.endCenter = selectedWorkCenter.name; this.endCenter = selectedWorkCenter.name;
this.endCenterIndex = selectedWorkCenter.id; this.endCenterIndex = selectedWorkCenter.id;
//
this.endArea = "";
this.endAreaIndex = 0;
},
handleStartConfirm() {
const code = this.startCode.trim();
if (!code) return;
this.$u.api
.getStationName({ stationCode: this.startCode })
.then((res) => {
console.log("起点站点", res.data);
this.startData = res.data;
this.startInputFocus = false;
});
}, },
handleSubmit() { handleSubmit() {
if (this.startCode == "") { // 使 mixin oneInput twoInput
if (!this.twoInput) {
uni.showToast({ uni.showToast({
title: `请扫描起点区域!`, title: `请扫描起点区域!`,
icon: "none", icon: "none",
@ -147,14 +188,17 @@ export default {
}); });
return; return;
} }
uni.showLoading({ uni.showLoading({
title: "提交中...", title: "提交中...",
}); });
let query = { let query = {
boxBarcode: this.boxCode || "", // boxBarcode: this.oneInput || "", // 使 mixin
endWcId: this.endCenterIndex, endWcId: this.endCenterIndex,
startStationCode: this.startCode, startStationCode: this.twoInput, // 使 mixin
}; };
this.$u.api this.$u.api
.boxBindingTesk(query) .boxBindingTesk(query)
.then((res) => { .then((res) => {
@ -164,17 +208,21 @@ export default {
}); });
uni.hideLoading(); uni.hideLoading();
this.startCode = ""; //
this.boxCode = "" this.clearInput(); // mixin
this.startData = null; this.startData = null;
this.startInputFocus = true; this.boxInputFocus = true;
this.startInputFocus = false;
}) })
.catch((err) => { .catch((err) => {
uni.hideLoading(); uni.hideLoading();
this.startCode = ""; uni.showToast({ title: err || '提交失败', icon: 'none' });
this.boxCode = ""
// 便
this.clearInput();
this.startData = null; this.startData = null;
this.startInputFocus = true; this.boxInputFocus = true;
this.startInputFocus = false;
}); });
}, },
}, },

@ -19,6 +19,8 @@
</view> </view>
</view> </view>
</uni-forms-item> </uni-forms-item>
<!-- 物料箱条码输入 -->
<uni-forms-item label="物料箱条码:" label-width="100px"> <uni-forms-item label="物料箱条码:" label-width="100px">
<template #label> <template #label>
<view class="custom-label"> <view class="custom-label">
@ -35,22 +37,21 @@
<view class="bottom-input-row"> <view class="bottom-input-row">
<view class="weight-input-wrapper"> <view class="weight-input-wrapper">
<view class="input-box"> <view class="input-box">
<!-- 修改点 1: 使用 mixin oneInput oneInputBlur -->
<input <input
type="text" type="text"
v-model="boxCode" v-model="oneInput"
@confirm="handleBoxConfirm" @input="oneInputBlur"
placeholder="物料箱条码" placeholder="物料箱条码"
class="uni-input-border" class="uni-input-border"
confirm-type="done"
:focus="boxInputFocus" :focus="boxInputFocus"
:key="'box-' + boxInputFocus" :key="'box-' + boxInputFocus"
/> />
<view v-if="boxCode" class="clear-icon" @click="clearBoxInput" <view v-if="oneInput" class="clear-icon" @click="clearBoxInput">清空</view>
>清空</view
>
</view> </view>
</view> </view>
</view> </view>
<view v-if="activeBox" class="box-stats"> <view v-if="activeBox" class="box-stats">
<view class="stats-left"> <view class="stats-left">
<text class="stats-label">当前物料箱</text> <text class="stats-label">当前物料箱</text>
@ -66,33 +67,32 @@
}}</text }}</text
> >
</view> </view>
<!-- <view class="stats-item">
<text class="stats-label">总重量</text>
<text class="stats-value-weight">{{ totalWeight }} g</text>
</view> -->
</view> </view>
</view> </view>
</uni-forms-item> </uni-forms-item>
<!-- 流程卡输入 -->
<uni-forms-item <uni-forms-item
:label=" :label="
scanMode === 'bind' ? `扫描流程卡(装箱):` : `扫描流程卡(解绑):` scanMode === 'bind' ? `扫描流程卡(装箱):` : `扫描流程卡(解绑):`
" "
label-width="200px" label-width="200px"
> >
<!-- 修改点 2: 使用 mixin twoInput twoInputBlur -->
<input <input
type="text" type="text"
v-model="cardCode" v-model="twoInput"
@confirm="handleCardConfirm" @input="twoInputBlur"
:disabled="!activeBox" :disabled="!activeBox"
placeholder="流程卡号" placeholder="流程卡号"
class="uni-input-border" class="uni-input-border"
:class="{ 'input-disabled': !activeBox }" :class="{ 'input-disabled': !activeBox }"
confirm-type="done"
:focus="cardInputFocus" :focus="cardInputFocus"
:key="'card-' + cardInputFocus" :key="'card-' + cardInputFocus"
/> />
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
<scroll-view class="orders-scroll" scroll-y> <scroll-view class="orders-scroll" scroll-y>
<view class="orders-header"> <view class="orders-header">
<view class="orders-left"> <view class="orders-left">
@ -122,10 +122,6 @@
class="order-card" class="order-card"
:class="{ 'order-latest': index === 0 }" :class="{ 'order-latest': index === 0 }"
> >
<!-- <view v-if="index === 0" class="latest-badge">最新</view> -->
<!-- <view class="delete-btn" @tap="handleDeleteOrder(order, index)">
<text class="delete-icon"></text>
</view> -->
<view class="order-header"> <view class="order-header">
<text class="order-no">{{ order.woOrder }}流程卡号</text> <text class="order-no">{{ order.woOrder }}流程卡号</text>
<text class="order-no">{{ order.cardNo }}</text> <text class="order-no">{{ order.cardNo }}</text>
@ -148,7 +144,10 @@
<script> <script>
import ifrm from "@/pages/index/ifrm"; import ifrm from "@/pages/index/ifrm";
import inputBlur from '@/mixin/inputBlur.js';
export default { export default {
mixins: [inputBlur], // mixin
components: { components: {
ifrm, ifrm,
}, },
@ -157,13 +156,13 @@ export default {
}, },
data() { data() {
return { return {
// oneInput, twoInput, oldOneInput mixin
list: ["绑定", "解绑"], list: ["绑定", "解绑"],
current: 1, current: 1,
boxInfo: { boxInfo: {
yieldOrderList: [], yieldOrderList: [],
}, },
boxCode: "", // boxCode cardCode mixin oneInput/twoInput
cardCode: "",
activeBox: null, activeBox: null,
orders: [], orders: [],
boxInputFocus: true, boxInputFocus: true,
@ -188,125 +187,80 @@ export default {
} }
return this.boxInfo.yieldOrderList.reduce((sum, o) => { return this.boxInfo.yieldOrderList.reduce((sum, o) => {
const weight = Number(o.actualWeighing) || 0; const weight = Number(o.actualWeighing) || 0;
// 0
return weight >= 0 ? sum + weight : sum; return weight >= 0 ? sum + weight : sum;
}, 0); }, 0);
}, },
}, },
methods: { methods: {
//
clearBoxInput() { clearBoxInput() {
this.boxCode = ""; this.clearOneInput(); // mixin
// key input focus
this.boxInputFocus = false; this.boxInputFocus = false;
this.$nextTick(() => { this.$nextTick(() => {
this.boxInputFocus = true; this.boxInputFocus = true;
}); });
}, },
handleOneClickUnbind() {
if (!this.activeBox) {
uni.showToast({
title: "请先扫描物料箱",
icon: "none",
});
return;
}
uni.showModal({
title: "确认解绑",
content: `确定要解绑物料箱 ${this.activeBox} 中的所有流程卡吗?`,
success: (res) => {
if (res.confirm) {
this.$u.api
.boxUnbind({ boxBarcode: this.activeBox })
.then(() => {
this.boxInfo.yieldOrderList = [];
this.activeBox = null;
this.boxCode = "";
uni.showToast({
title: "解绑成功",
icon: "success",
});
this.boxInputFocus = true;
this.cardInputFocus = false;
})
.catch((err) => {
uni.showToast({
title: err || "解绑失败",
icon: "error",
});
});
}
},
});
},
handleModeChange(mode) {
this.scanMode = mode;
this.hasData = false;
//
this.boxInfo = {
yieldOrderList: [],
};
this.boxCode = "";
this.cardCode = "";
this.activeBox = null;
this.orders = [];
this.boxInputFocus = true;
this.cardInputFocus = false;
uni.showToast({ // mixin
title: `已切换到${mode === "bind" ? "绑定" : "解绑"}模式`, oneInputData(val) {
icon: "none", // val mixin
}); if (!val) return;
},
handleDeleteOrder(order, index) { const code = val.trim();
uni.showModal({ this.handleBoxConfirmLogic(code);
title: "确认删除",
content: `确定要删除流程卡 ${order.cardNo} 吗?`,
success: (res) => {
if (res.confirm) {
this.boxInfo.yieldOrderList.splice(index, 1);
uni.showToast({
title: "删除成功",
icon: "success",
});
}
},
});
}, },
//
handleBoxConfirm() { // handleBoxConfirm
const code = this.boxCode.trim(); handleBoxConfirmLogic(code) {
if (!code) return; if (!code) return;
this.$u.api this.$u.api
.boxbarcodeDetails({ boxBarcode: this.boxCode, isDetail: false }) .boxbarcodeDetails({ boxBarcode: code, isDetail: false })
.then((res) => { .then((res) => {
this.boxInfo = res.data; this.boxInfo = res.data;
if (this.boxInfo.yieldOrderList == null) { if (this.boxInfo.yieldOrderList == null) {
this.boxInfo.yieldOrderList = []; this.boxInfo.yieldOrderList = [];
} }
});
this.activeBox = code; this.activeBox = code;
// ,
uni.showToast({ uni.showToast({
title: `物料箱 ${code} 已就绪`, title: `物料箱 ${code} 已就绪`,
icon: "none", icon: "none",
}); });
this.boxCode = "";
//
this.boxInputFocus = false; this.boxInputFocus = false;
this.cardInputFocus = true; this.cardInputFocus = true;
})
.catch(err => {
uni.showToast({ title: err || '查询失败', icon: 'none' });
// 便
this.oneInput = '';
this.oldOneInput = '';
this.boxInputFocus = false;
this.$nextTick(() => { this.boxInputFocus = true; });
});
},
// mixin
twoInputData(val) {
// val mixin
if (!val) return;
const code = val.trim();
this.handleCardConfirmLogic(code);
}, },
handleCardConfirm() { // handleCardConfirm
const code = this.cardCode; handleCardConfirmLogic(code) {
if (this.cardCode) {
if (!this.activeBox) { if (!this.activeBox) {
uni.showToast({ uni.showToast({
title: "请先扫描物料箱条码", title: "请先扫描物料箱条码",
icon: "none", icon: "none",
}); });
this.boxInputFocus = false; //
this.$nextTick(() => { this.cardInputFocus = false;
this.boxInputFocus = true; this.boxInputFocus = true;
});
return; return;
} }
@ -316,35 +270,24 @@ export default {
}); });
this.$u.api this.$u.api
.queryCardNo({ cardNo: this.cardCode }) .queryCardNo({ cardNo: code })
.then((res) => { .then((res) => {
uni.hideLoading(); uni.hideLoading();
//
if (this.scanMode === "bind") { if (this.scanMode === "bind") {
// === === // === ===
//
if ( if (
this.boxInfo.yieldOrderList.some( this.boxInfo.yieldOrderList.some(
(o) => o.cardNo === this.cardCode (o) => o.cardNo === code
) )
) { ) {
uni.showToast({ uni.showToast({
title: `订单 ${this.cardCode} 已在该箱中!`, title: `订单 ${code} 已在该箱中!`,
icon: "none", icon: "none",
}); });
this.cardCode = ""; } else {
this.cardInputFocus = false; //
this.$nextTick(() => {
this.cardInputFocus = true;
});
return;
}
//
this.boxInfo.yieldOrderList.push(res.data); this.boxInfo.yieldOrderList.push(res.data);
// >=0
const currentWeight = this.boxInfo.yieldOrderList.reduce( const currentWeight = this.boxInfo.yieldOrderList.reduce(
(sum, o) => { (sum, o) => {
const weight = Number(o.actualWeighing) || 0; const weight = Number(o.actualWeighing) || 0;
@ -358,21 +301,18 @@ export default {
title: `请注意箱子已超重!!!!!`, title: `请注意箱子已超重!!!!!`,
icon: "none", icon: "none",
}); });
//
this.boxInfo.yieldOrderList.pop(); this.boxInfo.yieldOrderList.pop();
} else { } else {
//
this.$u.api this.$u.api
.boxBinding({ .boxBinding({
boxBarcode: this.activeBox, boxBarcode: this.activeBox,
orderIdList: [this.cardCode], orderIdList: [code],
}) })
.then((bindRes) => { .then(() => {
uni.showToast({ uni.showToast({
title: `流程卡 ${code} 装箱绑定成功`, title: `流程卡 ${code} 装箱绑定成功`,
icon: "none", icon: "none",
}); });
//
this.refreshBoxInfo(); this.refreshBoxInfo();
}) })
.catch((bindErr) => { .catch((bindErr) => {
@ -380,44 +320,32 @@ export default {
title: bindErr || "绑定失败", title: bindErr || "绑定失败",
icon: "error", icon: "error",
}); });
//
this.boxInfo.yieldOrderList.pop(); this.boxInfo.yieldOrderList.pop();
}); });
} }
}
} else if (this.scanMode === "unbind") { } else if (this.scanMode === "unbind") {
// === === // === ===
//
const orderIndex = this.boxInfo.yieldOrderList.findIndex( const orderIndex = this.boxInfo.yieldOrderList.findIndex(
(o) => o.cardNo === this.cardCode (o) => o.cardNo === code
); );
if (orderIndex === -1) { if (orderIndex === -1) {
uni.showToast({ uni.showToast({
title: `订单 ${this.cardCode} 不在该箱中!`, title: `订单 ${code} 不在该箱中!`,
icon: "none", icon: "none",
}); });
this.cardCode = ""; } else {
this.cardInputFocus = false;
this.$nextTick(() => {
this.cardInputFocus = true;
});
return;
}
//
this.$u.api this.$u.api
.boxUnbind({ .boxUnbind({
// boxBarcode: this.activeBox, orderIdList: [code],
orderIdList: [this.cardCode],
}) })
.then((unbindRes) => { .then(() => {
uni.showToast({ uni.showToast({
title: `流程卡 ${code} 解绑成功`, title: `流程卡 ${code} 解绑成功`,
icon: "none", icon: "none",
}); });
//
this.boxInfo.yieldOrderList.splice(orderIndex, 1); this.boxInfo.yieldOrderList.splice(orderIndex, 1);
//
this.refreshBoxInfo(); this.refreshBoxInfo();
}) })
.catch((unbindErr) => { .catch((unbindErr) => {
@ -427,8 +355,11 @@ export default {
}); });
}); });
} }
}
this.cardCode = ""; // 便
this.twoInput = '';
this.oldTwoInput = '';
this.cardInputFocus = false; this.cardInputFocus = false;
this.$nextTick(() => { this.$nextTick(() => {
this.cardInputFocus = true; this.cardInputFocus = true;
@ -440,49 +371,82 @@ export default {
title: err, title: err,
icon: "error", icon: "error",
}); });
this.cardCode = ""; this.twoInput = '';
this.oldTwoInput = '';
this.cardInputFocus = false; this.cardInputFocus = false;
this.$nextTick(() => { this.$nextTick(() => {
this.cardInputFocus = true; this.cardInputFocus = true;
}); });
}); });
}
}, },
//
refreshBoxInfo() { handleOneClickUnbind() {
if (!this.activeBox) {
uni.showToast({
title: "请先扫描物料箱",
icon: "none",
});
return;
}
uni.showModal({
title: "确认解绑",
content: `确定要解绑物料箱 ${this.activeBox} 中的所有流程卡吗?`,
success: (res) => {
if (res.confirm) {
this.$u.api this.$u.api
.boxbarcodeDetails({ boxBarcode: this.activeBox, isDetail: false }) .boxUnbind({ boxBarcode: this.activeBox })
.then((res) => { .then(() => {
this.boxInfo = res.data;
if (this.boxInfo.yieldOrderList == null) {
this.boxInfo.yieldOrderList = []; this.boxInfo.yieldOrderList = [];
this.activeBox = null;
this.clearOneInput(); // 使 mixin
uni.showToast({
title: "解绑成功",
icon: "success",
});
this.boxInputFocus = true;
this.cardInputFocus = false;
})
.catch((err) => {
uni.showToast({
title: err || "解绑失败",
icon: "error",
});
});
} }
},
}); });
}, },
handleResetBox() { handleModeChange(mode) {
this.scanMode = mode;
this.hasData = false;
this.boxInfo = {
yieldOrderList: [],
};
this.clearInput(); // 使 mixin clearInput
this.activeBox = null; this.activeBox = null;
this.boxCode = "";
this.orders = []; this.orders = [];
this.boxInputFocus = true; this.boxInputFocus = true;
this.cardInputFocus = false; this.cardInputFocus = false;
},
//
handleSubmit() {
this.$u.api
.boxBinding({
boxBarcode: this.activeBox, //
orderIdList: this.boxInfo.yieldOrderList.map((o) => o.cardNo),
})
.then((res) => {
uni.showToast({ uni.showToast({
title: `装箱成功`, title: `已切换到${mode === "bind" ? "绑定" : "解绑"}模式`,
icon: "none", icon: "none",
}); });
this.cardCode = ""; },
refreshBoxInfo() {
this.$u.api
.boxbarcodeDetails({ boxBarcode: this.activeBox, isDetail: false })
.then((res) => {
this.boxInfo = res.data;
if (this.boxInfo.yieldOrderList == null) {
this.boxInfo.yieldOrderList = []; this.boxInfo.yieldOrderList = [];
}
}); });
}, },
// handleBoxConfirm handleCardConfirm
}, },
}; };
</script> </script>

@ -3,33 +3,18 @@
<u-sticky offset-top="0"> <u-sticky offset-top="0">
<uni-forms ref="wrForm" class="formBox"> <uni-forms ref="wrForm" class="formBox">
<uni-forms-item> <uni-forms-item>
<input <input class="uni-input-border" v-model="processCardNo" placeholder="请扫描流程卡号"
class="uni-input-border" placeholder-class="input-placeholder" :focus="processFocus" @input="handleCardNoConfirm" />
v-model="processCardNo"
placeholder="请扫描流程卡号"
placeholder-class="input-placeholder"
@confirm="handleCardNoConfirm"
/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item> <uni-forms-item>
<view class="bottom-input-row"> <view class="bottom-input-row">
<view class="weight-input-wrapper"> <view class="weight-input-wrapper">
<view class="input-box"> <view class="input-box">
<input <input class="input-field" v-model="weight" type="digit" placeholder="重量 (克)"
class="input-field" placeholder-class="input-placeholder" />
v-model="weight"
type="digit"
placeholder="重量 (克)"
placeholder-class="input-placeholder"
/>
</view> </view>
</view> </view>
<button <button class="submit-btn" :class="{ disabled: !canSubmit }" :disabled="!canSubmit" @tap="handleSubmit">
class="submit-btn"
:class="{ disabled: !canSubmit }"
:disabled="!canSubmit"
@tap="handleSubmit"
>
提交 提交
</button> </button>
</view> </view>
@ -84,8 +69,11 @@ export default {
data() { data() {
return { return {
processCardNo: "", processCardNo: "",
oldProcessCardNo: '',
processFocus:true,
weight: "", weight: "",
tableObj: {}, tableObj: {},
time: null,
orderInfo: { orderInfo: {
orderNo: "", orderNo: "",
materialCode: "", materialCode: "",
@ -109,13 +97,40 @@ export default {
this.$refs.ifrm.topMenuClick(btn); this.$refs.ifrm.topMenuClick(btn);
}, },
methods: { methods: {
handleCardNoConfirm() { clearInput(){
if (this.processCardNo) { this.oldProcessCardNo = ''
// this.processCardNo = ''
this.$u.api.queryCardNo({cardNo:this.processCardNo}).then((res) => {
},
handleCardNoConfirm(e) {
clearTimeout(this.time)
if (e.detail.value.length == 0) {
this.oldProcessCardNo = ''
this.processCardNo = e.detail.value
}
if (e.detail.value.length < this.oldProcessCardNo.length) {
this.processCardNo = e.detail.value
this.oldProcessCardNo = this.processCardNo
return
}
this.time = setTimeout(() => {
if (this.processCardNo.length >= 1) {
uni.showLoading({
title: '请稍候...'
})
this.processCardNo = e.detail.value.slice(this.oldProcessCardNo.length)
this.oldProcessCardNo = this.processCardNo
this.$u.api.queryCardNo({ cardNo: this.processCardNo }).then((res) => {
this.tableObj = res.data; this.tableObj = res.data;
}); this.clearInput()
uni.hideLoading()
}).catch(err=>{
uni.hideLoading()
this.clearInput()
})
} }
}, 1500);
}, },
// //
handleSubmit() { handleSubmit() {
@ -241,5 +256,4 @@ export default {
.submit-btn.disabled { .submit-btn.disabled {
opacity: 0.5; opacity: 0.5;
} }
</style> </style>

Loading…
Cancel
Save