初始化仓库

This commit is contained in:
tao
2025-12-18 14:11:48 +08:00
parent e96f277a68
commit 54ec472bd4
1107 changed files with 158756 additions and 0 deletions

View File

@@ -0,0 +1,281 @@
<template>
<view id="view">
<div>
<table>
<tr>
<td>&emsp;&emsp;</td><td>{{from.body.pwoCode}}</td>
</tr>
<tr>
<td>物料编码</td><td>{{from.body.ptNoTar}}</td>
</tr>
<tr>
<td>物料名称</td><td>{{from.body.ptTitleTar}}</td>
</tr>
<tr>
<td>物料规格</td><td>{{from.body.specification1}}</td>
</tr>
<tr>
<td>物料图号</td><td>{{from.body.dynamicField1 === null ? null : from.body.dynamicField1.drawingid}}</td>
</tr>
<tr>
<td>客户名称</td><td>{{from.body.dynamicField1 === null ? null : from.body.dynamicField1.ks_name}}</td>
</tr>
<tr>
<td>是否冲孔</td><td>{{from.body.dynamicField1 === null ? null : from.body.dynamicField1.zdy5}}</td>
</tr>
<tr>
<td>&thinsp;&thinsp;&nbsp;:</td><td>{{from.body.num}}</td>
</tr>
<tr>
<td>&emsp;&emsp;:</td><td>
<!-- <uni-easyinput type="text" v-model="from.body.deptCode" /> -->
<uni-data-select
v-model="from.body.deptCode"
:localdata="department"
></uni-data-select>
</td>
</tr>
<tr>
<td>接受仓库:</td><td>
<!-- <uni-easyinput type="text" v-model="from.body.whCode" /> -->
<uni-data-select
v-model="from.body.whCode"
:localdata="listWarehouse"
></uni-data-select>
</td>
</tr>
</table>
<p>物料转移单明细信息</p>
</div>
<scroll-view scroll-y="true" class="scroll" >
<view v-for="(item,index) in from.list" :key="index">
<table>
<tr>
<td>物料编码</td><td>{{item.materialCode}}</td>
</tr>
<tr>
<td>物料名称</td><td>{{item.materialName}}</td>
</tr>
<tr>
<td>物料规格</td><td>{{item.specification1}}</td>
</tr>
<tr>
<td>物料类型</td><td>{{item.typeText}}</td>
</tr>
<tr>
<td>&thinsp;&thinsp;&nbsp;:</td><td>{{item.inNumber}}</td>
</tr>
<tr>
<td>入库数量</td><td><uni-easyinput type="number" v-model="item.number" @input="inputInNumber($event,item)" :key="item.number+item.materialCode"/></td>
</tr>
</table>
</view>
</scroll-view>
<button id="button" type="primary" @click="submit" :disabled="!getOpen">提交</button>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import {
addConversion
} from "@/api/mes/pwoIn.js";
export default {
data() {
return {
from:{
body:{
},
list:{}
},
department:[],
listWarehouse:[],
message:{
msgType:'warn',
messageText:'请先查询设备信息'
},
}
},
/**
* 挂载前执行
*/
beforeMount() {
//把查询页面查询到的数据放入进来
//处理详情数据
const {body, list} = this.$store.state.pwo.data
const typeObj = {
1:'合格品',
2:'不良品',
3:'报废品'
}
for(let i in list){
list[i].inNumber = list[i].number
list[i].typeText =typeObj[list[i].type]
}
this.from = Object.assign({},{body,list})
console.log(this.from)
this.from.body.dynamicField1 = JSON.parse(this.from.body.dynamicField1)
//接收完后清空vuex里面的数据清空
this.$store.commit('updatData',{})
//处理部门数据
const department = this.$store.state.pwo.department
for(let i in department){
const item = department[i]
item.value = item.departmentCode
item.text = item.departmentCode + "-" + item.departmentTitle
}
this.department = department
//处理仓库数据
const listWarehouse = this.$store.state.pwo.listWarehouse
for(let i in listWarehouse){
const item = listWarehouse[i]
item.value = item.warehouseCode
item.text = item.warehouseCode + '-' + item.warehouseName
}
this.listWarehouse = listWarehouse
},
mounted() {
//获取屏幕宽高
updateCss(resSize())
},
computed:{
getOpen(){
return Boolean(this.from.list.length)
}
},
methods: {
/**
* 提交按钮点击事件
*/
async submit(){
try{
const {body,list} = this.from;
const { pwoCode ,id ,status,deptCode, whCode} = body
const data = {
deptCode,
whCode,
type:"3",
delStatus:"0",
genRedraw: false,
mesPwoJobCvDetailList:list,
dynamicField1:JSON.stringify(body.dynamicField1),
pwoCode:pwoCode,
pwoId:id,
status,
}
addConversion(data).then(res => {
if(res.code === 200){
this.messageType({
msgType:'success',
messageText:'提交成功'
})
setTimeout(function() {
uni.navigateBack({
delta: 1
});
}, 2100); // 3000毫秒 = 3秒
}
})
}catch(e){
this.messageType({
msgType:'error',
messageText:'提交失败,失败原因‘' + e +''
})
}
},
/**
* 提示信息
* @param {Object|undefined} value
* {msgType,messageText} 参数里面需要包含这两个键
*/
messageType(obj){
const _self = this;
let message ={}
if(obj === undefined){
message = {
msgType:'error',
messageText:'请填写设备代码'
}
}else{
message = {
msgType:obj.msgType,
messageText:obj.messageText
}
}
_self.message = Object.assign({},message)
return _self.$refs.message.open()
},
/**
* 入库数量输入事件
* @param {number} value,输入的值
* @param {Object} item,当前的明细信息
*/
inputInNumber(value,item){
const { number } = item
if(number > value){
item.inNumber = number
}
}
}
}
/**
* 获取屏幕宽高
*/
function resSize(){
let width = 0;
let height = 0;
uni.getSystemInfo({
success: function (res) {
width = res.windowWidth; // 窗口宽度
height = res.windowHeight; // 窗口高度
}
});
return {width,height}
}
/**
* 设置元素高度
* @param {Object} size
*/
function updateCss(size){
document.querySelector("#view>div").style.height = size.height * 0.35 + 'px'
document.querySelector(".scroll").style.height = size.height * 0.65 - 46 + 'px'
}
</script>
<style lang="scss" scoped>
page {
background-color: #ffffff;
padding-top: 1vw;
#view {
--heightSize : 0;
width: 100%;
& > div {
width: 100%;
};
& > .scroll {
width: 100%;
}
}
}
table {
border-collapse: collapse;
width: 95%;
border: 1px solid #ccc;
font-size: 14px;
margin:0 auto;
tr td:first-child{
width: 30%;
}
};
p {
text-align:center;
}
</style>

View File

@@ -0,0 +1,167 @@
<template>
<view>
<uni-forms ref="form" :modelValue="form" label-width="25%" label-align="right" :rules="rules">
<uni-forms-item label="工单编号:" name="pwoCode" >
<uni-easyinput v-model="form.pwoCode" placeholder="请输入不小于5位的工单编号" />
</uni-forms-item>
<uni-forms-item label='批号:' name='batchNo'>
<uni-easyinput v-model="form.batchNo" placeholder="请输入不小于5位的批号" />
</uni-forms-item>
<uni-forms-item label="物料编码:" >
<uni-easyinput v-model="form.ptNoTar" placeholder="请输入物料编码" />
</uni-forms-item>
<uni-forms-item label="物料名称:" >
<uni-easyinput v-model="form.ptTitleTar" placeholder="请输入物料名称" />
</uni-forms-item>
<uni-forms-item label="物料规格:" >
<uni-easyinput v-model="form.specification1" placeholder="请输入物料规格" />
</uni-forms-item>
</uni-forms>
<button type="primary" @click="clickSubmit(form)" :disabled="formComputed">查询</button>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue/>
</uni-popup>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.type" :message="message.messageText" :duration="message.duration"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import {
listPwoLike
} from "@/api/mes/pwoIn.js";
import {listDepartment} from"@/api/basic/department.js"
import {
hasValue
} from "@/utils/judge"
import {listWarehouse} from "@/api/wms/pdcIn.js"
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
export default {
components:{
lodingVue
},
data() {
return {
/**表单数据 */
form:{
/** 工单编号 */
pwoCode : null,
/** 批号 */
batchNo : null,
/** 物料编码 */
ptNoTar : null,
/** 物料名称 */
ptTitleTar : null,
/** 物料规格 */
specification1 : null
},
/** 校验规则 */
rules:{
pwoCode:{
rules:[
{
required : true,
},
]
},
batchNo:{
rules:[
{
required : true,
},
]
},
},
/** 提示信息 */
message:{
//类型 succes成功warn警告error失败inf消息
type:'error',
//提示信息
messageText:'没有符合条件的数据',
//显示时间
duration:1500
}
}
},
async mounted(){
//在页面挂载的时候获取部门数据
const data = await Promise.all([ listDepartment(), listWarehouse()])
this.$store.commit('updateDepartment',data[0].rows)
this.$store.commit('updateWarehouse',data[1].rows)
},
/**
* 计算属性
*/
computed:{
/**
* 判断form值是否符合要求
* 如果符合则可以点击按钮,没有不能点击
*/
formComputed(){
const {pwoCode,batchNo} = this.form
//判断工单编号和批号是否有值
//如果有值且长度大于5位则必填标志消失并且提交按钮可以点击
if((hasValue(pwoCode) && pwoCode.length >= 5) || (hasValue(batchNo) && batchNo.length >= 5)){
if(hasValue(pwoCode) && pwoCode.length >= 5) this.rules.batchNo.rules[0].required = false
if(hasValue(batchNo) && batchNo.length >= 5) this.rules.pwoCode.rules[0].required = false
return false
}
this.rules.batchNo.rules[0].required = this.rules.pwoCode.rules[0].required = true
return true
}
},
methods: {
/**
* 提交按钮点击事件
*/
async clickSubmit(){
const _self = this
try{
//打开蒙层
this.$refs.popup.open()
//查询接口
const res = await listPwoLike(this.form)
//关闭蒙层
//当没有查到数据给一个提示
if(res.total === 0 || res.rows.length === 0) {
this.$refs.message.open()
return
}
//通过vuex把获取到的数据保存下来 this.$store.state.pwo
this.$store.commit('updatData',res.rows)
uni.navigateTo({
url:'/pages/mes/jobCv/transfer/table'
})
}catch{
this.message.messageText="请求超时"
this.$refs.message.open()
}finally{
this.$refs.popup.close()
}
}
},
/**
* 页面卸载的时候清空数据
*/
onUnload(){
this.$store.commit('updateDepartment',[])
this.$store.commit('updateWarehouse',[])
}
}
</script>
<style scoped>
//设置页面背景颜色
page {
background-color: #ffffff;
padding-top: 1vw;
}
view {
width: 98%;
margin: 2% auto;
color: black;
}
</style>

View File

@@ -0,0 +1,108 @@
<template>
<view>
<div v-for="(item,index) in data" :key="index">
<div>
<table>
<tr>
<td>&emsp;&emsp;</td><td>{{item.pwoCode}}</td>
</tr>
<tr>
<td>物料编码</td><td>{{item.ptNoTar}}</td>
</tr>
<tr>
<td>物料名称</td><td>{{item.ptTitleTar}}</td>
</tr>
<tr>
<td>物料规格</td><td>{{item.specification1}}</td>
</tr>
<tr>
<td>物料图号</td><td></td>
</tr>
<tr>
<td>客户名称</td><td></td>
</tr>
<tr>
<td>是否冲孔</td><td></td>
</tr>
<tr>
<td>&thinsp;&thinsp;&nbsp;</td><td>{{item.num}}</td>
</tr>
</table>
</div>
<div>
<u-button class="uButton" @click="clickButton(item)">入库</u-button>
</div>
</div>
</view>
</template>
<script>
import {
getPwoByCode,
getDetailData
} from "@/api/mes/pwoIn.js";
export default {
data() {
return {
data:{}
}
},
beforeMount() {
//把查询页面查询到的数据放入进来
this.data =this.$store.state.pwo.data
//接收完后清空vuex里面的数据清空
this.$store.commit('updatData',{})
},
methods: {
/**
* 入库按钮点击事件
* @param {Object} item 当前点击按钮的数据
*/
async clickButton(item){
const {pwoCode,id} = item
const obj = {
delStatus : "0",
genRedraw : true,
pwoCode,
pwoI : id,
status : '0',
type : "3"
}
const res = await Promise.all([getPwoByCode(pwoCode),getDetailData(obj)])
this.$store.commit("updatData",{body:res[0].data,list:res[1].data})
uni.navigateTo({
url:"/pages/mes/jobCv/transfer/from"
})
}
}
}
</script>
<style lang="scss" scoped>
$fontSize : 14px ;
page {
background-color: #ffffff;
padding-top: 1vw;
view > div {
position: relative;
width: 95%;
border-width: 1px 2px;
border-style: solid;
border: 2px solid #e0fff9;
margin: 1px 2.5% 2px 2.5%;
display: flex;
div:first-child {
width: 85%;
margin-right:2%
};
div:last-child {
margin-right: auto;
width: 13%;
& > .uButton{
height: 1.65 * 8 * $fontSize;
}
}
}
}
</style>