1.新增检测报告链接地址字段

2.优化rfid码扫描
3.优化工单页面
This commit is contained in:
jinling.yang
2024-02-23 10:17:20 +08:00
parent 01c4e13198
commit ad0b9983bf
3 changed files with 27 additions and 16 deletions

View File

@@ -325,6 +325,7 @@ class Manufacturing_Connect(http.Controller):
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
[('feeder_station_destination', '=', ret['DeviceId'])])
if workpiece_delivery:
logging.info('workpiece_delivery.production_id:%s' % workpiece_delivery.production_id.id)
workpiece_delivery.production_id.write({'production_line_state': '已上产线'})
else:
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的工件配送数据'}
@@ -354,6 +355,7 @@ class Manufacturing_Connect(http.Controller):
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
[('feeder_station_destination', '=', ret['DeviceId'])])
if workpiece_delivery:
logging.info('workpiece_delivery.production_id:%s' % workpiece_delivery.production_id.id)
workpiece_delivery.production_id.write({'production_line_state': '已下产线'})
else:
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的工件配送数据'}

View File

@@ -134,18 +134,19 @@ class ResMrpWorkOrder(models.Model):
preset_program_information = fields.Char(string="预调程序信息")
workpiece_delivery_ids = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送')
is_delivery = fields.Boolean('是否配送完成', default=False)
rfid_code = fields.Char('RFID')
rfid_code = fields.Char('RFID')
production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id',
string='生产线', store=True)
production_line_state = fields.Selection(related='production_id.production_line_state',
string='上/下产线', store=True)
detection_report_path = fields.Char('检测报告链接地址')
@api.onchange('rfid_code')
def compute_rfid(self):
workorder = self.env['mrp.workorder'].search([('production_id', '=', self.production_id)])
if workorder:
for item in workorder:
item.rfid_code = self.rfid_code
# @api.onchange('rfid_code')
# def compute_rfid(self):
# workorder = self.env['mrp.workorder'].search([('production_id', '=', self.production_id.id)])
# if workorder:
# for item in workorder:
# item.write({'rfid_code': self.rfid_code})
def get_plan_workorder(self, production_line):
tomorrow = (date.today() + timedelta(days=+1)).strftime("%Y-%m-%d")
@@ -821,6 +822,12 @@ class SfWorkOrderBarcodes(models.Model):
workpiece_delivery.write({'workpiece_code': embryo_workpiece_code})
else:
raise UserError('工件生产线不一致,请重新确认')
else:
workorder_rfid = self.env['mrp.workorder'].search(
[('production_id', '=', workorder.production_id.id)])
if workorder_rfid:
for item in workorder_rfid:
item.write({'rfid_code': barcode})
class WorkPieceDelivery(models.Model):

View File

@@ -166,6 +166,7 @@
<field name="duration" widget="mrp_timer"
attrs="{'invisible': [('production_state','=', 'draft')], 'readonly': [('is_user_working', '=', True)]}"
sum="real duration"/>
<field name="glb_file" readonly="1" widget="Viewer3D" string="加工模型"/>
<field name="processing_panel" readonly="1"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
<field name="equipment_id"
@@ -176,17 +177,17 @@
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
<field name="functional_fixture_code" force_save="1"
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
<field name="functional_fixture_type_id" force_save="1"
<field name="functional_fixture_type_id"
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
<field name="rfid_code" force_save="1"/>
</group>
<group attrs='{"invisible": [("routing_type","=","获取CNC加工程序")]}'>
<div>
<label for="glb_file" string="加工模型"/>
<field name="glb_file" readonly="1" widget="Viewer3D"/>
</div>
<!-- <field name="glb_file" string="模型" readonly="1" widget="Viewer3D"/>-->
<field name="rfid_code" force_save="1" readonly="1"/>
</group>
<!-- <group>-->
<!-- <div>-->
<!-- <label for="glb_file" string="加工模型"/>-->
<!-- <field name="glb_file" readonly="1" widget="Viewer3D"/>-->
<!-- </div>-->
<!-- &lt;!&ndash; <field name="glb_file" string="模型" readonly="1" widget="Viewer3D"/>&ndash;&gt;-->
<!-- </group>-->
<!-- <field name="processing_panel" readonly="1" attrs="{'invisible': [('routing_type', 'in', ('获取CNC加工程序','装夹','解除装夹',-->
<!-- '前置三元定位检测','后置三元质量检测','解除装夹'))]}"/>-->
@@ -428,6 +429,7 @@
<field name="results" invisible="1"/>
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
<group>
<field name="detection_report_path" attrs='{"invisible":[("results","!=",False)]}'/>
<field name="test_results" widget="selection" attrs='{"invisible":[("results","!=",False)]}'/>
<field name="results" readonly="1" attrs='{"invisible":[("results","!=","合格")]}'/>
</group>