diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py
index 5c5c2725..94c9da55 100644
--- a/sf_base/__manifest__.py
+++ b/sf_base/__manifest__.py
@@ -15,7 +15,7 @@
'security/group_security.xml',
'security/ir.model.access.csv',
'data/product_data.xml',
- 'data/process_data.xml',
+ # 'data/process_data.xml',
'views/mrs_base_view.xml',
'views/mrs_common_view.xml',
'views/menu_view.xml',
diff --git a/sf_base/data/process_data.xml b/sf_base/data/process_data.xml
index 4bc9cf25..066f4e45 100644
--- a/sf_base/data/process_data.xml
+++ b/sf_base/data/process_data.xml
@@ -1,52 +1,52 @@
-
-
-
-
- 获取自动编码程序
- automatic coding
- manual
- 60
- True
-
+
+
+
+
+
+
+
+
+
+
-
- 装夹
- clamping
- manual
- 60
- True
-
+
+
+
+
+
+
+
-
- 前置三元定位检测
- pre-ternary
- manual
- 60
- True
-
+
+
+
+
+
+
+
-
- CNC加工
- CNC machining
- manual
- 60
- True
-
+
+
+
+
+
+
+
-
- 后置三元质量检测
- post ternary
- manual
- 60
- True
-
+
+
+
+
+
+
+
-
- 解除装夹
- remove the clamping
- manual
- 60
- True
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_base/models/process.py b/sf_base/models/process.py
index ea97dac0..4fec8c90 100644
--- a/sf_base/models/process.py
+++ b/sf_base/models/process.py
@@ -6,7 +6,7 @@ class ModelType(models.Model):
_description = '模型类型'
name = fields.Char('名称')
- routing_tmpl_id = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板')
+ routing_tmpl_ids = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板')
class ResMrpRoutingWorkcenter(models.Model):
@@ -14,9 +14,16 @@ class ResMrpRoutingWorkcenter(models.Model):
code = fields.Char('唯一编码')
is_repeat = fields.Boolean('重复', default=False)
- workcenter_id = fields.Many2many('mrp.workcenter', required=False)
+ workcenter_id = fields.Many2one('mrp.workcenter', required=False)
+ workcenter_ids = fields.Many2many('mrp.workcenter', 'rel_workcenter_route', required=True)
bom_id = fields.Many2one('mrp.bom', required=False)
- route_workcenter_sort_id = fields.Many2many('sf.model.type.routing.sort')
+
+ # 获得当前登陆者公司
+ def get_company_id(self):
+ company = self.env.ref('base.main_company')
+ return company.id
+
+ company_id = fields.Many2one('res.company', default=lambda self: self.env.company)
class ModelTypeRoutingSort(models.Model):
@@ -24,8 +31,11 @@ class ModelTypeRoutingSort(models.Model):
_description = '工序排序'
sequence = fields.Integer('Sequence')
-
- route_workcenter_id = fields.Many2many('mrp.routing.workcenter')
+ route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
+ is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
+ workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
model_type_id = fields.Many2one('sf.model.type')
-
+ _sql_constraints = [
+ ('route_model_type_uniq', 'unique (route_workcenter_id,model_type_id)', '工序不能重复!')
+ ]
diff --git a/sf_base/models/product_template.py b/sf_base/models/product_template.py
index 48c42996..f3ecda1c 100644
--- a/sf_base/models/product_template.py
+++ b/sf_base/models/product_template.py
@@ -49,15 +49,16 @@ class ResProductTemplate(models.Model):
# 并根据模型类型计算出产品的胚料尺寸;
@api.onchange('model_type_id')
def count_embryo_size(self):
- bom = self.env['mrp.bom.line'].search(
- [('product_tmpl_id', '=', self.id)])
+ bom = self.env['product.product'].search(
+ [('categ_id.is_embryo', '=', True), ('product_tmpl_id', '=', self.id)],
+ limit=1,
+ order='volume desc'
+ )
for item in self:
- print(bom.product_tmpl_id)
- print(bom.model_long)
- item.model_long = bom.model_long + 1
- print(item.model_long)
+ item.model_long = bom.embryo_long + 1
item.embryo_width = bom.embryo_width + 1
item.embryo_height = bom.embryo_height + 1
+ item.volume = item.model_long * item.embryo_width * item.embryo_height
diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv
index 565b5faf..b9b1ca39 100644
--- a/sf_base/security/ir.model.access.csv
+++ b/sf_base/security/ir.model.access.csv
@@ -19,3 +19,4 @@ access_sf_model_type_routing_sort,sf_model_type_routing_sort,model_sf_model_type
+
diff --git a/sf_base/views/mrp_routing_workcenter_view.xml b/sf_base/views/mrp_routing_workcenter_view.xml
index 3712561e..87fe49a7 100644
--- a/sf_base/views/mrp_routing_workcenter_view.xml
+++ b/sf_base/views/mrp_routing_workcenter_view.xml
@@ -7,7 +7,7 @@
-
+
diff --git a/sf_base/views/mrs_base_view.xml b/sf_base/views/mrs_base_view.xml
index 713173d4..b7f61d4f 100644
--- a/sf_base/views/mrs_base_view.xml
+++ b/sf_base/views/mrs_base_view.xml
@@ -523,13 +523,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/sf_manufacturing_orders/models/mrp_workorder.py b/sf_manufacturing_orders/models/mrp_workorder.py
index 200ec6b2..59f2626d 100644
--- a/sf_manufacturing_orders/models/mrp_workorder.py
+++ b/sf_manufacturing_orders/models/mrp_workorder.py
@@ -33,8 +33,8 @@ class ReStockRule(models.Model):
print(productions.product_id.processing_panel)
# 查出产品的加工面板并对根据面板的数量循环生成工序
for k in (productions.product_id.processing_panel.split(',')):
- print(productions.product_id.model_type_id.routing_tmpl_id)
- for j in productions.product_id.model_type_id.routing_tmpl_id:
+ print(productions.product_id.model_type_id.routing_tmpl_ids)
+ for j in productions.product_id.model_type_id.routing_tmpl_ids:
productions._create_workorder()
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
(
diff --git a/sf_manufacturing_orders/models/sf_production.py b/sf_manufacturing_orders/models/sf_production.py
index a41c65f6..e76ee80c 100644
--- a/sf_manufacturing_orders/models/sf_production.py
+++ b/sf_manufacturing_orders/models/sf_production.py
@@ -68,7 +68,9 @@ class MrpProduction(models.Model):
'operation_id': operation.id,
'state': 'pending',
}]
+ print('1111111')
production.workorder_ids = [(5, 0)] + [(0, 0, value) for value in workorders_values]
+ print('22222')
for workorder in production.workorder_ids:
workorder.duration_expected = workorder._get_duration_expected()