更新sf
This commit is contained in:
@@ -16,11 +16,11 @@ class MachineBrandTags(models.Model):
|
||||
|
||||
|
||||
class MachineControlSystem(models.Model):
|
||||
_name = 'mrs.machine_tool.type.control_system'
|
||||
_name = 'mrs.machine.control_system'
|
||||
_description = '控制系统'
|
||||
code = fields.Char('编码')
|
||||
|
||||
code = fields.Char('编码', size=10)
|
||||
name = fields.Char('名称', size=10)
|
||||
# type_id = fields.Many2one('mrs.machine_tool.type')
|
||||
brand_id = fields.Many2one('mrs.machine.brand', '品牌')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
@@ -60,7 +60,7 @@ class MachineTool(models.Model):
|
||||
c_axis = fields.Integer('C轴')
|
||||
remark = fields.Text('备注')
|
||||
precision = fields.Float('加工精度')
|
||||
control_system_id = fields.Many2one('mrs.machine_tool.type.control_system',
|
||||
control_system_id = fields.Many2one('mrs.machine.control_system',
|
||||
string="控制系统")
|
||||
# 多个机床型号对应一个机床
|
||||
type_id = fields.Many2one('mrs.machine_tool.type', '型号',
|
||||
|
||||
@@ -5,7 +5,7 @@ access_mrs_machine_tool_type,mrs_machine_tool_type,model_mrs_machine_tool_type,b
|
||||
access_mrs_cutting_tool_type,mrs_cutting_tool_type,model_mrs_cutting_tool_type,base.group_user,1,1,1,1
|
||||
access_mrs_machine_brand,mrs_machine_brand,model_mrs_machine_brand,base.group_user,1,1,1,1
|
||||
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_machine_control_system,mrs_machine_control_system,model_mrs_machine_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
|
||||
@@ -16,8 +16,3 @@ access_mrs_processing_technology,mrs_processing_technology,model_mrs_processing_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -126,6 +126,13 @@
|
||||
sequence="1"
|
||||
action="action_mrs_cutting_tool_type"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_mrs_machine_control_system"
|
||||
parent="menu_mrs_base"
|
||||
name="控制系统"
|
||||
sequence="1"
|
||||
action="action_mrs_machine_control_system"/>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -405,4 +405,63 @@
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
#------------------控制系统------------------
|
||||
|
||||
<record model="ir.ui.view" id="search_mrs_machine_control_system_view">
|
||||
<field name="name">search.mrs.machine.control_system</field>
|
||||
<field name="model">mrs.machine.control_system</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="控制系统">
|
||||
<field name="name" string="模糊搜索"
|
||||
filter_domain="['|',('name', 'ilike', self),('code', 'ilike', self)]"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="tree_mrs_machine_control_system_view">
|
||||
<field name="name">tree.mrs.machine.control_system</field>
|
||||
<field name="model">mrs.machine.control_system</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="控制系统">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="brand_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="form_mrs_machine_control_system">
|
||||
<field name="name">form.mrs.machine.control_system</field>
|
||||
<field name="model">mrs.machine.control_system</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="控制系统">
|
||||
<group>
|
||||
<group>
|
||||
<field name="code" force_save="1" readonly="1"/>
|
||||
<field name="brand_id" required="1"
|
||||
domain="[('tag_ids', '=', '控制系统')]"
|
||||
options="{'no_create': True}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_mrs_machine_control_system" model="ir.actions.act_window">
|
||||
<field name="name">控制系统</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mrs.machine.control_system</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
[控制系统] 还没有哦!点左上角的[创建]按钮,沙发归你了!
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'YZ',
|
||||
'website': 'https://www.sf.cs.jikimo.com',
|
||||
'depends': ['sf_base', 'sale'],
|
||||
'depends': ['account', 'sf_base', 'base', 'sale'],
|
||||
'data': [
|
||||
'views/sale_process_order_view.xml'
|
||||
],
|
||||
|
||||
@@ -4,6 +4,8 @@ import logging
|
||||
from datetime import date, timedelta
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
from odoo.addons.mrs_gateway_api.models.common import Common
|
||||
from odoo.addons.mrs_gateway_api.models.basicdata_str import BasicDataStr
|
||||
|
||||
|
||||
class Sf_Bf_Connect(http.Controller):
|
||||
@@ -12,30 +14,19 @@ class Sf_Bf_Connect(http.Controller):
|
||||
cors="*")
|
||||
def get_bfm_process_order_list(self, **kw):
|
||||
"""
|
||||
获取业务平台传送来的订单
|
||||
获取业务平台传送来的业务平台订单
|
||||
:param kw:
|
||||
:return:
|
||||
"""
|
||||
result = json.loads('result')
|
||||
order_line_ids = []
|
||||
for item in result['bfm_process_order_list']:
|
||||
order_line_ids.append({
|
||||
result = json.loads('bfm_process_order_list')
|
||||
for item in result:
|
||||
self.env['mrs.production.process'].create({
|
||||
"id": item['id'],
|
||||
"model_file": item['model_file'],
|
||||
"model_name": item['model_name'],
|
||||
"model_length": item['model_length'],
|
||||
"model_width": item['model_width'],
|
||||
"model_height": item['model_height'],
|
||||
"model_volume": item['model_volume'],
|
||||
"materials_id": item['texture_id'],
|
||||
"materials_type_id": item['texture_item_id'],
|
||||
"surface_technics_id": item['surface_id'],
|
||||
"technological_parameter_id": item['surface_item_id'],
|
||||
"type": item['type'],
|
||||
"surface_technics": item['surface_technics'],
|
||||
"unit_price": item['unit_price'],
|
||||
"amount": item['amount'],
|
||||
"money": item['money']
|
||||
})
|
||||
self.env['sf.bfm.order'].create({
|
||||
'order_number': result['order_number'],
|
||||
'deadline_of_delivery': result['delivery_end_date'],
|
||||
'order_line_ids': order_line_ids
|
||||
})
|
||||
|
||||
@@ -1,52 +1,25 @@
|
||||
from odoo import models, fields
|
||||
from odoo import models,fields
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class bfmOrder(models.Model):
|
||||
_name = 'sf.bfm.order'
|
||||
_description = '业务平台订单'
|
||||
|
||||
order_number = fields.Char('订单号')
|
||||
deadline_of_delivery = fields.Date('交货截止日期')
|
||||
order_line_ids = fields.One2many('sf.bfm.order.line', 'order_id', string='订单明细')
|
||||
|
||||
|
||||
class bfmOrderLine(models.Model):
|
||||
_name = 'sf.bfm.order.line'
|
||||
_description = '业务平台订单明细'
|
||||
_description = '业务平台订单'
|
||||
|
||||
# model_file = fields.Binary('模型文件')
|
||||
model_name = fields.Char('模型名称')
|
||||
model_length = fields.Float('长[mm]', digits=(16, 3))
|
||||
model_width = fields.Float('宽[mm]', digits=(16, 3))
|
||||
model_height = fields.Float('高[mm]', digits=(16, 3))
|
||||
model_volume = fields.Float('体积[mm³]', digits=(16, 3))
|
||||
materials_id = fields.Many2one('mrs.production.materials', string='材料')
|
||||
materials_type_id = fields.Many2one('mrs.materials.model', string='型号')
|
||||
surface_technics_id = fields.Many2one('mrs.production.process', string='表面工艺')
|
||||
technological_parameter_id = fields.Many2one('sf.surface.process.item', string='工艺参数')
|
||||
model_file = fields.Binary('模型文件', attachment=False)
|
||||
model_name = fields.char('模型名称')
|
||||
type = fields.Many2one('mrs.materials.model', '型号')
|
||||
surface_technics = fields.Many2one('mrs.production.process', string='表面工艺')
|
||||
# technological_parameter = fields.Many2one('',string='工艺参数')
|
||||
unit_price = fields.Float('单价')
|
||||
amount = fields.Integer('数量')
|
||||
money = fields.Float('金额')
|
||||
order_id = fields.Many2one('sf.bfm.order', string='业务平台订单')
|
||||
# sale_order_id = fields.Many2one('sale.order')
|
||||
|
||||
|
||||
class SurfaceProcessItem(models.Model):
|
||||
_name = 'sf.surface.process.item'
|
||||
_description = '表面工艺参数'
|
||||
|
||||
sequence = fields.Integer('排序', default=99)
|
||||
name = fields.Char('名称', index=True)
|
||||
surface_id = fields.Many2one('mrs.production.process', string='表面工艺')
|
||||
remark = fields.Text('说明')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
|
||||
class sale(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
bfm_process_order_ids = fields.One2many('sf.bfm.order', 'sale_order_id', string='业务平台订单')
|
||||
bfm_process_order_ids = fields.Many2one('sf.bfm.order.line', string='业务平台订单')
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_sf_form_inherit">
|
||||
<field name="name">sale.order.form.inherit.bfm.item</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='customer_signature']" position="before">
|
||||
<page string="业务平台订单">
|
||||
<xpath expr="//page[@name='Customer Signature']" position="before">
|
||||
<page string="Bfm Line">
|
||||
<group>
|
||||
<field name="bfm_process_order_ids" />
|
||||
<field name="bfm_process_order_ids"/>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
<record model="ir.cron" id="sf_cron6">
|
||||
<field name="name">同步资源库控制系统</field>
|
||||
<field name="model_id" ref="model_mrs_machine_tool_type_control_system"/>
|
||||
<field name="model_id" ref="model_mrs_machine_control_system"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.sync_machine_tool_type_control_system()</field>
|
||||
<field name="interval_number">1</field>
|
||||
|
||||
@@ -20,13 +20,13 @@ class ResConfigSettings(models.TransientModel):
|
||||
self.env['mrs.production.process'].sync_all_production_process()
|
||||
self.env['mrs.processing.technology'].sync_all_processing_technology()
|
||||
self.env['mrs.machine.brand.tags'].sync_all_machine_brand_tags()
|
||||
self.env['mrs.machine_tool.type.control_system'].sync_all_machine_tool_type_control_system()
|
||||
self.env['mrs.machine.brand'].sync_all_machine_brand()
|
||||
self.env['mrs.machine.control_system'].sync_all_machine_tool_type_control_system()
|
||||
# self.env['mrs.machine_tool'].sync_all_machine_tool()
|
||||
self.env['mrs.machine_tool.type'].sync_all_machine_tool_type()
|
||||
self.env['mrs.cutting_tool.category'].sync_all_cutting_tool_category()
|
||||
self.env['mrs.cutting_tool.type'].sync_all_cutting_tool_type()
|
||||
self.env['mrs.processing.order'].sync_all_processing_order()
|
||||
# self.env['mrs.processing.order'].sync_all_processing_order()
|
||||
|
||||
return _logger.info("同步资源库成功")
|
||||
|
||||
|
||||
@@ -350,12 +350,13 @@ class MachineBrandTags(models.Model):
|
||||
"color": item['color'],
|
||||
|
||||
})
|
||||
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
|
||||
class MachineControlSystem(models.Model):
|
||||
_inherit = 'mrs.machine_tool.type.control_system'
|
||||
_inherit = 'mrs.machine.control_system'
|
||||
_description = '控制系统'
|
||||
url = '/api/machine_control_system/list'
|
||||
|
||||
@@ -373,7 +374,7 @@ class MachineControlSystem(models.Model):
|
||||
if result['status'] == 1:
|
||||
for item in result['machine_control_system_yesterday_list']:
|
||||
if item:
|
||||
brand = self.env['mrs.machine_tool.type.control_system'].search(
|
||||
brand = self.env['mrs.machine.control_system'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if brand:
|
||||
brand.id = item['id'],
|
||||
@@ -381,7 +382,7 @@ class MachineControlSystem(models.Model):
|
||||
brand.code = item['code'],
|
||||
brand.active = item['active']
|
||||
else:
|
||||
self.env['mrs.machine_tool.type.control_system'].create({
|
||||
self.env['mrs.machine.control_system'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
@@ -409,12 +410,13 @@ class MachineControlSystem(models.Model):
|
||||
if result['status'] == 1:
|
||||
for item in result['machine_control_system_all_list']:
|
||||
if item:
|
||||
self.env['mrs.machine_tool.type.control_system'].create({
|
||||
self.env['mrs.machine.control_system'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
|
||||
# "brand_id": item['brand_id'],
|
||||
"brand_id": self.env['mrs.machine.brand'].search(
|
||||
[("id", '=', item['brand_id'])]),
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
@@ -482,7 +484,9 @@ class MachineBrand(models.Model):
|
||||
"code": item['code'],
|
||||
# "image_brand": item['image_brand'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
"tag_ids": self.env['mrs.machine.brand.tags'].search(
|
||||
[("id", 'in', item['tag_ids'])])
|
||||
|
||||
|
||||
})
|
||||
else:
|
||||
@@ -534,10 +538,10 @@ class MachineTool(models.Model):
|
||||
kw = json.dumps(machine_tool_list, ensure_ascii=False)
|
||||
print(type(kw))
|
||||
|
||||
r = requests.post(strurl, json={}, data={'kw':kw}, headers=headers)
|
||||
print(r)
|
||||
r = requests.post(strurl, json={}, data={'kw': kw}, headers=headers)
|
||||
|
||||
else:
|
||||
raise _logger.info("没有注册机床")
|
||||
raise ValidationError("没有机床信息")
|
||||
|
||||
# 定时同步机床
|
||||
def sync_machine_tool(self):
|
||||
|
||||
Reference in New Issue
Block a user