组盘入库、物料入库加功能

This commit is contained in:
2025-08-27 19:48:20 +08:00
parent 45bdf167e3
commit caef2ecc53
4 changed files with 173 additions and 20 deletions

View File

@@ -38,22 +38,38 @@
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">物料数量</span>
<span class="filter_label filter_input_disabled">物料数量</span>
</view>
<view class="zd-col-17">
<NumberInput
v-model="qty"
input-class="filter_input"
mode="decimal"
:decimalLength="3"
/>
<input type="number" class="filter_input filter_input_disabled" v-model="totalQty" disabled>
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<button class="mini-btn" type="primary" size="mini" style="display: block;" @tap="addmater">添加料框</button>
<view v-if="dataList.length" class="slide_new">
<table>
<thead>
<tr>
<th width="50%">料框号</th>
<th width="30%">数量</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td><input class="sin_input" :class="{ 'input-error': e.mater_frame === '' }" type="text" placeholder="请输入料框号" v-model="e.mater_frame" @blur="checkMaterFrame(i)" @input="clearError(i)" ref="materFrameInputs"></td>
<td><input class="sin_input" type="number" v-model="e.qty" @blur="checkQty(i)"></td>
<td><button class="mini-btn" type="primary" size="mini" style="display: block" @tap="delItem(i)">删除</button></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': JSON.stringify(currentData) === '{}' || !val1 || !qty}" :disabled="disabled" @tap="_groupPlate">组盘确认</button>
<button class="zd-col-16 button-primary" :class="{'button-info': JSON.stringify(currentData) === '{}' || !val1}" :disabled="disabled" @tap="_groupPlate">组盘确认</button>
</view>
</view>
</template>
@@ -73,18 +89,26 @@
return {
title: '',
val1: '',
qty: null,
totalQty: null,
currentData: {},
disabled: false
disabled: false,
dataList: []
};
},
watch: {
dataList: {
deep: true,
handler() {
this.updateTotalQty()
}
}
},
onLoad (options) {
this.title = options.title
},
onShow() {
if (this.$store.getters.publicObj !== '') {
this.currentData = this.$store.getters.publicObj
this.qty = this.currentData.qty
}
},
methods: {
@@ -93,21 +117,84 @@
url: '/pages/manage/common/cxwl?title=查询物料'
})
},
addmater () {
this.validateMaterFrames()
this.dataList.push({mater_frame: null, qty: 0.000})
},
delItem (i) {
this.dataList.splice(i, 1)
this.validateMaterFrames()
},
toEmpty () {
this.val1 = ''
this.currentData = {}
this.qty = null
this.totalQty = null
this.dataList = []
this.disabled = false
this.$store.dispatch('setPublicObj', '')
},
checkMaterFrame (index) {
const { mater_frame } = this.dataList[index]
if (!mater_frame) return
const isDuplicate = this.dataList.some((item, i) => i !== index && item.mater_frame === mater_frame)
if (isDuplicate) {
uni.showToast({
title: '料框号重复',
icon: 'none'
})
// 清空当前料框号
this.dataList[index].mater_frame = ''
}
},
checkQty (index) {
const { qty } = this.dataList[index]
if (qty < 0) {
uni.showToast({
title: '数量必须为非负数',
icon: 'none'
})
// 重置数量为0
this.dataList[index].qty = 0.000
}
},
clearError(index) {
if (this.dataList[index].mater_frame) {
this.$refs.materFrameInputs[index].$el.style.borderColor = ''
}
},
updateTotalQty() {
this.totalQty = this.dataList.reduce((total, item) => total + parseFloat(item.qty), 0)
},
validateMaterFrames () {
let isValid = true
for (let i = 0; i < this.dataList.length; i++) {
if (!this.dataList[i].mater_frame) {
this.$refs.materFrameInputs[i].$el.style.borderColor = 'red'
this.scrollToView(this.$refs.materFrameInputs[i])
isValid = false
} else {
this.$refs.materFrameInputs[i].$el.style.borderColor = ''
}
}
return isValid
},
scrollToView (element) {
if (element) {
element.$el.scrollIntoView({ behavior: 'smooth', block: 'center' })
}
},
async _groupPlate () {
this.disabled = true
if (JSON.stringify(this.currentData) === '{}' || !this.val1 || !this.qty) {
if (JSON.stringify(this.currentData) === '{}' || !this.val1) {
this.disabled = false
return
}
if (!this.validateMaterFrames()) {
this.disabled = false
return
}
try {
let res = await groupPlate(this.currentData.material_id, this.qty, this.val1)
let res = await groupPlate(this.currentData.material_id, this.totalQty, this.val1, this.dataList)
uni.showToast({
title: res.message,
icon: 'none'
@@ -122,5 +209,15 @@
}
</script>
<style lang="stylus">
<style lang="stylus" scoped>
.slide_new
table
table-layout auto
th,td
&:first-child
box-shadow: none
.sin_input
width 100%
.input-error
border-color #ff8227
</style>

View File

@@ -68,6 +68,24 @@
</view>
</view>
</view>
<view v-if="dataList.length" class="zd_wrapper grid-wraper">
<view v-if="dataList.length" class="slide_new">
<table>
<thead>
<tr>
<th width="60%">料框号</th>
<th width="40%">数量</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{e.mater_frame}}</td>
<td>{{e.qty}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
@@ -93,7 +111,8 @@
options: [],
index: '',
disabled: false,
currentData: {}
currentData: {},
dataList: []
};
},
onLoad (options) {
@@ -128,11 +147,14 @@
let res = await getVehicleMaterial(e)
if (res) {
this.currentData = res
this.dataList = res.dtlList
} else {
this.currentData = {}
this.dataList = []
}
} catch (e) {
this.currentData = {}
this.dataList = []
}
},
clearUp () {
@@ -141,6 +163,7 @@
this.index = ''
this.disabled = false
this.currentData = {}
this.dataList = []
},
async _confirmIn () {
this.disabled = true
@@ -166,6 +189,11 @@
}
</script>
<style lang="stylus">
<style lang="stylus" scoped>
.slide_new
table
table-layout auto
th,td
&:first-child
box-shadow: none
</style>

View File

@@ -44,9 +44,9 @@ export const getFloor = () => request({
})
// 物料组盘确认
export const groupPlate = (mid, qty, vcode) => request({
export const groupPlate = (mid, qty, vcode, dtlList) => request({
url:'api/pda/iosIn/groupPlate',
data: {material_id: mid, qty: qty, vehicle_code: vcode}
data: {material_id: mid, qty: qty, vehicle_code: vcode, dtlList: dtlList}
})
// 定点确认
@@ -111,4 +111,25 @@ export const schPointBinding = (code, vcode, data) => request({
export const schPointDissect = (code, vcode, data) => request({
url:'/api/pda/schPoint/dissect',
data: {struct_code: code, vehicle_code: vcode, data: data}
})
export const addTaskV2 = (Value, point1, point2) => request({
url:'api/fms/addTaskV2',
data: {
TaskType: '任务11',
Params: [
{
Key: 'TaskId',
Value: Value
},
{
Key: 'point1',
Value: point1
},
{
Key: 'point2',
Value: point2
}
]
}
})

7
utils/mork.js Normal file
View File

@@ -0,0 +1,7 @@
export const getMaterialList = (search, page, size) => {
let res = {
totalElements: 100,
content: [{material_name: '00001', material_spec: 'dfjlfjlf', material_code: 'aaaaa1', material_id: '1'}]
}
return res
}