From daeae46820db03a635933441884c25dd9c63ba12 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Tue, 14 Nov 2023 12:21:08 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=8E=92=E7=A8=8B=E5=8A=9F=E8=83=BD=E4=B8=BA=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=90=8C=E6=97=B6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=88=A4=E6=96=AD=E8=AE=A1=E5=88=92=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=98=AF=E5=90=A6=E4=B8=8E=E8=8E=B7=E5=8F=96cnc?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E6=97=B6=E9=97=B4=E5=86=B2=E7=AA=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=86=B2=E7=AA=81?= =?UTF-8?q?=EF=BC=8C=E6=97=B6=E9=97=B4=E8=87=AA=E5=8A=A8=E5=BB=B6=E5=90=8E?= =?UTF-8?q?1h;=E4=BC=98=E5=8C=96gantt=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_dlm/models/product_supplierinfo.py | 2 +- sf_plan/models/custom_plan.py | 214 ++++++++++++++++--------- web_gantt/static/src/xml/web_gantt.xml | 6 +- 3 files changed, 144 insertions(+), 78 deletions(-) diff --git a/sf_dlm/models/product_supplierinfo.py b/sf_dlm/models/product_supplierinfo.py index f8055e1a..0e04c1d2 100644 --- a/sf_dlm/models/product_supplierinfo.py +++ b/sf_dlm/models/product_supplierinfo.py @@ -95,7 +95,7 @@ class ResMrpBomMo(models.Model): limit=1, order='volume desc' ) - logging.info('get_bom-vals:%s' % embryo_has) + # logging.info('get_bom-vals:%s' % embryo_has) if embryo_has: rate_of_waste = ((embryo_has.volume - product.model_volume) % embryo_has.volume) * 100 if rate_of_waste <= 20: diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py index 858b1036..7603b4fd 100644 --- a/sf_plan/models/custom_plan.py +++ b/sf_plan/models/custom_plan.py @@ -162,6 +162,86 @@ class sf_production_plan(models.Model): # delivery_date = fields.Datetime(string='交货日期', related='plan_end_time', readonly=False, store=True) # 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了 + # def do_production_schedule(self): + # """ + # 排程方法 + # """ + # if not self.production_line_id: + # raise ValidationError("未选择生产线") + # else: + # aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)]) + # workorder_time = 0 + # workorder_id_list = self.production_id.workorder_ids.ids + # print(workorder_id_list) + # print(type(self.production_id.workorder_ids)) + # if self.production_id.workorder_ids: + # for item in self.production_id.workorder_ids: + # if item.name == 'CNC加工': + # item.date_planned_start = self.date_planned_start + # item.date_planned_finished = item.date_planned_start + timedelta( + # minutes=self.env['mrp.routing.workcenter'].sudo().search( + # [('name', '=', 'CNC加工')]).time_cycle) + # item.duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + # [('name', '=', 'CNC加工')]).time_cycle + # # print(item.id) + # sequence = workorder_id_list.index(item.id) - 1 + # # print('sequence', sequence) + # # print('total', len(workorder_id_list)) + # # 计算CNC加工之前工单的开始结束时间 + # for i in range(sequence): + # current_workorder_id = (item.id - (i + 1)) + # current_workorder_obj = self.env['mrp.workorder'].sudo().search( + # [('id', '=', current_workorder_id)]) + # old_workorder_obj = self.env['mrp.workorder'].sudo().search( + # [('id', '=', (current_workorder_id + 1))]) + # work_order = self.env['mrp.workorder'].sudo().search( + # [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)]) + # work_order.date_planned_finished = old_workorder_obj.date_planned_start + # work_order.date_planned_start = old_workorder_obj.date_planned_start - timedelta( + # minutes=self.env['mrp.routing.workcenter'].sudo().search( + # [('name', '=', current_workorder_obj.name)]).time_cycle) + # work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + # [('name', '=', current_workorder_obj.name)]).time_cycle + # # 计算CNC加工之后工单的开始结束时间 + # for j in range(len(workorder_id_list) - sequence - 2): + # current_workorder_id = (item.id + (j + 1)) + # current_workorder_obj = self.env['mrp.workorder'].sudo().search( + # [('id', '=', current_workorder_id)]) + # old_workorder_obj = self.env['mrp.workorder'].sudo().search( + # [('id', '=', (current_workorder_id - 1))]) + # work_order = self.env['mrp.workorder'].sudo().search( + # [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)]) + # try: + # work_order.date_planned_start = old_workorder_obj.date_planned_finished + # print('work_order.data_start', work_order.date_planned_start) + # work_order.date_planned_finished = old_workorder_obj.date_planned_finished + timedelta( + # minutes=self.env['mrp.routing.workcenter'].sudo().search( + # [('name', '=', current_workorder_obj.name)]).time_cycle) + # work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + # [('name', '=', current_workorder_obj.name)]).time_cycle + # except ValueError as e: + # print('时间设置失败,请检查是否为工序分配工作中心,%s' % e) + # + # current_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', item.id)]) + # workorder_time += current_workorder.duration_expected + # print('workorder_time', workorder_time) + # self.date_planned_finished = self.date_planned_start + timedelta(minutes=workorder_time) + # self.state = 'done' + # self.production_id.schedule_state = '已排' + # # self.production_id.date_planned_start = self.date_planned_start + # # self.production_id.date_planned_finished = self.date_planned_finished + # else: + # raise ValidationError("未找到工单") + # # self.date_planned_finished = self.date_planned_start + timedelta(days=3) + # # self.state = 'done' + # return { + # 'name': '排程甘特图', + # 'type': 'ir.actions.act_window', + # 'res_model': 'sf.production.plan', # 要跳转的模型名称 + # 'view_mode': 'gantt,tree,form', # 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等 + # 'target': 'current', # 跳转的目标窗口,可以是'current'或'new' + # } + def do_production_schedule(self): """ 排程方法 @@ -169,60 +249,20 @@ class sf_production_plan(models.Model): if not self.production_line_id: raise ValidationError("未选择生产线") else: - aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)]) - workorder_time = 0 workorder_id_list = self.production_id.workorder_ids.ids - print(workorder_id_list) - print(type(self.production_id.workorder_ids)) if self.production_id.workorder_ids: for item in self.production_id.workorder_ids: if item.name == 'CNC加工': + item.date_planned_finished = datetime.now() + timedelta(days=100) item.date_planned_start = self.date_planned_start item.date_planned_finished = item.date_planned_start + timedelta( minutes=self.env['mrp.routing.workcenter'].sudo().search( [('name', '=', 'CNC加工')]).time_cycle) item.duration_expected = self.env['mrp.routing.workcenter'].sudo().search( [('name', '=', 'CNC加工')]).time_cycle - # print(item.id) - sequence = workorder_id_list.index(item.id) - 1 - # print('sequence', sequence) - # print('total', len(workorder_id_list)) - # 计算CNC加工之前工单的开始结束时间 - for i in range(sequence): - current_workorder_id = (item.id - (i + 1)) - current_workorder_obj = self.env['mrp.workorder'].sudo().search( - [('id', '=', current_workorder_id)]) - old_workorder_obj = self.env['mrp.workorder'].sudo().search( - [('id', '=', (current_workorder_id + 1))]) - work_order = self.env['mrp.workorder'].sudo().search( - [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)]) - work_order.date_planned_finished = old_workorder_obj.date_planned_start - work_order.date_planned_start = old_workorder_obj.date_planned_start - timedelta( - minutes=self.env['mrp.routing.workcenter'].sudo().search( - [('name', '=', current_workorder_obj.name)]).time_cycle) - # work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', current_workorder_obj.name)]).time_cycle - # 计算CNC加工之后工单的开始结束时间 - for j in range(len(workorder_id_list) - sequence - 2): - current_workorder_id = (item.id + (j + 1)) - current_workorder_obj = self.env['mrp.workorder'].sudo().search( - [('id', '=', current_workorder_id)]) - old_workorder_obj = self.env['mrp.workorder'].sudo().search( - [('id', '=', (current_workorder_id - 1))]) - work_order = self.env['mrp.workorder'].sudo().search( - [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)]) - try: - work_order.date_planned_start = old_workorder_obj.date_planned_finished - print('work_order.data_start', work_order.date_planned_start) - work_order.date_planned_finished = old_workorder_obj.date_planned_finished + timedelta( - minutes=self.env['mrp.routing.workcenter'].sudo().search( - [('name', '=', current_workorder_obj.name)]).time_cycle) - except ValueError as e: - print('时间设置失败,请检查是否为工序分配工作中心,%s' % e) - - current_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', item.id)]) - workorder_time += current_workorder.duration_expected - print('workorder_time', workorder_time) - self.date_planned_finished = self.date_planned_start + timedelta(minutes=workorder_time) + self.calculate_plan_time_before(item, workorder_id_list) + self.calculate_plan_time_after(item, workorder_id_list) + self.date_planned_start, self.date_planned_finished = item.date_planned_start, item.date_planned_finished self.state = 'done' self.production_id.schedule_state = '已排' # self.production_id.date_planned_start = self.date_planned_start @@ -238,36 +278,62 @@ class sf_production_plan(models.Model): 'view_mode': 'gantt,tree,form', # 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等 'target': 'current', # 跳转的目标窗口,可以是'current'或'new' } - # if self.production_line_id: - # if self.plan_start_time and self.plan_end_time: - # return None - # elif self.plan_start_time and not self.plan_end_time: - # # 如果没有给出计划结束时间,则计划结束时间为计划开始时间+采购周期+缓冲期 - # # 采购周期 - # purchase_cycle = 3 - # # 缓冲期 - # buffer_period = 1 - # # 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期 - # self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta( - # days=buffer_period) - # self.state = 'produce' - # return self.plan_end_time - # else: - # return None - # # 后面要补充计划开始时间的计算方法 - # # # 坯料预制时间 - # # # pl_time = 0.5 - # # # 采购周期 - # # purchase_cycle = 3 - # # # 缓冲期 - # # buffer_period = 1 - # # # 计划结束时间 = 计划开始时间 + 坯料预制时间 + 采购周期 + 缓冲期 - # # # plan_end_time = plan_start_time + pl_time + purchase_cycle + buffer_period - # # # 计划结束时间 = 计划开始时间(是一个datatime) + 采购周期(Float) + 缓冲期(Float) - # # self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period) - # # return self.plan_end_time - # else: - # raise ValidationError('生产线为空!') + + def calculate_plan_time_before(self, item, workorder_id_list): + """ + 根据CNC工单的时间去计算之前的其他工单的开始结束时间 + """ + sequence = workorder_id_list.index(item.id) - 1 + # 计算CNC加工之前工单的开始结束时间 + for i in range(sequence): + current_workorder_id = (item.id - (i + 1)) + current_workorder_obj = self.env['mrp.workorder'].sudo().search( + [('id', '=', current_workorder_id)]) + old_workorder_obj = self.env['mrp.workorder'].sudo().search( + [('id', '=', (current_workorder_id + 1))]) + work_order = self.env['mrp.workorder'].sudo().search( + [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)]) + work_order.date_planned_finished = datetime.now() + timedelta(days=100) + work_order.date_planned_start = old_workorder_obj.date_planned_start - timedelta( + minutes=self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', current_workorder_obj.name)]).time_cycle) + work_order.date_planned_finished = old_workorder_obj.date_planned_start + work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', current_workorder_obj.name)]).time_cycle + first_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', workorder_id_list[0])]) + second_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', workorder_id_list[1])]) + if second_workorder.date_planned_start < first_workorder.date_planned_finished: + item.date_planned_start += timedelta(minutes=60) + item.date_planned_finished += timedelta(minutes=60) + item.duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', 'CNC加工')]).time_cycle + self.calculate_plan_time_before(item, workorder_id_list) + + def calculate_plan_time_after(self, item, workorder_id_list): + """ + 计算CNC加工之后工单的开始结束时间 + """ + sequence = workorder_id_list.index(item.id) - 1 + # 计算CNC加工之后工单的开始结束时间 + for j in range(len(workorder_id_list) - sequence - 2): + current_workorder_id = (item.id + (j + 1)) + current_workorder_obj = self.env['mrp.workorder'].sudo().search( + [('id', '=', current_workorder_id)]) + old_workorder_obj = self.env['mrp.workorder'].sudo().search( + [('id', '=', (current_workorder_id - 1))]) + work_order = self.env['mrp.workorder'].sudo().search( + [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)]) + try: + work_order.date_planned_finished = datetime.now() + timedelta(days=100) + work_order.date_planned_start = old_workorder_obj.date_planned_finished + print('work_order.data_start', work_order.date_planned_start) + work_order.date_planned_finished = old_workorder_obj.date_planned_finished + timedelta( + minutes=self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', current_workorder_obj.name)]).time_cycle) + work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', current_workorder_obj.name)]).time_cycle + except ValueError as e: + print('时间设置失败,请检查是否为工序分配工作中心,%s' % e) def cancel_production_schedule(self): self.date_planned_finished = False diff --git a/web_gantt/static/src/xml/web_gantt.xml b/web_gantt/static/src/xml/web_gantt.xml index 5af631a8..76910940 100644 --- a/web_gantt/static/src/xml/web_gantt.xml +++ b/web_gantt/static/src/xml/web_gantt.xml @@ -77,13 +77,13 @@ -
夜班
+
夜班(00:00-08:00)
-
早班
+
早班(08:00-16:00)
-
晚班
+
晚班(16:00-00:00)
From acccb4b6f9ff99fb4396423f33a72dff5b25a8bc Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Tue, 14 Nov 2023 15:42:54 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=8E=BB=E6=8E=89sf=5Fplan=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E4=B8=AD=E7=9A=84=20=20=E5=B7=A5=E4=BD=9C=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E8=AE=A1=E5=88=92=20=20=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan_management/views/operations_rename_menu.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sf_plan_management/views/operations_rename_menu.xml b/sf_plan_management/views/operations_rename_menu.xml index 1af2ba72..0795d658 100644 --- a/sf_plan_management/views/operations_rename_menu.xml +++ b/sf_plan_management/views/operations_rename_menu.xml @@ -10,8 +10,9 @@ - - + + + From 2a964bc30ebe93e60faa8c99032cab6cc3d007c7 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Tue, 14 Nov 2023 16:48:11 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=BB=84=E8=A3=85=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E5=9E=8B?= =?UTF-8?q?=E5=8F=B7=E5=AD=97=E6=AE=B5=E7=BB=91=E5=AE=9A=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=BA=E5=88=80=E5=85=B7=E6=A0=87=E5=87=86?= =?UTF-8?q?=E5=BA=93=EF=BC=8C=E5=B9=B6=E4=BC=98=E5=8C=96=E7=BB=84=E8=A3=85?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/models/base.py | 37 ++++++++++--------- sf_tool_management/views/tool_base_views.xml | 2 +- sf_tool_management/wizard/wizard.py | 39 ++++++++++---------- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 4b9edfe6..1fb775c3 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -688,45 +688,46 @@ class FunctionalToolAssembly(models.Model): # 整体式刀具型号 integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', readonly=True) - cutting_tool_integral_model_id = fields.Many2one('sf.cutting.tool.material', string='整体式刀具型号', readonly=True) - integral_name = fields.Char('整体式刀具名称', readonly=True) + cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号', readonly=True) + integral_name = fields.Char('整体式刀具名称', readonly=True, compute='_compute_auto_fill') sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True) # 刀片型号 blade_code_id = fields.Many2one('stock.lot', '刀片序列号', readonly=True) - cutting_tool_blade_model_id = fields.Many2one('sf.cutting.tool.material', string='刀片型号', readonly=True) - blade_name = fields.Char('刀片名称', readonly=True) + cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', readonly=True) + blade_name = fields.Char('刀片名称', readonly=True, compute='_compute_auto_fill') sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True) # 刀杆型号 bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', readonly=True) - cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting.tool.material', string='刀杆型号', readonly=True) - bar_name = fields.Char('刀杆名称', readonly=True) + cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号', readonly=True) + bar_name = fields.Char('刀杆名称', readonly=True, compute='_compute_auto_fill') sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True) # 刀盘型号 pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', readonly=True) - cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting.tool.material', string='刀盘型号', readonly=True) - pad_name = fields.Char('刀盘名称', readonly=True) + cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号', readonly=True) + pad_name = fields.Char('刀盘名称', readonly=True, compute='_compute_auto_fill') sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True) # 刀柄型号 handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', readonly=True) - cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting.tool.material', string='刀柄型号', readonly=True) - handle_name = fields.Char('刀柄名称', readonly=True) + cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号', readonly=True) + handle_name = fields.Char('刀柄名称', readonly=True, compute='_compute_auto_fill') sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True) # 夹头型号 chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', readonly=True) - cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True) - chuck_name = fields.Char('夹头名称', readonly=True) + cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号', readonly=True) + chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill') sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True) @api.depends('integral_code_id', 'blade_code_id', 'bar_code_id', 'pad_code_id', 'handle_code_id', 'chuck_code_id') def _compute_auto_fill(self): for record in self: if record.integral_code_id: - record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_material_id.id + print(record.integral_code_id.product_id) + record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_model_id.id record.integral_name = record.integral_code_id.product_id.name record.sf_tool_brand_id_1 = record.integral_code_id.product_id.brand_id.id else: @@ -734,7 +735,7 @@ class FunctionalToolAssembly(models.Model): record.integral_name = None record.sf_tool_brand_id_1 = None if record.blade_code_id: - record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_model_id.id record.blade_name = record.blade_code_id.product_id.name record.sf_tool_brand_id_2 = record.blade_code_id.product_id.brand_id.id else: @@ -742,7 +743,7 @@ class FunctionalToolAssembly(models.Model): record.blade_name = None record.sf_tool_brand_id_2 = None if record.bar_code_id: - record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_model_id.id record.bar_name = record.bar_code_id.product_id.name record.sf_tool_brand_id_3 = record.bar_code_id.product_id.brand_id.id else: @@ -750,7 +751,7 @@ class FunctionalToolAssembly(models.Model): record.bar_name = None record.sf_tool_brand_id_3 = None if record.pad_code_id: - record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_model_id.id record.pad_name = record.pad_code_id.product_id.name record.sf_tool_brand_id_4 = record.pad_code_id.product_id.brand_id.id else: @@ -758,7 +759,7 @@ class FunctionalToolAssembly(models.Model): record.pad_name = None record.sf_tool_brand_id_4 = None if record.handle_code_id: - record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_model_id.id record.handle_name = record.handle_code_id.product_id.name record.sf_tool_brand_id_5 = record.handle_code_id.product_id.brand_id.id else: @@ -766,7 +767,7 @@ class FunctionalToolAssembly(models.Model): record.handle_name = None record.sf_tool_brand_id_5 = None if record.chuck_code_id: - record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_model_id.id record.chuck_name = record.chuck_code_id.product_id.name record.sf_tool_brand_id_6 = record.chuck_code_id.product_id.brand_id.id else: diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index c1495df7..a63e650f 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -796,7 +796,7 @@ - + diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py index 0c554ca9..53d7f28a 100644 --- a/sf_tool_management/wizard/wizard.py +++ b/sf_tool_management/wizard/wizard.py @@ -17,7 +17,8 @@ class ToolChangeRequirementInformation(models.TransientModel): functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True) # replacement_tool_code = fields.Char(string='待换功能刀具编码', readonly=True) - replacement_tool_name_id = fields.Many2one('product.product', string='待换功能刀具名称', ) + replacement_tool_name_id = fields.Many2one('product.product', string='待换功能刀具名称', + domain=[('name', '=', '功能刀具')]) replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换功能刀具类型') replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精') @@ -139,42 +140,42 @@ class FunctionalToolAssemblyOrder(models.TransientModel): # 整体式刀具型号 integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '整体式刀具')]) - cutting_tool_integral_model_id = fields.Many2one('sf.cutting.tool.material', string='整体式刀具型号', readonly=True) + cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号', readonly=True) integral_name = fields.Char('整体式刀具名称', readonly=True) sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True) # 刀片型号 blade_code_id = fields.Many2one('stock.lot', '刀片序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '刀片')]) - cutting_tool_blade_model_id = fields.Many2one('sf.cutting.tool.material', string='刀片型号', readonly=True) + cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', readonly=True) blade_name = fields.Char('刀片名称', readonly=True) sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True) # 刀杆型号 bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '刀杆')]) - cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting.tool.material', string='刀杆型号', readonly=True) + cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号', readonly=True) bar_name = fields.Char('刀杆名称', readonly=True) sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True) # 刀盘型号 pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '刀盘')]) - cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting.tool.material', string='刀盘型号', readonly=True) + cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号', readonly=True) pad_name = fields.Char('刀盘名称', readonly=True) sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True) # 刀柄型号 handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '刀柄')]) - cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting.tool.material', string='刀柄型号', readonly=True) + cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号', readonly=True) handle_name = fields.Char('刀柄名称', readonly=True) sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True) # 夹头型号 chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '夹头')]) - cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True) + cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号', readonly=True) chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill') sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True) @@ -207,7 +208,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel): def _compute_auto_fill(self): for record in self: if record.integral_code_id: - record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_model_id.id record.integral_name = record.integral_code_id.product_id.name record.sf_tool_brand_id_1 = record.integral_code_id.product_id.brand_id.id else: @@ -215,7 +216,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel): record.integral_name = None record.sf_tool_brand_id_1 = None if record.blade_code_id: - record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_model_id.id record.blade_name = record.blade_code_id.product_id.name record.sf_tool_brand_id_2 = record.blade_code_id.product_id.brand_id.id else: @@ -223,7 +224,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel): record.blade_name = None record.sf_tool_brand_id_2 = None if record.bar_code_id: - record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_model_id.id record.bar_name = record.bar_code_id.product_id.name record.sf_tool_brand_id_3 = record.bar_code_id.product_id.brand_id.id else: @@ -231,7 +232,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel): record.bar_name = None record.sf_tool_brand_id_3 = None if record.pad_code_id: - record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_model_id.id record.pad_name = record.pad_code_id.product_id.name record.sf_tool_brand_id_4 = record.pad_code_id.product_id.brand_id.id else: @@ -239,7 +240,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel): record.pad_name = None record.sf_tool_brand_id_4 = None if record.handle_code_id: - record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_model_id.id record.handle_name = record.handle_code_id.product_id.name record.sf_tool_brand_id_5 = record.handle_code_id.product_id.brand_id.id else: @@ -247,7 +248,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel): record.handle_name = None record.sf_tool_brand_id_5 = None if record.chuck_code_id: - record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_material_id.id + record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_model_id.id record.chuck_name = record.chuck_code_id.product_id.name record.sf_tool_brand_id_6 = record.chuck_code_id.product_id.brand_id.id else: @@ -302,12 +303,12 @@ class FunctionalToolAssemblyOrder(models.TransientModel): 'barcode_id': stock_lot.id, 'functional_tool_name_id': self.functional_tool_name_id.id, 'mrs_cutting_tool_type_id': self.functional_tool_type_id.id, - 'cutting_tool_integral_model_id': self.cutting_tool_integral_model_id.id, - 'cutting_tool_blade_model_id': self.cutting_tool_blade_model_id.id, - 'cutting_tool_cutterbar_model_id': self.cutting_tool_cutterbar_model_id.id, - 'cutting_tool_cutterpad_model_id': self.cutting_tool_cutterpad_model_id.id, - 'cutting_tool_cutterhandle_model_id': self.cutting_tool_cutterhandle_model_id.id, - 'cutting_tool_cutterhead_model_id': self.cutting_tool_cutterhead_model_id.id, + 'cutting_tool_integral_model_id': self.integral_code_id.product_id.id, + 'cutting_tool_blade_model_id': self.blade_code_id.product_id.id, + 'cutting_tool_cutterbar_model_id': self.bar_code_id.product_id.id, + 'cutting_tool_cutterpad_model_id': self.pad_code_id.product_id.id, + 'cutting_tool_cutterhandle_model_id': self.handle_code_id.product_id.id, + 'cutting_tool_cutterhead_model_id': self.chuck_code_id.product_id.id, 'diameter': self.functional_tool_diameter, 'tool_grade': None, 'machining_accuracy': None, From d216478679d5441e0cc9242f3816354888a04e68 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Wed, 15 Nov 2023 15:28:32 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=BF=99=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E6=96=87=E4=BB=B6=E7=9A=84=5F=5Fmanifest=5F=5F.py?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_frontend/__manifest__.py | 4 ++-- sf_machine_connect/__manifest__.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jikimo_frontend/__manifest__.py b/jikimo_frontend/__manifest__.py index d9885897..65438849 100644 --- a/jikimo_frontend/__manifest__.py +++ b/jikimo_frontend/__manifest__.py @@ -32,8 +32,8 @@ 'jikimo_frontend/static/src/scss/rowno_in_tree.scss', # 'jikimo_frontend/static/src/views/list_nums/list_render.xml', 'jikimo_frontend/static/src/list/list_up_down_button.xml', - 'jikimo_frontend/static/src/list/custom_import.js', - 'jikimo_frontend/static/src/list/custom_width.js', + # 'jikimo_frontend/static/src/list/custom_import.js', + # 'jikimo_frontend/static/src/list/custom_width.js', 'jikimo_frontend/static/src/views/list_nums/extent_purchase.xml', ], diff --git a/sf_machine_connect/__manifest__.py b/sf_machine_connect/__manifest__.py index 3afbb200..6ee1a20a 100644 --- a/sf_machine_connect/__manifest__.py +++ b/sf_machine_connect/__manifest__.py @@ -39,6 +39,7 @@ ], }, + 'external_dependencies': {'python': ['opcua(使用pip install opcua -i https://pypi.tuna.tsinghua.edu.cn/simple)']}, 'installable': True, 'application': True, From 2322758e50cf78f6253cc8433709cb4c038b444f Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Wed, 15 Nov 2023 16:21:40 +0800 Subject: [PATCH 5/7] =?UTF-8?q?wms=E8=B7=AF=E7=BA=BF=E8=A7=84=E5=88=99?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=80=89=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/models/model.py | 53 ++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index aa11a0a3..10acb1fa 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -4,7 +4,6 @@ from odoo import SUPERUSER_ID, _, api, fields, models from odoo.osv import expression - class SfLocation(models.Model): _inherit = 'stock.location' @@ -201,7 +200,6 @@ class SfLocation(models.Model): j_str = str(j + 1).zfill(3) # 确保是两位数,如果不足两位,左侧补0 return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + i_str + '-' + j_str - # def generate_barcode(self, i, j): # # 这里是你生成barcode的代码 # area_type_barcode = self.location_id.barcode @@ -217,26 +215,51 @@ class SfProcurementGroup(models.Model): 修改路线多规则条件选取 """ if warehouse_id: - domain = expression.AND([['|', ('warehouse_id', '=', warehouse_id.id), ('warehouse_id', '=', False)], domain]) + domain = expression.AND( + [['|', ('warehouse_id', '=', warehouse_id.id), ('warehouse_id', '=', False)], domain]) Rule = self.env['stock.rule'] res = self.env['stock.rule'] if route_ids: - res = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]), order='route_sequence, sequence', limit=1) + res_list = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]), + order='route_sequence, sequence') + for res1 in res_list: + if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type: + res = res1 + if not res: + res = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]), + order='route_sequence, sequence', limit=1) + if not res and packaging_id: packaging_routes = packaging_id.route_ids if packaging_routes: - res = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]), order='route_sequence, sequence', limit=1) - if not res: - product_routes = product_id.route_ids | product_id.categ_id.total_route_ids - if product_routes: - res = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]), order='route_sequence, sequence', limit=1) - if not res and warehouse_id: - warehouse_routes = warehouse_id.route_ids - if warehouse_routes: - res_list = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]), order='route_sequence, sequence') + res_list = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]), + order='route_sequence, sequence') for res1 in res_list: if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type: res = res1 + if not res: + res = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]), + order='route_sequence, sequence', limit=1) if not res: - res = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]), order='route_sequence, sequence', limit=1) - return res \ No newline at end of file + product_routes = product_id.route_ids | product_id.categ_id.total_route_ids + if product_routes: + res_list = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]), + order='route_sequence, sequence') + for res1 in res_list: + if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type: + res = res1 + if not res: + res = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]), + order='route_sequence, sequence', limit=1) + if not res and warehouse_id: + warehouse_routes = warehouse_id.route_ids + if warehouse_routes: + res_list = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]), + order='route_sequence, sequence') + for res1 in res_list: + if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type: + res = res1 + if not res: + res = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]), + order='route_sequence, sequence', limit=1) + return res From 25d1a99239988e709e8ff3050045d53f8ac1d9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E7=84=B1?= Date: Thu, 16 Nov 2023 15:02:27 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E7=BA=BF=E7=9C=8B=E6=9D=BF=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/src/scss/custom_style.scss | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index c01ca6c9..35416444 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -205,8 +205,8 @@ div[class="o_content o_component_with_search_panel"] img[name="equipment_image"] div[class="o_content o_component_with_search_panel"] .o_kanban_card_content button { position: absolute; - top: -52px; - left: -55px; + //top: -52px; + //left: -55px; width: 80px; } @@ -253,11 +253,11 @@ div[class="o_content o_component_with_search_panel"] .show_state span { font-size: 12px; } -div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > .row { - position: absolute; - top: 55px; - right: 43.5%; -} +//div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > .row { +// position: absolute; +// top: 55px; +// right: 43.5%; +//} //------------------------------------------ .test_model > .o_form_label { @@ -270,10 +270,10 @@ div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > . right: 52%; } - div[class="o_content o_component_with_search_panel"] .o_kanban_card_content button { - - left: -95px; - } + //div[class="o_content o_component_with_search_panel"] .o_kanban_card_content button { + // + // left: -95px; + //} } @@ -354,3 +354,25 @@ div:has(.o_required_modifier) > label::before { } +// 2023-11-16 hy 新增 +.o_kanban_card_content .btn-group { + position: unset; +} + +.o_kanban_card_content .btn-group button{ + top: 100px; + left: 168px; +} + + +.o_kanban_primary_right { + position: absolute; + top: 40px; + left: 168px; + padding: 0; + .row { + >div { + width: unset; + } + } +} \ No newline at end of file From 076866e9b78830413a139f67c4bb1c7fd35a0c92 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 16 Nov 2023 17:01:14 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9>>>=E5=A2=9E=E5=8A=A0=E2=80=9C=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E2=80=9D=E5=AD=97=E6=AE=B5specification=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/mrp_production_addional_change.xml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 186ebc1c..345e5f38 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -104,5 +104,55 @@ + + + + custom.Product.template.product.kanban + product.template + + + + + + + + + + + +
+
+ Product +
+
+
+
+ + + +
+ +
+ [] +
+ + Variants + +
+
+ Price: +
+
+ 规格: +
+
+
+
+
+
+
+
+
+ \ No newline at end of file