Accept Merge Request #405: (feature/制造-计划优化 -> develop)
Merge Request: 调整菜单顺序等,优化gantt显示 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/405?initial=true
This commit is contained in:
@@ -264,11 +264,12 @@ div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > .
|
||||
}
|
||||
|
||||
div[class="o_content o_component_with_search_panel"] .o_kanban_card_content button {
|
||||
|
||||
left: -95px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//.o_kanban_renderer .o_kanban_record .o_kanban_record_bottom {
|
||||
// display: flex !important;
|
||||
// flex-direction: column;
|
||||
@@ -283,6 +284,7 @@ div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > .
|
||||
.o_kanban_renderer .o_kanban_record .o_kanban_record_bottom > div:nth-child(1) {
|
||||
margin-top: -5px;
|
||||
margin-bottom: 5px;
|
||||
|
||||
}
|
||||
|
||||
.text-bg-warning {
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
],
|
||||
'assets': {
|
||||
'web.assets_backend': [
|
||||
'sf_machine_connect/static/src/xml/barcode_button.xml',
|
||||
'sf_machine_connect/static/src/js/barcode_button.js',
|
||||
'sf_machine_connect/static/src/css/barcode_button.css',
|
||||
# 'sf_machine_connect/static/src/xml/barcode_button.xml',
|
||||
# 'sf_machine_connect/static/src/js/barcode_button.js',
|
||||
# 'sf_machine_connect/static/src/css/barcode_button.css',
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
'depends': ['sf_manufacturing'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/view.xml'
|
||||
'views/view.xml',
|
||||
# 'views/duration_view.xml'
|
||||
],
|
||||
|
||||
'assets': {
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import custom_plan
|
||||
# from . import duration
|
||||
|
||||
25
sf_plan/models/duration.py
Normal file
25
sf_plan/models/duration.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import json, requests
|
||||
from odoo import models, fields, api, _
|
||||
from datetime import datetime, timedelta
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
|
||||
class HoleDuration(models.Model):
|
||||
_name = 'hole.duration'
|
||||
_description = 'Hole Duration'
|
||||
|
||||
hole_diameter = fields.Selection([('3', '≤¢3'), ('6', '≤¢6'), ('10', '≤¢10'), ('12', '≤¢12'), ('16', '≤¢16'), ('25', '≤¢25')], string='孔径', required=True)
|
||||
name = fields.Char(string='名称', required=True, default='钻孔')
|
||||
hole_depth = fields.Selection([
|
||||
('10', '≤10'),
|
||||
('30', '≤30'),
|
||||
('50', '≤50'),
|
||||
('70', '≤70'),
|
||||
('90', '≤90'),
|
||||
('100', '≤100'),
|
||||
('120', '≤120'),
|
||||
('150', '≤150')], string='深度', required=True)
|
||||
working_hours = fields.Float(string='工时', required=True)
|
||||
hole_expansion = fields.Float(string='扩孔', required=True, default=0.6)
|
||||
52
sf_plan/views/duration_view.xml
Normal file
52
sf_plan/views/duration_view.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="hole_duration_tree" model="ir.ui.view">
|
||||
<field name="name">hole.duration.tree</field>
|
||||
<field name="model">hole.duration</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="孔加工">
|
||||
<field name="name"/>
|
||||
<field name="hole_diameter"/>
|
||||
<field name="hole_depth"/>
|
||||
<field name="working_hours"/>
|
||||
<field name="hole_expansion"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hole_duration_form" model="ir.ui.view">
|
||||
<field name="name">hole.duration.form</field>
|
||||
<field name="model">hole.duration</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="孔加工">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="hole_diameter"/>
|
||||
<field name="hole_depth"/>
|
||||
<field name="working_hours"/>
|
||||
<field name="hole_expansion"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hole_duration_action" model="ir.actions.act_window">
|
||||
<field name="name">孔加工</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hole.duration</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="hole_duration_menu"
|
||||
name="孔加工"
|
||||
sequence="900"
|
||||
action="hole_duration_action"
|
||||
parent="sf_production_plan_menu"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -128,7 +128,7 @@
|
||||
decoration-success="state == 'done'"
|
||||
progress_bar="name"
|
||||
form_view_id="sf_production_plan_form"
|
||||
default_scale="week"
|
||||
default_scale="day"
|
||||
scales="day,week,month,year"
|
||||
precision="{'day': 'hour:quarter', 'week': 'day:half', 'month': 'day', 'year': 'month:quarter'}">
|
||||
<field name="shift"/>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,69 @@
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
<!-- 隐藏讨论 -->
|
||||
<record id="mail.menu_root_discuss" model="ir.ui.menu">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
<!-- 调整采购菜单顺序 -->
|
||||
<record id="purchase.menu_purchase_root" model="ir.ui.menu">
|
||||
<field name="sequence" eval="33"/>
|
||||
</record>
|
||||
|
||||
<!-- 调整计划菜单顺序 -->
|
||||
<record id="sf_plan.sf_production_plan_menu" model="ir.ui.menu">
|
||||
<field name="sequence" eval="36"/>
|
||||
</record>
|
||||
|
||||
<!-- 调整制造菜单顺序 -->
|
||||
<record id="mrp.menu_mrp_root" model="ir.ui.menu">
|
||||
<field name="sequence" eval="39"/>
|
||||
</record>
|
||||
|
||||
<!-- 调整质量菜单顺序 -->
|
||||
<record id="quality_control.menu_quality_root" model="ir.ui.menu">
|
||||
<field name="sequence" eval="42"/>
|
||||
</record>
|
||||
|
||||
<!-- 调整设备菜单顺序 -->
|
||||
<record id="maintenance.menu_maintenance_title" model="ir.ui.menu">
|
||||
<field name="sequence" eval="45"/>
|
||||
</record>
|
||||
|
||||
<!-- 调整条码菜单顺序 -->
|
||||
<record id="stock_barcode.stock_barcode_menu" model="ir.ui.menu">
|
||||
<field name="sequence" eval="48"/>
|
||||
</record>
|
||||
|
||||
<!-- 调整库存菜单顺序 -->
|
||||
<record id="stock.menu_stock_root" model="ir.ui.menu">
|
||||
<field name="sequence" eval="51"/>
|
||||
</record>
|
||||
|
||||
<!-- 调整仪表板菜单顺序 -->
|
||||
<record id="spreadsheet_dashboard.spreadsheet_dashboard_menu_root" model="ir.ui.menu">
|
||||
<field name="sequence" eval="54"/>
|
||||
</record>
|
||||
|
||||
<!-- 调整开票菜单名字及顺序 -->
|
||||
<record id="account.menu_finance" model="ir.ui.menu">
|
||||
<field name="name">应收应付</field>
|
||||
<field name="sequence" eval="57"/>
|
||||
</record>
|
||||
<!-- 隐藏跟踪链 -->
|
||||
<record id="utm.menu_link_tracker_root" model="ir.ui.menu">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!-- <record id="mrp_workorder.menu_mrp_workorder_workcenter" model="ir.ui.menu"> -->
|
||||
<!-- <field name="name">工单计划</field> -->
|
||||
<!-- <field name="sequence" eval="300"/> -->
|
||||
<!-- <field name="parent_id" ref="sf_plan.sf_production_plan_menu"/> -->
|
||||
<!-- </record> -->
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
BIN
web_enterprise/static/img/jikimo_backgroud.png
Normal file
BIN
web_enterprise/static/img/jikimo_backgroud.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
@@ -684,10 +684,19 @@ export default AbstractRenderer.extend(WidgetAdapterMixin, {
|
||||
const stopDate = this.state.stopDate;
|
||||
let day = this.state.startDate;
|
||||
const dates = [];
|
||||
while (day <= stopDate) {
|
||||
dates.push(day);
|
||||
day = day.clone().add(1, token);
|
||||
const shift_time = 8;
|
||||
if (this.state.scale == "day") {
|
||||
while (day <= stopDate) {
|
||||
dates.push(day);
|
||||
day = day.clone().add(shift_time, token);
|
||||
}
|
||||
} else {
|
||||
while (day <= stopDate) {
|
||||
dates.push(day);
|
||||
day = day.clone().add(1, token);
|
||||
}
|
||||
}
|
||||
console.log(dates)
|
||||
return dates;
|
||||
},
|
||||
/**
|
||||
@@ -806,6 +815,7 @@ export default AbstractRenderer.extend(WidgetAdapterMixin, {
|
||||
* @override
|
||||
*/
|
||||
async _renderView() {
|
||||
console.log('this.state', this.state)
|
||||
const oldRowWidgets = Object.keys(this.rowWidgets).map((rowId) => {
|
||||
return this.rowWidgets[rowId];
|
||||
});
|
||||
|
||||
@@ -261,12 +261,18 @@ var GanttRow = Widget.extend({
|
||||
_adaptPills: function () {
|
||||
var self = this;
|
||||
var dateStartField = this.state.dateStartField;
|
||||
console.log("dateStartField",dateStartField)
|
||||
var dateStopField = this.state.dateStopField;
|
||||
console.log("dateStopField",dateStopField)
|
||||
var ganttStartDate = this.state.startDate;
|
||||
console.log("ganttStartDate",ganttStartDate)
|
||||
var ganttStopDate = this.state.stopDate;
|
||||
console.log("ganttStopDate",ganttStopDate)
|
||||
this.pills.forEach(function (pill) {
|
||||
var pillStartDate = self._convertToUserTime(pill[dateStartField]);
|
||||
console.log("pillStartDate",pillStartDate)
|
||||
var pillStopDate = self._convertToUserTime(pill[dateStopField]);
|
||||
console.log("pillStopDate",pillStopDate)
|
||||
if (pillStartDate < ganttStartDate) {
|
||||
pill.startDate = ganttStartDate;
|
||||
pill.disableStartResize = true;
|
||||
@@ -457,16 +463,50 @@ var GanttRow = Widget.extend({
|
||||
this.pills.forEach(function (pill) {
|
||||
let widthPill;
|
||||
let margin;
|
||||
const shift_time = 8;
|
||||
switch (self.state.scale) {
|
||||
case 'day':
|
||||
left = pill.startDate.diff(pill.startDate.clone().startOf('hour'), 'minutes');
|
||||
pill.leftMargin = (left / 60) * 100;
|
||||
// left = pill.startDate.diff(pill.startDate.clone().startOf('hour'), 'minutes');
|
||||
left = pill.startDate.diff(pill.startDate.clone().startOf('day'), 'minutes') % (shift_time * 60);
|
||||
|
||||
console.log('left', left)
|
||||
pill.leftMargin = (left / (shift_time * 60)) * 100;
|
||||
console.log('pill.leftMargin', pill.leftMargin)
|
||||
diff = pill.stopDate.diff(pill.startDate, 'minutes');
|
||||
var gapSize = pill.stopDate.diff(pill.startDate, 'hours') - 1; // Eventually compensate border(s) width
|
||||
widthPill = (diff / 60) * 100;
|
||||
console.log('diff', diff)
|
||||
var gapSize = pill.stopDate.diff(pill.startDate, 'hours') - shift_time; // Eventually compensate border(s) width
|
||||
console.log('gapSize', gapSize)
|
||||
widthPill = (diff / (shift_time * 60)) * 100;
|
||||
console.log('widthPill', widthPill)
|
||||
margin = pill.aggregatedPills ? 0 : 4;
|
||||
console.log('margin', margin)
|
||||
pill.width = gapSize > 0 ? `calc(${widthPill}% + ${gapSize}px - ${margin}px)` : `calc(${widthPill}% - ${margin}px)`;
|
||||
console.log('pill.width', pill.width)
|
||||
break;
|
||||
|
||||
// left = pill.startDate.diff(pill.startDate.clone().startOf('hour'), 'minutes');
|
||||
// console.log('left', left)
|
||||
// left = (left / (8 * 60)) * 100; // 修改这里,以8小时为单位
|
||||
// console.log('adjusted left', left)
|
||||
// pill.leftMargin = left;
|
||||
//
|
||||
// diff = pill.stopDate.diff(pill.startDate, 'minutes');
|
||||
// console.log('diff', diff)
|
||||
// diff = (diff / (8 * 60)) * 100; // 修改这里,以8小时为单位
|
||||
// console.log('adjusted diff', diff)
|
||||
//
|
||||
// var gapSize = pill.stopDate.diff(pill.startDate, 'hours') / 8 - 1; // 修改这里,以8小时为单位
|
||||
// console.log('gapSize', gapSize)
|
||||
//
|
||||
// widthPill = diff;
|
||||
// console.log('widthPill', widthPill)
|
||||
//
|
||||
// margin = pill.aggregatedPills ? 0 : 4;
|
||||
// console.log('margin', margin)
|
||||
//
|
||||
// pill.width = gapSize > 0 ? `calc(${widthPill}% + ${gapSize}px - ${margin}px)` : `calc(${widthPill}% - ${margin}px)`;
|
||||
// console.log('pill.width', pill.width)
|
||||
// break;
|
||||
case 'week':
|
||||
case 'month':
|
||||
left = pill.startDate.diff(pill.startDate.clone().startOf('day'), 'hours');
|
||||
@@ -666,21 +706,28 @@ var GanttRow = Widget.extend({
|
||||
* @private
|
||||
*/
|
||||
_insertIntoSlot: function () {
|
||||
console.log('this.slots', this.slots);
|
||||
var slotsToFill = this.slots;
|
||||
this.pills.forEach(function (currentPill) {
|
||||
var skippedSlots = [];
|
||||
slotsToFill.some(function (currentSlot) {
|
||||
console.log('currentPill.startDate1111111111', currentPill)
|
||||
// console.log('currentSlot.stop2222222222222', currentSlot.stop)
|
||||
var fitsInThisSlot = currentPill.startDate < currentSlot.stop;
|
||||
console.log('fitsInThisSlot', fitsInThisSlot)
|
||||
if (fitsInThisSlot) {
|
||||
currentSlot.pills.push(currentPill);
|
||||
console.log('currentSlot.pills', currentSlot.pills)
|
||||
} else {
|
||||
skippedSlots.push(currentSlot);
|
||||
console.log('skippedSlots', skippedSlots)
|
||||
}
|
||||
return fitsInThisSlot;
|
||||
});
|
||||
// Pills are sorted by start date, so any slot that was skipped
|
||||
// for this pill will not be suitable for any of the next pills
|
||||
slotsToFill = _.difference(slotsToFill, skippedSlots);
|
||||
console.log('slotsToFill', slotsToFill)
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -727,7 +774,7 @@ var GanttRow = Widget.extend({
|
||||
let index = 0;
|
||||
for (const date of this.viewInfo.slots) {
|
||||
const slotStart = date;
|
||||
const slotStop = date.clone().add(1, interval);
|
||||
const slotStop = date.clone().add(8, interval);
|
||||
const isToday = date.isSame(new Date(), 'day') && this.state.scale !== 'day';
|
||||
|
||||
let slotStyle = '';
|
||||
@@ -759,6 +806,7 @@ var GanttRow = Widget.extend({
|
||||
stop: slotStop,
|
||||
pills: [],
|
||||
});
|
||||
console.log('啊啊啊啊this啊啊啊啊.啊啊啊啊slots啊啊啊啊', this.slots)
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -76,8 +76,17 @@
|
||||
<div t-attf-class="col position-relative o_gantt_header_cell text-center p-2 #{isToday? 'o_gantt_today' : ''} ">
|
||||
<t t-if="widget.state.scale in formats" t-esc="slot.format(formats[widget.state.scale])"/>
|
||||
<small t-else="">
|
||||
<b t-esc="slot.format('k')"/>
|
||||
<span class="d-block d-xl-inline-block" t-esc="slot.format('a')"/>
|
||||
<t t-if="slot.format('k') == 24">
|
||||
<div>夜班</div>
|
||||
</t>
|
||||
<t t-if="slot.format('k') == 8">
|
||||
<div>早班</div>
|
||||
</t>
|
||||
<t t-if="slot.format('k') == 16">
|
||||
<div>晚班</div>
|
||||
</t>
|
||||
<!-- <b t-esc="slot.format('k')"/> -->
|
||||
<!-- <span class="d-block d-xl-inline-block" t-esc="slot.format('a')"/> -->
|
||||
</small>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user