Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化

This commit is contained in:
mgw
2025-01-16 14:32:47 +08:00
7 changed files with 26 additions and 27 deletions

View File

@@ -22,6 +22,7 @@
width: 50px; width: 50px;
height: 50px; height: 50px;
margin-bottom: 5px; margin-bottom: 5px;
margin-top: 15px;
} }
.item-label { .item-label {

View File

@@ -59,6 +59,7 @@
'sf_manufacturing/static/src/js/agv_scheduling_cancel_confirm.js', 'sf_manufacturing/static/src/js/agv_scheduling_cancel_confirm.js',
'sf_manufacturing/static/src/js/qr.js', 'sf_manufacturing/static/src/js/qr.js',
'sf_manufacturing/static/src/xml/qr.xml', 'sf_manufacturing/static/src/xml/qr.xml',
'sf_manufacturing/static/src/scss/equipment_spacing.scss',
] ]
}, },

View File

@@ -311,13 +311,6 @@ class MrpProduction(models.Model):
elif production.state == 'cancel' or (production.move_finished_ids and all( elif production.state == 'cancel' or (production.move_finished_ids and all(
move.state == 'cancel' for move in production.move_finished_ids)): move.state == 'cancel' for move in production.move_finished_ids)):
production.state = 'cancel' production.state = 'cancel'
elif (
production.state == 'done'
or (production.move_raw_ids and all(
move.state in ('cancel', 'done') for move in production.move_raw_ids))
and all(move.state in ('cancel', 'done') for move in production.move_finished_ids)
):
production.state = 'done'
elif production.workorder_ids and all( elif production.workorder_ids and all(
wo_state in ('done', 'cancel') for wo_state in production.workorder_ids.mapped('state')): wo_state in ('done', 'cancel') for wo_state in production.workorder_ids.mapped('state')):
production.state = 'to_close' production.state = 'to_close'
@@ -351,18 +344,9 @@ class MrpProduction(models.Model):
production.state = 'technology_to_confirmed' production.state = 'technology_to_confirmed'
if production.state == 'confirmed' and production.schedule_state == '已排': if production.state == 'confirmed' and production.schedule_state == '已排':
production.state = 'pending_cam' production.state = 'pending_cam'
if production.state == 'progress':
if all(wo_state not in ('progress', 'done', 'rework', 'scrap') for wo_state in
production.workorder_ids.mapped('state')):
production.state = 'pending_cam'
if production.is_rework is True:
production.state = 'rework'
if (production.state == 'rework' and production.tool_state == '0' if (production.state == 'rework' and production.tool_state == '0'
and production.schedule_state == '已排' and production.is_rework is False): and production.schedule_state == '已排' and production.is_rework is False):
production.state = 'pending_cam' production.state = 'pending_cam'
# if production.state == 'pending_cam':
# if all(wo_state in 'done' for wo_state in production.workorder_ids.mapped('state')):
# production.state = 'done'
if any((wo.test_results == '返工' and wo.state == 'done' and if any((wo.test_results == '返工' and wo.state == 'done' and
(production.programming_state in ['已编程'] or wo.individuation_page_PTD is True)) (production.programming_state in ['已编程'] or wo.individuation_page_PTD is True))
or (wo.is_rework is True and wo.state == 'done' and production.programming_state in ['编程中', '已编程']) or (wo.is_rework is True and wo.state == 'done' and production.programming_state in ['编程中', '已编程'])
@@ -377,6 +361,8 @@ class MrpProduction(models.Model):
wo_state in ('done', 'rework', 'cancel') for wo_state in production.workorder_ids.mapped('state')): wo_state in ('done', 'rework', 'cancel') for wo_state in production.workorder_ids.mapped('state')):
if production.state not in ['scrap', 'rework', 'cancel']: if production.state not in ['scrap', 'rework', 'cancel']:
production.state = 'done' production.state = 'done'
elif production.state == 'done':
production.state = 'progress'
# 退回调整 # 退回调整
def technology_back_adjust(self): def technology_back_adjust(self):
@@ -1540,15 +1526,16 @@ class MrpProduction(models.Model):
product_id = self.env['product.product'].browse(vals['product_id']) product_id = self.env['product.product'].browse(vals['product_id'])
is_self_process = product_id.materials_type_id and product_id.materials_type_id.gain_way and product_id.materials_type_id.gain_way != '自加工' is_self_process = product_id.materials_type_id and product_id.materials_type_id.gain_way and product_id.materials_type_id.gain_way != '自加工'
is_customer_provided = product_id.is_customer_provided is_customer_provided = product_id.is_customer_provided
if not is_custemer_group_id.get(is_customer_provided) and is_self_process: key = f"{is_self_process}_{is_customer_provided}"
is_custemer_group_id[is_customer_provided] = self.env["procurement.group"].create({'name': vals.get('name')}).id if not is_custemer_group_id.get(key):
is_custemer_group_id[key] = self.env["procurement.group"].create({'name': vals.get('name')}).id
# if not (is_first_customer or is_first_not_customer) and is_self_process: # if not (is_first_customer or is_first_not_customer) and is_self_process:
# is_first = True # is_first = True
# group_id = self.env["procurement.group"].create({'name': vals.get('name')}).id # group_id = self.env["procurement.group"].create({'name': vals.get('name')}).id
if not vals.get('procurement_group_id'): if not vals.get('procurement_group_id'):
if product_id.product_tmpl_id.single_manufacturing: if product_id.product_tmpl_id.single_manufacturing:
if product_id.categ_id.name == '成品' and is_self_process: if product_id.categ_id.name == '成品':
vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided] vals['procurement_group_id'] = is_custemer_group_id[key]
continue continue
if product_id.id not in product_group_id.keys(): if product_id.id not in product_group_id.keys():
procurement_group_vals = self._prepare_procurement_group_vals(vals) procurement_group_vals = self._prepare_procurement_group_vals(vals)
@@ -1558,7 +1545,7 @@ class MrpProduction(models.Model):
else: else:
vals['procurement_group_id'] = product_group_id[product_id.id] vals['procurement_group_id'] = product_group_id[product_id.id]
else: else:
vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided] vals['procurement_group_id'] = is_custemer_group_id[key]
return super(MrpProduction, self).create(vals_list) return super(MrpProduction, self).create(vals_list)
@api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id', @api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id',

View File

@@ -0,0 +1,3 @@
.my_custom_group_spacing {
margin-top: 30px; /* 调整组与上方元素的距离 */
}

View File

@@ -4,8 +4,14 @@
<record model="ir.ui.view" id="view_purchase_order_line_form_inherit_sf1"> <record model="ir.ui.view" id="view_purchase_order_line_form_inherit_sf1">
<field name="name">purchase.order.form.inherit.sf</field> <field name="name">purchase.order.form.inherit.sf</field>
<field name="model">purchase.order</field> <field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/> <field name="inherit_id" ref="purchase_order_approved.purchase_order_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="order_line" position="attributes">
<attribute
name="attrs"
>{'readonly': [('state', '!=', 'draft')]}
</attribute>
</field>
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="after"> <xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="after">
<field name="related_product" optional="show"/> <field name="related_product" optional="show"/>
<field name="part_number" optional="show"/> <field name="part_number" optional="show"/>

View File

@@ -12,15 +12,16 @@
attrs="{'invisible': [('equipment_type', '!=', '机床')]}"> attrs="{'invisible': [('equipment_type', '!=', '机床')]}">
<button name="get_equipment_base_coordinate" string="获取基坐标数据" type="object" <button name="get_equipment_base_coordinate" string="获取基坐标数据" type="object"
class="oe_highlight"/> class="oe_highlight"/>
<separator invisible="0"/> <group class="my_custom_group_spacing">
<group>
<group> <group>
<field name="base_coordinate_fixture_model_id" options="{'no_create': True}"/> <field name="base_coordinate_fixture_model_id" options="{'no_create': True}"/>
<field name="base_coordinate_g_coordinate"/>
<field name="base_coordinate_x"/> <field name="base_coordinate_x"/>
<field name="base_coordinate_y"/>
<field name="base_coordinate_z"/> <field name="base_coordinate_z"/>
</group> </group>
<group>
<field name="base_coordinate_g_coordinate"/>
<field name="base_coordinate_y"/>
</group>
</group> </group>
</page> </page>
<page string="标准刀库" name="sf_equipment_product_template" <page string="标准刀库" name="sf_equipment_product_template"

View File

@@ -311,7 +311,7 @@ class ReworkWizard(models.TransientModel):
break break
for p in production_id.detection_result_ids.filtered( for p in production_id.detection_result_ids.filtered(
lambda ap1: ap1.handle_result == '待处理'): lambda ap1: ap1.handle_result == '待处理'):
if p.processing_panel and p.processing_panel not in panel_arr: if p.processing_panel is not False and p.processing_panel not in panel_arr:
panel_arr += ','.join(p.processing_panel) panel_arr += ','.join(p.processing_panel)
for item in panel_arr.split(','): for item in panel_arr.split(','):
panel = self.env['sf.processing.panel'].search( panel = self.env['sf.processing.panel'].search(