1.优化工件配送向导2.增加rfid码字段

This commit is contained in:
jinling.yang
2024-04-29 17:34:00 +08:00
parent 58344b09d2
commit b45ffcc0d2
3 changed files with 39 additions and 29 deletions

View File

@@ -180,6 +180,11 @@ class ResMrpWorkOrder(models.Model):
detection_report = fields.Binary('检测报告', readonly=True) detection_report = fields.Binary('检测报告', readonly=True)
is_remanufacture = fields.Boolean(string='是否重新生成制造订单', default=True) is_remanufacture = fields.Boolean(string='是否重新生成制造订单', default=True)
@api.onchange('rfid_code')
def _onchange(self):
if self.rfid_code and self.state == 'progress':
self.workpiece_delivery_ids[0].write({'rfid_code': self.rfid_code})
def get_plan_workorder(self, production_line): def get_plan_workorder(self, production_line):
tomorrow = (date.today() + timedelta(days=+1)).strftime("%Y-%m-%d") tomorrow = (date.today() + timedelta(days=+1)).strftime("%Y-%m-%d")
tomorrow_start = tomorrow + ' 00:00:00' tomorrow_start = tomorrow + ' 00:00:00'
@@ -1106,6 +1111,7 @@ class WorkPieceDelivery(models.Model):
status = fields.Selection( status = fields.Selection(
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态', default='待下发') [('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态', default='待下发')
is_cnc_program_down = fields.Boolean('程序是否下发', default=False) is_cnc_program_down = fields.Boolean('程序是否下发', default=False)
rfid_code = fields.Char('rfid码')
active = fields.Boolean(string="有效", default=True) active = fields.Boolean(string="有效", default=True)
@api.model @api.model

View File

@@ -128,9 +128,11 @@
<button name="button_finish" type="object" string="完成" class="btn-success" <button name="button_finish" type="object" string="完成" class="btn-success"
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/> attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
<button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="阻塞" context="{'default_workcenter_id': workcenter_id}" class="btn-danger" <button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="阻塞"
context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked')]}"/> attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked')]}"/>
<button name="button_unblock" type="object" string="取消阻塞" context="{'default_workcenter_id': workcenter_id}" class="btn-danger" <button name="button_unblock" type="object" string="取消阻塞"
context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/> attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/>
<!-- <button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="停工" --> <!-- <button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="停工" -->
@@ -622,12 +624,9 @@
<field name="model">sf.workpiece.delivery</field> <field name="model">sf.workpiece.delivery</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="工件配送"> <search string="工件配送">
<!-- <filter string="上产线且待下发" name="on_up"-->
<!-- domain="[('status', '=', '待下发'),('type','=',['上产线'])]"/>-->
<!-- <filter string="下产线且待下发" name="on_down"-->
<!-- domain="[('status', '=', '待下发'),('type','=',['下产线'])]"/>-->
<filter string="上产线" name="up" domain="[('type', '=', '上产线')]"/> <filter string="上产线" name="up" domain="[('type', '=', '上产线')]"/>
<filter string="下产线" name="down" domain="[('type', '=', '下产线' )]"/> <filter string="下产线" name="down" domain="[('type', '=', '下产线' )]"/>
<field name="rfid_code" invisible="1"/>
<field name="production_id"/> <field name="production_id"/>
<field name="feeder_station_start_id"/> <field name="feeder_station_start_id"/>
<field name="production_line_id"/> <field name="production_line_id"/>

View File

@@ -11,6 +11,11 @@ class WorkpieceDeliveryWizard(models.TransientModel):
delivery_ids = fields.Many2many('sf.workpiece.delivery', string='配送') delivery_ids = fields.Many2many('sf.workpiece.delivery', string='配送')
workorder_id = fields.Many2one('mrp.workorder', string='工单') workorder_id = fields.Many2one('mrp.workorder', string='工单')
production_ids = fields.Many2many('mrp.production', string='制造订单号')
destination_production_line_id = fields.Many2one('sf.production.line', '目的生产线')
feeder_station_start_id = fields.Many2one('sf.agv.site', '起点接驳站')
feeder_station_destination_id = fields.Many2one('sf.agv.site', '目的接驳站')
def confirm(self): def confirm(self):
if self.workorder_id: if self.workorder_id: