diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py
index 74da7742..46f26257 100644
--- a/sf_maintenance/models/sf_maintenance.py
+++ b/sf_maintenance/models/sf_maintenance.py
@@ -38,8 +38,7 @@ class SfMaintenanceEquipment(models.Model):
crea_url = "/api/machine_tool/create"
-
- #AGV运行日志
+ # AGV运行日志
agv_logs = fields.One2many('maintenance.equipment.agv.log', 'equipment_id', string='AGV运行日志')
# 1212修改后的字段
number_of_axles = fields.Selection(
@@ -117,7 +116,6 @@ class SfMaintenanceEquipment(models.Model):
# num = "%04d" % m
# return num
-
equipment_maintenance_standards_ids = fields.Many2many('equipment.maintenance.standards',
'sf_maintenance_equipment_ids', string='设备维保标准')
eq_maintenance_id = fields.Many2one('equipment.maintenance.standards', string='设备保养标准',
@@ -179,7 +177,8 @@ class SfMaintenanceEquipment(models.Model):
type_id = fields.Many2one('sf.machine_tool.type', '型号')
state = fields.Selection(
- [("正常", "正常"), ("故障停机", "故障停机"), ("计划维保", "计划维保"), ("空闲", "空闲"), ("封存(报废)", "封存(报废)")],
+ [("正常", "正常"), ("故障停机", "故障停机"), ("计划维保", "计划维保"), ("空闲", "空闲"),
+ ("封存(报废)", "封存(报废)")],
default='正常', string="机床状态")
run_time = fields.Char('总运行时长')
# 0606新增字段
@@ -328,7 +327,7 @@ class SfMaintenanceEquipment(models.Model):
item.tool_diameter_min = item.type_id.tool_diameter_min
item.machine_tool_category = item.type_id.machine_tool_category.id
item.brand_id = item.type_id.brand_id.id
- #新增修改字段
+ # 新增修改字段
item.taper_type_id = item.type_id.taper_type_id.id
item.function_type = item.type_id.function_type
item.a_axis = item.type_id.a_axis
@@ -370,7 +369,6 @@ class SfMaintenanceEquipment(models.Model):
item.image_id = item.type_id.jg_image_id.ids
item.image_lq_id = item.type_id.lq_image_id.ids
-
# AGV小车设备参数
AGV_L = fields.Char('AGV尺寸(长)')
AGV_W = fields.Char('AGV尺寸(宽)')
@@ -461,18 +459,6 @@ class SfMaintenanceEquipment(models.Model):
original_value = fields.Char('原值')
incomplete_value = fields.Char('残值')
-
-
-
-
-
-
-
-
-
-
-
-
# 注册同步机床
def enroll_machine_tool(self):
sf_sync_config = self.env['res.config.settings'].get_values()
@@ -763,7 +749,7 @@ class SfMaintenanceEquipment(models.Model):
image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id',
domain="[('type', '=', '加工能力')]")
image_lq_id = fields.Many2many('maintenance.equipment.image', 'equipment_lq_id', string='冷却方式',
- domain="[('type', '=', '冷却方式')]")
+ domain="[('type', '=', '冷却方式')]")
class SfRobotAxisNum(models.Model):
@@ -777,4 +763,5 @@ class SfRobotAxisNum(models.Model):
weight = fields.Char('最大负载(kg)')
permissible_load_torque = fields.Char('允许负载扭矩(N-m)')
permissible_inertial_torque = fields.Char('允许惯性扭矩(kg-m²)')
- equipment_id = fields.Many2one('maintenance.equipment', string='机器人', domain="[('equipment_type', '=', '机器人')]")
+ equipment_id = fields.Many2one('maintenance.equipment', string='机器人',
+ domain="[('equipment_type', '=', '机器人')]")
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 0ab2be6b..0b68852b 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -806,6 +806,10 @@ class MrpProduction(models.Model):
backorders = backorders - productions_to_backorder
productions_not_to_backorder._post_inventory(cancel_backorder=True)
+ # if self.workorder_ids.filtered(lambda w: w.routing_type in ['表面工艺']):
+ # move_finish = self.env['stock.move'].search([('created_production_id', '=', self.id)])
+ # if move_finish:
+ # move_finish._action_assign()
productions_to_backorder._post_inventory(cancel_backorder=True)
# if completed products make other confirmed/partially_available moves available, assign them
diff --git a/sf_manufacturing/wizard/workpiece_delivery_wizard.py b/sf_manufacturing/wizard/workpiece_delivery_wizard.py
index 4ee0928c..472910f9 100644
--- a/sf_manufacturing/wizard/workpiece_delivery_wizard.py
+++ b/sf_manufacturing/wizard/workpiece_delivery_wizard.py
@@ -179,18 +179,14 @@ class WorkpieceDeliveryWizard(models.TransientModel):
self.feeder_station_destination_id = self.route_id.end_site_id.id
def on_barcode_scanned(self, barcode):
+ delivery_type = self.env.context.get('default_delivery_type')
# 判断barcode是否是数字
if not barcode.isdigit():
# 判断是否是AGV接驳站名称
agv_site = self.env['sf.agv.site'].search([('name', '=', barcode)])
- if agv_site:
- if not self.feeder_station_start_id:
- self.feeder_station_start_id = agv_site.id
- else:
- if self.feeder_station_start_id.id != agv_site.id:
- raise UserError('起点接驳站不匹配!')
+ self.feeder_station_start_id = agv_site.id # 修正:移除 .id
return
- delivery_type = self.env.context.get('default_delivery_type')
+
if delivery_type == '上产线':
workorder = self.env['mrp.workorder'].search(
[('production_line_state', '=', '待上产线'), ('rfid_code', '=', barcode),
@@ -214,7 +210,7 @@ class WorkpieceDeliveryWizard(models.TransientModel):
self.production_ids |= workorder.production_id
self.workorder_ids |= workorder
- down_product_agv_scheduling = self.get_down_product_agv_scheduling()
+ down_product_agv_scheduling = workorder.get_down_product_agv_scheduling()
if down_product_agv_scheduling:
if not self.feeder_station_start_id:
self.feeder_station_start_id = down_product_agv_scheduling.end_site_id.id
@@ -226,4 +222,11 @@ class WorkpieceDeliveryWizard(models.TransientModel):
raise UserError('该rfid码对应的工单不存在')
return
+ @api.onchange('feeder_station_start_id')
+ def on_start_id_change(self):
+ if self.delivery_type == '运送空料架' and len(self.workorder_ids) > 0:
+ down_product_agv_scheduling = self.workorder_ids[0].get_down_product_agv_scheduling()
+ if down_product_agv_scheduling and self.feeder_station_start_id \
+ and down_product_agv_scheduling.end_site_id.id != self.feeder_station_start_id.id:
+ raise UserError('当前接驳站不匹配!')
diff --git a/sf_message/__manifest__.py b/sf_message/__manifest__.py
index 3a0f37d8..713a4a5e 100644
--- a/sf_message/__manifest__.py
+++ b/sf_message/__manifest__.py
@@ -11,7 +11,7 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
- 'depends': ['base', 'sf_base'],
+ 'depends': ['base', 'sf_plan', 'sf_sale'],
'data': [
'security/ir.model.access.csv',
'views/sf_message_template_view.xml',
diff --git a/sf_message/models/__init__.py b/sf_message/models/__init__.py
index ec5b1c2f..b0c058fc 100644
--- a/sf_message/models/__init__.py
+++ b/sf_message/models/__init__.py
@@ -1 +1,8 @@
from . import sf_message_template
+from . import sf_message_sale
+from . import sf_message_plan
+from . import sf_message_stock_picking
+from . import sf_message_cam_program
+from . import sf_message_functional_tool_assembly
+from . import sf_message_purchase
+from . import sf_message_workorder
diff --git a/sf_message/models/sf_message_cam_program.py b/sf_message/models/sf_message_cam_program.py
new file mode 100644
index 00000000..5a6154e5
--- /dev/null
+++ b/sf_message/models/sf_message_cam_program.py
@@ -0,0 +1,6 @@
+from odoo import models, fields, api, _
+
+
+class SFMessageCamProgram(models.Model):
+ _name = 'sf.cam.work.order.program.knife.plan'
+ _inherit = ['sf.cam.work.order.program.knife.plan', 'sf.message.template']
diff --git a/sf_message/models/sf_message_functional_tool_assembly.py b/sf_message/models/sf_message_functional_tool_assembly.py
new file mode 100644
index 00000000..6b5e4ebf
--- /dev/null
+++ b/sf_message/models/sf_message_functional_tool_assembly.py
@@ -0,0 +1,6 @@
+from odoo import models, fields, api, _
+
+
+class SFMessagefunctionalToolAssembly(models.Model):
+ _name = 'sf.functional.tool.assembly'
+ _inherit = ['sf.functional.tool.assembly', 'sf.message.template']
diff --git a/sf_message/models/sf_message_plan.py b/sf_message/models/sf_message_plan.py
new file mode 100644
index 00000000..913b61de
--- /dev/null
+++ b/sf_message/models/sf_message_plan.py
@@ -0,0 +1,6 @@
+from odoo import models, fields, api, _
+
+
+class SFMessagePlan(models.Model):
+ _name = 'sf.production.plan'
+ _inherit = ['sf.production.plan', 'sf.message.template']
diff --git a/sf_message/models/sf_message_purchase.py b/sf_message/models/sf_message_purchase.py
new file mode 100644
index 00000000..89836486
--- /dev/null
+++ b/sf_message/models/sf_message_purchase.py
@@ -0,0 +1,6 @@
+from odoo import models, fields, api, _
+
+
+class SFMessagePurchase(models.Model):
+ _name = 'purchase.order'
+ _inherit = ['purchase.order', 'sf.message.template']
diff --git a/sf_message/models/sf_message_sale.py b/sf_message/models/sf_message_sale.py
new file mode 100644
index 00000000..2f9a9c01
--- /dev/null
+++ b/sf_message/models/sf_message_sale.py
@@ -0,0 +1,6 @@
+from odoo import models, fields, api, _
+
+
+class SFMessageSale(models.Model):
+ _name = 'sale.order'
+ _inherit = ['sale.order', 'sf.message.template']
diff --git a/sf_message/models/sf_message_stock_picking.py b/sf_message/models/sf_message_stock_picking.py
new file mode 100644
index 00000000..894dce9d
--- /dev/null
+++ b/sf_message/models/sf_message_stock_picking.py
@@ -0,0 +1,6 @@
+from odoo import models, fields, api, _
+
+
+class SFMessageStockPicking(models.Model):
+ _name = 'stock.picking'
+ _inherit = ['stock.picking', 'sf.message.template']
diff --git a/sf_message/models/sf_message_template.py b/sf_message/models/sf_message_template.py
index 4d89cc2a..5f695a52 100644
--- a/sf_message/models/sf_message_template.py
+++ b/sf_message/models/sf_message_template.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api
+from abc import ABC, abstractmethod
class SfMessageTemplate(models.Model):
@@ -7,30 +8,30 @@ class SfMessageTemplate(models.Model):
_description = u'消息模板'
name = fields.Char(string=u"名称", required=True)
- type = fields.Selection([
- ('待接单', '待接单'),
- ('待排程', '待排程'),
- ('坯料采购', '坯料采购'),
- ('坯料发料', '坯料发料'),
- ('待编程', '待编程'),
- ('调拨入库', '调拨入库'),
- ('功能刀具组装', '功能刀具组装'),
- ('功能刀具寿命到期', '功能刀具寿命到期'),
- ('程序用刀计划异常', '程序用刀计划异常'),
- ('工单无CNC程序', '工单无CNC程序'),
- ('生产线无功能刀具', '生产线无功能刀具'),
- ('工单无定位数据', '工单无定位数据'),
- ('工单FTP无文件', '工单FTP无文件'),
- ('工单加工失败', '工单加工失败'),
- ('设备故障及异常', '设备故障及异常'),
- ('工单逾期预警', '工单逾期预警'),
- ('工单已逾期', '工单已逾期'),
- ('销售订单逾期', '销售订单逾期'),
- ('销售订单已逾期', '销售订单已逾期'),
- ('待质量判定', '待质量判定'),
- ('生产完工待入库', '生产完工待入库'),
- ('订单发货', '订单发货')
- ], string='类型', required=True)
+ # type = fields.Selection([
+ # ('待接单', '待接单'),
+ # ('待排程', '待排程'),
+ # ('坯料采购', '坯料采购'),
+ # ('坯料发料', '坯料发料'),
+ # ('待编程', '待编程'),
+ # ('调拨入库', '调拨入库'),
+ # ('功能刀具组装', '功能刀具组装'),
+ # ('功能刀具寿命到期', '功能刀具寿命到期'),
+ # ('程序用刀计划异常', '程序用刀计划异常'),
+ # ('工单无CNC程序', '工单无CNC程序'),
+ # ('生产线无功能刀具', '生产线无功能刀具'),
+ # ('工单无定位数据', '工单无定位数据'),
+ # ('工单FTP无文件', '工单FTP无文件'),
+ # ('工单加工失败', '工单加工失败'),
+ # ('设备故障及异常', '设备故障及异常'),
+ # ('工单逾期预警', '工单逾期预警'),
+ # ('工单已逾期', '工单已逾期'),
+ # ('销售订单逾期', '销售订单逾期'),
+ # ('销售订单已逾期', '销售订单已逾期'),
+ # ('待质量判定', '待质量判定'),
+ # ('生产完工待入库', '生产完工待入库'),
+ # ('订单发货', '订单发货')
+ # ], string='类型', required=True)
description = fields.Char(string=u"描述")
content = fields.Html(string=u"内容", render_engine='qweb', translate=True, prefetch=True, sanitize=False)
msgtype = fields.Selection(
@@ -46,3 +47,9 @@ class SfMessageTemplate(models.Model):
def _clear_employee_ids(self):
if self.notification_department_id:
self.notification_employee_ids = False
+
+ @abstractmethod
+ def dispatch(self, args):
+ """
+ 强迫继承该类必走该抽象方法'
+ """
diff --git a/sf_message/models/sf_message_workorder.py b/sf_message/models/sf_message_workorder.py
new file mode 100644
index 00000000..cab2408d
--- /dev/null
+++ b/sf_message/models/sf_message_workorder.py
@@ -0,0 +1,6 @@
+from odoo import models, fields, api, _
+
+
+class SFMessageWork(models.Model):
+ _name = 'mrp.workorder'
+ _inherit = ['mrp.workorder', 'sf.message.template']
diff --git a/sf_message/views/sf_message_template_view.xml b/sf_message/views/sf_message_template_view.xml
index ac412589..9680507a 100644
--- a/sf_message/views/sf_message_template_view.xml
+++ b/sf_message/views/sf_message_template_view.xml
@@ -18,12 +18,11 @@
-
+
-
@@ -38,10 +37,9 @@
-
+
-
@@ -55,7 +53,7 @@
+ filter_domain="['|','|',('name','like',self),('description','like',self)]"/>
diff --git a/sf_mrs_connect/__manifest__.py b/sf_mrs_connect/__manifest__.py
index 3ccd3ac4..1ea4f693 100644
--- a/sf_mrs_connect/__manifest__.py
+++ b/sf_mrs_connect/__manifest__.py
@@ -10,11 +10,12 @@
""",
'category': 'sf',
'website': 'https://www.sf.cs.jikimo.com',
- 'depends': ['sf_base', 'base_setup'],
+ 'depends': ['sf_base', 'base_setup','sf_bf_connect'],
'data': [
'data/ir_cron_data.xml',
'security/ir.model.access.csv',
- 'views/res_config_settings_views.xml'
+ 'views/res_config_settings_views.xml',
+ 'views/order_price.xml',
],
'demo': [
],
diff --git a/sf_mrs_connect/models/__init__.py b/sf_mrs_connect/models/__init__.py
index 2f84348c..f01fb4fe 100644
--- a/sf_mrs_connect/models/__init__.py
+++ b/sf_mrs_connect/models/__init__.py
@@ -1,3 +1,4 @@
from . import ftp_operate
from . import res_config_setting
from . import sync_common
+from . import order_price
\ No newline at end of file
diff --git a/sf_mrs_connect/models/order_price.py b/sf_mrs_connect/models/order_price.py
new file mode 100644
index 00000000..d5841bf7
--- /dev/null
+++ b/sf_mrs_connect/models/order_price.py
@@ -0,0 +1,29 @@
+from odoo import fields, models, api
+
+
+class OrderPrice(models.Model):
+ _name = 'order.price'
+ _description = '订单价格对比'
+ sale_order_id = fields.Many2one('sale.order', '销售订单')
+ bfm_order_name = fields.Char(related="sale_order_id.default_code", string='bfm订单号')
+ sale_order_name = fields.Char(related="sale_order_id.name", string='销售订单号')
+ currency_id = fields.Many2one(
+ related='sale_order_id.currency_id', string='货币', store=True)
+ sale_order_amount_total = fields.Monetary(related="sale_order_id.amount_total", tracking=4, string='销售订单金额')
+ bfm_amount_total = fields.Float(string='价格合计', compute='_compute_bfm_amount_total', store=True)
+
+ def is_float(self,value):
+ try:
+ float(value)
+ return True
+ except ValueError:
+ return False
+ @api.depends('sale_order_id.remark')
+ def _compute_bfm_amount_total(self):
+ for record in self:
+ amount_total = 0
+ for line in record.sale_order_id.order_line:
+ # 判断remark是否存在并且是否是数字
+ if line.remark and self.is_float(line.remark):
+ amount_total += float(line.remark)
+ record.bfm_amount_total = amount_total
\ No newline at end of file
diff --git a/sf_mrs_connect/models/res_config_setting.py b/sf_mrs_connect/models/res_config_setting.py
index 04693fa7..c6f19502 100644
--- a/sf_mrs_connect/models/res_config_setting.py
+++ b/sf_mrs_connect/models/res_config_setting.py
@@ -184,7 +184,10 @@ class ResConfigSettings(models.TransientModel):
new_price = res_order_lines_map.get(str(index))
if order_line:
# 修改单价
- order_line.write({'remark': new_price})
+ order_line.write({'remark': new_price*order_line.product_uom_qty})
+ order_price = self.env['order.price'].sudo().search([('sale_order_id', '=',need_change_sale_order.id )])
+ if not order_price:
+ self.env['order.price'].sudo().create({'sale_order_id':need_change_sale_order.id})
else:
logging.error('同步销售订单价格失败 {}'.format(response.text))
raise UserError('同步销售订单价格失败')
diff --git a/sf_mrs_connect/security/ir.model.access.csv b/sf_mrs_connect/security/ir.model.access.csv
index 0ed43a62..60d5cea5 100644
--- a/sf_mrs_connect/security/ir.model.access.csv
+++ b/sf_mrs_connect/security/ir.model.access.csv
@@ -1,7 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sf_static_resource_datasync,sf_static_resource_datasync,model_sf_static_resource_datasync,base.group_user,1,1,1,1
-
+access_order_price,order.price,model_order_price,base.group_user,1,1,1,1
diff --git a/sf_mrs_connect/views/order_price.xml b/sf_mrs_connect/views/order_price.xml
new file mode 100644
index 00000000..ea80b7b4
--- /dev/null
+++ b/sf_mrs_connect/views/order_price.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ bfm订单价格对比
+ order.price
+ tree,form
+
+
+ order.price.list
+ order.price
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index ddd3bcc5..fb8176fe 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -75,16 +75,21 @@ class sf_production_plan(models.Model):
if self.date_planned_start:
self.date_planned_finished = self.date_planned_start + timedelta(hours=1)
- #处理计划状态非代排程,计划结束时间为空的数据处理
+ #处理计划状态非待排程,计划结束时间为空的数据处理
def deal_no_date_planned_finished(self):
plans = self.env['sf.production.plan'].search(
[('date_planned_finished', '=', False), ('state', 'in', ['processing', 'done', 'finished'])])
for item in plans:
if item.date_planned_start:
item.date_planned_finished = item.date_planned_start + timedelta(hours=1)
- if not item.order_deadline and item.date_planned_start:
- item.order_deadline = item.date_planned_start + timedelta(days=7)
+ # 处理计划订单截止时间为空的数据
+ def deal_no_order_deadline(self):
+ plans = self.env['sf.production.plan'].sudo().search(
+ [('order_deadline', '=', False)])
+ for item in plans:
+ if item.date_planned_start:
+ item.order_deadline = item.date_planned_start + timedelta(days=7)
@api.model
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
diff --git a/sf_tool_management/models/functional_cutting_tool_model.py b/sf_tool_management/models/functional_cutting_tool_model.py
index fe2c68c5..39048bfd 100644
--- a/sf_tool_management/models/functional_cutting_tool_model.py
+++ b/sf_tool_management/models/functional_cutting_tool_model.py
@@ -3,4 +3,4 @@ from odoo import models, fields
class SyncFunctionalCuttingToolModel(models.Model):
_inherit = 'sf.functional.cutting.tool.model'
- cutting_tool_type_ids = fields.Many2many('sf.cutting.tool.type', string='适用刀具物料类型', required=True)
\ No newline at end of file
+ cutting_tool_type_ids = fields.Many2many('sf.cutting.tool.type', string='适用刀具物料类型')
\ No newline at end of file
diff --git a/sf_tool_management/views/tool_views.xml b/sf_tool_management/views/tool_views.xml
index 24379b9a..d483e1a3 100644
--- a/sf_tool_management/views/tool_views.xml
+++ b/sf_tool_management/views/tool_views.xml
@@ -8,7 +8,7 @@
-
+