diff --git a/jikimo_account_process/__manifest__.py b/jikimo_account_process/__manifest__.py index f701deb7..0c1b521c 100644 --- a/jikimo_account_process/__manifest__.py +++ b/jikimo_account_process/__manifest__.py @@ -3,8 +3,8 @@ 'name': "jikimo_account_process", 'summary': """ - Short (1 phrase/line) summary of the module's purpose, used as - subtitle on modules listing or apps.openerp.com""", + 处理会计凭证生成重复名称报错问题 + """, 'description': """ Long description of module's purpose diff --git a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css index df6cdfb6..edaa2bb4 100644 --- a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css +++ b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css @@ -1,41 +1,99 @@ -.zoomed { - position: fixed !important; - top: 50%; - left: 50%; - transform: translate(-50%, -50%) scale(10); + +.processing-capabilities-grid { + display: grid; + grid-template-columns: repeat(6, 1fr); + gap: 10px; + width: 100%; } -.many2many_flex { - display: flex; +.grid-item { + display: flex; + align-items: center; } -.many2many_flex>div { - margin-right: 15px; - display: flex; - flex-direction: column; - align-items: center; +.item-content { + display: flex; + flex-direction: column; + align-items: center; + text-align: center; +} +/*控制图片大小*/ +.item-icon { + width: 50px; + height: 50px; + margin-bottom: 5px; } -.many2many_flex>div>:nth-child(2) { - position: relative; +.item-label { + font-size: 12px; + word-break: break-word; } -.close { - width: 20px; - height: 20px; - position: absolute; - top: -8.8px; - right: -8.8px; - color: #fff; - background-color: #000; - opacity: 0; - text-align: center; - line-height: 20px; - font-size: 18px; +@media (max-width: 1200px) { + .processing-capabilities-grid { + grid-template-columns: repeat(4, 1fr); + } } -.img_close { - opacity: 1; - transform: scale(0.1); - cursor: pointer; +@media (max-width: 768px) { + .processing-capabilities-grid { + grid-template-columns: repeat(3, 1fr); + } +} + +@media (max-width: 480px) { + .processing-capabilities-grid { + grid-template-columns: repeat(2, 1fr); + } +} +.image-preview-container { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.9); + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; + opacity: 0; + transition: opacity 0.3s ease; +} + +.image-preview-container.show { + opacity: 1; +} + +.image-preview { + max-width: 90%; + max-height: 90%; + object-fit: contain; + box-shadow: 0 0 20px rgba(255, 255, 255, 0.2); + border-radius: 5px; + transform: scale(0.9); + transition: transform 0.3s ease; +} + +.image-preview-container.show .image-preview { + transform: scale(1); +} + +.image-preview-close { + position: absolute; + top: 20px; + right: 30px; + color: #fff; + font-size: 40px; + font-weight: bold; + transition: 0.3s; + cursor: pointer; + opacity: 0.7; +} + +.image-preview-close:hover, +.image-preview-close:focus { + opacity: 1; + text-decoration: none; + cursor: pointer; } \ No newline at end of file diff --git a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js index a3053b72..dee78c5f 100644 --- a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js +++ b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js @@ -4,35 +4,57 @@ import {Many2ManyCheckboxesField} from "@web/views/fields/many2many_checkboxes/m import {registry} from "@web/core/registry"; export class MyCustomWidget extends Many2ManyCheckboxesField { - // 你可以重写或者添加一些方法和属性 - // 例如,你可以重写setup方法来添加一些事件监听器或者初始化一些变量 setup() { - super.setup(); // 调用父类的setup方法 - // 你自己的代码 + super.setup(); } - onImageClick(event) { - // 放大图片逻辑 - // 获取图片元素 - const img = event.target; - const close = img.nextSibling; + onImageClick(event, src) { + event.preventDefault(); + event.stopPropagation(); - // 实现放大图片逻辑 - // 比如使用 CSS 放大 - img.parentElement.classList.add('zoomed'); - close.classList.add('img_close'); - } + // 创建预览框 + const previewContainer = document.createElement('div'); + previewContainer.className = 'image-preview-container'; - onCloseClick(event) { - const close = event.target; - const img = close.previousSibling; - img.parentElement.classList.remove('zoomed'); - close.classList.remove('img_close'); + const previewImg = document.createElement('img'); + previewImg.src = src; + previewImg.className = 'image-preview'; + // 设置放大的预览图片大小 + previewImg.style.width = '600px'; + previewImg.style.height = 'auto'; // 保持宽高比 + + const closeButton = document.createElement('span'); + closeButton.innerHTML = '×'; + closeButton.className = 'image-preview-close'; + + previewContainer.appendChild(previewImg); + previewContainer.appendChild(closeButton); + document.body.appendChild(previewContainer); + + // 添加关闭预览的事件监听器 + const closePreview = () => { + previewContainer.classList.remove('show'); + setTimeout(() => { + document.body.removeChild(previewContainer); + }, 300); + }; + + closeButton.addEventListener('click', closePreview); + + // 点击预览框外部也可以关闭 + previewContainer.addEventListener('click', (e) => { + if (e.target === previewContainer) { + closePreview(); + } + }); + + // 使用 setTimeout 来触发过渡效果 + setTimeout(() => { + previewContainer.classList.add('show'); + }, 10); } } MyCustomWidget.template = "jikimo_frontend.MyCustomWidget"; -// MyCustomWidget.supportedTypes = ['many2many']; - -registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget); +registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget); \ No newline at end of file diff --git a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.xml b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.xml index bebae03b..9bb8797d 100644 --- a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.xml +++ b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.xml @@ -2,27 +2,22 @@ -
+
-
+
- - +
+ + +
-
- - -
×
-
-
-
- + \ No newline at end of file diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index d7e6414c..8eb76259 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -108,6 +108,10 @@ td.o_required_modifier { } .color_3 { + background-color: #808080; +} + +.color_4 { background-color: rgb(255, 150, 0); } diff --git a/jikimo_frontend/views/bye_odoo.xml b/jikimo_frontend/views/bye_odoo.xml index 14fd211b..d75ddd06 100644 --- a/jikimo_frontend/views/bye_odoo.xml +++ b/jikimo_frontend/views/bye_odoo.xml @@ -16,7 +16,7 @@ diff --git a/sf_base/views/base_view.xml b/sf_base/views/base_view.xml index a41d3a2b..8127efb7 100644 --- a/sf_base/views/base_view.xml +++ b/sf_base/views/base_view.xml @@ -109,7 +109,7 @@ form.sf.machine_tool.type sf.machine_tool.type -
+

@@ -129,31 +129,28 @@ - +
- + + + + - - - - - - + +
- + - - - + + + - - + +
@@ -178,7 +175,7 @@

- +
-
-
-
+
+
+
+

- + t-attf-class="#{record.run_status.raw_value == '运行中' ? 'font_color_1' : ''} + #{record.run_status.raw_value == '待机' ? 'font_color_4' : ''} + #{record.run_status.raw_value == '故障' ? 'font_color_2' : ''} + #{record.run_status.raw_value == '离线' ? 'font_color_3' : ''}"> +

diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 59ce68ab..da54f77b 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -296,8 +296,13 @@ class MrpProduction(models.Model): # 编程单更新 def update_programming_state(self): try: + manufacturing_type = 'rework' + if self.is_scrap: + manufacturing_type = 'scrap' + elif self.tool_state == '2': + manufacturing_type = 'invalid_tool_rework' res = {'programming_no': self.programming_no, - 'manufacturing_type': 'rework' if self.is_scrap is False else 'scrap'} + 'manufacturing_type': manufacturing_type} logging.info('res=%s:' % res) configsettings = self.env['res.config.settings'].get_values() config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key']) diff --git a/sf_manufacturing/models/mrp_workcenter.py b/sf_manufacturing/models/mrp_workcenter.py index 81a252fb..27fdb37c 100644 --- a/sf_manufacturing/models/mrp_workcenter.py +++ b/sf_manufacturing/models/mrp_workcenter.py @@ -1,4 +1,5 @@ import datetime +import logging from datetime import timedelta, time from collections import defaultdict from odoo import fields, models, api @@ -6,6 +7,8 @@ from odoo.addons.resource.models.resource import Intervals from odoo.exceptions import UserError, ValidationError import math +_logger = logging.getLogger(__name__) + class ResWorkcenter(models.Model): _name = "mrp.workcenter" @@ -225,12 +228,16 @@ class ResWorkcenter(models.Model): if plan_ids: sum_qty = sum([p.product_qty for p in plan_ids]) date_planned_working_hours = self._compute_effective_working_hours_day1(date_planned) - if sum_qty >= date_planned_working_hours: + default_capacity = round( + self.production_line_hour_capacity * date_planned_working_hours, 2) + _logger.info('排程日期:%s,计划数量:%s,日产能:%s,日工时:%s' % ( + date_planned, sum_qty, default_capacity, date_planned_working_hours)) + if sum_qty >= default_capacity: return False return True # 处理排程是否超过小时产能 - def deal_available_single_machine_capacity(self, date_planned): + def deal_available_single_machine_capacity(self, date_planned, count): date_planned_start = date_planned.strftime('%Y-%m-%d %H:00:00') date_planned_end = date_planned + timedelta(hours=1) @@ -242,7 +249,11 @@ class ResWorkcenter(models.Model): if plan_ids: sum_qty = sum([p.product_qty for p in plan_ids]) - if sum_qty >= self.production_line_hour_capacity: + production_line_hour_capacity = self.production_line_hour_capacity + if sum_qty >= production_line_hour_capacity: + message = '当前计划开始时间不能预约排程,超过生产线小时产能(%d件)%d件' % ( + production_line_hour_capacity, count) + raise UserError(message) return False return True diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index a26b5236..e896ca40 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1197,8 +1197,8 @@ class ResMrpWorkOrder(models.Model): if record.is_rework is False: if not record.material_center_point: raise UserError("坯料中心点为空,请检查") - if record.X_deviation_angle <= 0: - raise UserError("X偏差角度小于等于0,请检查!本次计算的X偏差角度为:%s" % record.X_deviation_angle) + # if record.X_deviation_angle <= 0: + # raise UserError("X偏差角度小于等于0,请检查!本次计算的X偏差角度为:%s" % record.X_deviation_angle) record.process_state = '待加工' # record.write({'process_state': '待加工'}) record.production_id.process_state = '待加工' @@ -1826,6 +1826,11 @@ class WorkPieceDelivery(models.Model): return is_free else: raise UserError("接驳站暂未反馈站点实时状态,请稍后再试") + + def delivery_avg(self): + is_agv_task_dispatch = self.env['ir.config_parameter'].sudo().get_param('is_agv_task_dispatch') + if is_agv_task_dispatch: + self._delivery_avg() # 配送至avg小车 def _delivery_avg(self): @@ -1886,7 +1891,7 @@ class WorkPieceDelivery(models.Model): logging.info('delivery_item-name:%s' % delivery_item.name) delivery_item.write({ 'task_delivery_time': fields.Datetime.now(), - 'status': '待配送' + 'status': '已下发' }) if delivery_item.type == "上产线": delivery_item.workorder_id.write({'is_delivery': True}) diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index e74a4e50..670dea7c 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -562,7 +562,12 @@ - + +
+ 品牌: + +
+
规格: diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 3d0f8167..ef95a934 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -223,8 +223,27 @@ - - + + + + + + + + + + + + + + + + + + + + 计划加工时间 @@ -248,76 +285,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -332,10 +305,6 @@ - - - - @@ -574,9 +543,7 @@ - - - + @@ -605,33 +572,43 @@ - - - - -