Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/加工质检添加权限
# Conflicts: # sf_quality/views/quality_cnc_test_view.xml
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
<field name='is_bfm' invisible="1"/>
|
||||
<field name='categ_type' invisible="1"/>
|
||||
<field name='part_number' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name='machining_drawings' attrs="{'invisible': [('categ_type', '!=', '成品')]}" widget="image"/>
|
||||
<field name='quality_standard' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name='manual_quotation' attrs="{'invisible':[('upload_model_file', '=', [])]}"/>
|
||||
<field name="upload_model_file"
|
||||
widget="many2many_binary"
|
||||
|
||||
@@ -402,20 +402,45 @@ class Sf_Dashboard_Connect(http.Controller):
|
||||
try:
|
||||
plan_obj = request.env['sf.production.plan'].sudo()
|
||||
production_obj = request.env['mrp.production'].sudo()
|
||||
work_order_obj = request.env['mrp.workorder'].sudo()
|
||||
line_list = ast.literal_eval(kw['line_list'])
|
||||
# print('line_list: %s' % line_list)
|
||||
for line in line_list:
|
||||
|
||||
# 工单计划量
|
||||
plan_data_total_counts = production_obj.search_count(
|
||||
[('production_line_id.name', '=', line), ('state', 'not in', ['cancel']),
|
||||
('active', '=', True)])
|
||||
# 工单完成量
|
||||
plan_data_finish_counts = plan_obj.search_count(
|
||||
[('production_line_id.name', '=', line), ('state', 'in', ['finished'])])
|
||||
# # 工单计划量
|
||||
# plan_data_plan_counts = plan_obj.search_count(
|
||||
# [('production_line_id.name', '=', line), ('state', 'not in', ['finished'])])
|
||||
# plan_data_total_counts = production_obj.search_count(
|
||||
# [('production_line_id.name', '=', line), ('state', 'not in', ['cancel']),
|
||||
# ('active', '=', True)])
|
||||
|
||||
# 工单计划量切换为CNC工单
|
||||
plan_data_total_counts = work_order_obj.search_count(
|
||||
[('production_id.production_line_id.name', '=', line),
|
||||
('state', 'in', ['ready', 'progress', 'done']), ('routing_type', '=', 'CNC加工')])
|
||||
|
||||
# # 工单完成量
|
||||
# plan_data_finish_counts = plan_obj.search_count(
|
||||
# [('production_line_id.name', '=', line), ('state', 'in', ['finished'])])
|
||||
|
||||
# 工单完成量切换为CNC工单
|
||||
plan_data_finish_counts = work_order_obj.search_count(
|
||||
[('production_id.production_line_id.name', '=', line),
|
||||
('state', 'in', ['done']), ('routing_type', '=', 'CNC加工')])
|
||||
|
||||
# 超期完成量
|
||||
# 搜索所有已经完成的工单
|
||||
plan_data_overtime = work_order_obj.search([
|
||||
('production_id.production_line_id.name', '=', line),
|
||||
('state', 'in', ['done']),
|
||||
('routing_type', '=', 'CNC加工')
|
||||
])
|
||||
|
||||
# 使用 filtered 进行字段比较
|
||||
plan_data_overtime_counts = plan_data_overtime.filtered(
|
||||
lambda order: order.date_finished > order.date_planned_finished
|
||||
)
|
||||
|
||||
# 获取数量
|
||||
plan_data_overtime_counts = len(plan_data_overtime_counts)
|
||||
|
||||
# 查找符合条件的生产计划记录
|
||||
plan_data = plan_obj.search([
|
||||
@@ -517,7 +542,10 @@ class Sf_Dashboard_Connect(http.Controller):
|
||||
'on_time_rate': on_time_rate,
|
||||
# 'detection_data': detection_data,
|
||||
'detection_data': plan_data_finish_counts,
|
||||
'pass_rate': (plan_data_finish_counts - plan_data_fault_counts) / plan_data_finish_counts
|
||||
'pass_rate': (plan_data_finish_counts - plan_data_fault_counts) / plan_data_finish_counts,
|
||||
'plan_data_overtime_counts': plan_data_overtime_counts,
|
||||
'overtime_rate': plan_data_overtime_counts / plan_data_finish_counts
|
||||
if plan_data_finish_counts > 0 else 0,
|
||||
}
|
||||
res['data'][line] = data
|
||||
|
||||
|
||||
3583
sf_maintenance/i18n/zh_CN.po
Normal file
3583
sf_maintenance/i18n/zh_CN.po
Normal file
File diff suppressed because it is too large
Load Diff
@@ -774,6 +774,8 @@ class ResProductMo(models.Model):
|
||||
# bfm下单
|
||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||
part_number = fields.Char(string='零件图号', readonly=True)
|
||||
# machining_drawings = fields.Binary('2D加工图纸', readonly=True)
|
||||
# quality_standard = fields.Binary('质检标准', readonly=True)
|
||||
|
||||
@api.constrains('tool_length')
|
||||
def _check_tool_length_size(self):
|
||||
@@ -873,6 +875,8 @@ class ResProductMo(models.Model):
|
||||
'manual_quotation': item['manual_quotation'] or False,
|
||||
'part_number': item.get('part_number') or '',
|
||||
'active': True,
|
||||
# 'machining_drawings': '' if not item['machining_drawings'] else base64.b64decode(item['machining_drawings']),
|
||||
# 'quality_standard': '' if not item['quality_standard'] else base64.b64decode(item['quality_standard']),
|
||||
}
|
||||
tax_id = self.env['account.tax'].sudo().search(
|
||||
[('type_tax_use', '=', 'sale'), ('amount', '=', item.get('tax')), ('price_include', '=', 'True')])
|
||||
|
||||
@@ -58,17 +58,8 @@
|
||||
<field name="name">订单发货提醒</field>
|
||||
<field name="model">stock.picking</field>
|
||||
</record>
|
||||
<!-- <record id="bussiness_mrp_workorder_pre_overdue_warning" model="jikimo.message.bussiness.node">-->
|
||||
<!-- <field name="name">装夹预调工单逾期预警</field>-->
|
||||
<!-- <field name="model">mrp.workorder</field>-->
|
||||
<!-- </record>-->
|
||||
<!-- <record id="bussiness_mrp_workorder_pre_overdue" model="jikimo.message.bussiness.node">-->
|
||||
<!-- <field name="name">装夹预调工单已逾期</field>-->
|
||||
<!-- <field name="model">mrp.workorder</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
|
||||
<record id="bussiness_mrp_workorder_pre_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<record id="bussiness_mrp_workorder_pre_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<field name="name">装夹预调工单逾期预警</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
@@ -77,12 +68,12 @@
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
|
||||
<record id="bussiness_mrp_workorder_cnc_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<record id="bussiness_mrp_workorder_cnc_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<field name="name">CNC加工工单逾期预警</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
<record id="bussiness_mrp_workorder_cnc_overdue" model="jikimo.message.bussiness.node">
|
||||
<field name="name">CNC工单已逾期</field>
|
||||
<field name="name">CNC加工工单已逾期</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
|
||||
@@ -96,7 +87,7 @@
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
|
||||
<record id="bussiness_mrp_workorder_surface_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<record id="bussiness_mrp_workorder_surface_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<field name="name">表面工艺工单逾期预警</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
|
||||
@@ -31,19 +31,31 @@ class SfQualityCncTest(models.Model):
|
||||
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因")
|
||||
detailed_reason = fields.Text('详细原因')
|
||||
|
||||
# machining_drawings = fields.Binary(related='workorder_id.machining_drawings', string='2D加工图纸', readonly=True)
|
||||
# quality_standard = fields.Binary(related='workorder_id.quality_standard', string='质检标准', readonly=True)
|
||||
|
||||
def submit_pass(self):
|
||||
self.write({'result': 'pass', 'test_results': self.test_results, 'state': 'done'})
|
||||
if self.test_results in ['返工', '报废']:
|
||||
raise UserError(_('请重新选择【判定结果】-【检测结果】'))
|
||||
self.write({'result': 'pass', 'test_results': '合格', 'state': 'done'})
|
||||
self.workorder_id.write({'test_results': self.test_results})
|
||||
self.workorder_id.button_finish()
|
||||
|
||||
def submit_fail(self):
|
||||
if not self.reason and not self.detailed_reason and not self.test_results:
|
||||
if not self.test_results:
|
||||
raise UserError(_('请填写【判定结果】里的信息'))
|
||||
else:
|
||||
self.write({'result': 'fail', 'test_results': self.test_results, 'state': 'done'})
|
||||
self.workorder_id.write(
|
||||
{'test_results': self.test_results, 'reason': self.reason, 'detailed_reason': self.detailed_reason})
|
||||
self.workorder_id.button_finish()
|
||||
if self.test_results == '合格':
|
||||
raise UserError(_('请重新选择【判定结果】-【检测结果】'))
|
||||
self.write({'result': 'fail', 'test_results': self.test_results, 'state': 'done'})
|
||||
self.workorder_id.write(
|
||||
{'test_results': self.test_results, 'reason': self.reason, 'detailed_reason': self.detailed_reason})
|
||||
self.workorder_id.button_finish()
|
||||
|
||||
@api.onchange('test_results')
|
||||
def _onchange_test_results(self):
|
||||
if self.test_results == '合格':
|
||||
self.reason = False
|
||||
self.detailed_reason = False
|
||||
|
||||
|
||||
class SfQualityWorkOrder(models.Model):
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="name">加工质检单编码规则</field>
|
||||
<field name="code">quality.cnc.test</field>
|
||||
<field name="prefix">QCT</field>
|
||||
<field name="padding">4</field>
|
||||
<field name="padding">5</field>
|
||||
<field name="company_id" eval="False"/>
|
||||
</record>
|
||||
|
||||
@@ -20,8 +20,12 @@
|
||||
<field name="product_id"/>
|
||||
<field name="part_number"/>
|
||||
<field name="number"/>
|
||||
<field name="state"/>
|
||||
<field name="result"/>
|
||||
<field name="state" widget="badge"
|
||||
decoration-success="state == 'done'"
|
||||
decoration-warning="state == 'waiting'"/>
|
||||
<field name="result" widget="badge"
|
||||
decoration-success="result == 'pass'"
|
||||
decoration-danger="result == 'fail'"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -87,7 +91,6 @@
|
||||
<group>
|
||||
<field name="part_number"/>
|
||||
<field name="processing_panel"/>
|
||||
<field name="detection_report"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
@@ -97,17 +100,19 @@
|
||||
<page string="判定结果">
|
||||
<group>
|
||||
<field name="test_results" attrs="{'readonly': [('state','=', 'done')]}"/>
|
||||
<field name="reason" attrs="{'readonly': [('state','=', 'done')]}"/>
|
||||
<field name="detailed_reason" attrs="{'readonly': [('state','=', 'done')]}"/>
|
||||
<field name="reason"
|
||||
attrs="{'readonly': [('state','=', 'done')],'required': [('test_results','in', ['返工','报废'])],'invisible': [('test_results','in', ['合格',False])]}"/>
|
||||
<field name="detailed_reason"
|
||||
attrs="{'readonly': [('state','=', 'done')],'required': [('reason','!=', False)],'invisible': [('test_results','in', ['合格',False])]}"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="2D图纸">
|
||||
<!-- <field name="detection_report" string="" widget="pdf_viewer"/>-->
|
||||
<!-- <field name="machining_drawings" string="" widget="pdf_viewer"/>-->
|
||||
</page>
|
||||
<page string="客户质量标准">
|
||||
<!-- <field name="detection_report" string="" widget="pdf_viewer"/>-->
|
||||
<!-- <field name="quality_standard" string=""/>-->
|
||||
</page>
|
||||
<page string="其他" attrs="{'readonly': [('state','=', 'done')]}">
|
||||
<page string="其他" attrs="{'invisible': [('state','=', 'waiting')]}">
|
||||
<group>
|
||||
<field name="write_uid" widget='many2one_avatar_user' string="判定人" readonly="1"/>
|
||||
<field name="write_date" string="判定时间" readonly="1"/>
|
||||
@@ -169,7 +174,7 @@
|
||||
<field name="name">驾驶舱</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">quality.cnc.test</field>
|
||||
<field name="view_mode">kanban,form</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="view_id" ref="quality_cnc_test_view_kanban"/>
|
||||
<field name="search_view_id" ref="quality_cnc_test_search"/>
|
||||
<field name="domain">[]</field>
|
||||
|
||||
@@ -34,36 +34,36 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="quality_point_view_form_inherit_sf">
|
||||
<field name="name">quality.point.form.inherit.sf</field>
|
||||
<field name="model">quality.point</field>
|
||||
<field name="inherit_id" ref="quality.quality_point_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='title']" position="replace"> -->
|
||||
<!-- <field name="title" class="custom_required" required="1"/> -->
|
||||
<!-- </xpath> -->
|
||||
<xpath expr="//sheet//group//group//field[@name='title']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//group//group//field[@name='picking_type_ids']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!-- <record model="ir.ui.view" id="quality_point_view_form_inherit_sf">-->
|
||||
<!-- <field name="name">quality.point.form.inherit.sf</field>-->
|
||||
<!-- <field name="model">quality.point</field>-->
|
||||
<!-- <field name="inherit_id" ref="quality.quality_point_view_form"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <!– <xpath expr="//sheet//group//group//field[@name='title']" position="replace"> –>-->
|
||||
<!-- <!– <field name="title" class="custom_required" required="1"/> –>-->
|
||||
<!-- <!– </xpath> –>-->
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='title']" position="attributes">-->
|
||||
<!-- <attribute name="class">custom_required</attribute>-->
|
||||
<!-- <attribute name="required">1</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='picking_type_ids']" position="attributes">-->
|
||||
<!-- <attribute name="class">custom_required</attribute>-->
|
||||
<!-- <attribute name="required">1</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<record model="ir.ui.view" id="sf_quality_point_view_form_inherit_quality_control">
|
||||
<field name="name">sf.quality.point.form.inherit.sf</field>
|
||||
<field name="model">quality.point</field>
|
||||
<field name="inherit_id" ref="quality_control.quality_point_view_form_inherit_quality_control"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='measure_on']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='measure_frequency_type']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!-- <record model="ir.ui.view" id="sf_quality_point_view_form_inherit_quality_control">-->
|
||||
<!-- <field name="name">sf.quality.point.form.inherit.sf</field>-->
|
||||
<!-- <field name="model">quality.point</field>-->
|
||||
<!-- <field name="inherit_id" ref="quality_control.quality_point_view_form_inherit_quality_control"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <xpath expr="//field[@name='measure_on']" position="attributes">-->
|
||||
<!-- <attribute name="class">custom_required</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- <xpath expr="//field[@name='measure_frequency_type']" position="attributes">-->
|
||||
<!-- <attribute name="class">custom_required</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
</odoo>
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
<field name="unit_price"/>
|
||||
<field name="price" options="{'format': false}"/>
|
||||
<field name="part_drawing_number"/>
|
||||
<field name="machining_drawings" filename="machining_drawings_name" widget="pdf_viewer"/>
|
||||
<field name="machining_drawings_name" invisible="1"/>
|
||||
<!-- <field name="machining_drawings" filename="machining_drawings_name" widget="pdf_viewer"/>-->
|
||||
<!-- <field name="machining_drawings_name" invisible="1"/>-->
|
||||
<field name="sale_order_id"
|
||||
attrs='{"invisible": [("sale_order_id","=",False)],"readonly": [("sale_order_id","!=",False)]}'/>
|
||||
</group>
|
||||
|
||||
@@ -687,7 +687,7 @@ class FunctionalToolAssembly(models.Model):
|
||||
sf_cam_work_order_program_knife_plan_id = fields.Many2one('sf.cam.work.order.program.knife.plan',
|
||||
'CAM工单程序用刀计划', readonly=True)
|
||||
|
||||
active = fields.Boolean(string='已归档', default=True, groups='base.user_root')
|
||||
active = fields.Boolean(string='已归档', default=True)
|
||||
|
||||
code = fields.Char('功能刀具编码', compute='_compute_code')
|
||||
|
||||
|
||||
@@ -554,7 +554,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
||||
sf_functional_tool_entity_ids = fields.One2many('sf.functional.cutting.tool.entity', 'safe_inventory_id',
|
||||
string='功能刀具信息')
|
||||
|
||||
active = fields.Boolean(string='已归档', default=True, groups='base.user_root')
|
||||
active = fields.Boolean(string='已归档', default=True)
|
||||
|
||||
@api.depends('functional_name_id', 'functional_name_id.diameter', 'functional_name_id.angle',
|
||||
'functional_name_id.functional_cutting_tool_model_id')
|
||||
|
||||
@@ -194,8 +194,9 @@ class MrpProduction(models.Model):
|
||||
# 自动调用重新获取编程的方法
|
||||
logging.info('cnc用刀校验到无效刀自动调用重新编程方法:update_programming_state()')
|
||||
self[0].update_programming_state()
|
||||
# 修改制造订单 编程状态变为“编程中”
|
||||
self.write({'programming_state': '编程中', 'work_state': '编程中'})
|
||||
self[0].write({'is_rework': False})
|
||||
# 修改制造订单 编程状态变为“编程中” 制造订单状态为‘返工’
|
||||
self.write({'programming_state': '编程中', 'work_state': '编程中', 'state': 'rework'})
|
||||
if missing_tool_1:
|
||||
# 修改 修改cnc程序的‘刀具状态’ 为 ‘缺刀’
|
||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||
|
||||
Reference in New Issue
Block a user