1.工单,工件配送新增sns及给部分字段添加tracking(跟踪)及优化页面
2.优化agv:部分字段不可编辑
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
import requests
|
||||
import logging
|
||||
import time
|
||||
from odoo import fields, models
|
||||
from odoo import fields, models, api
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AgvSetting(models.Model):
|
||||
@@ -59,11 +60,17 @@ class AgvTaskRoute(models.Model):
|
||||
('F01', '搬运'), ], string='任务类型', default="F01")
|
||||
route_type = fields.Selection([
|
||||
('上产线', '上产线'), ('下产线', '下产线'), ('运送空料架', '运送空料架')], string='类型')
|
||||
start_site_id = fields.Many2one('sf.agv.site', '起点接驳站位置编号')
|
||||
end_site_id = fields.Many2one('sf.agv.site', '终点接驳站位置编号')
|
||||
start_site_id = fields.Many2one('sf.agv.site', '起点接驳站')
|
||||
end_site_id = fields.Many2one('sf.agv.site', '终点接驳站')
|
||||
destination_production_line_id = fields.Many2one('sf.production.line', '目的生产线')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
@api.constrains('end_site_id')
|
||||
def _check_end_site_id(self):
|
||||
if self.end_site_id:
|
||||
if self.end_site_id == self.start_site_id:
|
||||
raise UserError("您选择的终点接驳站与起点接驳站重复,请重新选择")
|
||||
|
||||
|
||||
class Center_controlInterfaceLog(models.Model):
|
||||
_name = 'center_control.interface.log'
|
||||
|
||||
@@ -53,13 +53,13 @@ class MrpProduction(models.Model):
|
||||
active = fields.Boolean(string='已归档', default=True)
|
||||
programming_no = fields.Char('编程单号')
|
||||
work_state = fields.Char('业务状态')
|
||||
programming_state = fields.Char('编程状态')
|
||||
programming_state = fields.Char('编程状态', tracking=True)
|
||||
glb_file = fields.Binary("glb模型文件")
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线')
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', tracking=True)
|
||||
plan_start_processing_time = fields.Datetime('计划开始加工时间')
|
||||
production_line_state = fields.Selection(
|
||||
[('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')],
|
||||
string='上/下产线', default='待上产线')
|
||||
string='上/下产线', default='待上产线', tracking=True)
|
||||
# 工序状态
|
||||
# Todo 研究下用法
|
||||
process_state = fields.Selection([
|
||||
|
||||
@@ -102,7 +102,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
Z10_axis = fields.Float(default=0)
|
||||
X_deviation_angle = fields.Integer(string="X轴偏差度", default=0)
|
||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格',
|
||||
string="检测结果")
|
||||
string="检测结果", tracking=True)
|
||||
cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工程序")
|
||||
cmm_ids = fields.One2many("sf.cmm.program", 'workorder_id', string="CMM程序")
|
||||
tray_code = fields.Char(string="托盘编码")
|
||||
@@ -133,7 +133,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
return action
|
||||
|
||||
supplier_id = fields.Many2one('res.partner', string='外协供应商')
|
||||
equipment_id = fields.Many2one('maintenance.equipment', string='加工设备')
|
||||
equipment_id = fields.Many2one('maintenance.equipment', string='加工设备', tracking=True)
|
||||
is_ok = fields.Boolean(string='是否合格')
|
||||
# 加工人
|
||||
processing_user_id = fields.Many2one('res.users', string='加工人')
|
||||
@@ -195,15 +195,15 @@ class ResMrpWorkOrder(models.Model):
|
||||
rfid_code_old = fields.Char('RFID码(已解除)')
|
||||
|
||||
production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id',
|
||||
string='生产线', store=True)
|
||||
string='生产线', store=True, tracking=True)
|
||||
production_line_state = fields.Selection(related='production_id.production_line_state',
|
||||
string='上/下产线', store=True)
|
||||
string='上/下产线', store=True, tracking=True)
|
||||
detection_report = fields.Binary('检测报告', readonly=True)
|
||||
is_remanufacture = fields.Boolean(string='重新生成制造订单', default=False)
|
||||
is_fetchcnc = fields.Boolean(string='重新获取NC程序', default=False)
|
||||
reason = fields.Selection(
|
||||
[("programming", "编程"), ("clamping", "返工"), ("cutter", "刀具"), ("operate computer", "操机"),
|
||||
("technology", "工艺"), ("customer redrawing", "客户改图"), ("other", "其他"), ], string="原因")
|
||||
("technology", "工艺"), ("customer redrawing", "客户改图"), ("other", "其他"), ], string="原因", tracking=True)
|
||||
detailed_reason = fields.Text('详细原因')
|
||||
|
||||
@api.onchange('rfid_code')
|
||||
@@ -1346,19 +1346,33 @@ class WorkPieceDelivery(models.Model):
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if vals.get('name', '/') == '/' or vals.get('name', '/') is False:
|
||||
vals['name'] = self.env['ir.sequence'].next_by_code('sf.workpiece.delivery') or '/'
|
||||
else:
|
||||
if vals['route_id'] and vals.get('type') is None:
|
||||
vals['type'] = '运送空料架'
|
||||
else:
|
||||
if vals.get('name', '/') == '/' or vals.get('name', '/') is False:
|
||||
vals['name'] = self.env['ir.sequence'].next_by_code('sf.workpiece.delivery') or '/'
|
||||
obj = super(WorkPieceDelivery, self).create(vals)
|
||||
if obj.type == '运送空料架':
|
||||
if obj.name is False:
|
||||
obj.name = "运送空料架路线:%s-%s" % (
|
||||
obj.feeder_station_start_id.name, obj.feeder_station_destination_id.name)
|
||||
return obj
|
||||
|
||||
@api.constrains('name')
|
||||
def _check_name(self):
|
||||
@api.constrains('route_id')
|
||||
def _check_route_id(self):
|
||||
if self.type == '运送空料架':
|
||||
wd = self.sudo().search([('name', '=', self.name), ('id', '!=', self.id)])
|
||||
if wd:
|
||||
raise UserError("该名称已存在")
|
||||
if self.route_id and self.name is False:
|
||||
route = self.sudo().search(
|
||||
[('route_id', '=', self.route_id.id), ('id', '!=', self.id), ('name', 'ilike', '运送空料架路线')])
|
||||
if route:
|
||||
raise UserError("该任务路线已存在,请重新选择")
|
||||
|
||||
# @api.constrains('name')
|
||||
# def _check_name(self):
|
||||
# if self.type == '运送空料架':
|
||||
# wd = self.sudo().search([('name', '=', self.name), ('id', '!=', self.id)])
|
||||
# if wd:
|
||||
# raise UserError("该名称已存在")
|
||||
|
||||
def action_delivery_history(self):
|
||||
return {
|
||||
|
||||
@@ -7,8 +7,8 @@ import os
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.modules import get_resource_path
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
|
||||
|
||||
class ResProductMo(models.Model):
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
<field name="model">sf.agv.site</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="name" required="1"/>
|
||||
<field name="owning_region" required="1"/>
|
||||
<field name="state" required="1"/>
|
||||
<field name="name" required="1" attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name="owning_region" required="1" attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name="state" required="1" attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name="divide_the_work" required="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -34,12 +34,14 @@
|
||||
<field name="model">sf.agv.task.route</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="name" required="1"/>
|
||||
<field name="name" required="1" attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name="type" readonly="1" string="任务类型"/>
|
||||
<field name="route_type" string="类型" required="1"/>
|
||||
<field name="start_site_id" required="1" options="{'no_create': True}" string="起点接驳站"/>
|
||||
<field name="route_type" string="类型" required="1" attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name="start_site_id" required="1" options="{'no_create': True}" string="起点接驳站"
|
||||
attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name="end_site_id" required="1" options="{'no_create': True}" string="终点接驳站"/>
|
||||
<field name="destination_production_line_id" required="1" options="{'no_create': True}"/>
|
||||
<field name="destination_production_line_id" required="1" options="{'no_create': True}"
|
||||
attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -73,7 +75,8 @@
|
||||
<field name="model">center_control.interface.log</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Logs">
|
||||
<field name="name"/>
|
||||
<field name="name" filter_domain="[('name','ilike', self)]"/>
|
||||
<field name="content" filter_domain="[('content','ilike', self)]"/>
|
||||
<group expand="0" string="分组">
|
||||
<field name="interface_call_date"/>
|
||||
</group>
|
||||
|
||||
@@ -683,9 +683,9 @@
|
||||
<field name="model">sf.workpiece.delivery</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="工件配送">
|
||||
<filter name="status" string="待下发" domain="[('status', 'in', ['待下发','待配送'])]"/>
|
||||
<filter name="status" string="待配送" domain="[('status', 'in', ['待下发','待配送'])]"/>
|
||||
<filter name="status" string="已配送" domain="[('status', 'in', ['待下发','待配送'])]"/>
|
||||
<filter name="filter_to_be_issued" string="待下发" domain="[('status', 'in', ['待下发'])]"/>
|
||||
<filter name="filter_waiting_delivery" string="待配送" domain="[('status', 'in', ['待配送'])]"/>
|
||||
<filter name="filter_delivered" string="已配送" domain="[('status', 'in', ['已配送'])]"/>
|
||||
<field name="rfid_code"/>
|
||||
<field name="production_id"/>
|
||||
<field name="feeder_station_start_id"/>
|
||||
@@ -695,9 +695,6 @@
|
||||
<field name="task_completion_time"/>
|
||||
<field name="delivery_duration"/>
|
||||
<field name="status"/>
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="状态" name="status" domain="[]" context="{'group_by': 'status'}"/>
|
||||
</group>
|
||||
<searchpanel>
|
||||
<field name="production_line_id" icon="fa-building" enable_counters="1"/>
|
||||
<field name="status" icon="fa-building" enable_counters="1"/>
|
||||
@@ -710,7 +707,9 @@
|
||||
<field name="name">工件配送</field>
|
||||
<field name="res_model">sf.workpiece.delivery</field>
|
||||
<field name="search_view_id" ref="sf_workpiece_delivery_search"/>
|
||||
<field name="context">{'search_default_on_up':1}</field>
|
||||
<field name="context">{'search_default_filter_to_be_issued': 1,
|
||||
'search_default_filter_waiting_delivery': 1}
|
||||
</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">
|
||||
[('type','in',['上产线','下产线']),('workorder_state','=','done'),('is_manual_work','=',false)]
|
||||
@@ -724,23 +723,39 @@
|
||||
<field name="model">sf.workpiece.delivery</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="工件配送" editable="bottom" class="center" delete="0" create="1">
|
||||
<header>
|
||||
<button name="button_delivery" type="object" string="配送" class="oe_highlight"/>
|
||||
</header>
|
||||
<field name="name" string="路线名称" attrs="{'readonly': [('id', '!=', False)]}"
|
||||
placeholder="例如:运送空料架路线:G01-A01" required="1" force_save="1"/>
|
||||
<!-- <header>-->
|
||||
<!-- <button name="button_delivery" type="object" string="配送" class="oe_highlight"/>-->
|
||||
<!-- </header>-->
|
||||
<!-- <field name="name" string="路线名称" attrs="{'readonly': [('id', '!=', False)]}"-->
|
||||
<!-- placeholder="例如:运送空料架路线:G01-A01" required="1" force_save="1"/>-->
|
||||
<field name="route_id" options="{'no_create': True}" required="1"
|
||||
attrs="{'readonly': [('id', '!=', False)]}" domain="[('route_type', '=', '运送空料架')]"
|
||||
force_save="1"/>
|
||||
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
||||
<!-- <field name="type" readonly="1"/>-->
|
||||
<field name="feeder_station_destination_id" readonly="1" force_save="1"/>
|
||||
<button name="button_delivery" type="object" string="配送" class="oe_highlight"/>
|
||||
<button name="action_delivery_history" type="object" class="btn btn-link text-info" icon="fa-history"
|
||||
string="历史"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="sf_workpiece_delivery_empty_racks_kanban" model="ir.ui.view">-->
|
||||
<!-- <field name="name">sf.workpiece.delivery.view.kanban</field>-->
|
||||
<!-- <field name="model">sf.workpiece.delivery</field>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <kanban>-->
|
||||
<!-- <field name="route_id"/>-->
|
||||
<!-- <field name="feeder_station_start_id"/>-->
|
||||
<!-- <field name="feeder_station_destination_id"/>-->
|
||||
<!--<!– <button name="button_delivery" type="object" string="配送" class="oe_highlight"/>–>-->
|
||||
<!--<!– <button name="action_delivery_history" type="object" class="btn btn-link text-info" icon="fa-history"–>-->
|
||||
<!--<!– string="历史"/>–>-->
|
||||
<!-- </kanban>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<record id="sf_workpiece_delivery_empty_racks_tree" model="ir.ui.view">
|
||||
<field name="name">空料架配送</field>
|
||||
<field name="model">sf.workpiece.delivery</field>
|
||||
@@ -763,6 +778,7 @@
|
||||
<field name="model">sf.workpiece.delivery</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="运送空料架">
|
||||
<filter name="filter_active" string="已归档" domain="[('active', '=', False)]"/>
|
||||
<field name="route_id"/>
|
||||
<field name="feeder_station_start_id"/>
|
||||
<field name="feeder_station_destination_id"/>
|
||||
|
||||
Reference in New Issue
Block a user