物料问题修改

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({ return http.request({
url: '/blade-desk/order-bind/box-binding', url: '/blade-desk/order-bind/box-binding',
method: 'POST', method: 'POST',
data:data data: data
}) })
} }
@ -23,7 +23,7 @@ const boxBindingTesk = (data) => {
return http.request({ return http.request({
url: '/blade-desk/order/box-binding', url: '/blade-desk/order/box-binding',
method: 'POST', 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 { export default {
getWeighing, getWeighing,
getOrderBindPage, getOrderBindPage,
boxBinding, boxBinding,
boxBindingTesk, boxBindingTesk,
getWorkCenter, getWorkCenter,
receiveOrder, receiveOrder,
boxbarcodeDetails, boxbarcodeDetails,
queryCardNo, queryCardNo,
getQuantityLocation, getQuantityLocation,
getStationName, getStationName,
getStationNameBoxbarcode, getStationNameBoxbarcode,
getStationList, getStationList,
stationUpdate stationUpdate,
boxUnbind,
getStationRegion
} }

@ -2,6 +2,11 @@
<ifrm> <ifrm>
<uni-forms ref="wrForm" class="formBox" label-position="top"> <uni-forms ref="wrForm" class="formBox" label-position="top">
<uni-forms-item label="扫描模式:" label-width="100px" class="label-left"> <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="mode-switch">
<view <view
class="switch-btn" class="switch-btn"
@ -20,6 +25,11 @@
</view> </view>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="物料箱条码:" label-width="100px"> <uni-forms-item label="物料箱条码:" label-width="100px">
<template #label>
<view class="required-label">
<text>物料箱条码</text>
</view>
</template>
<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">
@ -64,6 +74,12 @@
label-width="100px" label-width="100px"
v-if="scanMode === 'bind'" v-if="scanMode === 'bind'"
> >
<template #label>
<view class="required-label">
<text class="required-mark">*</text>
<text>起点区域</text>
</view>
</template>
<input <input
type="text" type="text"
v-model="startCode" v-model="startCode"
@ -79,6 +95,12 @@
</view> </view>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="起点区域:" label-width="100px" v-else> <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 <picker
mode="selector" mode="selector"
:range="startAreas" :range="startAreas"
@ -110,6 +132,12 @@
</picker> </picker>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="终点区域:" label-width="150px"> <uni-forms-item label="终点区域:" label-width="150px">
<template #label>
<view class="required-label">
<text class="required-mark">*</text>
<text>终点区域</text>
</view>
</template>
<picker <picker
mode="selector" mode="selector"
:range="workCenters" :range="workCenters"
@ -125,6 +153,7 @@
</view> </view>
</picker> </picker>
<picker <picker
v-if="endAreas && endAreas.length > 0"
mode="selector" mode="selector"
:range="endAreas" :range="endAreas"
range-key="name" range-key="name"
@ -139,6 +168,10 @@
</text> </text>
</view> </view>
</picker> </picker>
<!-- 终点区域选择 - 无数据时显示提示 -->
<view v-else class="empty-tip-picker">
<text class="empty-text">暂无数据</text>
</view>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
<view class="footer-action"> <view class="footer-action">
@ -151,33 +184,6 @@
配送 配送
</button> </button>
</view> </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> </ifrm>
</template> </template>
@ -221,15 +227,7 @@ export default {
startStationIndex: 0, // startStationIndex: 0, //
}; };
}, },
computed: { 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;
},
},
mounted() { mounted() {
this.getWorkCenterList(); this.getWorkCenterList();
}, },
@ -238,11 +236,13 @@ export default {
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 = this.startAreas[index].id; 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);
}, },
@ -250,17 +250,37 @@ export default {
handleStartStationChange(e) { handleStartStationChange(e) {
const index = e.detail.value; const index = e.detail.value;
this.startStation = this.startStations[index].name; this.startStation = this.startStations[index].name;
this.startStationIndex = this.startStations[index].id; this.startStationIndex = index;
}, },
// //
getStartAreasList() { getStartAreasList() {
this.$u.api.getStartAreas().then((res) => { uni.showLoading({
this.startAreas = res.data.map((area) => ({ title: "加载中...",
id: area.id, mask: true,
name: area.areaName,
}));
}); });
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 // ID
@ -269,27 +289,78 @@ export default {
this.startStations = []; this.startStations = [];
return; return;
} }
this.$u.api.getStartStations({ areaId }).then((res) => {
this.startStations = res.data.map((station) => ({ // startAreas stationCodeList
id: station.id, const area = this.startAreas.find((item) => item.id === areaId);
name: station.stationName,
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) { if (this.startStations.length > 0) {
this.startStation = this.startStations[0].name; 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) { handleEndChange(e) {
const index = e.detail.value; const index = e.detail.value;
this.endCenter = this.workCenters[index].name; const selectedWorkCenter = this.workCenters[index];
this.endCenterIndex = index;
// this.endCenter = selectedWorkCenter.name;
this.endCenterIndex = selectedWorkCenter.id;
//
this.endArea = ""; this.endArea = "";
this.endAreaIndex = 0; 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") { if (mode === "unbind") {
this.getStartAreasList(); this.getStartAreasList();
} }
uni.showToast({
title: `已切换到${mode === "bind" ? "送料" : "叫料"}模式`,
icon: "none",
});
}, },
// //
detailsFn() { detailsFn() {
@ -411,11 +486,6 @@ export default {
}); });
}, },
handleEndChange(e) {
const index = e.detail.value;
this.endCenter = this.workCenters[index].name;
},
// //
getWorkCenterList() { getWorkCenterList() {
this.$u.api.getWorkCenter().then((res) => { this.$u.api.getWorkCenter().then((res) => {
@ -423,6 +493,7 @@ export default {
this.workCenters = res.data.map((c) => ({ this.workCenters = res.data.map((c) => ({
id: c.id, id: c.id,
name: c.wcName, name: c.wcName,
stationRegionList: c.stationRegionList,
})); }));
}); });
}, },
@ -880,6 +951,37 @@ export default {
opacity: 0.5; opacity: 0.5;
background-color: #f1f5f9; 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 { .uni-input-border {
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }

@ -56,7 +56,9 @@
<view class="stats-right"> <view class="stats-right">
<view class="stats-item"> <view class="stats-item">
<text class="stats-label">配送终点</text> <text class="stats-label">配送终点</text>
<text class="stats-value">{{ totalCount }}</text> <text class="stats-value"
>{{ boxInfo.wcName }}-{{ boxInfo.stationRegion }}</text
>
</view> </view>
<!-- <view class="stats-item"> <!-- <view class="stats-item">
<text class="stats-label">总重量</text> <text class="stats-label">总重量</text>
@ -65,7 +67,12 @@
</view> </view>
</view> </view>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="扫描流程卡(装箱):" label-width="200px"> <uni-forms-item
:label="
scanMode === 'bind' ? `扫描流程卡(装箱):` : `扫描流程卡(解绑):`
"
label-width="200px"
>
<input <input
type="text" type="text"
v-model="cardCode" v-model="cardCode"
@ -110,16 +117,20 @@
:class="{ 'order-latest': index === 0 }" :class="{ 'order-latest': index === 0 }"
> >
<!-- <view v-if="index === 0" class="latest-badge">最新</view> --> <!-- <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> <text class="delete-icon"></text>
</view> </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>
</view> </view>
<view class="order-footer"> <view class="order-footer">
<text class="order-part">{{ order.partCode }}</text> <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> </view>
</view> </view>
@ -165,7 +176,9 @@ export default {
return 0; return 0;
} }
return this.boxInfo.yieldOrderList.reduce((sum, o) => { 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); }, 0);
}, },
}, },
@ -209,6 +222,21 @@ export default {
handleModeChange(mode) { handleModeChange(mode) {
this.scanMode = mode; this.scanMode = mode;
this.hasData = false; 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) { handleDeleteOrder(order, index) {
uni.showModal({ uni.showModal({
@ -250,7 +278,6 @@ export default {
handleCardConfirm() { handleCardConfirm() {
const code = this.cardCode; const code = this.cardCode;
// if (!code) return;
if (this.cardCode) { if (this.cardCode) {
if (!this.activeBox) { if (!this.activeBox) {
uni.showToast({ uni.showToast({
@ -263,46 +290,125 @@ export default {
}); });
return; 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({ uni.showLoading({
title: "查询中...", title: "查询中...",
mask: true, mask: true,
}); });
this.$u.api this.$u.api
.queryCardNo({ cardNo: this.cardCode }) .queryCardNo({ cardNo: this.cardCode })
.then((res) => { .then((res) => {
this.boxInfo.yieldOrderList.push(res.data);
uni.hideLoading(); uni.hideLoading();
//
const currentWeight = this.boxInfo.yieldOrderList.reduce( //
(sum, o) => { if (this.scanMode === "bind") {
return sum + (Number(o.actualWeighing) || 0); // === ===
}, //
0 if (
); this.boxInfo.yieldOrderList.some(
if (currentWeight > 50000) { (o) => o.cardNo === this.cardCode
uni.showToast({ )
title: `请注意箱子已超重!!!!!`, ) {
icon: "warring", uni.showToast({
}); title: `订单 ${this.cardCode} 已在该箱中!`,
} else { icon: "none",
uni.showToast({ });
title: `流程卡 ${code} 装箱成功`, this.cardCode = "";
icon: "success", 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 = ""; this.cardCode = "";
@ -312,6 +418,7 @@ export default {
}); });
}) })
.catch((err) => { .catch((err) => {
uni.hideLoading();
uni.showToast({ uni.showToast({
title: err, title: err,
icon: "error", 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() { handleResetBox() {
this.activeBox = null; this.activeBox = null;

Loading…
Cancel
Save