diff --git a/sf_base/models/sf_base.py b/sf_base/models/sf_base.py
index 4459d4dd..1697d4b9 100644
--- a/sf_base/models/sf_base.py
+++ b/sf_base/models/sf_base.py
@@ -18,10 +18,10 @@ class MachineBrandTags(models.Model):
class MachineControlSystem(models.Model):
_name = 'mrs.machine_tool.type.control_system'
_description = '控制系统'
-
+ code = fields.Char('编码')
name = fields.Char('名称', size=50)
# type_id = fields.Many2one('mrs.machine_tool.type')
-
+ active = fields.Boolean('有效', default=True)
# 品牌标签
class MachineBrand(models.Model):
diff --git a/sf_base/models/sf_common.py b/sf_base/models/sf_common.py
index 40f1fcd8..17bd0a79 100644
--- a/sf_base/models/sf_common.py
+++ b/sf_base/models/sf_common.py
@@ -38,8 +38,7 @@ class MrsProductionProcess(models.Model):
_description = '表面工艺'
name = fields.Char('表面工艺')
remark = fields.Text("备注")
- processing_technology_ids = fields.Many2many('mrs.processing.technology', 'mrs_associated_processes',
- index=True)
+ processing_order_ids = fields.One2many('mrs.processing.order', 'production_process_id', string='工序')
partner_process_ids = fields.Many2many('res.partner', 'process_ids', '加工工厂')
process_encode = fields.Char("编码")
active = fields.Boolean('有效', default=True)
@@ -49,14 +48,23 @@ class MrsProcessingTechnology(models.Model):
_name = 'mrs.processing.technology'
_description = '加工工艺'
remark = fields.Text("备注")
- sequence = fields.Integer('Sequence', index=True)
name = fields.Char('加工工艺', index=True)
remark = fields.Text('备注', index=True)
process_encode = fields.Char("编码")
- production_process_ids = fields.Many2many('mrs.production.process', 'mrs_associated_processes',
- index=True)
+ processing_order_ids = fields.Many2many('mrs.processing.order', 'mrs_associated_processes',
+ index=True, string='工序')
active = fields.Boolean('有效', default=True)
+class MrsProcessingOrder(models.Model):
+ _name = 'mrs.processing.order'
+ _description = '工序'
+ sequence = fields.Integer('Sequence')
+
+ processing_technology_ids = fields.Many2many('mrs.processing.technology', 'mrs_associated_processes',
+
+ index=True, string='加工工艺')
+
+ production_process_id = fields.Many2one('mrs.production.process', string="表面工艺")
class ProductTemplate(models.Model):
_inherit = 'product.template'
diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv
index 3a1b5059..6df5e07e 100644
--- a/sf_base/security/ir.model.access.csv
+++ b/sf_base/security/ir.model.access.csv
@@ -7,7 +7,7 @@ access_mrs_machine_brand,mrs_machine_brand,model_mrs_machine_brand,base.group_us
access_mrs_machine_brand_tags,mrs_machine_brand_tags,model_mrs_machine_brand_tags,base.group_user,1,1,1,1
access_mrs_machine_tool_type_control_system,mrs_machine_tool_type_control_system,model_mrs_machine_tool_type_control_system,base.group_user,1,1,1,1
-
+access_mrs_processing_order,mrs_processing_order,model_mrs_processing_order,base.group_user,1,1,1,1
access_mrs_production_process,mrs_production_process,model_mrs_production_process,base.group_user,1,1,1,1
access_mrs_production_materials,mrs_production_materials,model_mrs_production_materials,base.group_user,1,1,1,1
access_mrs_materials_model,mrs_materials_model,model_mrs_materials_model,base.group_user,1,1,1,1
diff --git a/sf_base/views/mrs_common_view.xml b/sf_base/views/mrs_common_view.xml
index c1089185..3ad854e0 100644
--- a/sf_base/views/mrs_common_view.xml
+++ b/sf_base/views/mrs_common_view.xml
@@ -70,14 +70,19 @@
-
-
-
+
+
+
-
-
-
+
+
+
diff --git a/sf_mrs_sync/data/sf_cron.xml b/sf_mrs_sync/data/sf_cron.xml
index c6d5f9fc..6131b340 100644
--- a/sf_mrs_sync/data/sf_cron.xml
+++ b/sf_mrs_sync/data/sf_cron.xml
@@ -6,7 +6,7 @@
code
model.sync_production_materials()
1
- minutes
+ days
-1
@@ -17,7 +17,7 @@
code
model.sync_materials_model()
1
- minutes
+ days
-1
@@ -29,7 +29,7 @@
code
model.sync_production_process()
1
- minutes
+ days
-1
@@ -40,7 +40,7 @@
code
model.sync_processing_technology()
1
- minutes
+ days
-1
@@ -51,7 +51,7 @@
code
model.sync_machine_brand_tags()
1
- minutes
+ days
-1
@@ -63,7 +63,7 @@
code
model.sync_machine_tool_type_control_system()
1
- minutes
+ days
-1
@@ -74,7 +74,7 @@
code
model.sync_machine_brand()
1
- minutes
+ days
-1
@@ -85,7 +85,7 @@
code
model.sync_machine_tool()
1
- minutes
+ days
-1
@@ -96,7 +96,7 @@
code
model.sync_machine_tool_type()
1
- minutes
+ days
-1
@@ -107,7 +107,7 @@
code
model.sync_cutting_tool_category()
1
- minutes
+ days
-1
@@ -118,7 +118,7 @@
code
model.sync_cutting_tool_type()
1
- minutes
+ days
-1
diff --git a/sf_mrs_sync/models/sf_sync_common.py b/sf_mrs_sync/models/sf_sync_common.py
index 13c74be8..7484a76c 100644
--- a/sf_mrs_sync/models/sf_sync_common.py
+++ b/sf_mrs_sync/models/sf_sync_common.py
@@ -16,12 +16,17 @@ import logging
_logger = logging.getLogger(__name__)
MRS = 'https://mrs.cs.jikimo.com'
-# MRS = 'http://192.168.50.11:8069'
+# MRS = 'http://192.168.50.100:6069'
+# 服务器
+TOKEN = '0b231a4c-3f01-11ed-a1cb-0242ac110003'
+# 本地
+# TOKEN = '4130d97c-37be-11ed-84a7-f8b54df29535'
-TOKEN = '9524cba0-3e39-11ed-84ab-0242ac110003'
# TOKEN = '999e2cff-3e44-11ed-92e2-f8b54d90e788'
-mrs_secret_key = 'HcSd4zh5AofCm73W'
-
+# 服务器
+mrs_secret_key = 'WNHeIopD4XJy6TLK'
+# 本地
+# mrs_secret_key = 'BCDkXbaISz4Vg08y'
# TIMESTAMP = str(int(time.time()))
@@ -52,10 +57,10 @@ class MrsProductionMaterials(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
- for item in result['production_materials_list']:
+ for item in result['production_materials_all_list']:
if item:
brand = self.env['mrs.production.materials'].search(
- [("id", '=', item['id'])])
+ [("materials_no", '=', item['materials_no'])])
if brand:
print(item['name'])
else:
@@ -91,10 +96,10 @@ class MrsMaterialModel(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
- for item in result['materials_model_list']:
+ for item in result['materials_model_all_list']:
if item:
brand = self.env['mrs.materials.model'].search(
- [("id", '=', item['id'])])
+ [("materials_num", '=', item['materials_num'])])
if brand:
print(item['name'])
else:
@@ -134,17 +139,17 @@ class MrsProductionProcess(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
- for item in result['production_process_list']:
+ for item in result['production_process_all_list']:
if item:
brand = self.env['mrs.production.process'].search(
- [("id", '=', item['id'])])
+ [("process_encode", '=', item['process_encode'])])
if brand:
print(item['name'])
else:
self.env['mrs.production.process'].create({
"id": item['id'],
"name": item['name'],
- "process_enstatus": item['process_enstatus'],
+ "process_encode": item['process_encode'],
"remark": item['remark'],
"active": item['active'],
# "tag_ids": item['tag_ids']
@@ -172,17 +177,17 @@ class MrsProcessingTechnology(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
- for item in result[' processing_technology_list_all']:
+ for item in result['processing_technology_all_list']:
if item:
brand = self.env['mrs.processing.technology'].search(
- [("id", '=', item['id'])])
+ [("process_encode", '=', item['process_encode'])])
if brand:
print(item['name'])
else:
self.env['mrs.processing.technology'].create({
"id": item['id'],
"name": item['name'],
- "process_enstatus": item['process_enstatus'],
+ "process_encode": item['process_encode'],
"remark": item['remark'],
"active": item['active'],
# "tag_ids": item['tag_ids']
@@ -244,18 +249,19 @@ class MachineControlSystem(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
- for item in result['machine_control_system_list_all']:
+ for item in result['machine_control_system_all_list']:
if item:
brand = self.env['mrs.machine_tool.type.control_system'].search(
- [("id", '=', item['id'])])
+ [("code", '=', item['code'])])
if brand:
print(item['name'])
else:
self.env['mrs.machine_tool.type.control_system'].create({
"id": item['id'],
"name": item['name'],
- "status": item['status'],
- "brand_id": item['brand_id'],
+ "code": item['code'],
+
+ # "brand_id": item['brand_id'],
"active": item['active'],
# "tag_ids": item['tag_ids']
@@ -278,6 +284,7 @@ class MachineBrand(models.Model):
'TIMESTAMP': timestamp,
'check_str': check_mrs_str}
strUrl = MRS + self.url
+ print("打印headers密钥"+check_mrs_str )
r = requests.post(strUrl, json={}, data=None, headers=headers)
r = r.json()
result = json.loads(r['result'])
@@ -319,7 +326,7 @@ class MachineTool(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
- for item in result['machine_tool_list']:
+ for item in result['machine_tool_all_list']:
brand = self.env['mrs.machine_tool'].search(
[("code", '=', item['code'])])
if brand:
@@ -329,6 +336,7 @@ class MachineTool(models.Model):
"id": item['id'],
"name": item['name'],
"precision": item['precision'],
+ "code": item['code'],
"status": item['status'],
"knife_type": item['knife_type'],
"registration_date": item['registration_date'],
@@ -370,9 +378,9 @@ class MachineToolType(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
- for item in result['machine_tool_type_list']:
+ for item in result['machine_tool_type_all_list']:
brand = self.env['mrs.machine_tool.type'].search(
- [("id", '=', item['id'])])
+ [("code", '=', item['code'])])
if brand:
print(item['name'])
else:
@@ -418,16 +426,16 @@ class CuttingTool(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
- for item in result['cutting_tool_category_list_all']:
+ for item in result['cutting_tool_category_all_list']:
brand = self.env['mrs.cutting_tool.category'].search(
- [("id", '=', item['id'])])
+ [("code", '=', item['code'])])
if brand:
print(item['name'])
else:
self.env['mrs.cutting_tool.category'].create({
"id": item['id'],
"name": item['name'],
- "status": item['status'],
+ "code": item['code'],
"remark": item['remark'],
"active": item['active'],
# "tag_ids": item['tag_ids']
@@ -455,17 +463,17 @@ class CuttingToolType(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
- for item in result['cutting_tool_type_list_all']:
+ for item in result['cutting_tool_type_all_list']:
brand = self.env['mrs.cutting_tool.type'].search(
- [("id", '=', item['id'])])
+ [("code", '=', item['code'])])
if brand:
print(item['name'])
else:
self.env['mrs.cutting_tool.type'].create({
"id": item['id'],
"name": item['name'],
- "status": item['status'],
"remark": item['remark'],
+ "code": item['code'],
"active": item['active'],
"diameter": item['diameter'],
"cone_angle_pitch": item['cone_angle_pitch'],
@@ -474,8 +482,8 @@ class CuttingToolType(models.Model):
"taper_shank_length": item['taper_shank_length'],
"tool_length": item['tool_length'],
"blade_number": item['blade_number'],
- "brand_id": item['brand_id'],
- "category_id": item['category_id']
+ # "brand_id": item['brand_id'],
+ # "category_id": item['category_id']
})
else:
raise ValidationError("访问失败")