Commit a360f704 by 夏超

[fix] 修改问题

parent f18812ae
......@@ -21,8 +21,22 @@ class JzjxInheritProduction(InheritProduction):
"""
res = super(JzjxInheritProduction, self)._get_work_record_values(wo, values)
repair_process_id = values.get('process_id', False) # 工序
scrap_list, _ = values.get("scrap_list", []), values.get("repair_list", [])
if repair_process_id:
res.update({"repair_process_id": repair_process_id})
no_scrap_detail_ids = []
for scrap in scrap_list:
scrap_qty = float(scrap.get("qty", 0))
if scrap_qty:
continue
no_scrap_detail_ids.append((0, 0, {
'reason_id': int(scrap.get("reason_id")),
'qty': scrap_qty,
'note': scrap.get("note")
}))
res.update({
"scrap_detail_ids": res.get("scrap_detail_ids", []) + no_scrap_detail_ids,
})
return res
def check_join_in_data(self, values):
......
......@@ -267,3 +267,19 @@ class RokeWorkstationWorkOrderModel(http.Controller):
break
work_record.scrap_line_ids.order_id.write({"is_rfe": True})
return {"code": 0, "message": f"补件工单创建成功!"}
@http.route('/roke/workstation/craft_design/workstation_work_process_check_work_order', type='json', auth='user',
csrf=False, cors="*")
def workstation_work_process_check_work_order(self):
"""
根据工艺路线重新生成工单
"""
_self = http.request
routing_id = _self.jsonrequest.get("routing_id", 0)
routing = _self.env["roke.routing"].search([("id", "=", routing_id)])
if not routing.routing_task_id:
return {"code": 0, "message": f"工艺没有相应的任务!"}
routing.routing_task_id.write({
"work_order_ids": routing.routing_task_id.change_routing_id_work_order(routing)
})
return {"code": 0, "message": f"工艺路线生成工单成功!"}
......@@ -66,9 +66,4 @@ class InheritRokeRoutingLineModel(models.Model):
def write(self, vals):
res = super(InheritRokeRoutingLineModel, self).write(vals)
for v in self:
if v.routing_id.routing_task_id:
v.routing_id.routing_task_id.write({
"work_order_ids": v.routing_id.routing_task_id.change_routing_id_work_order(v.routing_id)
})
return res
......@@ -144,30 +144,30 @@
<div style="width: 100%;">
<div>
<el-image style="width: 1rem; height: 1rem;margin-right: 5px;"
:src="baseURL+scope.row.thumbnail" fit="contain">
</el-image>
[[scope.row.name]]
:src="baseURL+scope.row.thumbnail" fit="contain">
</el-image>
[[scope.row.name]]
</div>
</div>
</template>
</el-table-column>
<el-table-column label="上传人" align="center" width="120">
<template slot-scope="scope">
<div >
<div>
[[scope.row.create_user]]
</div>
</template>
</el-table-column>
<el-table-column label="上传时间" align="center" width="180">
<template slot-scope="scope">
<div >
<div>
[[dateTimeHandle(scope.row.create_date)]]
</div>
</template>
</el-table-column>
<el-table-column label="文件类型" align="center" width="100">
<template slot-scope="scope">
<div >
<div>
[[
getFileTypeHandle(scope.row.mimetype)!='其它文件'?getFileTypeHandle(scope.row.mimetype):
getFileSuffixHandle(scope.row.name) ]]
......@@ -288,8 +288,9 @@
</div>
<!-- 关键物料 -->
<div v-if="activeIndex=='关键物料'" style="width: 100%; padding: 0 15px;">
<el-table ref="keyMaterials" :data="isEdit?key_materials_listTow:key_materials_list" :height="windowHeight"
:header-cell-style="{backgroundColor:'#f5f7fa'}" style="width: 100%">
<el-table ref="keyMaterials" :data="isEdit?key_materials_listTow:key_materials_list"
:height="windowHeight" :header-cell-style="{backgroundColor:'#f5f7fa'}"
style="width: 100%">
<el-table-column type="index" label="序号" align="center" width="50"></el-table-column>
<el-table-column label="物料名称" align="center">
<template slot-scope="scope">
......@@ -329,7 +330,8 @@
</el-table-column>
</el-table>
<div style="padding: 10px;">
<el-button type="primary" size="small" :disabled="!selProductProcessData||isEdit" @click="addInfoHandle('关键物料')">
<el-button type="primary" size="small" :disabled="!selProductProcessData||isEdit"
@click="addInfoHandle('关键物料')">
添加
</el-button>
<el-button type="primary" size="small" @click="editInfoHandle('关键物料')"
......@@ -663,7 +665,7 @@
qty: [{ required: true, trigger: 'blur', message: '请输入数量' }],
must: [{ required: true, trigger: 'blur', message: '请选择是否必投' }],
},
selProcessHandleItem:null
selProcessHandleItem: null
}
},
computed: {
......@@ -771,6 +773,21 @@
},
methods: {
// 更新
workstation_work_process_check_work_order() {
axios({
method: "POST",
url: this.baseURL + "/roke/workstation/craft_design/workstation_work_process_check_work_order",
data: {
routing_id: this.routingData.routing_id
},
headers: {
'Content-Type': 'application/json',
},
}).then((result) => {
})
},
// 接口请求方法封装
requestApi(url, config, errorMessage = "操作失败,请稍后重试", contentType = 'application/json') {
return new Promise((resolve, reject) => {
......@@ -1804,6 +1821,7 @@
let processConfig = {
routing_id: this.routingData.routing_id
}
this.workstation_work_process_check_work_order()
this.getProductProcessListApi(processConfig).then(result => {
this.loading = false
result.result.data.forEach(item => {
......@@ -2037,6 +2055,7 @@
this.$message.success(result.result.message)
this.loading = false
this.dialogCloseHandle('添加产品工序')
this.workstation_work_process_check_work_order()
}).catch(err => {
this.errorHandle('添加成功,但数据刷新失败,请手动刷新当前页面!', true)
})
......@@ -2206,18 +2225,18 @@
}
this.loading = true
this.requestApi('/roke/workstation/craft_design/workstation_bom/create', config).then(data => {
if(data.result.code == 0){
if (data.result.code == 0) {
let config = {
routing_line_id: this.selProcessHandleItem.line_id
}
this.getworkstation_bom(config).then(result => {
result.result.data.forEach(item => {
item['show'] = false
})
this.key_materials_list = result.result.data
}).catch(error => {
this.errorHandle(error, true)
})
routing_line_id: this.selProcessHandleItem.line_id
}
this.getworkstation_bom(config).then(result => {
result.result.data.forEach(item => {
item['show'] = false
})
this.key_materials_list = result.result.data
}).catch(error => {
this.errorHandle(error, true)
})
}
this.loading = false
this.$message.success(data.result.message)
......@@ -2464,7 +2483,7 @@
menuSelectHandle(index) {
this.activeIndex = index
this.isEdit = false
if(index === '关键物料'){
if (index === '关键物料') {
this.searchProductValue = ''
this.getProductListApi().then(result => {
this.loading = false
......@@ -2642,19 +2661,19 @@
})
this.loading = true
this.requestApi('/roke/workstation/craft_design/workstation_bom/update', { bom_info: standard_info }).then(result => {
if(result.result.code == 0){
let config = {
routing_line_id: this.selProcessHandleItem.line_id
}
this.getworkstation_bom(config).then(result => {
result.result.data.forEach(item => {
item['show'] = false
})
this.key_materials_list = result.result.data
}).catch(error => {
this.errorHandle(error, true)
})
}
if (result.result.code == 0) {
let config = {
routing_line_id: this.selProcessHandleItem.line_id
}
this.getworkstation_bom(config).then(result => {
result.result.data.forEach(item => {
item['show'] = false
})
this.key_materials_list = result.result.data
}).catch(error => {
this.errorHandle(error, true)
})
}
this.loading = false
this.$message.success(result.result.message)
this.isEdit = false
......
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