Browse Source

feat: add 补料申请

master
TengXF 7 months ago
parent
commit
1e91668d06
  1. 12
      src/api/mes/workScheduling/addBasicItem/addBAsicItemApi.ts
  2. 7
      src/pages.json
  3. 268
      src/pages/mes/workScheduling/addBasicItem/index.vue
  4. 3
      src/pages/mes/workScheduling/workScheduling.vue

12
src/api/mes/workScheduling/addBasicItem/addBAsicItemApi.ts

@ -0,0 +1,12 @@
import http from '../../../http'
//查询物料信息列表
export function getByOrder(params) {
return http.get('/mes/orderDayBom/getByOrder', {params})
}
//补料
export function addBasicItem(data) {
return http.post('/mes/item-request-main/addBasicItem', data)
}

7
src/pages.json

@ -2051,6 +2051,13 @@
"navigationBarTitleText": "批量创建返工返修登记",
"enablePullDownRefresh": true
}
},
{
"path": "pages/mes/workScheduling/addBasicItem/index",
"style": {
"navigationBarTitleText": "补料申请",
"enablePullDownRefresh": true
}
}

268
src/pages/mes/workScheduling/addBasicItem/index.vue

@ -0,0 +1,268 @@
<template>
<!-- 列表展示标准模版 -->
<view class="container">
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index">
<view class="title">
<view class="title-txt">
{{item.repMaterialCode}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<!-- <view class="dec">
<view>计划编码</view><view>{{item.planDayCode}}</view>
</view>
<view class="dec">
<view>批次编码</view><view>{{item.planBatchCode}}</view>
</view> -->
<view class="dec">
<view>产品编码</view><view>{{item.productCode}}</view>
</view>
<view class="dec">
<view>工序编码</view><view>{{item.processCode}}</view>
</view>
<view class="dec">
<view>物料规格</view><view>{{item.repMaterialModel}}</view>
</view>
<view class="dec">
<view>物料数量</view>
<view> {{item.repMaterialCounts * queryForm.planCount}}</view>
</view>
<view class="dec" style="font-weight: bold;">
<view >补料数量</view>
<view > <u-input v-model="item.srcMaterialCounts" type="number" placeholder="补料数量" border="true" clearable="true" style="width: 100px;" />
</view>
</view>
<view class="dec">
<view>
<u-button size="medium" type="error" @click="deleteItem(item)" style="width: 20px;">删除物料</u-button>
</view>
<!-- <view >
<u-button size="medium" type="success" @click="setupNum(item)" style="margin-left: 100px;width: 20px;">选择数量</u-button>
</view> -->
</view>
</view>
</view>
<view class="footer">
<view class="btns" v-if="listSize!=0">
<u-button type="success" @click="handleSubmit" :loading='loading' :disabled='loading'>提交</u-button>
</view>
<view class="btns" v-if="listSize == 0">
<u-button type="success" @click="navigateBack" :loading='loading' :disabled='loading'>返回</u-button>
</view>
</view>
</view>
</template>
<script setup lang="ts">
/*初始化*/
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
/*引入API*/
import * as addBasicItemApi from "@/api/mes/workScheduling/addBasicItem/addBasicItemApi.ts"
import * as dictApi from "@/api/mes/dict/dictApi.ts"
const { proxy } = getCurrentInstance()
const loading = ref(false)
const showProduct = ref(false)
const paramData = ref()
const typeList = ref([])
const list = ref([])
const listSize = ref(1)
const productList = ref([{label:'产品1',value: '111',name:'产品'},{label:'产品2',value: '222',name:'产品'}])
const queryForm = ref({
planNoDay:'',
productCode:'',
workroomCode:'',
workBillNo:'',
lineCode:'',
processrouteCode:'',
batchCode:'',
processCode:'',
planCount:''
})
const saveData = ref({
planDayCode:'',
workBillNo:'',
batchCode:'',
workstationCode:'',
productCode:'',
processCode:'',
requestType:'2',
list:[]
})
//
function deleteItem(val) {
const index = list.value.findIndex(item => item.repMaterialCode === val.repMaterialCode);
if (index !== -1) {
list.value.splice(index, 1);
listSize.value -= 1
console.log(listSize.value)
}
}
//
function handleSubmit(){
saveData.value.planDayCode = queryForm.value.planNoDay
saveData.value.workBillNo = queryForm.value.workBillNo
saveData.value.batchCode = queryForm.value.batchCode
saveData.value.workstationCode = queryForm.value.workroomCode
saveData.value.productCode = queryForm.value.productCode
saveData.value.processCode = queryForm.value.processCode
saveData.value.list = list.value
//
proxy.$modal.confirm('确定提交处理吗').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
addBasicItemApi.addBasicItem(saveData.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
proxy.$modal.closeLoading()
}, 1000)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
proxy.$modal.closeLoading()
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
function navigateBack() {
proxy.$tab.navigateBack()
}
//
async function getDictInfo(){
await dictApi.getDict("uom").then((res) => {
proxy.$modal.closeLoading()
if (res) {
typeList.value = res
} else {
}
}).catch(() => {
})
}
async function getBasicItem() {
proxy.$modal.loading('加载中')
await addBasicItemApi.getByOrder(queryForm.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.length > 0) {
list.value = list.value.concat(res.data);
listSize.value = res.data.length
} else {
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
/*通用方法*/
onLoad((option) => {
if (option.obj) {
paramData.value = JSON.parse(decodeURIComponent(option.obj)); // paramData
queryForm.value.planNoDay = paramData.value.planMasterCode
queryForm.value.productCode = paramData.value.productCode
queryForm.value.workroomCode = paramData.value.workroomCode
queryForm.value.lineCode = paramData.value.lineCode
queryForm.value.processrouteCode = paramData.value.prouteCode
queryForm.value.batchCode = paramData.value.batchCode
queryForm.value.processCode = paramData.value.workingNode
queryForm.value.workBillNo = paramData.value.schedulingCode
queryForm.value.planCount = paramData.value.planCount
}
})
onShow(() => {
getDictInfo()
getBasicItem()
})
onReachBottom(() => {
})
</script>
<style lang="scss" scoped>
// .footer {
// position: fixed;
// bottom: 0;
// left: 0;
// width: 100%;
// background-color: #fff; /* footer */
// /* paddingborder */
// }
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
display: flex;
align-items: center;
view {
&:nth-child(1){
width: 160rpx;;
}
&:nth-child(2){
color: #999999;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

3
src/pages/mes/workScheduling/workScheduling.vue

@ -306,7 +306,8 @@ function receiveBasicItem(item){
}
//
function addBasicItem(item){
console.log(item)
const objString = JSON.stringify(item);
proxy.$tab.navigateTo(`/pages/mes/workScheduling/addBasicItem/index?obj=${encodeURIComponent(objString)}`)
}
</script>

Loading…
Cancel
Save