物料问题修改

master
zhangdi 2 weeks ago
parent 82df365374
commit b1df61fb5b
  1. 51
      api/logistics.js
  2. 220
      pages/logistics/delivery.vue
  3. 196
      pages/logistics/packaging.vue

@ -14,7 +14,7 @@ const boxBinding = (data) => {
return http.request({
url: '/blade-desk/order-bind/box-binding',
method: 'POST',
data:data
data: data
})
}
@ -23,7 +23,7 @@ const boxBindingTesk = (data) => {
return http.request({
url: '/blade-desk/order/box-binding',
method: 'POST',
data:data
data: data
})
}
@ -116,18 +116,39 @@ const stationUpdate = (data) => {
})
}
// 物料箱一键解绑
const boxUnbind = (data) => {
return http.request({
url: '/blade-desk/order-bind/box-unbind',
method: 'POST',
data:data
})
}
// 叫料--起点区域站点
const getStationRegion = (params) => {
return http.request({
url: '/blade-desk/order/stationRegion-list',
method: 'GET',
params
})
}
export default {
getWeighing,
getOrderBindPage,
boxBinding,
boxBindingTesk,
getWorkCenter,
receiveOrder,
boxbarcodeDetails,
queryCardNo,
getQuantityLocation,
getStationName,
getStationNameBoxbarcode,
getStationList,
stationUpdate
getWeighing,
getOrderBindPage,
boxBinding,
boxBindingTesk,
getWorkCenter,
receiveOrder,
boxbarcodeDetails,
queryCardNo,
getQuantityLocation,
getStationName,
getStationNameBoxbarcode,
getStationList,
stationUpdate,
boxUnbind,
getStationRegion
}

@ -2,6 +2,11 @@
<ifrm>
<uni-forms ref="wrForm" class="formBox" label-position="top">
<uni-forms-item label="扫描模式:" label-width="100px" class="label-left">
<template #label>
<view class="required-label">
<text>扫描模式</text>
</view>
</template>
<view class="mode-switch">
<view
class="switch-btn"
@ -20,6 +25,11 @@
</view>
</uni-forms-item>
<uni-forms-item label="物料箱条码:" label-width="100px">
<template #label>
<view class="required-label">
<text>物料箱条码</text>
</view>
</template>
<view class="bottom-input-row">
<view class="weight-input-wrapper">
<view class="input-box">
@ -64,6 +74,12 @@
label-width="100px"
v-if="scanMode === 'bind'"
>
<template #label>
<view class="required-label">
<text class="required-mark">*</text>
<text>起点区域</text>
</view>
</template>
<input
type="text"
v-model="startCode"
@ -79,6 +95,12 @@
</view>
</uni-forms-item>
<uni-forms-item label="起点区域:" label-width="100px" v-else>
<template #label>
<view class="required-label">
<text class="required-mark">*</text>
<text>起点区域</text>
</view>
</template>
<picker
mode="selector"
:range="startAreas"
@ -110,6 +132,12 @@
</picker>
</uni-forms-item>
<uni-forms-item label="终点区域:" label-width="150px">
<template #label>
<view class="required-label">
<text class="required-mark">*</text>
<text>终点区域</text>
</view>
</template>
<picker
mode="selector"
:range="workCenters"
@ -125,6 +153,7 @@
</view>
</picker>
<picker
v-if="endAreas && endAreas.length > 0"
mode="selector"
:range="endAreas"
range-key="name"
@ -139,6 +168,10 @@
</text>
</view>
</picker>
<!-- 终点区域选择 - 无数据时显示提示 -->
<view v-else class="empty-tip-picker">
<text class="empty-text">暂无数据</text>
</view>
</uni-forms-item>
</uni-forms>
<view class="footer-action">
@ -151,33 +184,6 @@
配送
</button>
</view>
<view v-if="showDetails" class="popup-overlay" @click="showDetails = false">
<view class="popup-content" @click.stop>
<view class="popup-header">
<text class="popup-title"> {{ boxData.boxBarcode }} 明细</text>
</view>
<scroll-view class="popup-scroll" scroll-y>
<view class="popup-orders">
<view
v-for="(order, index) in yieldOrderList"
:key="index"
class="popup-order-item"
>
<view class="popup-order-header">
<text class="popup-order-no">{{ order.partCode }}</text>
<text class="popup-order-qty">{{ order.actualWeighing }}g</text>
</view>
<text class="popup-order-name">{{ order.partName }}</text>
</view>
</view>
</scroll-view>
<view class="popup-footer">
<button @click="showDetails = false" class="popup-close-btn">
关闭
</button>
</view>
</view>
</view>
</ifrm>
</template>
@ -221,15 +227,7 @@ export default {
startStationIndex: 0, //
};
},
computed: {
endCenterIndex() {
if (!this.endCenter) return 0;
const index = this.workCenters.find((c) => c.name === this.endCenter);
console.log(9999, this.endCenter, index.id);
return index.id;
},
},
computed: {},
mounted() {
this.getWorkCenterList();
},
@ -238,11 +236,13 @@ export default {
handleStartAreaChange(e) {
const index = e.detail.value;
this.startArea = this.startAreas[index].name;
this.startAreaIndex = this.startAreas[index].id;
this.startAreaIndex = index;
//
this.startStation = "";
this.startStationIndex = 0;
//
// stationCodeList
this.getStartStationsList(this.startAreas[index].id);
},
@ -250,17 +250,37 @@ export default {
handleStartStationChange(e) {
const index = e.detail.value;
this.startStation = this.startStations[index].name;
this.startStationIndex = this.startStations[index].id;
this.startStationIndex = index;
},
//
getStartAreasList() {
this.$u.api.getStartAreas().then((res) => {
this.startAreas = res.data.map((area) => ({
id: area.id,
name: area.areaName,
}));
uni.showLoading({
title: "加载中...",
mask: true,
});
this.$u.api
.getStationRegion()
.then((res) => {
uni.hideLoading();
console.log("起点区域列表:", res.data);
this.startAreas = res.data.map((area) => ({
id: area.stationRegion,
name: area.stationRegion,
stationCodeList: area.stationCodeList || [],
}));
})
.catch((err) => {
uni.hideLoading();
console.error("获取区域列表失败:", err);
uni.showToast({
title: "加载区域列表失败",
icon: "none",
});
});
},
// ID
@ -269,27 +289,78 @@ export default {
this.startStations = [];
return;
}
this.$u.api.getStartStations({ areaId }).then((res) => {
this.startStations = res.data.map((station) => ({
id: station.id,
name: station.stationName,
// startAreas stationCodeList
const area = this.startAreas.find((item) => item.id === areaId);
if (area && area.stationCodeList && area.stationCodeList.length > 0) {
// stationCodeList picker
this.startStations = area.stationCodeList.map((code, index) => ({
id: code,
name: code,
}));
//
if (this.startStations.length > 0) {
this.startStation = this.startStations[0].name;
this.startStationIndex = this.startStations[0].id;
this.startStationIndex = 0;
}
});
} else {
this.startStations = [];
this.startStation = "";
this.startStationIndex = 0;
}
},
//
handleEndChange(e) {
const index = e.detail.value;
this.endCenter = this.workCenters[index].name;
this.endCenterIndex = index;
//
const selectedWorkCenter = this.workCenters[index];
this.endCenter = selectedWorkCenter.name;
this.endCenterIndex = selectedWorkCenter.id;
//
this.endArea = "";
this.endAreaIndex = 0;
this.getEndAreaList(this.workCenters[index].id);
console.log("选中的作业中心:", selectedWorkCenter);
console.log("stationRegionList:", selectedWorkCenter.stationRegionList);
// stationRegionList
if (
selectedWorkCenter.stationRegionList &&
selectedWorkCenter.stationRegionList.length > 0
) {
// stationRegionList
const firstItem = selectedWorkCenter.stationRegionList[0];
if (typeof firstItem === "object") {
//
this.endAreas = selectedWorkCenter.stationRegionList.map(
(region) => ({
id: region.id,
name: region.regionName || region.name || region.areaName,
})
);
} else {
//
this.endAreas = selectedWorkCenter.stationRegionList.map(
(region, idx) => ({
id: idx,
name: region,
})
);
}
//
if (this.endAreas.length > 0) {
this.endArea = this.endAreas[0].name;
this.endAreaIndex = this.endAreas[0].id;
}
} else {
this.endAreas = [];
console.log("stationRegionList 为空或不存在");
}
},
//
@ -355,6 +426,10 @@ export default {
if (mode === "unbind") {
this.getStartAreasList();
}
uni.showToast({
title: `已切换到${mode === "bind" ? "送料" : "叫料"}模式`,
icon: "none",
});
},
//
detailsFn() {
@ -411,11 +486,6 @@ export default {
});
},
handleEndChange(e) {
const index = e.detail.value;
this.endCenter = this.workCenters[index].name;
},
//
getWorkCenterList() {
this.$u.api.getWorkCenter().then((res) => {
@ -423,6 +493,7 @@ export default {
this.workCenters = res.data.map((c) => ({
id: c.id,
name: c.wcName,
stationRegionList: c.stationRegionList,
}));
});
},
@ -880,6 +951,37 @@ export default {
opacity: 0.5;
background-color: #f1f5f9;
}
.uni-input-border {
margin-bottom: 20rpx;
}
.required-label {
display: flex;
align-items: center;
}
.required-mark {
color: #ff0000;
font-size: 28rpx;
font-weight: bold;
margin-right: 4rpx;
}
/* 空数据提示样式 */
.empty-tip-picker {
width: 100%;
padding: 16rpx;
background-color: #f8fafc;
border: 2rpx solid #e2e8f0;
border-radius: 4rpx;
margin-bottom: 20rpx;
}
.empty-text {
color: #94a3b8;
font-size: 28rpx;
text-align: center;
display: block;
}
.uni-input-border {
margin-bottom: 20rpx;
}

@ -56,7 +56,9 @@
<view class="stats-right">
<view class="stats-item">
<text class="stats-label">配送终点</text>
<text class="stats-value">{{ totalCount }}</text>
<text class="stats-value"
>{{ boxInfo.wcName }}-{{ boxInfo.stationRegion }}</text
>
</view>
<!-- <view class="stats-item">
<text class="stats-label">总重量</text>
@ -65,7 +67,12 @@
</view>
</view>
</uni-forms-item>
<uni-forms-item label="扫描流程卡(装箱):" label-width="200px">
<uni-forms-item
:label="
scanMode === 'bind' ? `扫描流程卡(装箱):` : `扫描流程卡(解绑):`
"
label-width="200px"
>
<input
type="text"
v-model="cardCode"
@ -110,16 +117,20 @@
:class="{ 'order-latest': index === 0 }"
>
<!-- <view v-if="index === 0" class="latest-badge">最新</view> -->
<view class="delete-btn" @tap="handleDeleteOrder(order, index)">
<!-- <view class="delete-btn" @tap="handleDeleteOrder(order, index)">
<text class="delete-icon"></text>
</view>
</view> -->
<view class="order-header">
<text class="order-no">{{ order.woOrder }}订单号</text>
<text class="order-no">{{ order.cardNo }}</text>
</view>
<view class="order-footer">
<text class="order-part">{{ order.partCode }}</text>
<text class="order-weight">{{ order.actualWeighing }} g</text>
<text class="order-weight"
>{{
order.actualWeighing >= 0 ? order.actualWeighing + "g" : 0 + "g"
}}
</text>
</view>
</view>
</view>
@ -165,7 +176,9 @@ export default {
return 0;
}
return this.boxInfo.yieldOrderList.reduce((sum, o) => {
return sum + (Number(o.actualWeighing) || 0);
const weight = Number(o.actualWeighing) || 0;
// 0
return weight >= 0 ? sum + weight : sum;
}, 0);
},
},
@ -209,6 +222,21 @@ export default {
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({
title: `已切换到${mode === "bind" ? "绑定" : "解绑"}模式`,
icon: "none",
});
},
handleDeleteOrder(order, index) {
uni.showModal({
@ -250,7 +278,6 @@ export default {
handleCardConfirm() {
const code = this.cardCode;
// if (!code) return;
if (this.cardCode) {
if (!this.activeBox) {
uni.showToast({
@ -263,46 +290,125 @@ export default {
});
return;
}
if (
this.boxInfo.yieldOrderList.some((o) => o.cardNo === this.cardCode)
) {
uni.showToast({
title: `订单 ${this.cardCode} 已在该箱中!`,
icon: "none",
});
this.cardCode = "";
this.cardInputFocus = false;
this.$nextTick(() => {
this.cardInputFocus = true;
});
return;
}
uni.showLoading({
title: "查询中...",
mask: true,
});
this.$u.api
.queryCardNo({ cardNo: this.cardCode })
.then((res) => {
this.boxInfo.yieldOrderList.push(res.data);
uni.hideLoading();
//
const currentWeight = this.boxInfo.yieldOrderList.reduce(
(sum, o) => {
return sum + (Number(o.actualWeighing) || 0);
},
0
);
if (currentWeight > 50000) {
uni.showToast({
title: `请注意箱子已超重!!!!!`,
icon: "warring",
});
} else {
uni.showToast({
title: `流程卡 ${code} 装箱成功`,
icon: "success",
});
//
if (this.scanMode === "bind") {
// === ===
//
if (
this.boxInfo.yieldOrderList.some(
(o) => o.cardNo === this.cardCode
)
) {
uni.showToast({
title: `订单 ${this.cardCode} 已在该箱中!`,
icon: "none",
});
this.cardCode = "";
this.cardInputFocus = false;
this.$nextTick(() => {
this.cardInputFocus = true;
});
return;
}
//
this.boxInfo.yieldOrderList.push(res.data);
// >=0
const currentWeight = this.boxInfo.yieldOrderList.reduce(
(sum, o) => {
const weight = Number(o.actualWeighing) || 0;
return weight >= 0 ? sum + weight : sum;
},
0
);
if (currentWeight > 50000) {
uni.showToast({
title: `请注意箱子已超重!!!!!`,
icon: "warring",
});
//
this.boxInfo.yieldOrderList.pop();
} else {
//
this.$u.api
.boxBinding({
boxBarcode: this.activeBox,
orderIdList: this.boxInfo.yieldOrderList.map(
(o) => o.cardNo
),
})
.then((bindRes) => {
uni.showToast({
title: `流程卡 ${code} 装箱绑定成功`,
icon: "success",
});
//
this.refreshBoxInfo();
})
.catch((bindErr) => {
uni.showToast({
title: bindErr || "绑定失败",
icon: "error",
});
//
this.boxInfo.yieldOrderList.pop();
});
}
} else if (this.scanMode === "unbind") {
// === ===
//
const orderIndex = this.boxInfo.yieldOrderList.findIndex(
(o) => o.cardNo === this.cardCode
);
if (orderIndex === -1) {
uni.showToast({
title: `订单 ${this.cardCode} 不在该箱中!`,
icon: "none",
});
this.cardCode = "";
this.cardInputFocus = false;
this.$nextTick(() => {
this.cardInputFocus = true;
});
return;
}
//
this.$u.api
.boxUnbind({
boxBarcode: this.activeBox,
orderIdList: [this.cardCode],
})
.then((unbindRes) => {
uni.showToast({
title: `流程卡 ${code} 解绑成功`,
icon: "success",
});
//
this.boxInfo.yieldOrderList.splice(orderIndex, 1);
//
this.refreshBoxInfo();
})
.catch((unbindErr) => {
uni.showToast({
title: unbindErr || "解绑失败",
icon: "error",
});
});
}
this.cardCode = "";
@ -312,6 +418,7 @@ export default {
});
})
.catch((err) => {
uni.hideLoading();
uni.showToast({
title: err,
icon: "error",
@ -324,6 +431,17 @@ export default {
});
}
},
//
refreshBoxInfo() {
this.$u.api
.boxbarcodeDetails({ boxBarcode: this.activeBox })
.then((res) => {
this.boxInfo = res.data;
if (this.boxInfo.yieldOrderList == null) {
this.boxInfo.yieldOrderList = [];
}
});
},
handleResetBox() {
this.activeBox = null;

Loading…
Cancel
Save