add 托盘混料组盘,修改时间11月28日

This commit is contained in:
2025-12-23 14:29:04 +08:00
parent 226e512018
commit 8ca43064e6
8 changed files with 415 additions and 11 deletions

View File

@@ -1,6 +1,5 @@
# 注意事项
+ 原生APP云打包使用自有证书
+ 证书别名testalias
+ 接口在线地址:(https://apifox.com/apidoc/shared-e9d4798e-2db1-493d-a0cb-7a0e881c4bd6/api-160097540)
+ app图标为lms
+ 接口在线地址http://47.98.105.245:8001/project/21/interface/api/cat_122
+ 接口在线地址:[http://47.111.78.178:8014/]

135
components/LimitInput.vue Normal file
View File

@@ -0,0 +1,135 @@
<template>
<input
type="number"
:value="displayValue"
@input="handleInput"
@blur="handleBlur"
:class="inputClass"
/>
</template>
<script>
export default {
name: "LimitInput",
props: {
value: [Number, String],
inputClass: {
type: String,
default: ''
},
// 输入模式integer(纯整数), decimal(纯小数), mixed(混合)
mode: {
type: String,
default: "mixed",
validator: (v) => ["integer", "decimal", "mixed"].includes(v),
},
// 小数位数限制
decimalLength: {
type: Number,
default: 2,
},
// 最小值
min: {
type: Number,
default: 0,
},
// 最大值
max: {
type: Number,
default: Infinity,
},
},
data() {
return {
displayValue: this.value?.toString() || "",
};
},
watch: {
value(newVal) {
this.displayValue = newVal?.toString() || "";
},
},
methods: {
handleInput(e) {
let value = e.detail.value;
// 1. 过滤非法字符
let filtered = value.replace(/[^\d.]/g, "");
// 2. 处理多余的小数点
if (this.mode === "integer") {
filtered = filtered.replace(/\./g, ""); // 整数模式删除所有小数点
} else {
const firstDotIndex = filtered.indexOf(".");
if (firstDotIndex !== -1) {
// 只保留第一个小数点
filtered =
filtered.substring(0, firstDotIndex + 1) +
filtered.substring(firstDotIndex + 1).replace(/\./g, "");
}
}
// 3. 处理前导0
if (filtered.startsWith("0") && filtered.length > 1 && !filtered.startsWith("0.")) {
filtered = filtered.replace(/^0+/, "0").replace(/^0([^.])/, "$1");
}
// 4. 处理开头的小数点
if (filtered.startsWith(".")) {
if (this.mode === "integer") {
filtered = "";
} else {
filtered = "0" + filtered;
}
}
this.displayValue = filtered;
},
handleBlur() {
let value = this.displayValue;
// 空值处理
if (value === "" || value === ".") {
this.$emit("input", "");
return;
}
// 处理结尾的小数点
if (value.endsWith(".")) {
value = value.slice(0, -1);
}
// 转换为数字
const numValue = Number(value);
// 小数位数处理
let processedValue = value;
if (this.mode !== "integer" && value.includes(".")) {
const parts = value.split(".");
if (parts[1].length > this.decimalLength) {
processedValue = `${parts[0]}.${parts[1].slice(0, this.decimalLength)}`;
}
}
// 范围校验
let finalNum = Number(processedValue);
if (finalNum < this.min) finalNum = this.min;
if (finalNum > this.max) finalNum = this.max;
// 更新值
this.displayValue = finalNum.toString();
this.$emit("input", finalNum);
},
},
};
</script>
<style scoped>
.number-input {
border: 1px solid #ddd;
padding: 8px 12px;
border-radius: 4px;
font-size: 14px;
}
</style>

View File

@@ -321,6 +321,13 @@
"navigationStyle": "custom"
}
},
{
"path" : "pages/entry/tray-mix-group",
"style" :
{
"navigationStyle": "custom"
}
}
],
"globalStyle": {

View File

@@ -29,7 +29,20 @@
<th>仓库编码</th>
</tr>
</thead>
<tbody>
<tbody v-if="check === 'all'">
<tr v-for="(e, i) in dataList" :class="{'checked': e.checked}" @tap="allCheck(e)">
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.material_spec}}</td>
<td>{{e.unit_id}}</td>
<td>{{e.single_weight}}</td>
<td>{{e.pcsn}}</td>
<td>{{e.qty}}</td>
<td>{{e.vehicle_code}}</td>
<td>{{e.stor_code}}</td>
</tr>
</tbody>
<tbody v-else>
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.material_id === pkId}" @tap="toCheck(e)">
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
@@ -50,7 +63,8 @@
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
<button class="zd-col-8 button-primary" @tap="searchList">查询</button>
<button class="zd-col-8 button-primary" :class="{'button-info': !pkId}" @tap="toSure">确认</button>
<button v-if="check === 'all'" class="zd-col-8 button-primary" :class="{'button-info': !checkData.length}" @tap="toSure1">确认</button>
<button v-else class="zd-col-8 button-primary" :class="{'button-info': !pkId}" @tap="toSure">确认</button>
</view>
</view>
</template>
@@ -66,6 +80,8 @@
},
data() {
return {
check: null,
checkData: [],
title: '',
val1: '',
dataList: [],
@@ -85,6 +101,7 @@
},
onLoad (options) {
this.title = options.title
this.check = options.check
},
methods: {
searchList () {
@@ -98,6 +115,11 @@
this.totalCount = res.totalElements
if (res.totalElements > 0) {
const dataMap = res.content
if (this.check === 'all') {
dataMap.map(el => {
this.$set(el, 'checked', false)
})
}
this.dataList = this.reload ? dataMap : this.dataList.concat(dataMap)
this.reload = false
} else {
@@ -124,11 +146,22 @@
this.pkId = this.pkId === e.material_id ? '' : e.material_id
this.pkObj = this.pkId === e.material_id ? e : {}
},
allCheck (e) {
e.checked = !e.checked
this.checkData = this.dataList.filter(el => {return el.checked})
},
toEmpty () {
this.val1 = ''
this.dataList = []
this.pageNum = 1
this.pkId = ''
this.checkData = []
},
toSure1 () {
if (this.checkData.length > 0) {
this.$store.dispatch('setPublicArr', this.checkData)
uni.navigateBack()
}
},
toSure () {
if (this.pkId) {

View File

@@ -0,0 +1,174 @@
<template>
<view class="zd_container">
<!-- 托盘混料组盘 -->
<nav-bar title="托盘混料组盘"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-24">
<search-box
v-model="code"
/>
</view>
</view>
</view>
<button type="primary" class="mgb10 button-add" @tap="toJump"><uni-icons type="plus" size="30" color="#ffffff"></uni-icons>添加物料</button>
<view v-show="dataList.length > 0" class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>物料名称</th>
<th>物料编码</th>
<th>数量</th>
<th>批次号</th>
<th>单重</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{e.material_name}}</td>
<td>{{e.material_code}}</td>
<td>
<LimitInput
input-class="td_input"
:class="{'error-border': !e.qty || e.qty.toString().trim() === ''}"
mode="integer"
v-model="e.qty"
/>
</td>
<td>
<input
type="text"
class="td_input"
:class="{'error-border': !e.pcsn || e.pcsn.toString().trim() === ''}"
v-model="e.pcsn"
/>
</td>
<td>
<LimitInput
input-class="td_input"
mode="mixed"
:decimalLength="6"
v-model="e.single_weight"
/>
</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="toEmpty">清空</button>
<button class="zd-col-16 button-primary" :class="{'button-info': !code || !dataList.length}" :disabled="disabled" @tap="_mixingGroupDick">组盘确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import LimitInput from '@/components/LimitInput.vue'
import { mixingGroupDick } from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox,
LimitInput
},
data() {
return {
title: '',
code: '',
dataList: [],
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
onShow () {
if (this.$store.getters.publicArr !== '') {
const currentData = this.$store.getters.publicArr
this.dataList = this.dataList.concat(currentData)
this.$store.dispatch('setPublicArr', '')
}
},
methods: {
toJump () {
uni.navigateTo({
url: '/pages/common/mater-list?title=查询物料&check=all'
})
},
toEmpty () {
this.dataList = []
this.disabled = false
},
validateData() {
let isValid = true
this.dataList.forEach((item) => {
if (!item.qty || item.qty.toString().trim() === '') {
isValid = false
}
if (!item.pcsn || item.pcsn.toString().trim() === '') {
isValid = false
}
})
return isValid
},
async _mixingGroupDick () {
this.disabled = true
if (!this.code || !this.dataList.length) {
this.disabled = false
return
}
if (!this.validateData()) {
uni.showToast({
title: '物料数量和批次号不能为空',
icon: 'none'
})
this.disabled = false
return
}
try {
let res = await mixingGroupDick(this.code, this.dataList)
if (res.code === '200') {
this.dataList = []
}
this.disabled = false
uni.showToast({
title: res.msg,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus" scoped>
.button-add
display flex
justify-content center
align-items center
line-height: 34rpx;
height: 88rpx;
.td_input
width: 180rpx;
height: 80rpx;
line-height: 80rpx;
border: 1px solid #dcdfe6;
background-color: #fff;
padding: 0 15rpx;
font-size: 34rpx;
color: #606266;
border-radius: 10rpx;
.error-border
border: 1px solid #ff6a00 !important
</style>

View File

@@ -42,12 +42,61 @@
return {
userName: '',
menuList: [
{title: '入库管理', path: 'RF01', sonTree: [{title: '物料组盘入库', path: '/pages/entry/mater-group-to-store'}, {title: '合格证入库', path: '/pages/entry/qualified-to-store'}, {title: '单据入库', path: '/pages/entry/bill-to-store'}, {title: '盘点入库', path: '/pages/entry/check-to-store'}, {title: '空托盘入库', path: '/pages/entry/empty-tray-to-store'}]},
{title: '库管理', path: 'RF02', sonTree: [{title: '空托盘出库', path: '/pages/outbound/tray-out-store'}, {title: '出库确认', path: '/pages/outbound/out-store-confirm'}, {title: '单据出库', path: '/pages/outbound/bill-list'}, {title: '盘点出库', path: '/pages/outbound/stock-out-store'}]},
{title: '拣选管理', path: 'RF04', sonTree: [{title: '拣选作业', path: '/pages/pick/pick-task'}]},
{title: '设备操控', path: 'RF07', sonTree: [{title: '切换出入库模式', path: '/pages/mode/switch-in-out'}, {title: '拣选工位启停模式', path: '/pages/mode/pick'}, {title: '下发输送线运动命令', path: '/pages/mode/command'}]},
{title: '产线叫料', path: 'RF10', sonTree: [{title: '二楼生产出库', path: '/pages/outbound/produce-out-store-2nd'}, {title: '二楼取货确认', path: '/pages/outbound/pick-confirm-2nd'}, {title: '二楼货架绑定', path: '/pages/outbound/shelf-bind-2nd'}]},
{title: '转运管理', path: 'RF09', sonTree: [{title: '托盘转运', path: '/pages/transfer/tray-transfer'}, {title: '打印测试', path: '/pages/test'}]}
{
title: '库管理',
path: 'RF01',
sonTree: [
{title: '物料组盘入库', path: '/pages/entry/mater-group-to-store'},
{title: '合格证入库', path: '/pages/entry/qualified-to-store'},
{title: '托盘混料组盘', path: '/pages/entry/tray-mix-group'},
{title: '单据入库', path: '/pages/entry/bill-to-store'},
{title: '盘点入库', path: '/pages/entry/check-to-store'},
{title: '空托盘入库', path: '/pages/entry/empty-tray-to-store'},
],
},
{
title: '出库管理',
path: 'RF02',
sonTree: [
{title: '空托盘出库', path: '/pages/outbound/tray-out-store'},
{title: '出库确认', path: '/pages/outbound/out-store-confirm'},
{title: '单据出库', path: '/pages/outbound/bill-list'},
{title: '盘点出库', path: '/pages/outbound/stock-out-store'},
],
},
{
title: '拣选管理',
path: 'RF04',
sonTree: [
{title: '拣选作业', path: '/pages/pick/pick-task'},
],
},
{
title: '设备操控',
path: 'RF07',
sonTree: [
{title: '切换出入库模式', path: '/pages/mode/switch-in-out'},
{title: '拣选工位启停模式', path: '/pages/mode/pick'},
{title: '下发输送线运动命令', path: '/pages/mode/command'},
],
},
{
title: '产线叫料',
path: 'RF10',
sonTree: [
{title: '二楼生产出库', path: '/pages/outbound/produce-out-store-2nd'},
{title: '二楼取货确认', path: '/pages/outbound/pick-confirm-2nd'},
{title: '二楼货架绑定', path: '/pages/outbound/shelf-bind-2nd'},
],
},
{
title: '转运管理',
path: 'RF09',
sonTree: [
{title: '托盘转运', path: '/pages/transfer/tray-transfer'},
{title: '打印测试', path: '/pages/test'},
],
}
],
show: false,
secM: [],

View File

@@ -12,7 +12,7 @@
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
<view class="zd-row">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">单据编码</span>
</view>

View File

@@ -279,4 +279,11 @@ export const checkMaterConfirm = (obj) => request({
export const getStructCount = (code) => request({
url:'api/pda/common/getStructCount',
data: {vehicle_code: code}
})
/**
* 托盘混料组盘
*/
export const mixingGroupDick = (code, item) => request({
url:'api/mdGruopDick/mixingGroupDick',
data: {vehicle_code: code, item: item}
})