diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index 623e5e21..f2d2ac15 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -12,25 +12,46 @@ class sf_production_plan(models.Model):
# _inherit = 'mrp.production'
_description = 'sf_production_plan'
- name = fields.Char(string='名称')
+ state = fields.Selection([
+ ('draft', '待排程'),
+ ('done', '已排程'),
+ ('processing', '已加工'),
+ ('finished', '已完成')
+ ], string='工单状态', tracking=True)
+ name = fields.Char(string='工单编号')
# selected = fields.Boolean(default=False)
+ order_number = fields.Char(string='订单号')
+ order_deadline = fields.Datetime(string='订单交期')
production_id = fields.Many2one('mrp.production', '关联制造订单')
product_qty = fields.Float(string='数量', digits='Product Unit of Measure', required=True, default=0.0)
+ production_line_id = fields.Many2one('sf.production.line', string='生产线')
date_planned_start = fields.Datetime(string='计划开始时间', required=True, index=True, copy=False,
default=fields.Datetime.now)
date_planned_finished = fields.Datetime(string='计划结束时间')
- state = fields.Selection([
- ('draft', '未排程'), ('done', '已排程')], string='状态', copy=False, index=True, readonly=True,
- store=True, tracking=True)
+ # 排程设置selection(倒排,顺排,默认倒排)
+ schedule_setting = fields.Selection([
+ ('reverse', '倒排'), ('positive', '顺排')], string='排程设置', default='reverse')
product_id = fields.Many2one('product.product', '关联产品')
origin = fields.Char(string='来源')
+ # 加工时长
+ process_time = fields.Float(string='加工时长', digits=(16, 2))
+ # 实际加工时长、实际开始时间、实际结束时间
+ actual_process_time = fields.Float(string='实际加工时长', digits=(16, 2))
+ actual_start_time = fields.Datetime(string='实际开始时间')
+ actual_end_time = fields.Datetime(string='实际结束时间')
+ shift = fields.Char(string='班次')
+
# 序号、坯料编号、坯料名称、材质、数量、长度、宽度、厚度、直径、计划开始时间、计划结束时间、状态(已产出与待产出)、操作、创建人、创建时间、客户名称、订单号、行号、长度、宽度、厚度、直径、交货数量、交货日期
# sequence = fields.Integer(string='序号', required=True, copy=False, readonly=True, index=True,
# default=lambda self: self.env['ir.sequence'].sudo().next_by_code('sf.pl.plan'))
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
- production_line_id = fields.Many2one('sf.production.line', string='生产线')
+
+
+
+
+
# state = fields.Selection([
# ('未排程', '未排程'), ('已排程', '已排程')], string='State', copy=False, index=True, readonly=True,
diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml
index 1f35b088..04751d0c 100644
--- a/sf_plan/views/view.xml
+++ b/sf_plan/views/view.xml
@@ -9,11 +9,15 @@
+
+
+
+
-
+
@@ -28,6 +32,7 @@
-
+
+
+
+
+
+
+
+
-
+
@@ -115,8 +127,11 @@
color="production_line_id"
decoration-success="state == 'done'"
progress_bar="name"
- form_view_id="sf_production_plan_form">
-
+ form_view_id="sf_production_plan_form"
+ default_scale="year"
+ scales="day,week,month,year"
+ precision="{'day': 'hour:quarter', 'week': 'day:half', 'month': 'day', 'year': 'month:quarter'}">
+
From 532e4a4c7a2bc635b7003c025989b06f813e4b3b Mon Sep 17 00:00:00 2001
From: "qihao.gong@jikimo.com"
Date: Wed, 13 Sep 2023 16:52:40 +0800
Subject: [PATCH 35/36] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=9B=BE=E6=96=87?=
=?UTF-8?q?=E5=B1=95=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_maintenance/models/sf_maintenance.py | 36 ++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py
index ef7ffc4c..d66de31e 100644
--- a/sf_maintenance/models/sf_maintenance.py
+++ b/sf_maintenance/models/sf_maintenance.py
@@ -486,4 +486,38 @@ class MaintenanceStandardImage(models.Model):
active = fields.Boolean('有效', default=True)
name = fields.Char('加工能力')
image = fields.Binary(string='设备图文')
- equipment_id = fields.Many2many('maintenance.equipment', 'image_id', string='设备')
\ No newline at end of file
+ equipment_id = fields.Many2many('maintenance.equipment', 'image_id', string='设备')
+
+ @api.model
+ def name_search(self, name='', args=None, operator='ilike', limit=100):
+ # 调用父类的name_search方法,获取原始的结果列表
+ res = super().name_search(name, args, operator, limit)
+ # 定义一个空字典用来存储id和name的映射关系
+ name_dict = {}
+ # 遍历结果列表,将id和name存入字典中
+ for item in res:
+ id = item[0]
+ name = item[1]
+ name_dict[id] = name
+ # 根据id列表搜索符合条件的记录
+ records = self.browse(name_dict.keys())
+ # 定义一个新的结果列表用来存储修改后的结果
+ new_res = []
+ # 遍历每条记录
+ for record in records:
+ # 获取记录的id,name和image属性
+ id = record.id
+ name = name_dict[id]
+ image = record.image
+ # 如果image不为空,将其转换为data URI scheme
+ if image:
+ data_uri = f"data:image/png;base64,{image.decode('utf-8')}"
+ else:
+ data_uri = ""
+ # 将这三个属性组成一个数组,并添加到结果列表中 result.append([id, name, data_uri]) # 返回结果列表 return result
+ new_res.append([id, name, data_uri])
+ # 返回新的结果列表
+ return new_res
+
+
+
From 43d9c5462648914c509df9210914048c6d63f7e1 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Thu, 14 Sep 2023 09:17:38 +0800
Subject: [PATCH 36/36] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/stock.py | 1 +
sf_plan/models/custom_plan.py | 4 ++--
sf_plan/views/view.xml | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index fd014941..5a4e2ec4 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -203,6 +203,7 @@ class StockRule(models.Model):
productions = self.env['sf.production.plan'].with_user(SUPERUSER_ID).sudo().with_company(company_id). \
create({
'name': production.name,
+ 'order_deadline': sale_order.deadline_of_delivery,
'production_id': production.id,
'date_planned_start': production.date_planned_start,
'origin': production.origin,
diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index f2d2ac15..15af211a 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -20,7 +20,7 @@ class sf_production_plan(models.Model):
], string='工单状态', tracking=True)
name = fields.Char(string='工单编号')
# selected = fields.Boolean(default=False)
- order_number = fields.Char(string='订单号')
+ # order_number = fields.Char(string='订单号')
order_deadline = fields.Datetime(string='订单交期')
production_id = fields.Many2one('mrp.production', '关联制造订单')
product_qty = fields.Float(string='数量', digits='Product Unit of Measure', required=True, default=0.0)
@@ -32,7 +32,7 @@ class sf_production_plan(models.Model):
schedule_setting = fields.Selection([
('reverse', '倒排'), ('positive', '顺排')], string='排程设置', default='reverse')
product_id = fields.Many2one('product.product', '关联产品')
- origin = fields.Char(string='来源')
+ origin = fields.Char(string='订单号')
# 加工时长
process_time = fields.Float(string='加工时长', digits=(16, 2))
# 实际加工时长、实际开始时间、实际结束时间
diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml
index 04751d0c..7878fa5f 100644
--- a/sf_plan/views/view.xml
+++ b/sf_plan/views/view.xml
@@ -11,7 +11,7 @@
-
+