Compare commits
13 Commits
307e860fe0
...
feature/坯料
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe3492ceb5 | ||
|
|
4274b9fe99 | ||
|
|
4ddabdefa1 | ||
|
|
364127beb3 | ||
|
|
109ea8729d | ||
|
|
32de726164 | ||
|
|
79f89f068b | ||
|
|
52189cff72 | ||
|
|
aadccce47e | ||
|
|
abd88fd721 | ||
|
|
2c2fa87719 | ||
|
|
7d8b7048a8 | ||
|
|
e7b312fb22 |
@@ -196,11 +196,14 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
else:
|
else:
|
||||||
line.model_long = None
|
line.model_long = None
|
||||||
|
|
||||||
@api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height')
|
@api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height', 'product_id.blank_type')
|
||||||
def _compute_embryo_long(self):
|
def _compute_embryo_long(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
if line.product_id:
|
if line.product_id:
|
||||||
line.embryo_long = f"{round(line.product_id.model_long, 3)}*{round(line.product_id.model_width, 3)}*{round(line.product_id.model_height, 3)}"
|
if line.product_id.blank_type == '圆料':
|
||||||
|
line.embryo_long = f"Ø{round(line.product_id.model_width, 3)}*{round(line.product_id.model_long, 3)}"
|
||||||
|
else:
|
||||||
|
line.embryo_long = f"{round(line.product_id.model_long, 3)}*{round(line.product_id.model_width, 3)}*{round(line.product_id.model_height, 3)}"
|
||||||
else:
|
else:
|
||||||
line.embryo_long = None
|
line.embryo_long = None
|
||||||
|
|
||||||
@@ -399,29 +402,30 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
outsourcing_purchase_request.extend(pr_ids.ids)
|
outsourcing_purchase_request.extend(pr_ids.ids)
|
||||||
if record.supply_method == 'outsourcing' and not record.sale_order_line_id.is_incoming_material:
|
if record.supply_method == 'outsourcing' and not record.sale_order_line_id.is_incoming_material:
|
||||||
bom_line_ids = record.product_id.bom_ids.bom_line_ids
|
bom_line_ids = record.product_id.bom_ids.bom_line_ids
|
||||||
# BOM_数量
|
if bom_line_ids:
|
||||||
total_product_qty = sum(line.product_qty for line in bom_line_ids)
|
# BOM_数量
|
||||||
bom_product_ids = bom_line_ids.mapped('product_id')
|
total_product_qty = sum(line.product_qty for line in bom_line_ids)
|
||||||
product_purchase_orders = self.env['purchase.order'].sudo().search([
|
bom_product_ids = bom_line_ids.mapped('product_id')
|
||||||
('state', 'in', ('purchase', 'done')),
|
product_purchase_orders = self.env['purchase.order'].sudo().search([
|
||||||
('order_line.product_id', 'in', bom_product_ids.ids)
|
('state', 'in', ('purchase', 'done')),
|
||||||
])
|
('order_line.product_id', 'in', bom_product_ids.ids)
|
||||||
# 购订单_数量
|
])
|
||||||
total_outsourcing_purchase_quantity = sum(
|
# 购订单_数量
|
||||||
sum(
|
total_outsourcing_purchase_quantity = sum(
|
||||||
order.order_line.filtered(
|
sum(
|
||||||
lambda line: line.product_id in bom_product_ids
|
order.order_line.filtered(
|
||||||
).mapped('product_qty')
|
lambda line: line.product_id in bom_product_ids
|
||||||
|
).mapped('product_qty')
|
||||||
|
)
|
||||||
|
for order in product_purchase_orders
|
||||||
)
|
)
|
||||||
for order in product_purchase_orders
|
quantity = total_outsourcing_purchase_quantity / total_product_qty
|
||||||
)
|
if float_compare(quantity, record.product_uom_qty,
|
||||||
quantity = total_outsourcing_purchase_quantity / total_product_qty
|
precision_rounding=record.product_id.uom_id.rounding) == -1:
|
||||||
if float_compare(quantity, record.product_uom_qty,
|
purchase_request = self.env['purchase.request'].sudo().search(
|
||||||
precision_rounding=record.product_id.uom_id.rounding) == -1:
|
[('line_ids.product_id', 'in', bom_product_ids.ids),
|
||||||
purchase_request = self.env['purchase.request'].sudo().search(
|
('line_ids.purchase_state', 'not in', ('purchase', 'done')), ('state', '!=', 'done')])
|
||||||
[('line_ids.product_id', 'in', bom_product_ids.ids),
|
outsourcing_purchase_request.extend(purchase_request.ids)
|
||||||
('line_ids.purchase_state', 'not in', ('purchase', 'done')), ('state', '!=', 'done')])
|
|
||||||
outsourcing_purchase_request.extend(purchase_request.ids)
|
|
||||||
record.outsourcing_purchase_request = json.dumps(outsourcing_purchase_request)
|
record.outsourcing_purchase_request = json.dumps(outsourcing_purchase_request)
|
||||||
if outsourcing_purchase_request:
|
if outsourcing_purchase_request:
|
||||||
record.hide_action_purchase_orders = True
|
record.hide_action_purchase_orders = True
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<field name="qty_delivered"/>
|
<field name="qty_delivered"/>
|
||||||
<field name="qty_to_deliver"/>
|
<field name="qty_to_deliver"/>
|
||||||
<field name="model_long"/>
|
<field name="model_long"/>
|
||||||
<field name="blank_type"/>
|
<field name="blank_type" optional="hide"/>
|
||||||
<field name="embryo_long"/>
|
<field name="embryo_long"/>
|
||||||
<field name="materials_id"/>
|
<field name="materials_id"/>
|
||||||
<field name="model_machining_precision"/>
|
<field name="model_machining_precision"/>
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
|
|
||||||
# 工单返工数量
|
# 工单返工数量
|
||||||
|
|
||||||
plan_data_rework = work_order_obj.search(plan_domain + [
|
plan_data_rework = work_order_obj.search(work_order_domain + [
|
||||||
('state', 'in', ['rework'])
|
('state', 'in', ['rework'])
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -857,7 +857,6 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
:param kw:
|
:param kw:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
request.env['stock.warehouse'].browse(request.env.company.id).pbm_loc_id
|
|
||||||
# res = {'status': 1, 'message': '成功', 'not_done_data': [], 'done_data': []}
|
# res = {'status': 1, 'message': '成功', 'not_done_data': [], 'done_data': []}
|
||||||
res = {'status': 1, 'message': '成功', 'data': {}}
|
res = {'status': 1, 'message': '成功', 'data': {}}
|
||||||
plan_obj = request.env['sf.production.plan'].sudo()
|
plan_obj = request.env['sf.production.plan'].sudo()
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="page" style="min-height: 800px; position: relative; padding-bottom: 250px;">
|
<div class="page" style="min-height: 800px; position: relative; padding-bottom: 250px;">
|
||||||
|
|
||||||
<table class="table table-sm o_main_table mt-4" style="border: 1px solid black;">
|
<table class="table table-sm o_main_table mt-4" style="border: 1px solid black;">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 15%; border: 1px solid black;"><strong>产品名称:</strong></td>
|
<td style="width: 15%; border: 1px solid black;"><strong>产品名称:</strong></td>
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
<td style="border: 1px solid black;"><span t-field="o.check_qty"/></td>
|
<td style="border: 1px solid black;"><span t-field="o.check_qty"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h4 class="text-center mt-4">检验结果</h4>
|
<h4 class="text-center mt-4">检验结果</h4>
|
||||||
<div class="" style="position: relative;">
|
<div class="" style="position: relative;">
|
||||||
<table class="table table-sm mt-2" style="border: 1px solid black;">
|
<table class="table table-sm mt-2" style="border: 1px solid black;">
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mt-4">
|
<div class="row mt-4">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<p><strong>操作员: </strong> <span t-field="o.measure_operator"/></p>
|
<p><strong>操作员: </strong> <span t-field="o.measure_operator"/></p>
|
||||||
@@ -200,7 +200,7 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<!-- 页脚固定在底部 -->
|
<!-- 页脚固定在底部 -->
|
||||||
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
|
<!-- <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"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user