feat: 工单转移

This commit is contained in:
2024-05-15 16:39:01 +08:00
parent 164a740cb9
commit 0aef31b49f
3 changed files with 77 additions and 4 deletions

View File

@@ -77,5 +77,11 @@ export function changeActive(data) {
data
})
}
export function getYZDevice() {
return request({
url: 'api/device/getYZDevice',
method: 'post'
})
}
export default { add, edit, del, getWorkprocedure, getItemByDeviceId, copyAdd, changeActive, getAllRegions }
export default { add, edit, del, getWorkprocedure, getItemByDeviceId, copyAdd, changeActive, getAllRegions, getYZDevice }

View File

@@ -103,4 +103,11 @@ export function getMaterial() {
})
}
export default { add, edit, del, submits, getDevice, getTable, openStart, saveReport, finish, getReportWork, forceFinish, getDtl, getMaterial }
export function changeDevice(data) {
return request({
url: 'api/workorder/changeDevice',
method: 'post',
data
})
}
export default { add, edit, del, submits, getDevice, getTable, openStart, saveReport, finish, getReportWork, forceFinish, getDtl, getMaterial, changeDevice }

View File

@@ -86,6 +86,17 @@
>
开工
</el-button>
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-position"
size="mini"
:disabled="!(crud.selections[0]) || crud.selections[1]"
@click="changeDevice(crud.selections[0])"
>
工单变更
</el-button>
<el-button
slot="right"
class="filter-item"
@@ -350,11 +361,37 @@
<el-button type="primary" @click="toForceFinish">确认</el-button>
</div>
</el-dialog>
<!-- 提示对话框 -->
<el-dialog
:close-on-click-modal="false"
:visible.sync="showDeviceChoose"
title="选择设备"
width="350px"
>
<el-select
v-model="cacheOrderDevice"
placeholder="转移设备"
style="width: 300px"
filterable
>
<el-option
v-for="item in yzDeviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
<span slot="footer" class="dialog-footer">
<el-button @click="showDeviceChoose = false">取消</el-button>
<el-button type="primary" @click="doChangeDevice">确定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import crudWorkorder from '@/api/wms/pdm/workorder'
import crudDevice from '@/api/wms/pdm/device'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
@@ -416,7 +453,7 @@ const defaultForm = {
}
export default {
name: 'Produceshiftorder',
components: { pagination, crudOperation, rrOperation, udOperation, MaterDtl, ViewDialog, DeviceDialog },
components: { pagination, crudOperation, rrOperation, udOperation, MaterDtl, ViewDialog, DeviceDialog, crudDevice },
mixins: [presenter(), header(), form(defaultForm), crud()],
dicts: ['pdm_workorder_status', 'priority_direction', 'is_used', 'is_or_not', 'material_type', 'vehicle_type', 'workorder_procedure', 'true_or_false', 'wood_vehicle_type'],
cruds() {
@@ -470,10 +507,17 @@ export default {
plan_date: [
{ required: true, message: '计划生产日期不能为空', trigger: 'blur' }
]
}
},
showDeviceChoose: false,
cacheOrderData: {},
cacheOrderDevice: null,
yzDeviceList: []
}
},
created() {
crudDevice.getYZDevice().then(res => {
this.yzDeviceList = res
})
},
methods: {
// 工单状态多选搜索
@@ -545,6 +589,22 @@ export default {
this.crud.toQuery()
})
},
// 工单变更
changeDevice(row) {
this.cacheOrderData = row
this.showDeviceChoose = true
},
doChangeDevice() {
// 工单更换
this.cacheOrderData.new_device_code = this.cacheOrderDevice
crudWorkorder.changeDevice(this.cacheOrderData).then(res => {
this.crud.notify('工单转移成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.showDeviceChoose = false
this.cacheOrderData = {}
this.cacheOrderDevice = null
this.crud.toQuery()
})
},
downloadExcel() {
if (this.crud.query.createTime) {
this.crud.query.begin_time = this.crud.query.createTime[0]