This commit is contained in:
赵正易 2024-11-15 11:29:58 +08:00
parent dc34c6a02d
commit 2f55d33c89
7 changed files with 308 additions and 116 deletions

View File

@ -63,7 +63,7 @@ export function getWorkOrderProgress(query) {
/**
* 错扫码报工扫标签码
* 错扫码报工扫标签码
* @param {主键} pid
* <returns> -1 此产品不属于此工单 0 报工失败 1 成功报工 </returns>
*/
@ -77,3 +77,17 @@ export function errorProofingAndReportingWork(query) {
/**
* 不防错直接扫码报工
* @param {主键} pid
* <returns> -1 此产品不属于此工单 0 报工失败 1 成功报工 </returns>
*/
export function noErrorProofingAndReportingReport(query) {
return request({
url: '/kanban/workorderProgress/no_errorProofingAndReportingReport',
method: 'get',
params: query
})
}

View File

@ -2,8 +2,8 @@
"name" : "DOAN总装车间PDA",
"appid" : "__UNI__EFA389B",
"description" : "",
"versionName" : "1.1.0",
"versionCode" : 110,
"versionName" : "1.1.1",
"versionCode" : 111,
"transformPx" : false,
"app-plus" : {
"usingComponents" : true,

View File

@ -40,6 +40,9 @@
<script>
import { fail } from 'assert';
export default {
onShow() {
uni.hideLoading();
},
data() {
return {
current: 0,

View File

@ -107,28 +107,28 @@ export default {
return;
}
// ====== ========
uni.showLoading({
title:'物料校验中'
})
const _strList = this.materialList.map((item) => {
return item.materialCode;
});
const checkData = {
matetialCodeArray: _strList,
lineCode: this.lineCode,
handelDate: this.dateTime
};
const checkRes = await checkMaterialIsInDateAndLine(checkData)
if (checkRes.code === 200 && checkRes.data.length > 0) {
this.popupData.title =
checkRes.data.map((item) => {
return item.matetialCode + '\n';
}) + '零件不在此产线今日工单中,请删除!';
this.$refs.popup1.open();
uni.hideLoading();
return false;
}
uni.hideLoading();
// uni.showLoading({
// title:''
// })
// const _strList = this.materialList.map((item) => {
// return item.materialCode;
// });
// const checkData = {
// matetialCodeArray: _strList,
// lineCode: this.lineCode,
// handelDate: this.dateTime
// };
// const checkRes = await checkMaterialIsInDateAndLine(checkData)
// if (checkRes.code === 200 && checkRes.data.length > 0) {
// this.popupData.title =
// checkRes.data.map((item) => {
// return item.matetialCode + '\n';
// }) + '线';
// this.$refs.popup1.open();
// uni.hideLoading();
// return false;
// }
// uni.hideLoading();
// ==== ========
const postData = {
Ingredient_task: this.materialList,

View File

@ -2,15 +2,15 @@
<!-- 扫码报工 -->
<view>
<uni-card v-if="!formData.workorder">
<!-- <text>{{ '线别:' + lineCode }}</text> -->
<text>{{ '组别' + groupCode }}</text>
<ScanInput @scanConfirm="scanConfirm" placeholder="请扫报工码开始报工"></ScanInput>
</uni-card>
<!-- <uni-card v-if="formData.workorder && formData.status === 2">
<text>{{ '线别:' + lineCode }}</text>
<text style="margin-left: 20px">{{ '组别' + groupCode }}</text>
<ScanInput @scanConfirm="scanConfirm" placeholder="请扫报工码"></ScanInput>
</uni-card>
<uni-card v-if="formData.workorder && formData.status === 2">
<text>{{ '线别:' + lineCode }}</text>
<text style="margin-left: 20px">{{ '组别' + groupCode }}</text>
<ScanInput @scanConfirm="scanConfirm2" placeholder="请扫产品码"></ScanInput>
</uni-card>
<ScanInput @scanConfirm="scanConfirm2" placeholder="请扫报工码结束报工"></ScanInput>
</uni-card> -->
<uni-card v-if="formData.workorder">
<uni-forms :modelValue="formData" label-width="80px" label-align="right">
<uni-forms-item label="工单号" name="workorder">
@ -33,21 +33,56 @@
<uni-forms-item label="计划生产" name="deliveryNum">
<span>{{ formData.deliveryNum }}</span>
</uni-forms-item>
<uni-forms-item label="已报工数" name="finishedNum">
<span style="font-size: 26px;">{{ formData.finishNum }}</span>
<uni-forms-item v-if="formData.status === 2" label="报工数" name="finishedNum">
<uni-number-box class="input-item" :width="200" v-model="finishedNum" placeholder="请输入报工数" :max="99999" ></uni-number-box>
</uni-forms-item>
<uni-forms-item v-if="formData.status === 2" label="">
<span class="row-box">
<button @click="addFinishedNum">增加</button>
<button @click="reduceFinishedNum">减少</button>
<!-- <button @click="doStartWorkOrder">暂存</button> -->
</span>
</uni-forms-item>
</uni-forms>
</uni-card>
<view class="bottom-box row-box" v-if="formData.workorder">
<button :disabled="loading" type="primary" @click="doStartWorkOrder">开始工单</button>
<button :disabled="loading" type="warn" @click="doFinfishWorkOrder">完成工单</button>
<view class="bottom-box" v-if="formData.workorder">
<button v-if="formData.status === 1" :disabled="loading" type="primary" @click="doStartWorkOrder">开始工单</button>
<button v-if="formData.status === 2" :disabled="loading" type="warn" @click="doFinfishWorkOrder2">完成工单</button>
</view>
<!-- 报工数自动修改 -->
<view>
<!-- 输入框示例 -->
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog
ref="inputClose"
mode="input"
:title="numModel === 1?'增加报工数':'减少报工数'"
:value="0"
placeholder=""
@confirm="dialogInputConfirm"
></uni-popup-dialog>
</uni-popup>
</view>
<!-- 完成工单校验 -->
<!-- <view>
<uni-popup ref="inputDialog2" type="dialog">
<uni-popup-dialog
ref="inputClose2"
mode="input"
title="扫"
value=""
placeholder="请扫报工码校验"
@confirm="dialogInputConfirm2"
></uni-popup-dialog>
</uni-popup>
</view> -->
</view>
</template>
<script>
import { errorProofingAndReportingWork } from '@/api/workorder/proreportwork.js';
import { GetWorkOrderDetail,startWorkOrder,finishWorkOrder } from '@/api/workorder/proworkorder.js';
import { errorProofingAndReportingWork,updateProReportwork,noErrorProofingAndReportingReport } from '@/api/workorder/proreportwork.js';
import { GetWorkOrderDetail, startWorkOrder, finishWorkOrder } from '@/api/workorder/proworkorder.js';
export default {
onLoad: function (option) {
this.lineCode = option.lineCode;
@ -61,11 +96,21 @@ export default {
formData: {
id: null,
finishNum: 0
}
},
finishedNum:0,
// 1- 2-
numModel:1,
inputDialog:null,
inputClose:null,
inputDialog2:null,
inputClose2:null,
};
},
methods: {
//
// finishedNumInputChange(e){
// this.formData.finishedNum = e.detail.value;
// },
//
async scanConfirm(val) {
this.loading = true;
if (val === '' || val === null) {
@ -77,7 +122,7 @@ export default {
workorder: strArray[0]
};
let res1 = await GetWorkOrderDetail(params);
if (res1.code !== 200) {
if (res1 === null || res1.code !== 200) {
uni.showToast({
icon: 'error',
title: '标签异常'
@ -85,101 +130,195 @@ export default {
this.loading = false;
return;
}
if (res1.data.lineCode !== this.lineCode || res1.data.groupCode !== this.groupCode) {
if (res1.data.groupCode !== this.groupCode) {
uni.showToast({
icon: 'none',
title: '扫码结果异常,该工单不属于此线别或'
title: '扫码结果异常,该工单不属于此组'
});
this.loading = false;
return;
}
this.formData = res1.data;
this.finishedNum = res1.data.finishNum ?? 0;
this.loading = false;
},
//
async scanConfirm2(val) {
if (val === '' || val === null) {
return;
}
const params = {
workorder: this.formData.workorder,
labelContext: val
};
let res1 = await errorProofingAndReportingWork(params);
if (res1.code !== 200) {
uni.showToast({
icon: 'error',
title: '标签异常'
});
return;
}
if (res1.data === -1) {
uni.showToast({
icon: 'none',
title: '此产品不属于此工单'
});
return;
}
if (res1.data === 0) {
uni.showToast({
icon: 'none',
title: '报工失败'
});
return;
}
if (res1.data === 1) {
uni.showToast({
icon: 'success',
title: '报工成功'
});
this.updateWorkOrderDetail(params)
return;
}
},
//
updateWorkOrderDetail(params){
GetWorkOrderDetail(params).then(res=>{
if(res.code === 200){
updateWorkOrderDetail(params) {
GetWorkOrderDetail(params).then((res) => {
if (res.code === 200) {
this.formData = res.data;
// this.formData.finishedNum = res.data.nu,
}
})
});
},
//
doStartWorkOrder() {
this.loading = true
this.loading = true;
const params = {
workorder:this.formData.workorder
}
startWorkOrder(params).then(res=>{
if(res.code === 200){
workorder: this.formData.workorder
};
startWorkOrder(params).then((res) => {
if (res.code === 200) {
uni.showToast({
icon: 'success',
title: '工单开始成功'
});
this.updateWorkOrderDetail(params)
this.loading = false
}else{
this.loading = false
this.updateWorkOrderDetail(params);
this.loading = false;
} else {
this.loading = false;
}
});
},
//
addFinishedNum() {
this.numModel = 1
this.$refs.inputDialog.open()
},
//
reduceFinishedNum() {
this.numModel = 2
this.$refs.inputDialog.open()
},
// 1
dialogInputConfirm(val){
let oldNum = this.finishedNum ?? 0
if(this.numModel === 1){
this.finishedNum = (oldNum * 1) + (val * 1)
}else{
this.finishedNum = (oldNum * 1) - (val * 1)
if(this.finishedNum < 0){
this.finishedNum = 0
}
}
},
// NODO
openDialog2() {
this.$refs.inputDialog2.open()
},
// NODO 2
dialogInputConfirm2(val){
const that = this
if (val === '' || val === null) {
uni.showToast({
icon: 'error',
title: '报工号异常'
});
return;
}
let strArray = val.split('^');
if(strArray[0] != this.formData.workorder){
uni.showToast({
icon: 'error',
title: '报工号异常'
});
this.loading = false;
return;
}
this.loading = true;
uni.showLoading({
title:'报工中……'
})
//
const params = {
workorder:this.formData.workorder,
reportNum:this.finishedNum
}
noErrorProofingAndReportingReport(params).then(res=>{
if(res.code === 200){
uni.showToast({
icon: 'success',
title: '报工成功',
duration:2000,
success() {
const params2 = {
workorder: that.formData.workorder
};
finishWorkOrder(params2).then((res) => {
if (res.code === 200) {
uni.showToast({
icon: 'success',
title: '完成工单'
});
that.loading = false;
uni.hideLoading();
setTimeout(()=>{
uni.navigateBack(-1)
},2000)
}
});
}
});
}
}).finally(()=>{
this.loading = true;
uni.hideLoading();
})
},
//
// NODO
doFinfishWorkOrder() {
const params = {
workorder:this.formData.workorder
}
finishWorkOrder(params).then(res=>{
if(res.code === 200){
workorder: this.formData.workorder
};
finishWorkOrder(params).then((res) => {
if (res.code === 200) {
uni.showToast({
icon: 'success',
title: '工单完成成功'
});
this.updateWorkOrderDetail(params)
this.loading = false
}else{
this.loading = false
this.updateWorkOrderDetail(params);
this.loading = false;
} else {
this.loading = false;
}
});
},
// +
doFinfishWorkOrder2(){
let that = this
this.loading = true;
uni.showLoading({
title:'报工中……'
})
//
const params = {
workorder:this.formData.workorder,
reportNum:this.finishedNum
}
noErrorProofingAndReportingReport(params).then(res=>{
if(res.code === 200){
uni.showToast({
icon: 'success',
title: '报工成功',
duration:2000,
success() {
const params2 = {
workorder: that.formData.workorder
};
finishWorkOrder(params2).then((res) => {
if (res.code === 200) {
uni.showToast({
icon: 'success',
title: '完成工单'
});
that.loading = false;
uni.hideLoading();
setTimeout(()=>{
uni.navigateBack(-1)
},2000)
}
});
}
});
}
}).finally(()=>{
this.loading = true;
uni.hideLoading();
})
}
}
@ -196,4 +335,10 @@ span {
align-items: center;
justify-content: flex-start;
}
.input-item {
height: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
}
</style>

View File

@ -6,9 +6,9 @@
<uni-forms-item label="日期">
<uni-datetime-picker type="date" :clear-icon="false" v-model="query.dateTime" />
</uni-forms-item>
<uni-forms-item label="线别">
<!-- <uni-forms-item label="线别">
<uni-data-select v-model="query.lineCode" :localdata="lineOptions" :clear="false"></uni-data-select>
</uni-forms-item>
</uni-forms-item> -->
<uni-forms-item label="组别">
<uni-data-select v-model="query.groupCode" :localdata="groupOptions" :clear="false"></uni-data-select>
</uni-forms-item>
@ -21,11 +21,12 @@
<scroll-view class="scroll-view" scroll-y="true">
<uni-list style="width: 100%">
<uni-list-item
:class="getWorkOrderClass(item)"
v-for="(item, index) in dataList"
:key="index"
:title="item.title"
:note="item.note"
rightText="报工"
:rightText="item.rightText"
link
@click="onListItemClick(item)"
></uni-list-item>
@ -51,7 +52,7 @@ export default {
return {
//
query: {
lineCode: '1',
lineCode: '',
groupCode: '1',
dateTime: this.$dayjs().format('YYYY-MM-DD')
},
@ -78,6 +79,17 @@ export default {
//
this.getSelectOptions();
},
getWorkOrderClass(item) {
if (item.status === 1) {
return '';
}
if (item.status === 2) {
return 'bg-blue';
}
if (item.status === 3) {
return 'bg-green';
}
},
async getSelectOptions() {
uni.showLoading();
const res1 = await GetAllRoute();
@ -129,23 +141,35 @@ export default {
pageIndex: 1,
pageSize: 1000,
groupCode: this.query.groupCode,
lineCode: this.query.lineCode,
lineCode: null,
timeRange: [this.query.dateTime, this.query.dateTime]
};
getReportWorkOrderList(params).then((res) => {
let that = this
if (res.code === 200) {
this.setSessionStorage(this.query);
this.dataList = res.data.result.map((item) => {
let statusStr = that.getWorkOrderStatus(item.status)
return {
id: item.id,
workOrderInfo: item,
title: `工单号:${item.fkWorkorder}`,
note: `${item.productionName} ${item.productionCode}`
status: item.status,
title: `${item.fkWorkorder} -- ${statusStr}`,
note: `${item.productionName} ${item.productionCode}`,
rightText: `${item.finishedNum ?? 0} 修改报工`
};
});
}
});
},
getWorkOrderStatus(status = 0){
try{
const list = ['', '未开始', '进行中', '已完成'];
return list[status * 1]
}catch(e){
return ''
}
},
WorkOrderStatusColor(status) {
const list = ['', '未开始', '已开始', '已完成'];
const colorList = ['#fff', '#8f939c', '#2979ff', '#18bc37'];
@ -193,7 +217,13 @@ export default {
width: 100%;
}
.scroll-view {
height: 760rpx;
height: 800rpx;
padding-bottom: 40rpx;
}
.bg-blue {
background-color: rgb(197.7, 225.9, 255) !important;
}
.bg-green {
background-color: rgb(209.4, 236.7, 195.9) !important;
}
</style>

View File

@ -43,7 +43,7 @@ const request = config => {
header: config.header,
dataType: 'json'
}).then(response => {
// console.log('response',response);
let [error, res] = response
if (error) {
toast('后端接口连接异常')