Compare commits
11 Commits
feature/齐套
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe8df494f9 | ||
|
|
32cd68e15f | ||
|
|
f0e47371ed | ||
|
|
6dde814acc | ||
|
|
71ab241e94 | ||
|
|
0a13acbb68 | ||
|
|
4b026535f8 | ||
|
|
99ac89f995 | ||
|
|
35b1d648c3 | ||
|
|
fe3492ceb5 | ||
|
|
4274b9fe99 |
@@ -1,2 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import models
|
||||
@@ -1,18 +0,0 @@
|
||||
# -*- 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',
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import production_demand_plan
|
||||
@@ -1,20 +0,0 @@
|
||||
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()
|
||||
@@ -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',
|
||||
|
||||
@@ -72,6 +72,7 @@ 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='精度',
|
||||
@@ -326,13 +327,9 @@ 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
|
||||
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 {
|
||||
'res_model': 'sf.demand.plan.print.wizard',
|
||||
|
||||
@@ -82,3 +82,8 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
th[data-name=processing_time] + th::before{
|
||||
content: '待执行单据';
|
||||
line-height: 38px;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
<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">
|
||||
class="demand_plan_tree freeze-columns-before-part_number">
|
||||
<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"/>
|
||||
@@ -29,6 +28,7 @@
|
||||
<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,7 +43,10 @@
|
||||
<field name="date_order"/>
|
||||
<field name="contract_code"/>
|
||||
<field name="plan_remark"/>
|
||||
<field name="processing_time"/>
|
||||
<field name="priority" decoration-danger="priority == '1'"
|
||||
decoration-warning="priority == '2'"
|
||||
decoration-info="priority == '3'"
|
||||
decoration-success="priority == '4'"/>
|
||||
<field name="material_check" optional="hide"/>
|
||||
<field name="hide_action_open_mrp_production" invisible="1"/>
|
||||
<field name="hide_action_purchase_orders" invisible="1"/>
|
||||
@@ -62,6 +65,7 @@
|
||||
<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="更新时间"/>
|
||||
@@ -91,7 +95,8 @@
|
||||
<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="[]"
|
||||
@@ -122,4 +127,9 @@
|
||||
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>
|
||||
@@ -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="cnc_worksheet" attrs="{'column_invisible': True }" />
|
||||
<field name="status"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -3,6 +3,7 @@ import logging
|
||||
|
||||
import re
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class ResProductCategory(models.Model):
|
||||
@@ -47,11 +48,14 @@ 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': 1,
|
||||
'product_qty': product.unit_number,
|
||||
'product_uom_id': 1
|
||||
}
|
||||
return self.env['mrp.bom.line'].sudo().create(vals)
|
||||
@@ -122,7 +126,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
|
||||
|
||||
|
||||
|
||||
@@ -95,6 +95,8 @@
|
||||
<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="长"/>
|
||||
@@ -104,7 +106,7 @@
|
||||
<label for="model_height" string="高"/>
|
||||
<field name="model_height" class="o_address_zip"/>
|
||||
</div>
|
||||
<field name="blank_type" readonly="1"/>
|
||||
<field name="unit_number" readonly="1"/>
|
||||
<field name="model_volume" string="体积[mm³]"/>
|
||||
<field name="product_model_type_id" string="模型类型"/>
|
||||
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"
|
||||
|
||||
@@ -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_production'))
|
||||
plan_data_total_counts = sum(plan_data_total.mapped('qty_produced'))
|
||||
|
||||
# # 工单完成量
|
||||
# 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_production'))
|
||||
plan_count_dict[key] = sum(interval_orders.mapped('qty_produced'))
|
||||
|
||||
# order_counts.append()
|
||||
res['data'][line] = {
|
||||
|
||||
@@ -27,9 +27,11 @@ 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='加工精度')
|
||||
@@ -901,9 +903,11 @@ 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 (
|
||||
|
||||
@@ -201,33 +201,9 @@
|
||||
</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"/>-->
|
||||
<t t-call="sf_quality.report_quality_footer"/>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</t>
|
||||
@@ -353,11 +329,9 @@
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user