Compare commits

..

32 Commits

Author SHA1 Message Date
guanhuan
7d1f7b11eb 坯料尺寸显示修改 2025-06-24 11:39:47 +08:00
guanhuan
0d76d1a7d3 需求计划修改 2025-06-23 13:59:37 +08:00
guanhuan
9ad06b4361 需求计划 2025-06-20 17:34:17 +08:00
guanhuan
f9c13341e6 Merge branch 'refs/heads/develop' into feature/齐套检查与下达生产 2025-06-20 17:33:26 +08:00
guanhuan
d2a61c79d0 需求计划 2025-06-20 17:29:41 +08:00
禹翔辉
5f80b377e5 Accept Merge Request #2238: (feature/出厂检验报告模版 -> develop)
Merge Request: 添加页脚页码数据测试

Created By: @禹翔辉
Reviewed By: @胡尧 @秦圣
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2238
2025-06-20 17:28:20 +08:00
yuxianghui
ab2e685004 添加页脚页码数据测试 2025-06-20 17:24:48 +08:00
guanhuan
dcc5eef006 需求计划 2025-06-20 17:21:06 +08:00
guanhuan
7e8b2adb3d 需求计划 2025-06-20 17:19:33 +08:00
禹翔辉
9aa870065b Accept Merge Request #2237: (feature/出厂检验报告模版 -> develop)
Merge Request: 页脚优化

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2237
2025-06-20 17:03:52 +08:00
yuxianghui
60c39929b2 页脚优化 2025-06-20 17:02:31 +08:00
禹翔辉
9a5b8a2627 Accept Merge Request #2236: (feature/出厂检验报告模版 -> develop)
Merge Request: 出厂检验报告-页脚优化

Created By: @禹翔辉
Reviewed By: @秦圣
Approved By: @秦圣 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2236
2025-06-20 16:56:08 +08:00
yuxianghui
73696eb72c 出厂检验报告-页脚优化 2025-06-20 16:50:59 +08:00
禹翔辉
55babb8a35 Accept Merge Request #2235: (feature/出厂检验报告模版 -> develop)
Merge Request: 出厂检验报告模版-页脚优化

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2235
2025-06-20 16:42:02 +08:00
yuxianghui
6682dbfb7d 出厂检验报告模版-页脚优化 2025-06-20 16:40:38 +08:00
禹翔辉
e0b8e5fe07 Accept Merge Request #2234: (feature/出厂检验报告模版 -> develop)
Merge Request: 出厂检验报告-页脚优化

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2234
2025-06-20 16:19:18 +08:00
yuxianghui
800f2eb6a7 出厂检验报告-页脚优化 2025-06-20 16:03:13 +08:00
禹翔辉
3cc633131e Accept Merge Request #2233: (feature/出厂检验报告模版 -> develop)
Merge Request: 出厂检验报告-页脚修改

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2233
2025-06-20 15:57:55 +08:00
yuxianghui
e3fb266890 出厂检验报告-页脚修改 2025-06-20 15:55:58 +08:00
胡尧
844f7de1ab Accept Merge Request #2232: (feature/6711 -> develop)
Merge Request: 修改计划量字段为–qty_production

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2232?initial=true
2025-06-20 15:39:28 +08:00
胡尧
13d33488dc 修改计划量字段为–qty_production 2025-06-20 15:39:11 +08:00
禹翔辉
266601cf84 Accept Merge Request #2231: (feature/出厂检验报告模版 -> develop)
Merge Request: 出厂检验报告模版-页脚优化

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2231
2025-06-20 15:36:51 +08:00
yuxianghui
2e168a4ba7 出厂检验报告模版-页脚优化 2025-06-20 15:35:07 +08:00
胡尧
68ba47ed70 Accept Merge Request #2230: (feature/7151 -> develop)
Merge Request: 修改依赖

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2230?initial=true
2025-06-20 15:03:57 +08:00
胡尧
5bb6fcd4f7 修改依赖 2025-06-20 15:03:42 +08:00
胡尧
9a05bbd82c Accept Merge Request #2229: (feature/7151 -> develop)
Merge Request: 修改需求计划,下达生成的方法

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2229?initial=true
2025-06-20 14:52:34 +08:00
胡尧
b33c992b25 修改需求计划,下达生成的方法 2025-06-20 14:51:58 +08:00
yuxianghui
5947b3dfe9 回退出厂检验报告模版 2025-06-20 14:26:29 +08:00
禹翔辉
95e43b0fba Accept Merge Request #2228: (feature/出厂检验报告模版 -> develop)
Merge Request: 出厂检验报告模版优化

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2228
2025-06-20 14:07:56 +08:00
yuxianghui
e7afc76753 出厂检验报告模版优化 2025-06-20 14:01:56 +08:00
胡尧
788183e239 修改批量大小 2025-06-20 13:52:37 +08:00
胡尧
f38f60a6a8 计划增加队列 2025-06-20 11:24:39 +08:00
14 changed files with 95 additions and 49 deletions

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
{
'name': '机企猫 需求计划排程队列',
'version': '1.0',
'summary': """ 使用队列进行排程 """,
'author': 'fox',
'website': '',
'category': '',
'depends': ['queue_job_batch', 'sf_demand_plan'],
'data': [
],
'application': True,
'installable': True,
'auto_install': False,
'license': 'LGPL-3',
}

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import production_demand_plan

View File

@@ -0,0 +1,20 @@
from odoo import models, fields
class ProductionDemandPlan(models.Model):
_inherit = 'sf.production.demand.plan'
def _do_production_schedule(self, pro_plan_list):
"""使用队列进行排程"""
batch_size = 10
current_time = fields.Datetime.now().strftime('%Y%m%d%H%M%S')
index = 1
for i in range(0, len(pro_plan_list), batch_size):
batch = self.env['queue.job.batch'].get_new_batch('plan-%s-%s' % (current_time, index))
pro_plans = pro_plan_list[i:i+batch_size]
pro_plans.with_context(
job_batch=batch
).with_delay().do_production_schedule()
index += 1
batch.enqueue()

View File

@@ -10,7 +10,7 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
'depends': ['sf_plan', 'jikimo_printing'],
'depends': ['sf_plan','jikimo_printing'],
'data': [
'security/ir.model.access.csv',
'views/demand_plan.xml',

View File

@@ -72,7 +72,6 @@ class SfProductionDemandPlan(models.Model):
model_long = fields.Char('尺寸(mm)', compute='_compute_model_long')
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
related='product_id.blank_type')
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型', related='product_id.blank_precision')
embryo_long = fields.Char('坯料尺寸(mm)', compute='_compute_embryo_long')
materials_id = fields.Char('材料', compute='_compute_materials_id', store=True)
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='精度',
@@ -327,8 +326,12 @@ class SfProductionDemandPlan(models.Model):
date_planned_start = datetime.combine(date_part, time_part)
pro_plan_list.production_line_id = sf_production_line.id
pro_plan_list.date_planned_start = date_planned_start
for pro_plan in pro_plan_list:
pro_plan.do_production_schedule()
self._do_production_schedule(pro_plan_list)
def _do_production_schedule(self, pro_plan_list):
for pro_plan in pro_plan_list:
pro_plan.do_production_schedule()
def button_action_print(self):
return {

View File

@@ -81,9 +81,4 @@
input,label {
cursor: pointer;
}
}
th[data-name=processing_time] + th::before{
content: '待执行单据';
line-height: 38px;
}
}

View File

@@ -4,13 +4,14 @@
<field name="model">sf.production.demand.plan</field>
<field name="arch" type="xml">
<tree string="需求计划" default_order="sequence desc,id desc" editable="bottom"
class="demand_plan_tree freeze-columns-before-part_number">
class="demand_plan_tree">
<header>
<button string="打印" name="button_action_print" type="object"
class="btn-primary"/>
</header>
<field name="sequence" widget="handle"/>
<field name="id" optional="hide"/>
<field name="priority"/>
<field name="status"/>
<field name="customer_name"/>
<field name="order_remark"/>
@@ -28,7 +29,6 @@
<field name="qty_to_deliver"/>
<field name="model_long"/>
<field name="blank_type" optional="hide"/>
<field name="blank_precision"/>
<field name="embryo_long"/>
<field name="materials_id"/>
<field name="model_machining_precision"/>
@@ -43,10 +43,7 @@
<field name="date_order"/>
<field name="contract_code"/>
<field name="plan_remark"/>
<field name="priority" decoration-danger="priority == '1'"
decoration-warning="priority == '2'"
decoration-info="priority == '3'"
decoration-success="priority == '4'"/>
<field name="processing_time"/>
<field name="material_check" optional="hide"/>
<field name="hide_action_open_mrp_production" invisible="1"/>
<field name="hide_action_purchase_orders" invisible="1"/>
@@ -65,7 +62,6 @@
<field name="planned_start_date"/>
<field name="actual_start_date"/>
<field name="actual_end_date"/>
<field name="processing_time"/>
<field name="create_date" optional="hide" string="创建时间"/>
<field name="create_uid" optional="hide" string="创建人"/>
<field name="write_date" string="更新时间"/>
@@ -95,8 +91,7 @@
<group expand="0" string="Group By">
<filter name="group_by_priority" string="优先级" domain="[]" context="{'group_by': 'priority'}"/>
<filter name="group_by_status" string="状态" domain="[]" context="{'group_by': 'status'}"/>
<filter name="group_by_customer_name" string="客户" domain="[]"
context="{'group_by': 'customer_name'}"/>
<filter name="group_by_customer_name" string="客户" domain="[]" context="{'group_by': 'customer_name'}"/>
<filter name="group_by_is_incoming_material" string="客供料" domain="[]"
context="{'group_by': 'is_incoming_material'}"/>
<filter name="group_by_supply_method" string="供货方式" domain="[]"
@@ -127,9 +122,4 @@
action="sf_production_demand_plan_action"
parent="sf_plan.sf_production_plan_menu"
/>
<!-- 调拨动作中屏蔽验证-->
<record id="stock.action_validate_picking" model="ir.actions.server">
<field name="binding_model_id" eval="False"/>
</record>
</odoo>

View File

@@ -4,12 +4,12 @@
<field name="name">sf.demand.plan.print.wizard.tree</field>
<field name="model">sf.demand.plan.print.wizard</field>
<field name="arch" type="xml">
<tree string="打印" class="print_demand" js_class="print_demand" >
<tree string="打印" class="print_demand" js_class="print_demand">
<field name="model_id"/>
<field name="filename_url"/>
<field name="type"/>
<field name="machining_drawings" attrs="{'column_invisible': True }"/>
<field name="cnc_worksheet" attrs="{'column_invisible': True }" />
<field name="machining_drawings" attrs="{'column_invisible': True }"/>
<field name="cnc_worksheet" attrs="{'column_invisible': True }"/>
<field name="status"/>
</tree>
</field>

View File

@@ -3,7 +3,6 @@ import logging
import re
from odoo import models, fields, api
from odoo.exceptions import ValidationError
class ResProductCategory(models.Model):
@@ -48,14 +47,11 @@ class ResMrpBomMo(models.Model):
item.subcontractor_name = ''
def bom_create_line_has(self, embryo):
product = self.product_tmpl_id
if product.unit_number in (0, None, False):
raise ValidationError(f'产品{product.name}单件用量的值不能为{product.unit_number}')
vals = {
'bom_id': self.id,
'product_id': embryo.id,
'product_tmpl_id': embryo.product_tmpl_id.id,
'product_qty': product.unit_number,
'product_qty': 1,
'product_uom_id': 1
}
return self.env['mrp.bom.line'].sudo().create(vals)
@@ -126,7 +122,7 @@ class ResMrpBomMo(models.Model):
# 查bom的原材料
def get_raw_bom(self, product):
raw_bom = self.env['product.product'].search(
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)], limit=1)
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)],limit=1)
return raw_bom

View File

@@ -95,8 +95,6 @@
<page string="加工参数">
<group>
<group string="模型">
<field name="blank_type" readonly="1"/>
<field name="blank_precision" readonly="1"/>
<label for="model_long" string="坯料尺寸[mm]"/>
<div class="o_address_format">
<label for="model_long" string="长"/>
@@ -106,7 +104,7 @@
<label for="model_height" string="高"/>
<field name="model_height" class="o_address_zip"/>
</div>
<field name="unit_number" readonly="1"/>
<field name="blank_type" readonly="1"/>
<field name="model_volume" string="体积[mm³]"/>
<field name="product_model_type_id" string="模型类型"/>
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"

View File

@@ -437,7 +437,7 @@ class Sf_Dashboard_Connect(http.Controller):
('state', 'in', ['ready', 'progress', 'done'])
])
plan_data_total_counts = sum(plan_data_total.mapped('qty_produced'))
plan_data_total_counts = sum(plan_data_total.mapped('qty_production'))
# # 工单完成量
# plan_data_finish_counts = plan_obj.search_count(
@@ -717,7 +717,7 @@ class Sf_Dashboard_Connect(http.Controller):
# 使用小时和分钟作为键,确保每个小时的数据有独立的键
key = start_time.strftime('%H:%M:%S') # 只取小时:分钟:秒作为键
# time_count_dict[key] = len(orders)
plan_count_dict[key] = sum(interval_orders.mapped('qty_produced'))
plan_count_dict[key] = sum(interval_orders.mapped('qty_production'))
# order_counts.append()
res['data'][line] = {

View File

@@ -27,11 +27,9 @@ class ResProductMo(models.Model):
categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True)
model_name = fields.Char('模型名称')
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型')
model_long = fields.Float('模型长(mm)', digits=(16, 3))
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
model_height = fields.Float('模型高(mm)', digits=(16, 3))
unit_number = fields.Float('单件用量', digits=(16, 3), default=1)
model_volume = fields.Float('模型体积(m³)')
model_area = fields.Float('模型表面积(m²)')
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度')
@@ -903,11 +901,9 @@ class ResProductMo(models.Model):
vals = {
'name': product_name,
'blank_type': item.get('blank_type'),
'blank_precision': item.get('blank_precision'),
'model_long': item.get('blank_length') if blank_bool else self.format_float(item['model_long'] + embryo_redundancy_id.long),
'model_width': item.get('blank_width') if blank_bool else self.format_float(item['model_width'] + embryo_redundancy_id.width),
'model_height': item.get('blank_height') if blank_bool else self.format_float(item['model_height'] + embryo_redundancy_id.height),
'unit_number': item.get('unit_number'),
'model_volume': self.format_float(((item['model_long'] + embryo_redundancy_id.long) *
(item['model_width'] + embryo_redundancy_id.width) *
(item['model_height'] + embryo_redundancy_id.height))) if not blank_bool else (
@@ -961,7 +957,7 @@ class ResProductMo(models.Model):
self.attachment_update(item['quality_standard_name'], copy_product_id.product_tmpl_id.id,
'quality_standard', item['quality_standard_mimetype'])
return copy_product_id
def format_float(self, value):
# 将浮点数转换为字符串
value_str = str(value)

View File

@@ -201,10 +201,34 @@
</div>
</div> -->
<div class="footer">
<div style="border-top: 2px solid black;"></div>
<div>
<p>o_index: <t t-esc="o_index"/></p>
<p>len(docs): <t t-esc="len(docs)"/></p>
</div>
<t t-if="o_index + 1 == len(docs)">
<div class="row">
<div class="col-6">
<p>售后服务: <span t-field="o.company_id.phone"/></p>
<p>公司名称: <span t-field="o.company_id.name"/></p>
<p>加工工厂: <span t-field="o.company_id.factory_name"/></p>
</div>
<div class="col-6">
<p>公司网址: <span t-field="o.company_id.website"/></p>
<p>公司邮箱: <span t-field="o.company_id.email"/></p>
</div>
</div>
</t>
<div class="text-center">
<span><span class="page"/> 页/共 <span class="topage"/></span>
</div>
</div>
<!-- 页脚固定在底部 -->
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
<t t-call="sf_quality.report_quality_footer"/>
<!-- </div> -->
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
<!-- <t t-call="sf_quality.report_quality_footer"/>-->
<!-- </div> -->
</div>
</t>
</t>
@@ -329,9 +353,11 @@
</div> -->
<!-- 页脚固定在底部 -->
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
<t t-call="sf_quality.html_report_quality_footer"/>
<!-- </div> -->
<!-- <t t-if="loop.index == len(docs) - 1">-->
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
<t t-call="sf_quality.html_report_quality_footer"/>
<!-- </div> -->
<!-- </t>-->
</div>
</t>
</t>