初始化仓库

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,360 @@
<template>
<view>
<div class="head">
<table>
<tr>
<td>&emsp;&emsp;:</td>
<td>
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描设备!"
v-model="machineCode"
@iconClick="iconClick('machineCode')"
/>
<div class="button" @click="clickButton('getSelect')">查询</div>
</td>
</tr>
<tr>
<td>当前状态</td><td>{{head.statusChina}}</td>
</tr>
<tr>
<td>开炉时间</td><td>{{head.openTime}}</td>
</tr>
<tr>
<td>关炉时间</td><td>{{head.closeTime}}</td>
</tr>
</table>
<div class="button" @click="clickButton('openUpdate')" :class="{ 'bgColor-Click': open }">记录</div>
</div>
<div class="body">
<div class="button" @click="clickButton('getHistory')">查看历史</div>
<table v-show="open">
<tr>
<td>工单编码:</td>
<td>
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描工单编码!"
v-model="body.pwoCode"
@iconClick="iconClick('pwoCode')"
@change="getPwoCode"
/>
</td>
</tr>
<tr>
<td>物料编码:</td><td><uni-easyinput disabled v-model="body.materialCode" placeholder="工单扫完带出" /></td>
</tr>
<tr>
<td>物料名称:</td><td><uni-easyinput disabled v-model="body.materialName" placeholder="工单扫完带出"/></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;:</td><td><uni-easyinput v-model="body.parameter1" placeholder="输入"/></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;:</td><td><uni-easyinput v-model="body.parameter2" placeholder="输入"/></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;:</td><td><uni-easyinput v-model="body.parameter3" placeholder="输入"/></td>
</tr>
</table>
<button v-show="open" type="primary" style="width: 100%;" @click="clickButton('submit')">提交记录</button>
</div>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue/>
</uni-popup>
</view>
</template>
<script>
import {
listMesFurnaceOperationRecord,
listMesFurnaceOperationRecordDetail,
updateMesFurnaceOperationRecordDetail
} from '@/api/mes/bom.js'
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
import {listPwoLike} from "@/api/mes/pwoIn.js"
export default {
components:{
lodingVue
},
data() {
return {
head:{
updateTime:'',
openTime:'',
},
machineCode:'',
body:{},
open:false,
message:{
msgType:'warn',
messageText:'请先查询设备信息'
},
}
},
methods: {
/**
* 扫码方法
* @param {Object} value {'equipment' || }
*/
iconClick(value){
const _this = this;
uni.scanCode({
// 是否只能从相机扫码,不允许从相册选择图片
onlyFromCamera:true,
// 扫码类型
scanType: ['barCode', 'qrCode'],
success: function(res) {
value === 'machineCode' ? _self.machineCode = res.result : value;
value === 'pwoCode' ? _self.body.pwoCode = res.result :value;
}
})
},
/**
* 按钮点击事件
* @param {Object} value
*/
clickButton(value){
const _self= this
if(_self.machineCode == '') {
return _self.messageType({
msgType:'warn',
messageText:'请输入设备代码'
})
}
if( _self.head.statusChina === undefined && value !== 'getSelect'){
return _self.messageType({
msgType:'warn',
messageText:'请先查询设备信息'
})
}
_self[value]()
},
/**
* 查询设备最近的记录
*/
async getSelect(){
const _self = this
const query = {
pageNum: 1,
pageSize: 1,
machineCode: _self.machineCode,
orderByColumn: "id",
isAsc: "desc",
}
let rows = (await _self.fnApi('listMesFurnaceOperationRecord',query))[0];
if(rows === undefined) return
rows = Object.assign(rows,{statusChina:await getStatus(rows)})
_self.open = false;
_self.head = rows
/**
* 判断当期是清炉|关|开
* @param {Object} arr
*/
function getStatus (arr){
const obj = {
0:'开炉',
1:'关炉',
2:'清炉'
}
return obj[arr.status]
}
},
/**
* 接口访问方法
* @param {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
listMesFurnaceOperationRecord,
listMesFurnaceOperationRecordDetail,
updateMesFurnaceOperationRecordDetail,
listPwoLike,
}
try{
//打开蒙层
_self.$refs.popup.open()
//查询接口
const data = (await objApi[api](value)).rows
return data
}catch(e){
_self.messageType({
msgType:'error',
messageText:'接口请求出错'
})
}finally{
//关闭蒙层
_self.$refs.popup.close()
}
},
/**
* 提示信息
* @param {Object} obj
*/
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()
},
/**
* 记录事件
*/
async openUpdate(){
const _self = this;
_self.open = !_self.open
const {id} = _self.head
const obj = {
pageNum: 1,
pageSize: 1,
furnaceOpRecId: id,
orderByColumn: "id",
isAsc: "desc",
}
// const data = (await _self.fnApi('listMesFurnaceOperationRecordDetail',obj)[0]
const data = (await _self.fnApi('listMesFurnaceOperationRecordDetail',obj))[0]
_self.body = Object.assign({},data)
},
/**
* 工单查询事件
* @param {Object} value
*/
async getPwoCode(value){
const _self = this;
const row = (await _self.fnApi('listPwoLike',{pwoCode:_self.body.pwoCode}))[0]
_self.body = Object.assign({},_self.body,{
materialCode:row.ptNoTar,
materialName:row.ptTitleTar
})
},
/**
* 提交方法
*/
submit(){
const _self = this;
// 获取当前北京时间的时间戳(单位为毫秒)
var stamp= new Date().getTime() + 8 * 60 * 60 * 1000;
var beijingTime = new Date(stamp).toISOString().replace(/T/, ' ').replace(/\..+/, '').substring(0, 19);
const obj = Object.assign(_self.body,{
updateTime:beijingTime
})
_self.fnApi('updateMesFurnaceOperationRecordDetail',obj)
},
/**
* 查看历史
*/
getHistory(){
const _self = this;
const obj = {
type : 'chiefRecords',
value : {id:_self.head.id}
}
//在起始页面跳转到test.vue页面并传递参数
uni.navigateTo({
url: '/pages/bom/history',
success: function(res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('data', obj)
}
});
}
}
}
</script>
<style lang="scss" scoped>
page{
background-color: #ffffff;
$fontSize:5vw; //设置变量,以字体为基础大小
font-size: $fontSize;
color: #6a6663;
view{
width: 96vw;
margin: 0 auto;
&>div{
display: flex;
flex-direction:row-reverse; //设置主轴对齐方向为水平,并且右对齐
flex-wrap: wrap ; //设置换行
}
.head{
border-bottom: 0.5vw solid #a2adab;
table{
&>tr:first-child>td:last-child{
&>* {
float: left;
}
&>*:first-child{
margin-right: 2%;
width: 75%;
}
&>*:last-child{
width: 20%;
min-height: 35px;
max-height: 50px;
margin:0;
border: 1px solid #a3cccc;
}
}
}
}
table{
width: 100%;
&>tr td:last-child{
width: 71%;
}
}
.button{
width: 4 * $fontSize;
// aspect-ratio: 2; //设置元素纵横比,宽是高的两倍
border: $fontSize / 10 solid #a3cccc;
border-radius: 15%;
text-align: center;
line-height: 2 * $fontSize;
margin: $fontSize /2 0;
}
}
}
@media (min-width: 100px) and (max-width: 600px) {
.head tr:first-child>td:last-child>*:last-child{
font-size: 15px;
line-height: 35px;
}
}
@media (min-width: 600px) {
.head tr:first-child>td:last-child>*:last-child{
font-size: 30px;
line-height: 50px;
}
}
</style>
<style>
page{
background-color: #ffffff ;
}
</style>