<template>
|
<view class="content">
|
<view class="list">
|
<uni-card :title="'当期订单:'+currentOrder[0].HSourceBillNo"
|
style="margin: 10px;">
|
<view class="card-detail">
|
<view class="detail" v-if="currentOrder[0].HSourceName" style="width: 100%;">
|
<text>当前设备:</text>{{currentOrder[0].HSourceName}}
|
</view>
|
<view class="detail" v-if="currentOrder[0].首检次数?currentOrder[0].首检次数:0" style="width: 100%;">
|
<text>首检次数:</text>{{currentOrder[0].首检次数}}
|
</view>
|
<view class="detail">
|
<text>巡检次数:</text>{{currentOrder[0].巡检次数?currentOrder[0].巡检次数:0}}
|
</view>
|
<view class="detail">
|
<text>过程检次数:</text>{{currentOrder[0].过程检次数?currentOrder[0].过程检次数:0}}
|
</view>
|
<view class="detail" v-if="currentOrder[0].当日点检完成情况">
|
<text>点检完成情况:</text>{{currentOrder[0].当日点检完成情况}}
|
</view>
|
<view class="detail" v-if="currentOrder[0].安灯未验收数量">
|
<text>异常反馈未验收:</text>{{currentOrder[0].安灯未验收数量}}
|
<view style="width: 6rpx; display: inline-block;"></view>
|
<template v-if="currentOrder[0].安灯未验收数量 == 0">
|
<uni-icons type="smallcircle-filled" size="12"
|
color="#13ad4c"></uni-icons>
|
</template>
|
<template v-else-if="currentOrder[0].安灯未验收数量 != 0">
|
<uni-icons type="smallcircle-filled" size="12"
|
color="#e74c3c"></uni-icons>
|
</template>
|
</view>
|
</view>
|
</uni-card>
|
</view>
|
<view class="list" v-for="(item,index) in listData" :key="index">
|
<uni-card :title="'工单号:'+item.HICMOBillNo" :extra="'日期:'+item.计划日期" style="margin: 10px;" @tap="edit(item)">
|
<view class="card-detail">
|
<view class="detail" v-if="item.HMaterName" style="width: 100%;">
|
<text>产品名称:</text>{{item.HMaterName}}
|
</view>
|
<view class="detail" v-if="item.HModel" style="width: 100%;">
|
<text>产品型号:</text>{{item.HModel}}
|
</view>
|
<view class="detail">
|
<text>计划数量:</text>{{item.HDatePlanQty?item.HDatePlanQty:0}}
|
</view>
|
<view class="detail">
|
<text>汇报总数:</text>{{item.HDateFinishQty?item.HDateFinishQty:0}}
|
</view>
|
<view class="detail" v-if="item.HICMOStatus">
|
<text>当前状态:</text>{{item.HICMOStatus}}
|
</view>
|
<view class="detail" v-if="item.领料状态">
|
<text>领料状态:</text>{{item.领料状态}}
|
</view>
|
<view class="detail" style="width: 100%;display: flex;align-items: center;">
|
<text>生产进度:</text>
|
<zui-progress-bar :value="item.percent" :width="210" type="follow-left" />
|
</view>
|
</view>
|
</uni-card>
|
</view>
|
<uni-popup ref="popup" background-color="#fff">
|
<view class="popup-content">
|
<view class="tit">异常类型</view>
|
<view class="item" v-for="(item,index) in popList" :key="index" @tap="toAbnm(item)">{{item}}</view>
|
</view>
|
</uni-popup>
|
<view class="over" v-if="listData.length == 0">暂无数据</view>
|
<view class="over" v-if="listData.length != 0">已到底</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
CommonUtils
|
} from "../../utils/common";
|
import {
|
getUserInfo
|
} from "@/utils/auth.js";
|
export default {
|
data() {
|
return {
|
userInfo: getUserInfo(),
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
HSourceID: '',
|
HSourceName: '',
|
number: 1,
|
listData: [],
|
chooseIt: '',
|
popList: ['人员原因', '设备原因', '材料原因', '工艺原因', '模具原因', '测试原因', '环境原因'],
|
badReasonBackTypeList: [],
|
currentOrder: [],
|
// 定义操作映射配置
|
actionConfig: {
|
'开工': {
|
apiUrl: '/Sc_MESBeginWorkBill/FastBeginWorkBill',
|
type: '开工',
|
handler: 'handleBegin',
|
checkStatus: true, // 需要检查状态
|
denyMsg: '单据状态不满足开工条件!' // 固定错误提示
|
},
|
'完工': {
|
apiUrl: '/Sc_MESEndWorkBill/FastEndWorkBill',
|
type: '完工',
|
handler: 'handleEnd',
|
checkStatus: true,
|
denyMsg: '单据状态不满足完工条件!' // 固定错误提示
|
},
|
'停工': {
|
apiUrl: '/Sc_MESStopWorkBill/FastStopWorkBill',
|
type: '停工',
|
handler: 'handleStop',
|
checkStatus: true,
|
denyMsg: '单据状态不满足停工条件!' // 固定错误提示
|
},
|
'异常反馈': {
|
apiUrl: '',
|
type: '异常反馈',
|
handler: 'handleAbnormal',
|
checkStatus: true,
|
denyMsg: '单据状态不满足异常反馈条件!' // 固定错误提示
|
},
|
'工艺参数点检': {
|
apiUrl: '',
|
type: '工艺参数点检',
|
handler: 'handleICMOTechParam',
|
checkStatus: true,
|
denyMsg: '单据状态不满足工艺参数点检条件!' // 固定错误提示
|
},
|
'首检': {
|
apiUrl: '',
|
type: '首检',
|
handler: 'handleFirstCheck',
|
checkStatus: false,
|
denyMsg: '单据状态不满足工艺参数点检条件!'
|
},
|
'巡检': {
|
apiUrl: '', // 巡检需要检查首件是否完成
|
type: '巡检',
|
handler: 'handlePatrolCheck',
|
checkStatus: false,
|
denyMsg: '单据状态不满足巡检条件!'
|
},
|
'末检': {
|
apiUrl: '',
|
type: '末检',
|
handler: 'handleProcessCheck',
|
checkStatus: false,
|
denyMsg: '单据状态不满足末检条件!'
|
}
|
}
|
}
|
},
|
onLoad(e) {
|
console.log(e)
|
uni.showLoading({
|
title: '加载中...'
|
})
|
this.HSourceName = e.HSourceName
|
this.HSourceID = e.HSourceID
|
this.getList(e.HSourceID)
|
this.getErrMsgBackType()
|
},
|
onPullDownRefresh: function() {
|
this.getList(this.HSourceID)
|
setTimeout(() => {
|
uni.stopPullDownRefresh();
|
}, 1000);
|
},
|
methods: {
|
async getErrMsgBackType() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/Gy_BadReason/Gy_ErrMsgBackTypeList',
|
data: {
|
sWhere: ` and 使用组织名称 = '${uni.getStorageSync('Organization')}'`,
|
user: getUserInfo()['Czymc']
|
}
|
})
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.popList = Array.from(data).map(item => item['异常反馈类型名称'])
|
this.badReasonBackTypeList = data
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取异常反馈类型失败: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取异常反馈类型失败: ${err}`
|
})
|
}
|
},
|
getList(e) {
|
uni.request({
|
url: this.serverUrl + '/ReportPlatForm/SearchGetWorkBillList',
|
data: {
|
"HSourceID": e
|
},
|
success: (res) => {
|
if (res.data.count == 1) {
|
console.log(res.data.data.h_p_JIT_GetWorkBillListInfoBySource)
|
this.listData = res.data.data.h_p_JIT_GetWorkBillListInfoBySource
|
this.currentOrder = res.data.data.h_p_JIT_GetWorkBillListInfoBySource1
|
for (var i = 0; i < this.listData.length; i++) {
|
this.listData[i].percent = (this.listData[i].HDateFinishQty / this.listData[
|
i].HDatePlanQty).toFixed(4)
|
}
|
setTimeout(() => {
|
uni.hideLoading()
|
}, 1000);
|
} else {
|
setTimeout(() => {
|
uni.hideLoading()
|
}, 1000);
|
uni.showToast({
|
title: '获取列表出错!',
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
setTimeout(() => {
|
uni.hideLoading()
|
}, 1000);
|
uni.showToast({
|
title: '获取列表接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
toAbnm(item) {
|
console.log(item, this.chooseIt)
|
this.$refs.popup.close()
|
uni.navigateTo({
|
url: './OA_ErrMsgBackBill?HICMOBillNo=' + this.chooseIt.HICMOBillNo +
|
'&HSourceName=' + this.HSourceName +
|
'&HSourceBillNo=' + this.chooseIt.HSourceBillNo +
|
'&HType=' + item +
|
'&OperationType=4&linterid=&HSouceBillType=3772'
|
})
|
},
|
edit(item) {
|
console.log(item)
|
this.chooseIt = item
|
|
// 使用对象映射配置生成可用的操作列表
|
const availableActions = Object.keys(this.actionConfig)
|
|
uni.showActionSheet({
|
itemList: availableActions,
|
success: (res) => {
|
const actionKey = availableActions[res.tapIndex]
|
const actionConfig = this.actionConfig[actionKey]
|
|
// 调用对应的处理方法
|
this[actionConfig.handler](item, actionConfig)
|
},
|
fail: function(res) {
|
console.log(res.errMsg);
|
}
|
});
|
},
|
// 开工处理
|
handleBegin(item, config) {
|
const upData = this.createUpData(item)
|
this.checkAndExecuteWorkStatus(
|
item,
|
config,
|
config.apiUrl,
|
upData
|
)
|
},
|
// 完工处理
|
handleEnd(item, config) {
|
const upData = this.createUpData(item)
|
this.checkAndExecuteWorkStatus(
|
item,
|
config,
|
config.apiUrl,
|
upData
|
)
|
},
|
// 停工处理
|
handleStop(item, config) {
|
const upData = this.createUpData(item)
|
this.checkAndExecuteWorkStatus(
|
item,
|
config,
|
config.apiUrl,
|
upData
|
)
|
},
|
// 异常反馈处理
|
handleAbnormal(item, config) {
|
const sWhere = {
|
"HSourceID": this.HSourceID,
|
"HICMOBillNo": item.HICMOBillNo,
|
"HInterID": item.HSourceInterID,
|
"type": config.type
|
}
|
|
uni.request({
|
url: this.serverUrl + '/Sc_MESBeginWorkBill/GetMESBeginWorkBillStaus',
|
type: "GET",
|
data: {
|
"sWhere": JSON.stringify(sWhere)
|
},
|
dataType: "json",
|
async: false,
|
success: (res) => {
|
console.log('异常反馈状态检查:', res.data)
|
// 根据第二个页面的逻辑:如果count>0,表示不允许操作
|
if (res.data.count > 0) {
|
// 不允许操作,显示错误提示
|
const status = item.HICMOStatus || '未知状态'
|
uni.showToast({
|
title: `工单【${item.HICMOBillNo}】当前状态为【${status}】,${config.denyMsg}`,
|
icon: 'none',
|
duration: 3000
|
})
|
} else {
|
// count<=0,表示允许操作
|
this.$refs.popup.open('center')
|
}
|
},
|
fail: (res) => {
|
console.log(res)
|
uni.hideLoading()
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
})
|
},
|
// 工艺参数点检
|
handleICMOTechParam(item, config) {
|
const upData = this.createUpData(item)
|
this.checkAndExecuteWorkStatus(
|
item,
|
config,
|
config.apiUrl,
|
upData
|
)
|
},
|
handleFirstCheck(item, config) {
|
let uri = `?HSouceBillType=${item.HBillType}&HBillNo=${item.HICMOBillNo}` +
|
`&linterid=${item.HProcExchInterID}&hsubid=${item.HProcExchEntryID || 1}`
|
uni.navigateTo({
|
url: '/pages/ZLGL/shoujianjianyan/firstCheckBill' + uri + `&operationType=2`
|
})
|
},
|
handlePatrolCheck(item, config) {
|
let uri = `?HSouceBillType=${item.HBillType}&HBillNo=${item.HICMOBillNo}` +
|
`&linterid=${item.HProcExchInterID}&hsubid=${item.HProcExchEntryID || 1}`
|
uni.navigateTo({
|
url: '/pages/ZLGL/xunjianjianyan/PatrolProcCheckBill' + uri + `&operationType=2`
|
})
|
},
|
handleProcessCheck(item, config) {
|
let uri = `?HSouceBillType=${item.HBillType}&HBillNo=${item.HICMOBillNo}` +
|
`&linterid=${item.HProcExchInterID}&hsubid=${item.HProcExchEntryID || 1}`
|
uni.navigateTo({
|
url: '/pages/ZLGL/mojianjianyan/ProcessCheckBill' + uri + `&operationType=2`
|
})
|
},
|
// 创建通用的请求数据
|
createUpData(item) {
|
return {
|
HBillType: item.HBillType,
|
HSourceInterID: item.HSourceInterID,
|
HSourceEntryID: item.HSourceEntryID,
|
HSourceBillNo: item.HSourceBillNo,
|
HSourceBillType: item.HSourceBillType,
|
user: uni.getStorageSync('HUserName')
|
}
|
},
|
// 通用的检查和执行方法
|
checkAndExecuteWorkStatus(item, config, apiUrl, upData) {
|
const sWhere = {
|
"HSourceID": this.HSourceID,
|
"HICMOBillNo": item.HICMOBillNo,
|
"HInterID": item.HSourceInterID,
|
"type": config.type
|
}
|
|
console.log('状态检查参数:', JSON.stringify(sWhere))
|
|
uni.request({
|
url: this.serverUrl + '/Sc_MESBeginWorkBill/GetMESBeginWorkBillStaus',
|
type: "GET",
|
data: {
|
"sWhere": JSON.stringify(sWhere)
|
},
|
dataType: "json",
|
async: false,
|
success: (res) => {
|
console.log('状态检查结果:', res.data)
|
// 根据第二个页面的逻辑:如果data.count>0,表示不允许操作
|
if (res.data.count > 0) {
|
// 不允许操作,显示错误提示
|
const status = item.HICMOStatus || '未知状态'
|
const operationMap = {
|
'开工': '开工',
|
'完工': '完工',
|
'停工': '停工',
|
'异常反馈': '异常反馈',
|
'工艺参数点检': '工艺参数点检'
|
}
|
const operationName = operationMap[config.type] || config.type
|
|
// 根据操作类型给出不同的建议
|
let suggestion = ''
|
switch (config.type) {
|
case '开工':
|
suggestion = '开工操作需要工单状态为"待生产"或"挂起"状态,请检查当前状态是否符合要求'
|
break
|
case '完工':
|
suggestion = '完工操作需要工单处于"生产中"状态,请检查当前状态是否符合要求'
|
break
|
case '停工':
|
suggestion = '停工操作需要工单处于"生产中"状态,请检查当前状态是否符合要求'
|
break
|
case '异常反馈':
|
suggestion = '异常反馈需要工单处于"生产中"或"开工"状态,请检查当前状态是否符合要求'
|
break
|
case '工艺参数点检':
|
suggestion = '工艺参数点检需要工单处于"生产中"或"开工"状态,请检查当前状态是否符合要求'
|
break
|
default:
|
suggestion = '请检查工单状态是否符合操作要求'
|
}
|
|
uni.showToast({
|
title: `工单【${item.HICMOBillNo}】当前状态为【${status}】,无法进行【${operationName}】操作。\n${suggestion}`,
|
icon: 'none',
|
duration: 4000
|
})
|
} else {
|
// data.count<=0,表示允许操作
|
this.showConfirmDialog(config.type, item, apiUrl, upData)
|
}
|
},
|
fail: (res) => {
|
console.log(res)
|
uni.hideLoading()
|
uni.showToast({
|
title: '状态检查接口请求失败',
|
icon: 'none'
|
})
|
},
|
})
|
},
|
// 显示确认对话框
|
showConfirmDialog(actionType, item, apiUrl, upData) {
|
// 获取当前工单状态显示在确认框中
|
const status = item.HICMOStatus || '未知状态'
|
|
uni.showModal({
|
title: actionType + '确认',
|
content: `设备:${this.HSourceName}\n工单:${item.HICMOBillNo}\n产品:${item.HMaterName}\n当前状态:${status}\n\n确定要执行【${actionType}】操作吗?`,
|
success: (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定')
|
this.executeWork(apiUrl, upData, item, actionType)
|
} else if (res.cancel) {
|
console.log('用户点击取消')
|
}
|
}
|
})
|
},
|
// 执行工作操作
|
executeWork(apiUrl, upData, item, actionType) {
|
uni.showLoading({
|
title: `正在${actionType}...`,
|
mask: true
|
})
|
console.log('执行操作参数:', upData)
|
|
if (actionType == '工艺参数点检') {
|
uni.hideLoading()
|
console.log('item: ', item);
|
uni.navigateTo({
|
url: `/pages/MJGL/SB_EquipICMOTechParamBill/SB_EquipICMOTechParamBillEdit?hinterid=${item.HSourceInterID}&hsubid=${item.HSourceEntryID}&operationType=5`
|
})
|
} else {
|
uni.request({
|
url: this.serverUrl + apiUrl,
|
data: upData,
|
success: (res) => {
|
console.log('执行操作结果:', res)
|
if (res.data.count == 1) {
|
// 操作成功后刷新列表
|
this.getList(this.HSourceID)
|
uni.showToast({
|
title: `${actionType}成功!`,
|
icon: 'success'
|
})
|
|
if (actionType == '完工') {
|
// 完工单提交成功后。提示是否需要跳转达到下模单
|
uni.showModal({
|
title: "跳转页面",
|
content: "完工单保存成功,是否跳转到下模单页面。",
|
success: (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定')
|
uni.redirectTo({
|
url: "/pages/MJGL/xiamodan/MouldLowerBillList"
|
})
|
} else if (res.cancel) {
|
console.log('用户点击取消')
|
}
|
}
|
})
|
|
}
|
} else {
|
uni.hideLoading()
|
// 显示更详细的操作失败提示
|
let errorMsg = res.data.Message || `${actionType}失败`
|
uni.showToast({
|
title: `${actionType}失败:${errorMsg}`,
|
icon: 'none',
|
duration: 3000
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res)
|
uni.hideLoading()
|
uni.showToast({
|
title: `${actionType}接口请求失败,请检查网络`,
|
icon: 'none'
|
})
|
},
|
})
|
}
|
},
|
changeTab(e) {
|
this.number = e
|
if (e == 1) {
|
this.listData = this.listData1
|
} else {
|
this.listData = this.listData2
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.list {
|
width: 100%;
|
|
.card-detail {
|
width: 100%;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
line-height: 120%;
|
|
.detail {
|
width: 46%;
|
font-size: 26rpx;
|
margin-bottom: 12rpx;
|
color: #555;
|
margin-right: 20rpx;
|
|
text {
|
color: #999;
|
font-size: 26rpx;
|
}
|
}
|
}
|
|
.more {
|
color: #888;
|
font-size: 24rpx;
|
display: flex;
|
border-top: 1px solid #eee;
|
padding-top: 20rpx;
|
|
.part {
|
width: 50%;
|
text-align: center;
|
}
|
}
|
}
|
|
.popup-content {
|
width: 500rpx;
|
border-radius: 20rpx;
|
text-align: center;
|
padding-bottom: 20rpx;
|
|
.tit {
|
height: 120rpx;
|
line-height: 120rpx;
|
font-size: 34rpx;
|
color: #222;
|
font-weight: bold;
|
}
|
|
.item {
|
height: 88rpx;
|
line-height: 88rpx;
|
border-top: 1px solid #eee;
|
font-size: 32rpx;
|
color: #444;
|
}
|
}
|
</style>
|