托盘根据工单绑定制造订单,修改托盘状态
添加解除装夹功能 三元定位增加xy 8个点的字段
This commit is contained in:
@@ -18,11 +18,26 @@ _logger = logging.getLogger(__name__)
|
||||
class Tray(models.Model):
|
||||
_inherit = 'sf.tray'
|
||||
_description = '托盘'
|
||||
qr_image = fields.Binary(string="托盘二维码", compute='compute_qr_image')
|
||||
|
||||
production_id = fields.Many2one('mrp.production', string='制造订单',
|
||||
related='workorder_id.production_id'
|
||||
)
|
||||
workorder_id = fields.Many2one('mrp.workorder', string="工单"
|
||||
)
|
||||
|
||||
qr_image = fields.Binary(string="托盘二维码", compute='compute_qr_image')
|
||||
@api.onchange('production_id')
|
||||
def updateTrayState(self):
|
||||
|
||||
if self.workorder_id != False:
|
||||
self.state = '占用'
|
||||
else:
|
||||
self.state = '空闲'
|
||||
|
||||
def unclamp(self):
|
||||
self.workorder_id = False
|
||||
self.production_id = False
|
||||
self.state = '空闲'
|
||||
|
||||
@api.depends('code')
|
||||
def compute_qr_image(self):
|
||||
@@ -70,23 +85,48 @@ class MrpWorkOrder(models.Model):
|
||||
tray_state = fields.Selection(
|
||||
string='托盘状态',
|
||||
related='tray_id.state')
|
||||
|
||||
# def get_tray_info(self):
|
||||
@api.onchange('X_axis', 'Y_axis', 'Z_axis')
|
||||
def get_center_point(self):
|
||||
return 'X:%s,Y:%s,Z:%s' % (self.X_axis, self.Y_axis, self.Z_axis)
|
||||
|
||||
surface = fields.Selection([("上面", "上面"), ("下面", "下面"), ("左面", "左面"), ("右面", "右面"),
|
||||
("顶面", "顶面")], required=True, default="顶面")
|
||||
material_center_point = fields.Char(string='配料中心点', default=get_center_point)
|
||||
X1_axis = fields.Integer(string='x1', default=0)
|
||||
Y1_axis = fields.Integer(string='y1', default=0)
|
||||
X2_axis = fields.Integer(string='x2', default=0)
|
||||
Y2_axis = fields.Integer(string='y2', default=0)
|
||||
X3_axis = fields.Integer(string='x3', default=0)
|
||||
Y3_axis = fields.Integer(string='y3', default=0)
|
||||
X4_axis = fields.Integer(string='x4', default=0)
|
||||
Y4_axis = fields.Integer(string='y4', default=0)
|
||||
X5_axis = fields.Integer(string='x5', default=0)
|
||||
Y5_axis = fields.Integer(string='y5', default=0)
|
||||
X6_axis = fields.Integer(string='x6', default=0)
|
||||
Y6_axis = fields.Integer(string='y6', default=0)
|
||||
X7_axis = fields.Integer(string='x7', default=0)
|
||||
Y7_axis = fields.Integer(string='y7', default=0)
|
||||
X8_axis = fields.Integer(string='x8', default=0)
|
||||
Y8_axis = fields.Integer(string='y8', default=0)
|
||||
|
||||
@api.depends('tray_id')
|
||||
def updateTrayState(self):
|
||||
X_deviation_angle = fields.Integer(string="X轴偏差度", default=0)
|
||||
|
||||
for item in self:
|
||||
if item.tray_code == False:
|
||||
continue
|
||||
trayInfo = self.env['sf.tray'].sudo.search([('code', '=', item.tray_code)])
|
||||
if trayInfo:
|
||||
trayInfo.update(
|
||||
{
|
||||
'production_id': item.production_id,
|
||||
'state': "占用",
|
||||
}
|
||||
)
|
||||
# @api.depends('tray_id')
|
||||
# def updateTrayState(self):
|
||||
#
|
||||
# for item in self:
|
||||
# if item.tray_code == False:
|
||||
# continue
|
||||
# trayInfo = self.env['sf.tray'].sudo.search([('code', '=', item.tray_code)])
|
||||
# if trayInfo:
|
||||
# trayInfo.update(
|
||||
# {
|
||||
# 'production_id': item.production_id,
|
||||
# 'state': "占用",
|
||||
# }
|
||||
# )
|
||||
|
||||
|
||||
'''
|
||||
@@ -97,3 +137,5 @@ class MrpWorkOrder(models.Model):
|
||||
class MrpProduction(models.Model):
|
||||
_inherit = 'mrp.production'
|
||||
_description = "制造订单"
|
||||
|
||||
tray_ids = fields.One2many('sf.tray', 'production_id', string="托盘")
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="sf_tray1" model="report.paperformat">
|
||||
<field name="name">Dymo Label Sheet</field>
|
||||
<field name="default" eval="True"/>
|
||||
<field name="format">custom</field>
|
||||
<field name="page_height">100</field>
|
||||
<field name="page_width">60</field>
|
||||
<field name="orientation">Landscape</field>
|
||||
<field name="margin_top">0</field>
|
||||
<field name="margin_bottom">0</field>
|
||||
<field name="margin_left">0</field>
|
||||
<field name="margin_right">0</field>
|
||||
<field name="disable_shrinking" eval="True"/>
|
||||
<field name="dpi">96</field>
|
||||
</record>
|
||||
|
||||
<record id="label_sf_tray_code" model="ir.actions.report">
|
||||
<field name="name">打印条形码</field>
|
||||
<field name="model">sf.tray</field>
|
||||
@@ -8,7 +24,7 @@
|
||||
<field name="report_file">sf_route_workcenter.sf_tray_template</field>
|
||||
<field name="binding_model_id" ref="model_sf_tray"/>
|
||||
<field name="binding_type">report</field>
|
||||
<field name="paperformat_id" ref="hr_holidays.paperformat_hrsummary"/>
|
||||
<field name="paperformat_id" ref="sf_route_workcenter.sf_tray1"/>
|
||||
|
||||
</record>
|
||||
|
||||
@@ -17,27 +33,18 @@
|
||||
<t t-call="web.external_layout">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<div class="page">
|
||||
<div><h4>编码:<t t-esc="o.code" /></h4></div>
|
||||
<div t-field="o.code" t-options="{'widget': 'barcode', 'width': 600, 'height': 100, 'img_style': 'width:350px;height:60px'}"/>
|
||||
|
||||
<div t-field="o.code"
|
||||
t-options="{'widget': 'barcode', 'width': 600, 'height': 100, 'img_style': 'width:350px;height:60px'}"/>
|
||||
<div t-field="o.code" style="text-align: center"/>
|
||||
</div>
|
||||
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
</template>
|
||||
<record id="sf_tray1" model="report.paperformat">
|
||||
<field name="name">European A4 for DIN5008 Type A</field>
|
||||
<field name="default" eval="False" />
|
||||
<field name="format">A5</field>
|
||||
<field name="orientation">Portrait</field>
|
||||
<field name="margin_top">27</field>
|
||||
<field name="margin_bottom">40</field>
|
||||
<field name="margin_left">20</field>
|
||||
<field name="margin_right">10</field>
|
||||
<field name="dpi">70</field>
|
||||
<field name="header_line" eval="False" />
|
||||
<field name="header_spacing">27</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -9,8 +9,18 @@
|
||||
<notebook>
|
||||
<page string="生成条形码">
|
||||
<field name='qr_image' widget="image"/>
|
||||
<field name='production_id' default="production_id.name"/>
|
||||
<group>
|
||||
<field name='production_id' readonly="1"
|
||||
attrs='{"invisible": [("production_id","=",False)]}'/>
|
||||
<field name="workorder_id"/>
|
||||
</group>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="unclamp" string="解除装夹"
|
||||
attrs='{"invisible": [("state","=","空闲")]}'/>
|
||||
</div>
|
||||
|
||||
</page>
|
||||
|
||||
</notebook>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[last()]" position="before">
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="托盘参数" >
|
||||
<group>
|
||||
<field name="tray_id" domain="[('state', '!=', '占用'),('state', '!=', '报损')]"/>
|
||||
@@ -14,7 +14,75 @@
|
||||
<field name="tray_state"/>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
|
||||
<page string="三元前置检测定位参数" >
|
||||
<group>
|
||||
<field name="surface" widget="radio"/>
|
||||
<!-- <field name = 'X_axis'/>-->
|
||||
<!-- <field name = 'Y_axis'/>-->
|
||||
<!-- <field name = 'Z_axis'/>-->
|
||||
|
||||
<field name="material_center_point"/>
|
||||
<field name ='X_deviation_angle' />
|
||||
</group>
|
||||
<group>
|
||||
<div class="o_address_format">
|
||||
<label for="X1_axis" string="x1"/>
|
||||
<field name = 'X1_axis' class="o_address_city"/>
|
||||
<label for="Y1_axis" string="y1"/>
|
||||
<field name = 'Y1_axis' class="o_address_city"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X2_axis" string="x2"/>
|
||||
<field name = 'X2_axis' class="o_address_city"/>
|
||||
<label for="Y2_axis" string="y2"/>
|
||||
<field name = 'Y2_axis' class="o_address_city"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X3_axis" string="x3"/>
|
||||
<field name = 'X3_axis' class="o_address_city"/>
|
||||
<label for="Y3_axis" string="y3"/>
|
||||
<field name = 'Y3_axis' class="o_address_city"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X4_axis" string="x4"/>
|
||||
<field name = 'X4_axis' class="o_address_city"/>
|
||||
<label for="Y4_axis" string="y4"/>
|
||||
<field name = 'Y4_axis' class="o_address_city"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X5_axis" string="x5"/>
|
||||
<field name = 'X5_axis' class="o_address_city"/>
|
||||
<label for="Y5_axis" string="y5"/>
|
||||
<field name = 'Y5_axis' class="o_address_city"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X6_axis" string="x6"/>
|
||||
<field name = 'X6_axis' class="o_address_city"/>
|
||||
<label for="Y6_axis" string="y6"/>
|
||||
<field name = 'Y6_axis' class="o_address_city"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X7_axis" string="x7"/>
|
||||
<field name = 'X7_axis' class="o_address_city"/>
|
||||
<label for="Y7_axis" string="y7"/>
|
||||
<field name = 'Y7_axis' class="o_address_city"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X8_axis" string="x8"/>
|
||||
<field name = 'X8_axis' class="o_address_city"/>
|
||||
<label for="Y8_axis" string="y8"/>
|
||||
<field name = 'Y8_axis' class="o_address_city"/>
|
||||
</div>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user