|
|
|
|
@@ -92,7 +92,8 @@ class sfProductionMaterials(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['production_materials_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
materials = self.search([("materials_no", '=', item['materials_no'])])
|
|
|
|
|
materials = self.search(
|
|
|
|
|
[("materials_no", '=', item['materials_no'], ('active', 'in', [True, False]))])
|
|
|
|
|
if materials:
|
|
|
|
|
materials.name = item['name']
|
|
|
|
|
materials.remark = item['remark']
|
|
|
|
|
@@ -118,7 +119,8 @@ class sfProductionMaterials(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['production_materials_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
materials = self.search([("materials_no", '=', item['materials_no'])])
|
|
|
|
|
materials = self.search(
|
|
|
|
|
[("materials_no", '=', item['materials_no']), ('active', 'in', [True, False])])
|
|
|
|
|
if not materials:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -150,7 +152,8 @@ class sfMaterialModel(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['materials_model_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
materials_model = self.search([("materials_no", '=', item['materials_no'])])
|
|
|
|
|
materials_model = self.search(
|
|
|
|
|
[("materials_no", '=', item['materials_no']), ('active', 'in', [True, False])])
|
|
|
|
|
materials = self.env['sf.production.materials'].search(
|
|
|
|
|
[("materials_no", '=', item['materials_id.materials_no'])])
|
|
|
|
|
if materials_model:
|
|
|
|
|
@@ -196,7 +199,8 @@ class sfMaterialModel(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['materials_model_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
materials_model = self.search([("materials_no", '=', item['materials_no'])])
|
|
|
|
|
materials_model = self.search(
|
|
|
|
|
[("materials_no", '=', item['materials_no']), ('active', 'in', [True, False])])
|
|
|
|
|
materials = self.env['sf.production.materials'].search(
|
|
|
|
|
[("materials_no", '=', item['materials_id.materials_no'])])
|
|
|
|
|
if not materials_model:
|
|
|
|
|
@@ -256,7 +260,8 @@ class sfProductionProcessCategory(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['production_process_category_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
production_process_category = self.search([("code", '=', item['code'])])
|
|
|
|
|
production_process_category = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if production_process_category:
|
|
|
|
|
production_process_category.name = item['name']
|
|
|
|
|
production_process_category.code = item['code']
|
|
|
|
|
@@ -281,7 +286,7 @@ class sfProductionProcessCategory(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['production_process_category_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
category = self.search([("code", '=', item['code'])])
|
|
|
|
|
category = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not category:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -311,17 +316,7 @@ class sfProductionProcess(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['production_process_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
brand = self.env['sf.production.process'].search(
|
|
|
|
|
[("code", '=', item['code'])])
|
|
|
|
|
if brand:
|
|
|
|
|
brand.name = item['name']
|
|
|
|
|
brand.category_id = self.env['sf.production.process.category'].search(
|
|
|
|
|
[("code", '=', item['category_code'])]).id
|
|
|
|
|
brand.code = item['code']
|
|
|
|
|
brand.remark = item['remark']
|
|
|
|
|
brand.active = item['active']
|
|
|
|
|
brand.remark = item['remark']
|
|
|
|
|
production_process = self.search([("code", '=', item['code'])])
|
|
|
|
|
production_process = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
category = self.env['sf.production.process.category'].search(
|
|
|
|
|
[("code", '=', item['category_code'])])
|
|
|
|
|
if production_process:
|
|
|
|
|
@@ -332,8 +327,7 @@ class sfProductionProcess(models.Model):
|
|
|
|
|
else:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
"category_id": self.env['sf.production.process.category'].search(
|
|
|
|
|
[("code", '=', item['category_code'])]).id,
|
|
|
|
|
"category_id": category.id,
|
|
|
|
|
"code": item['code'],
|
|
|
|
|
"remark": item['remark'],
|
|
|
|
|
"active": item['active'],
|
|
|
|
|
@@ -352,7 +346,7 @@ class sfProductionProcess(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['production_process_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
production_process = self.search([("code", '=', item['code'])])
|
|
|
|
|
production_process = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
category = self.env['sf.production.process.category'].search(
|
|
|
|
|
[("code", '=', item['category_code'])])
|
|
|
|
|
if not production_process:
|
|
|
|
|
@@ -388,7 +382,7 @@ class sfProcessingTechnology(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['processing_technology_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
processing_technology = self.search([("code", '=', item['code'])])
|
|
|
|
|
processing_technology = self.search([("code", '=', item['process_encode']), ('active', 'in', [True, False])])
|
|
|
|
|
if processing_technology:
|
|
|
|
|
processing_technology.name = item['name']
|
|
|
|
|
processing_technology.remark = item['remark']
|
|
|
|
|
@@ -396,7 +390,7 @@ class sfProcessingTechnology(models.Model):
|
|
|
|
|
else:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
"code": item['code'],
|
|
|
|
|
"code": item['process_encode'],
|
|
|
|
|
"remark": item['remark'],
|
|
|
|
|
"active": item['active'],
|
|
|
|
|
})
|
|
|
|
|
@@ -414,11 +408,11 @@ class sfProcessingTechnology(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['processing_technology_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
processing_technology = self.search([("code", '=', item['code'])])
|
|
|
|
|
processing_technology = self.search([("code", '=', item['process_encode']), ('active', 'in', [True, False])])
|
|
|
|
|
if not processing_technology:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
"code": item['code'],
|
|
|
|
|
"code": item['process_encode'],
|
|
|
|
|
"remark": item['remark'],
|
|
|
|
|
"active": item['active'],
|
|
|
|
|
})
|
|
|
|
|
@@ -496,7 +490,7 @@ class MachineControlSystem(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['machine_control_system_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
control_system = self.search([("code", '=', item['code'])])
|
|
|
|
|
control_system = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
brand = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])])
|
|
|
|
|
if control_system:
|
|
|
|
|
control_system.name = item['name']
|
|
|
|
|
@@ -525,7 +519,7 @@ class MachineControlSystem(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['machine_control_system_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
control_system = self.search([("code", '=', item['code'])])
|
|
|
|
|
control_system = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
brand = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])])
|
|
|
|
|
if not control_system:
|
|
|
|
|
self.create({
|
|
|
|
|
@@ -559,7 +553,7 @@ class MachineBrand(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['machine_brand_yesterday_list']:
|
|
|
|
|
brand = self.search([("code", '=', item['code'])])
|
|
|
|
|
brand = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if brand:
|
|
|
|
|
brand.name = item['name']
|
|
|
|
|
brand.image_brand = '' if not item['image_brand'] else base64.b64decode(item['image_brand'])
|
|
|
|
|
@@ -588,7 +582,7 @@ class MachineBrand(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['machine_brand_all_list']:
|
|
|
|
|
brand = self.search([("code", '=', item['code'])])
|
|
|
|
|
brand = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not brand:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -628,7 +622,7 @@ class MachineToolType(models.Model):
|
|
|
|
|
else:
|
|
|
|
|
image = ''
|
|
|
|
|
taper_type_id = self.env['spindle.taper.type'].search([('name', '=', item['taper_type_id'])])
|
|
|
|
|
machine_tool_type = self.search([("code", '=', item['code'])])
|
|
|
|
|
machine_tool_type = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
control_system = self.env['sf.machine.control_system'].search(
|
|
|
|
|
[('code', '=', item['control_system_id'])])
|
|
|
|
|
jg_image_id = self.env['maintenance.equipment.image'].search([('name', 'in', item['jg_image_id'])])
|
|
|
|
|
@@ -822,7 +816,7 @@ class MachineToolType(models.Model):
|
|
|
|
|
'name': item['taper_type_id']
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
machine_tool_type = self.search([("code", '=', item['code'])])
|
|
|
|
|
machine_tool_type = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
control_system = self.env['sf.machine.control_system'].search(
|
|
|
|
|
[('code', '=', item['control_system_id'])])
|
|
|
|
|
brand = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])])
|
|
|
|
|
@@ -1013,7 +1007,7 @@ class sfProcessingOrder(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['processing_order_yesterday_list']:
|
|
|
|
|
processing_order = self.search([("id", '=', item['id'])])
|
|
|
|
|
processing_order = self.search([("id", '=', item['id']), ('active', 'in', [True, False])])
|
|
|
|
|
if processing_order:
|
|
|
|
|
processing_order.sequence = item['sequence']
|
|
|
|
|
else:
|
|
|
|
|
@@ -1033,7 +1027,7 @@ class sfProcessingOrder(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['processing_order_all_list']:
|
|
|
|
|
processing_order = self.search([("id", '=', item['id'])])
|
|
|
|
|
processing_order = self.search([("id", '=', item['id']), ('active', 'in', [True, False])])
|
|
|
|
|
if not processing_order:
|
|
|
|
|
self.create({
|
|
|
|
|
"sequence": item['sequence'],
|
|
|
|
|
@@ -1060,7 +1054,8 @@ class sfProductionProcessParameter(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['mrs_production_process_parameter_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
production_process_parameter = self.search([("code", '=', item['code'])])
|
|
|
|
|
production_process_parameter = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
process = self.env['sf.production.process'].search(
|
|
|
|
|
[('code', '=', item['process_id_code'])])
|
|
|
|
|
if production_process_parameter:
|
|
|
|
|
@@ -1093,7 +1088,7 @@ class sfProductionProcessParameter(models.Model):
|
|
|
|
|
for item in result['mrs_production_process_parameter_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
production_process_parameter = self.search(
|
|
|
|
|
[("code", '=', item['code'])])
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
process = self.env['sf.production.process'].search(
|
|
|
|
|
[('code', '=', item['process_id_code'])], limit=1)
|
|
|
|
|
if not production_process_parameter:
|
|
|
|
|
@@ -1130,7 +1125,7 @@ class MachineToolCategory(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['machine_tool_category_yesterday_list']:
|
|
|
|
|
machine_tool_category = self.search([("code", '=', item['code'])])
|
|
|
|
|
machine_tool_category = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if machine_tool_category:
|
|
|
|
|
machine_tool_category.name = item['name']
|
|
|
|
|
machine_tool_category.category = item['category']
|
|
|
|
|
@@ -1157,7 +1152,7 @@ class MachineToolCategory(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['machine_tool_category_all_list']:
|
|
|
|
|
machine_tool_category = self.search([("code", '=', item['code'])])
|
|
|
|
|
machine_tool_category = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not machine_tool_category:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1195,7 +1190,8 @@ class sfSyncCutting_tool_Material(models.Model):
|
|
|
|
|
if result.get('mrs_cutting_tool_material_yesterday_list'):
|
|
|
|
|
for item in result['mrs_cutting_tool_material_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
cutting_tool_material = self.search([("code", '=', item['code'])])
|
|
|
|
|
cutting_tool_material = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutting_tool_material:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1225,7 +1221,8 @@ class sfSyncCutting_tool_Material(models.Model):
|
|
|
|
|
if result.get('mrs_cutting_tool_material_all_list'):
|
|
|
|
|
for item in result['mrs_cutting_tool_material_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
cutting_tool_material = self.search([("code", '=', item['code'])])
|
|
|
|
|
cutting_tool_material = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutting_tool_material:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1262,7 +1259,8 @@ class SyncFunctionalCuttingToolModel(models.Model):
|
|
|
|
|
if result.get('mrs_functional_cutting_tool_model_yesterday_list'):
|
|
|
|
|
for item in result['mrs_functional_cutting_tool_model_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
functional_cutting_tool_model = self.search([("code", '=', item['code'])])
|
|
|
|
|
functional_cutting_tool_model = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not functional_cutting_tool_model:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1292,7 +1290,8 @@ class SyncFunctionalCuttingToolModel(models.Model):
|
|
|
|
|
if result.get('mrs_functional_cutting_tool_model_all_list'):
|
|
|
|
|
for item in result['mrs_functional_cutting_tool_model_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
functional_cutting_tool_model = self.search([("code", '=', item['code'])])
|
|
|
|
|
functional_cutting_tool_model = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not functional_cutting_tool_model:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1329,7 +1328,7 @@ class SyncFixtureMaterial(models.Model):
|
|
|
|
|
if result.get('fixture_material_yesterday_list'):
|
|
|
|
|
for item in result['fixture_material_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
fixture_material = self.search([("code", '=', item['code'])])
|
|
|
|
|
fixture_material = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not fixture_material:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1361,7 +1360,7 @@ class SyncFixtureMaterial(models.Model):
|
|
|
|
|
if result.get('fixture_material_all_list'):
|
|
|
|
|
for item in result['fixture_material_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
fixture_material = self.search([("code", '=', item['code'])])
|
|
|
|
|
fixture_material = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not fixture_material:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1399,7 +1398,8 @@ class SyncMulti_Mounting_Type(models.Model):
|
|
|
|
|
if result.get('multi_mounting_type_yesterday_list'):
|
|
|
|
|
for item in result['multi_mounting_type_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
multi_mounting_type = self.search([("code", '=', item['code'])])
|
|
|
|
|
multi_mounting_type = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not multi_mounting_type:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1429,7 +1429,8 @@ class SyncMulti_Mounting_Type(models.Model):
|
|
|
|
|
if result.get('multi_mounting_type_all_list'):
|
|
|
|
|
for item in result['multi_mounting_type_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
multi_mounting_type = self.search([("code", '=', item['code'])])
|
|
|
|
|
multi_mounting_type = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not multi_mounting_type:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1674,7 +1675,8 @@ class SyncFunctionalFixtureType(models.Model):
|
|
|
|
|
if result.get('functional_fixture_type_yesterday_list'):
|
|
|
|
|
for item in result['functional_fixture_type_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
functional_fixture_type = self.search([("code", '=', item['code'])])
|
|
|
|
|
functional_fixture_type = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not functional_fixture_type:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1703,7 +1705,8 @@ class SyncFunctionalFixtureType(models.Model):
|
|
|
|
|
if result.get('functional_fixture_type_all_list'):
|
|
|
|
|
for item in result['functional_fixture_type_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
functional_fixture_type = self.search([("code", '=', item['code'])])
|
|
|
|
|
functional_fixture_type = self.search(
|
|
|
|
|
[("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not functional_fixture_type:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1739,7 +1742,7 @@ class SfToolType(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['mrs_cutting_tool_type_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
cutting_tool_type = self.search([("code", '=', item['code'])])
|
|
|
|
|
cutting_tool_type = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
cutting_tool_material = self.env['sf.cutting.tool.material'].search(
|
|
|
|
|
[("code", '=', item['cutting_tool_material_code'])])
|
|
|
|
|
if not cutting_tool_type:
|
|
|
|
|
@@ -1771,7 +1774,7 @@ class SfToolType(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['mrs_cutting_tool_type_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
cutting_tool_type = self.search([("code", '=', item['code'])])
|
|
|
|
|
cutting_tool_type = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
cutting_tool_material = self.env['sf.cutting.tool.material'].search(
|
|
|
|
|
[("code", '=', item['cutting_tool_material_code'])])
|
|
|
|
|
if not cutting_tool_type:
|
|
|
|
|
@@ -1811,7 +1814,8 @@ class SfMaintenanceEquipmentImage(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['ability_feature_library_yesterday_list']:
|
|
|
|
|
if item:
|
|
|
|
|
ability_feature_library = self.search([("name", '=', item['name'])])
|
|
|
|
|
ability_feature_library = self.search(
|
|
|
|
|
[("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not ability_feature_library:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1839,7 +1843,8 @@ class SfMaintenanceEquipmentImage(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['ability_feature_library_all_list']:
|
|
|
|
|
if item:
|
|
|
|
|
ability_feature_library = self.search([("name", '=', item['name'])])
|
|
|
|
|
ability_feature_library = self.search(
|
|
|
|
|
[("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not ability_feature_library:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1872,7 +1877,7 @@ class MaterialApply(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['material_apply_yesterday_list']:
|
|
|
|
|
material_apply = self.search([("name", '=', item['name'])])
|
|
|
|
|
material_apply = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if material_apply:
|
|
|
|
|
material_apply.name = item['name']
|
|
|
|
|
material_apply.active = item['active']
|
|
|
|
|
@@ -1894,7 +1899,7 @@ class MaterialApply(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['material_apply_all_list']:
|
|
|
|
|
material_apply = self.search([("name", '=', item['name'])])
|
|
|
|
|
material_apply = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not material_apply:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1922,7 +1927,7 @@ class ModelInternationalStandards(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['mrs_international_standards_yesterday_list']:
|
|
|
|
|
international_standards = self.search([("name", '=', item['name'])])
|
|
|
|
|
international_standards = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if international_standards:
|
|
|
|
|
international_standards.name = item['name']
|
|
|
|
|
international_standards.active = item['active']
|
|
|
|
|
@@ -1945,7 +1950,7 @@ class ModelInternationalStandards(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['mrs_international_standards_all_list']:
|
|
|
|
|
international_standards = self.search([("name", '=', item['name'])])
|
|
|
|
|
international_standards = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not international_standards:
|
|
|
|
|
self.create({
|
|
|
|
|
"name": item['name'],
|
|
|
|
|
@@ -1973,7 +1978,7 @@ class CuttingSpeed(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['cutting_speed_yesterday_list']:
|
|
|
|
|
cutting_speed = self.search([("name", '=', item['name'])])
|
|
|
|
|
cutting_speed = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutting_speed:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': item['name'],
|
|
|
|
|
@@ -2027,7 +2032,7 @@ class CuttingSpeed(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['cutting_speed_all_list']:
|
|
|
|
|
cutting_speed = self.search([("name", '=', item['name'])])
|
|
|
|
|
cutting_speed = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutting_speed:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': item['name'],
|
|
|
|
|
@@ -2087,7 +2092,7 @@ class CuttingWidthDepth(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['cutting_width_depth_yesterday_list']:
|
|
|
|
|
cutting_width_depth = self.search([("name", '=', item['name'])])
|
|
|
|
|
cutting_width_depth = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutting_width_depth:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': item['name'],
|
|
|
|
|
@@ -2104,7 +2109,7 @@ class CuttingWidthDepth(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['cutting_width_depth_all_list']:
|
|
|
|
|
cutting_width_depth = self.search([("name", '=', item['name'])])
|
|
|
|
|
cutting_width_depth = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutting_width_depth:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': item['name'],
|
|
|
|
|
@@ -2127,7 +2132,7 @@ class CuttingSpeed(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['feed_per_tooth_yesterday_list']:
|
|
|
|
|
feed_per_tooth = self.search([("name", '=', item['name'])])
|
|
|
|
|
feed_per_tooth = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not feed_per_tooth:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': item['name'],
|
|
|
|
|
@@ -2165,7 +2170,7 @@ class CuttingSpeed(models.Model):
|
|
|
|
|
result = json.loads(r['result'])
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['feed_per_tooth_all_list']:
|
|
|
|
|
feed_per_tooth = self.search([("name", '=', item['name'])])
|
|
|
|
|
feed_per_tooth = self.search([("name", '=', item['name']), ('active', 'in', [True, False])])
|
|
|
|
|
if not feed_per_tooth:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': item['name'],
|
|
|
|
|
@@ -2211,7 +2216,8 @@ class Cutting_tool_standard_library(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['cutting_tool_standard_library_yesterday_list']:
|
|
|
|
|
cutting_tool_standard_library = self.search(
|
|
|
|
|
[("code", '=', item['code'].replace("JKM", result['factory_short_name']))])
|
|
|
|
|
[("code", '=', item['code'].replace("JKM", result['factory_short_name']),
|
|
|
|
|
('active', 'in', [True, False]))])
|
|
|
|
|
cutting_tool_type = self.env['sf.cutting.tool.type'].search(
|
|
|
|
|
[("code", '=', item['cutting_tool_type_code'])])
|
|
|
|
|
cutting_tool_material = self.env['sf.cutting.tool.material'].search(
|
|
|
|
|
@@ -2317,7 +2323,8 @@ class Cutting_tool_standard_library(models.Model):
|
|
|
|
|
if result['status'] == 1:
|
|
|
|
|
for item in result['cutting_tool_standard_library_all_list']:
|
|
|
|
|
cutting_tool_standard_library = self.search(
|
|
|
|
|
[("code", '=', item['code'].replace("JKM", result['factory_short_name']))])
|
|
|
|
|
[("code", '=', item['code'].replace("JKM", result['factory_short_name']),
|
|
|
|
|
('active', 'in', [True, False]))])
|
|
|
|
|
cutting_tool_type = self.env['sf.cutting.tool.type'].search(
|
|
|
|
|
[("code", '=', item['cutting_tool_type_code'])])
|
|
|
|
|
cutting_tool_material = self.env['sf.cutting.tool.material'].search(
|
|
|
|
|
@@ -2431,7 +2438,8 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_integral_tool'])
|
|
|
|
|
if basic_parameters_integral_tool_list:
|
|
|
|
|
for integral_tool_item in basic_parameters_integral_tool_list:
|
|
|
|
|
integral_tool = self.search([('code', '=', integral_tool_item['code'])])
|
|
|
|
|
integral_tool = self.search(
|
|
|
|
|
[('code', '=', integral_tool_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not integral_tool:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': integral_tool_item['name'],
|
|
|
|
|
@@ -2483,7 +2491,7 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_blade'])
|
|
|
|
|
if basic_parameters_blade_list:
|
|
|
|
|
for blade_item in basic_parameters_blade_list:
|
|
|
|
|
blade = self.search([('code', '=', blade_item['code'])])
|
|
|
|
|
blade = self.search([('code', '=', blade_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not blade:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': blade_item['name'],
|
|
|
|
|
@@ -2547,7 +2555,7 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_chuck'])
|
|
|
|
|
if basic_parameters_chuck_list:
|
|
|
|
|
for chuck_item in basic_parameters_chuck_list:
|
|
|
|
|
chuck = self.search([('code', '=', chuck_item['code'])])
|
|
|
|
|
chuck = self.search([('code', '=', chuck_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not chuck:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': chuck_item['name'],
|
|
|
|
|
@@ -2591,7 +2599,8 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_cutter_arbor'])
|
|
|
|
|
if basic_parameters_cutter_arbor_list:
|
|
|
|
|
for cutter_arbor_item in basic_parameters_cutter_arbor_list:
|
|
|
|
|
cutter_arbor = self.search([('code', '=', cutter_arbor_item['code'])])
|
|
|
|
|
cutter_arbor = self.search(
|
|
|
|
|
[('code', '=', cutter_arbor_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutter_arbor:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': cutter_arbor_item['name'],
|
|
|
|
|
@@ -2659,7 +2668,8 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_cutter_head'])
|
|
|
|
|
if basic_parameters_cutter_head_list:
|
|
|
|
|
for cutter_head_item in basic_parameters_cutter_head_list:
|
|
|
|
|
cutter_head = self.search([('code', '=', cutter_head_item['code'])])
|
|
|
|
|
cutter_head = self.search(
|
|
|
|
|
[('code', '=', cutter_head_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutter_head:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': cutter_head_item['name'],
|
|
|
|
|
@@ -2713,7 +2723,8 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_knife_handle'])
|
|
|
|
|
if basic_parameters_knife_handle_list:
|
|
|
|
|
for knife_handle_item in basic_parameters_knife_handle_list:
|
|
|
|
|
knife_handle = self.search([('code', '=', knife_handle_item['code'])])
|
|
|
|
|
knife_handle = self.search(
|
|
|
|
|
[('code', '=', knife_handle_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not knife_handle:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': knife_handle_item['name'],
|
|
|
|
|
@@ -2780,7 +2791,8 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_integral_tool'])
|
|
|
|
|
if basic_parameters_integral_tool_list:
|
|
|
|
|
for integral_tool_item in basic_parameters_integral_tool_list:
|
|
|
|
|
integral_tool = self.search([('code', '=', integral_tool_item['code'])])
|
|
|
|
|
integral_tool = self.search(
|
|
|
|
|
[('code', '=', integral_tool_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not integral_tool:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': integral_tool_item['name'],
|
|
|
|
|
@@ -2835,7 +2847,7 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_blade'])
|
|
|
|
|
if basic_parameters_blade_list:
|
|
|
|
|
for blade_item in basic_parameters_blade_list:
|
|
|
|
|
blade = self.search([('code', '=', blade_item['code'])])
|
|
|
|
|
blade = self.search([('code', '=', blade_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not blade:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': blade_item['name'],
|
|
|
|
|
@@ -2901,7 +2913,7 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_chuck'])
|
|
|
|
|
if basic_parameters_chuck_list:
|
|
|
|
|
for chuck_item in basic_parameters_chuck_list:
|
|
|
|
|
chuck = self.search([('code', '=', chuck_item['code'])])
|
|
|
|
|
chuck = self.search([('code', '=', chuck_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not chuck:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': chuck_item['name'],
|
|
|
|
|
@@ -2947,7 +2959,8 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_cutter_arbor'])
|
|
|
|
|
if basic_parameters_cutter_arbor_list:
|
|
|
|
|
for cutter_arbor_item in basic_parameters_cutter_arbor_list:
|
|
|
|
|
cutter_arbor = self.search([('code', '=', cutter_arbor_item['code'])])
|
|
|
|
|
cutter_arbor = self.search(
|
|
|
|
|
[('code', '=', cutter_arbor_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutter_arbor:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': cutter_arbor_item['name'],
|
|
|
|
|
@@ -3017,7 +3030,8 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_cutter_head'])
|
|
|
|
|
if basic_parameters_cutter_head_list:
|
|
|
|
|
for cutter_head_item in basic_parameters_cutter_head_list:
|
|
|
|
|
cutter_head = self.search([('code', '=', cutter_head_item['code'])])
|
|
|
|
|
cutter_head = self.search(
|
|
|
|
|
[('code', '=', cutter_head_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not cutter_head:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': cutter_head_item['name'],
|
|
|
|
|
@@ -3073,7 +3087,8 @@ class CuttingToolBasicParameters(models.Model):
|
|
|
|
|
result['cutting_tool_basic_parameters_all_list']['basic_parameters_knife_handle'])
|
|
|
|
|
if basic_parameters_knife_handle_list:
|
|
|
|
|
for knife_handle_item in basic_parameters_knife_handle_list:
|
|
|
|
|
knife_handle = self.search([('code', '=', knife_handle_item['code'])])
|
|
|
|
|
knife_handle = self.search(
|
|
|
|
|
[('code', '=', knife_handle_item['code']), ('active', 'in', [True, False])])
|
|
|
|
|
if not knife_handle:
|
|
|
|
|
self.create({
|
|
|
|
|
'name': knife_handle_item['name'],
|
|
|
|
|
|