Commit 6524426e authored by 何远江's avatar 何远江

添加刀模版上架功能

parents bc5b57e2 97db4688
......@@ -149,6 +149,16 @@ const install = (Vue, vm) => {
enable: (params = {}) => vm.$u.post(config.adminPath + '/test/testData/enable', params),
delete: (params = {}) => vm.$u.post(config.adminPath + '/test/testData/delete', params),
},
// 刀模版相关
dModel: {
// 获取领用单
getToolsByProcessIdAndArrangeCode: (params = {}) => vm.$u.putJson(config.adminPath + '/tm/tmToolRequestUse/getToolsByProcessIdAndArrangeCode', params),
// 获取上下机记录
getRecordsByProcessIdAndArrangeCode: (params = {}) => vm.$u.putJson(config.adminPath + '/tm/tmToolMachinesRecord/getRecordsByProcessIdAndArrangeCode', params),
// 新增
tmToolMachines: (params = {}) => vm.$u.postJson(config.adminPath + '/tm/tmToolMachines', params),
tmToolMachinesRecord: (params = {}) => vm.$u.putJson(config.adminPath + '/tm/tmToolMachinesRecord', params)
}
};
......
<template>
<view class="dmodel-table">
<u-button type="primary" size="mini" @click="commonClick('1')">上机</u-button>
<u-button style="margin-left: 20rpx;" type="success" size="mini" @click="commonClick('2')">下机</u-button>
<zb-table :columns="tableColumn" :data="tableData" :stripe="true" @toggleAllSelection="toggleAllSelection"
@toggleRowSelection="toggleRowSelection">
</zb-table>
</view>
</template>
<script>
export default {
props: {
data: {
type: Array,
default: () => []
}
},
data() {
return {
tableSelectData: [],
tableColumn: [{
type: 'selection',
width: 35
},
{
name: 'typeName',
label: '状态',
width: 80,
},
{
name: 'toolCode',
label: '工装夹具sn码',
width: 140,
},
{
name: 'toolName',
label: '工装夹具名称',
width: 140,
},
{
name: 'itemName',
label: '物料名称',
width: 140,
},
{
name: 'upDate',
label: '上机时间',
width: 140,
},
{
name: 'downDate',
label: '下机时间',
width: 140,
},
],
}
},
computed: {
tableData() {
return this.data || []
}
},
methods: {
async commonClick(type) {
if (this.tableSelectData.length == 0) {
return this.$u.toast('请选择一条数据!')
}
// 判断选中的类型是否一致
if (this.tableSelectData.length > 1) {
let flag = false
for (let i = 1; i < this.tableSelectData.length; i++) {
const pre = this.tableSelectData[i - 1]
const cur = this.tableSelectData[i]
flag = cur.type == pre.type
if (!flag) {
break;
}
}
if (!flag) {
return this.$u.toast('请选择状态相同的数据')
}
}
const params = {
toolMachinesRecordIdList: this.tableSelectData.map(v => v.toolMachinesRecordId),
type
}
const {code} = await this.$u.api.dModel.tmToolMachinesRecord(params)
if (code == 200) {
this.$emit('action')
}
},
toggleAllSelection(checked, arr) {
this.tableSelectData = arr
},
toggleRowSelection(checked, arr) {
this.tableSelectData = arr
},
}
}
</script>
<style scoped>
.dmodel-table {
height: 500rpx;
margin-top: 20rpx;
padding: 0 20rpx;
}
</style>
......@@ -97,6 +97,7 @@
<view class="prod-body-left-task">
<zb-table :columns="tableColumn" :stripe="true" @rowClick="rowClick"
@numclik = "numclik"
@toggleRowSelection="toggleRowSelection" @toggleAllSelection="toggleAllSelection" :border="true"
:data="tableData"></zb-table>
</view>
......@@ -228,17 +229,8 @@
</u-col>
</u-row>
</u-form>
<view>
扫描结果
<uni-card>
<view class="uni-card__content">
<view class="uni-card__content-title">刀模信息</view>
<view class="uni-card__content-extra">刀模编号:{{ knifeTempInfo.knifeTemplateCode }}</view>
<view class="uni-card__content-extra">刀模名称:{{ knifeTempInfo.knifeTemplateName }}</view>
<view class="uni-card__content-extra">刀模规格:{{ knifeTempInfo.knifeTemplateSpec }}</view>
</view>
</uni-card>
</view>
<dModelList :data="dModelData" @action="upDownGetList" />
</u-modal>
......@@ -262,10 +254,10 @@
<script>
import SearchInput from "@/components/ScanInput/index.vue";
import dModelList from './components/dModelList.vue'
export default {
name: "ProdReport",
components: {SearchInput},
components: {SearchInput, dModelList},
data() {
return {
screenHeight: 768,
......@@ -367,18 +359,40 @@ export default {
type: 'selection',
width: 35
},
{
name: 'arrangeCode',
label: '编排单号',
width: 140,
func:"numclik"
},
{
name: 'startTime',
label: '计划开始时间',
width: 140,
func:"numclik"
},
{
name: 'endTime',
label: '计划结束时间',
width: 140,
},
{
name: 'quantity',
label: '待加工数量',
width: 140,
},
{
name: 'status',
label: '订单状态',
label: '状态',
filters: {
'START': '生产中',
// 'START': '生产中',
// 'PAUSE': '暂停',
// 'NORMARL': '未开始'
'PREPARE': '未开工',
'BEGINNING': '已开工',
'PAUSE': '暂停',
'NORMARL': '未开始'
'ERROR_STOP': '异常停工',
'FINISH': '完工'
},
width: 60,
align: "center"
......@@ -398,15 +412,15 @@ export default {
label: '生产单号',
width: 120,
},
{
name: 'itemCode',
label: '物料编号',
width: 110,
},
{
name: 'itemName',
label: '物料名称'
},
// {
// name: 'itemCode',
// label: '物料编号',
// width: 110,
// },
// {
// name: 'itemName',
// label: '物料名称'
// },
{
name: 'processName',
label: '工序',
......@@ -437,6 +451,7 @@ export default {
align: "center"
},
],
dModelData: [],
tableSelectData: [],
feedbackForms: [],
materialUsageRecordList: [],
......@@ -472,6 +487,9 @@ export default {
uni.$off('taskStatusChanged');
},
methods: {
numclik(...arg){
console.log('99999999', arg)
},
changeWorkstation() {
uni.$emit('changeWorkstation');
},
......@@ -516,19 +534,60 @@ export default {
}
},
async knifeTempShow() {
// this.knifeTempSearch.knifeTempCode = '';
// this.knifeTempSearch.locationCode = '';
console.log(this.tableSelectData, 'selectData');
if (this.tableSelectData.length > 1) {
return
}
const params = {
arrangeCode: '',
processId: ''
arrangeCode: this.tableSelectData[0].arrangeCode || '',
processId: this.tableSelectData[0].processId
}
await this.$u.api.dModel.getToolsByProcessIdAndArrangeCode(params)
const records = await this.$u.api.dModel.getRecordsByProcessIdAndArrangeCode(params)
// 如果有数据
if (records?.data && records.data.length) {
this.dModelData = records.data
this.knifeTempVisible = true
return
}
this.addDModelRecord(params)
},
async upDownGetList() {
const params = {
arrangeCode: this.tableSelectData[0].arrangeCode || '',
processId: this.tableSelectData[0].processId
}
const records = await this.$u.api.dModel.getRecordsByProcessIdAndArrangeCode(params)
this.dModelData = records.data
},
// 新增刀模版上下机记录
async addDModelRecord(params) {
const {data} = await this.$u.api.dModel.getToolsByProcessIdAndArrangeCode(params)
if (data?.length) {
const [selectData] = this.tableSelectData
const ps = {
toolMachinesCode: '',
arrangeCode: selectData.arrangeCode,
workunitId: selectData.workunitId,
processId: selectData.processId,
workorderId: selectData.workorderId,
toolRequestUseId: data[0].toolRequestUseId,
toolMachinesRecordList: data.map(v => {
return {
toolRequestUseItemId: v.toolRequestUseItemId,
type: 3,
upDate: '',
downDate: ''
}
})
}
// 新增
const data2 = await this.$u.api.dModel.tmToolMachines(ps)
if (data2.code == 200) {
const records = await this.$u.api.dModel.getRecordsByProcessIdAndArrangeCode(params)
this.dModelData = records.data || []
this.knifeTempVisible = true
}
}
},
rowClick(row, index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment