初始化仓库

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

420
pages/bom/chiefRecords.vue Normal file
View File

@@ -0,0 +1,420 @@
<template>
<view>
<div id="body">
<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>
<div class="button" @click="clickButton('openTrue')">开炉</div>
<div class="button" @click="clickButton('openClose')">关炉</div>
<div class="button" @click="clickButton('openUpdate')" :class="{ 'bgColor-Click': open }">记录</div>
</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.ptNoTar" placeholder="工单扫完带出" /></td>
</tr>
<tr>
<td>物料名称:</td><td><uni-easyinput disabled v-model="body.ptTitleTar" 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>
</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,
addMesFurnaceOperationRecord,
closeFurnace,
addMesFurnaceOperationRecordDetail
} from '@/api/mes/bom.js'
import {listPwoLike} from "@/api/mes/pwoIn.js"
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
export default {
components:{
lodingVue
},
data() {
return {
machineCode:'',
head:{
updateTime:'',
openTime:'',
statusChina:'',
},
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
_self.open = false;
rows = Object.assign(rows,{statusChina:await getStatus(rows)})
_self.head = rows
/**
* 判断当期是清炉|关|开
* @param {Object} arr
*/
function getStatus (arr){
const obj = {
0:'开炉',
1:'关炉',
2:'清炉'
}
return obj[arr.status]
}
},
/**
* 开炉事件
*/
async openTrue(){
const _self = this;
const {clearBy,clearTime,closeBy,closeTime,createBy,createTime,machineCode, machineId} = _self.head
// 获取当前北京时间的时间戳(单位为毫秒)
var stamp= new Date().getTime() + 8 * 60 * 60 * 1000;
var beijingTime = new Date(stamp).toISOString().replace(/T/, ' ').replace(/\..+/, '').substring(0, 19);
const openBy = uni.getStorageSync('HBusername')
const obj = Object.assign(_self.head,{
openBy,
openTime:beijingTime,
updateTime:beijingTime,
id:null,
status:0
})
await _self.fnApi('addMesFurnaceOperationRecord',obj)
_self.getSelect()
},
/**
* 关炉事件
*/
async openClose(){
const _self = this;
await _self.fnApi('closeFurnace',_self.head.id)
_self.getSelect()
},
/**
* 工单查询事件
* @param {Object} value
*/
async getPwoCode(value){
const _self = this;
const row = (await _self.fnApi('listPwoLike',{pwoCode:_self.body.pwoCode}))[0]
_self.body = Object.assign({},row)
},
/**
* 记录事件
*/
openUpdate(){
const _self = this;
_self.open = !_self.open
},
/**
* 提示信息
* @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 {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
addMesFurnaceOperationRecord,
closeFurnace:closeFurnace,
listMesFurnaceOperationRecord,
listPwoLike:listPwoLike,
addMesFurnaceOperationRecordDetail
}
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()
}
},
/**
* 提交方法
*/
async submit(){
const _self = this;
const {id} =_self.head
const {pwoCode,materialCode,ptTitleTar,parameter1,parameter2,parameter3} = _self.body
const obj = {
createBy: null,
createTime: null,
delStatus: "0",
finalProductCode: null,
finalProductName: null,
furnaceOpRecCode: null,
furnaceOpRecId: id,
id:null,
materialCode,
materialName:ptTitleTar,
opType: null,
parameter1,
parameter2,
parameter3,
parameter4: null,
parameter5: null,
parameter6: null,
parameter7: null,
parameter8: null,
pwoCode,
remark: null,
updateBy: null,
updateTime: null,
}
await _self.fnApi('addMesFurnaceOperationRecordDetail',obj)
_self.messageType({
msgType:'success',
messageText:'提交成功'
})
},
/**
* 查看历史
*/
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>
#body{
margin: 0 auto;
width: 90vw;
$fontSize:5vw; //设置变量,以字体为基础大小
font-size: $fontSize;
color: #6a6663;
.head{
table{
&>tr:first-child>td:last-child{ //设置table里面的第一个tr的第二个td的宽
width: 71%;
// float: left;
& > * {
float: left;
font-size: $fontSize * 0.75;
}
& >*:first-child{
width: 70%;
}
& >*:last-child {
margin-left: 2%;
width: 25%;
min-height: 35px;
max-height: 50px;
border: 1px solid #a3cccc;
}
}
}
&>div{
display: flex; //设置子元素开启flex布局
justify-content: space-around; //设置子元素横向对齐方式
border-bottom: $fontSize / 10 solid #cbccbf; //设置div下面的框的样式
padding: $fontSize 0 $fontSize/2; //设置其内部子元素的所在位置
}
}
.body{
padding: $fontSize/2 0 0 0 ; //设置内边距
display: flex; //开启flex布局
flex-direction:row-reverse; //设置主轴对齐方向为水平,并且右对齐
flex-wrap: wrap ; //设置换行
&>div{
// width: 4 * $fontSize;
margin:0 $fontSize * 0.9 $fontSize 0;
}
table{
width: 100%;
float: left;
&>tr:first-child>td:last-child{
width: 70%;
}
}
}
.button{
width: 4 * $fontSize;
// aspect-ratio: 2; //设置元素纵横比,宽是高的两倍
border: $fontSize / 10 solid #a3cccc;
border-radius: 15%;
text-align: center;
// line-height: 2 * $fontSize;
}
}
@media (min-width: 100px) and (max-width: 600px) {
.head>table>tr:first-child>td:last-child>*:last-child{
font-size: 15px;
line-height: 35px;
}
}
@media (min-width: 600px) {
.head>table>tr:first-child>td:last-child>*:last-child{
font-size: 30px;
line-height: 50px;
}
}
.bgColor-Click{
background-color: #a3cccc;
}
</style>
<style>
page{
background-color: #ffffff ;
}
</style>

View File

@@ -0,0 +1,268 @@
<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" v-show="open" @click="clickButton('inClick')">清炉</div>
</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,
addMesFurnaceOperationRecord
} from '@/api/mes/bom.js'
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
export default {
components:{
lodingVue
},
data() {
return {
head:{
statusChina:'',
closeTime:'',
openTime:'',
},
machineCode:'',
message:{
msgType:'warn',
messageText:'请先查询设备信息'
},
open:false
}
},
methods: {
/**
* 按钮点击事件
* @param {Object} value
*/
clickButton(value){
const _self= this
_self.open = false;
if(_self.machineCode == '') {
return _self.messageType({
msgType:'warn',
messageText:'请输入设备代码'
})
}
if( _self.head.statusChina === undefined && value !== 'getSelect'){
return _self.messageType({
msgType:'warn',
messageText:'请先查询设备信息'
})
}
_self[value]()
},
/**
* 提示信息
* @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()
},
/**
* 接口访问方法
* @param {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
listMesFurnaceOperationRecord,
addMesFurnaceOperationRecord,
}
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()
}
},
/**
* 查询设备最近的记录
*/
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
const statusChina = await getStatus(rows)
rows = Object.assign(rows,{statusChina})
_self.open = statusChina =='关炉' ? true :false;
_self.head = rows
/**
* 判断当期是清炉|关|开
* @param {Object} arr
*/
function getStatus (arr){
const obj = {
0:'开炉',
1:'关炉',
2:'清炉'
}
return obj[arr.status]
}
},
/**
* 清炉事件
*/
async inClick(){
const _self = this;
const {closeBy,closeTime,createBy,createTime,machineCode, machineId} = _self.head
// 获取当前北京时间的时间戳(单位为毫秒)
var stamp= new Date().getTime() + 8 * 60 * 60 * 1000;
var beijingTime = new Date(stamp).toISOString().replace(/T/, ' ').replace(/\..+/, '').substring(0, 19);
const clearBy = uni.getStorageSync('HBusername');
const obj = Object.assign(_self.head,{
clearBy,
clearTime:beijingTime,
updateTime:beijingTime,
id:null,
status:2
})
await _self.fnApi('addMesFurnaceOperationRecord',obj)
_self.getSelect()
}
}
}
</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;
justify-content:center;
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>

116
pages/bom/history.vue Normal file
View File

@@ -0,0 +1,116 @@
<template>
<view>
<uni-table ref="table" border stripe emptyText="暂无更多数据" >
<uni-tr>
<uni-th align="center">开炉记录编码</uni-th>
<uni-th align="center">工单编码</uni-th>
<uni-th align="center">物料名称</uni-th>
<uni-th align="center">参数1</uni-th>
<uni-th align="center">参数2</uni-th>
<uni-th align="center">参数3</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
<uni-td align="center">{{ item.furnaceOpRecCode }}</uni-td>
<uni-td align="center">{{ item.pwoCode }}</uni-td>
<uni-td align="center">{{ item.materialName }}</uni-td>
<uni-td align="center">{{ item.parameter1 }}</uni-td>
<uni-td align="center">{{ item.parameter2 }}</uni-td>
<uni-td align="center">{{ item.parameter3 }}</uni-td>
</uni-tr>
</uni-table>
<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.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import {
listMesFurnaceOperationRecordDetail,
} from '@/api/mes/bom.js'
import lodingVue from "@/utils/loding/loding.vue";
export default {
onLoad: function (option) { //option为object类型会序列化上个页面传递的参数
const _self = this;
const eventChannel = _self.getOpenerEventChannel();
eventChannel.on('data', function(data) {
console.log(data,_self)
_self[data.type](data.value)
})
},
data() {
return {
tableData:{},
message:{
msgType:'error',
messageText:'接口请求出错'
},
}
},
methods: {
/**
* 接口访问方法
* @param {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
listMesFurnaceOperationRecordDetail
}
try{
const data = (await objApi[api](value)).rows
_self.$nextTick(()=>{
_self.$refs.popup.open()
})
return data
}catch(e){
//TODO handle the exception
_self.$nextTick(()=>{
_self.$refs.message.open()
})
}finally{
_self.$nextTick(()=>{
_self.$refs.popup.close()
})
}
},
/**
* 炉长记录查询
* @param {Object} value
*/
async chiefRecords(value){
const _self = this;
const {id} = value;
const obj = {
pageNum: 1,
pageSize: 50,
furnaceOpRecId: id,
}
_self.tableData = await _self.fnApi('listMesFurnaceOperationRecordDetail',obj)
},
},
}
</script>
<style lang="scss" scoped>
page{
$fontSize:5vw;
background-color: #ffffff;
font-size: $fontSize;
color: #6a6663;
view {
width: 98vw;
margin: 0 auto;
}
}
</style>
<style>
page{
background-color: #ffffff ;
}
</style>

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>

196
pages/bom/recordQuerys.vue Normal file
View File

@@ -0,0 +1,196 @@
<template>
<view>
<div>
<uni-forms ref="form" :modelValue="form" label-width="25%" label-align="right" :rules="rules">
<uni-forms-item label="工单编号:" name="pwoCode" >
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描工单编码!"
v-model="form.pwoCode"
@iconClick="iconClick('pwoCode')"
/>
</uni-forms-item>
<uni-forms-item label='物料编码:' name='materialCode'>
<uni-easyinput v-model="form.materialCode" placeholder="请输入物料编码" />
</uni-forms-item>
<uni-forms-item label="物料名称:" >
<uni-easyinput v-model="form.materialName" disabled placeholder="工单扫完/物料编码输入带出" />
</uni-forms-item>
</uni-forms>
<button type="primary" @click="clickSubmit(form)" :disabled="formComputed">查询</button>
</div>
<uni-table ref="table" border stripe emptyText="暂无更多数据" v-show="open">
<uni-tr>
<uni-th align="center">类型</uni-th>
<uni-th align="center">参数1</uni-th>
<uni-th align="center">参数2</uni-th>
<uni-th align="center">参数3</uni-th>
<uni-th align="center">日期</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
<uni-td align="center">{{ item.opType }}</uni-td>
<uni-td align="center">{{ item.parameter1 }}</uni-td>
<uni-td align="center">{{ item.parameter2 }}</uni-td>
<uni-td align="center">{{ item.parameter3 }}</uni-td>
<uni-td align="center">{{ item.updateTime }}</uni-td>
</uni-tr>
</uni-table>
<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 lodingVue from "@/utils/loding/loding.vue";
import {
hasValue
} from "@/utils/judge"
import {
listMesFurnaceOperationRecordDetail,
} from '@/api/mes/bom.js'
export default {
components:{
lodingVue
},
data() {
return {
/**表单数据 */
form:{
/** 工单编号 */
pwoCode : null,
/** 物料编码 */
materialCode : null,
/** 物料名称 */
materialName : null,
},
/** 校验规则 */
rules:{
pwoCode:{
rules:[
{
required : true,
},
]
},
materialCode:{
rules:[
{
required : true,
},
]
},
},
message:{
msgType:'',
messageText:''
},
tableData:[],
open:false,
}
},
/**
* 计算属性
*/
computed:{
/**
* 判断form值是否符合要求
* 如果符合则可以点击按钮,没有不能点击
*/
formComputed(){
const {pwoCode,materialCode} = this.form
//物料编码或工单编码有值则按钮可以点击
if(hasValue(pwoCode) || hasValue(materialCode)){
//工单编码有值则取消物料编码的必填
if(hasValue(pwoCode)) this.rules.materialCode.rules[0].required = false
//物料编码有值则取消工单编码的必填
if(hasValue(materialCode)) this.rules.pwoCode.rules[0].required = false
return false
}
this.rules.materialCode.rules[0].required = this.rules.pwoCode.rules[0].required = true
return true
}
},
methods: {
/**
* 扫码方法
* @param {Object} value {'equipment' || }
*/
iconClick(value){
const _this = this;
uni.scanCode({
// 是否只能从相机扫码,不允许从相册选择图片
onlyFromCamera:true,
// 扫码类型
scanType: ['barCode', 'qrCode'],
success: function(res) {
value === 'pwoCode' ? _self.body.pwoCode = res.result :value;
}
})
},
/**
* 接口访问方法
* @param {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
listMesFurnaceOperationRecordDetail,
}
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} value
*/
async clickSubmit(form){
const _self= this
const data = await _self.fnApi('listMesFurnaceOperationRecordDetail',form)
_self.form.materialName = data[0].materialName
_self.tableData = data
_self.open = true
}
}
}
</script>
<style lang="scss" scoped>
page{
background-color: #ffffff;
$fontSize:5vw; //设置变量,以字体为基础大小
font-size: $fontSize;
color: #6a6663;
padding-top: 1vw;
view{
width: 96vw;
margin: 0 auto;
}
}
</style>
<style>
page{
background-color: #ffffff ;
}
</style>