Skip to content

Commit

Permalink
fix: plant floor design changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitwaghchaure committed Sep 26, 2024
1 parent a63dca0 commit 029511f
Show file tree
Hide file tree
Showing 13 changed files with 200 additions and 153 deletions.
65 changes: 3 additions & 62 deletions erpnext/manufacturing/doctype/bom_creator/bom_creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,69 +90,10 @@ frappe.ui.form.on("BOM Creator", {
},
{ fieldtype: "Section Break" },
{
label: __("Track Operations"),
fieldtype: "Check",
fieldname: "track_operations",
onchange: (r) => {
let track_operations = dialog.get_value("track_operations");
if (r.type === "input" && !track_operations) {
dialog.set_value("track_semi_finished_goods", 0);
}
},
},
{ fieldtype: "Column Break" },
{
label: __("Track Semi Finished Goods"),
fieldtype: "Check",
fieldname: "track_semi_finished_goods",
depends_on: "eval:doc.track_operations",
},
{
fieldtype: "Section Break",
label: __("Final Product Operation"),
depends_on: "eval:doc.track_semi_finished_goods",
},
{
label: __("Operation"),
fieldtype: "Link",
fieldname: "operation",
options: "Operation",
default: "Assembly",
mandatory_depends_on: "eval:doc.track_semi_finished_goods",
depends_on: "eval:doc.track_semi_finished_goods",
},
{
label: __("Operation Time (in mins)"),
fieldtype: "Float",
fieldname: "operation_time",
mandatory_depends_on: "eval:doc.track_semi_finished_goods",
depends_on: "eval:doc.track_semi_finished_goods",
},
{ fieldtype: "Column Break" },
{
label: __("Workstation Type"),
label: __("Routing"),
fieldtype: "Link",
fieldname: "workstation_type",
options: "Workstation",
depends_on: "eval:doc.track_semi_finished_goods",
},
{
label: __("Workstation"),
fieldtype: "Link",
fieldname: "workstation",
options: "Workstation",
depends_on: "eval:doc.track_semi_finished_goods",
get_query() {
let workstation_type = dialog.get_value("workstation_type");

if (workstation_type) {
return {
filters: {
workstation_type: dialog.get_value("workstation_type"),
},
};
}
},
fieldname: "routing",
options: "Routing",
},
],
primary_action_label: __("Create"),
Expand Down
15 changes: 14 additions & 1 deletion erpnext/manufacturing/doctype/bom_creator/bom_creator.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"qty",
"project",
"uom",
"section_break_xvld",
"routing",
"raw_materials_tab",
"currency_detail",
"rm_cost_as_per",
Expand Down Expand Up @@ -393,6 +395,17 @@
{
"fieldname": "column_break_buha",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_xvld",
"fieldtype": "Section Break",
"label": "Operations Routing"
},
{
"fieldname": "routing",
"fieldtype": "Link",
"label": "Routing",
"options": "Routing"
}
],
"hide_toolbar": 1,
Expand All @@ -404,7 +417,7 @@
"link_fieldname": "bom_creator"
}
],
"modified": "2024-09-20 09:05:52.945112",
"modified": "2024-09-26 17:07:32.111198",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Creator",
Expand Down
5 changes: 3 additions & 2 deletions erpnext/manufacturing/doctype/bom_creator/bom_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ class BOMCreator(Document):
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from frappe.types import DF

from erpnext.manufacturing.doctype.bom_creator_item.bom_creator_item import BOMCreatorItem
from frappe.types import DF

amended_from: DF.Link | None
backflush_from_wip_warehouse: DF.Check
Expand All @@ -64,6 +63,7 @@ class BOMCreator(Document):
raw_material_cost: DF.Currency
remarks: DF.TextEditor | None
rm_cost_as_per: DF.Literal["Valuation Rate", "Last Purchase Rate", "Price List"]
routing: DF.Link | None
set_rate_based_on_warehouse: DF.Check
skip_material_transfer: DF.Check
source_warehouse: DF.Link | None
Expand Down Expand Up @@ -595,6 +595,7 @@ def add_sub_assembly(**kwargs):
{
"item_code": row.item_code,
"qty": row.qty,
"operation": row.operation,
"fg_item": bom_item.item_code,
"uom": item_info.stock_uom,
"fg_reference_id": name,
Expand Down
7 changes: 7 additions & 0 deletions erpnext/manufacturing/doctype/plant_floor/plant_floor.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ frappe.ui.form.on("Plant Floor", {
refresh(frm) {
frm.trigger("prepare_stock_dashboard");
frm.trigger("prepare_workstation_dashboard");
frm.trigger("update_realtime_status");

if (!frm.is_new()) {
frm.trigger("add_workstation");
Expand All @@ -58,6 +59,12 @@ frappe.ui.form.on("Plant Floor", {
});
},

update_realtime_status(frm) {
frappe.realtime.on("update_workstation_status", (data) => {
frappe.visual_plant_floor.update_status(data);
});
},

prepare_stock_dashboard(frm) {
if (!frm.doc.warehouse) {
return;
Expand Down
2 changes: 1 addition & 1 deletion erpnext/manufacturing/doctype/plant_floor/plant_floor.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"hide_toolbar": 1,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-09-19 18:06:36.481625",
"modified": "2024-09-25 10:27:41.139634",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Plant Floor",
Expand Down
41 changes: 22 additions & 19 deletions erpnext/manufacturing/doctype/workstation/workstation.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ class WorkstationDashboard {
setup_menu_actions() {
let me = this;
this.job_cards.forEach((data) => {
me.menu_actions = me.$wrapper.find(`.menu-actions[data-job-card='${data.name}']`);
$(me.menu_actions).find(".btn-start").hide();
$(me.menu_actions).find(".btn-resume").hide();
$(me.menu_actions).find(".btn-pause").hide();
$(me.menu_actions).find(".btn-complete").hide();
me.menu_btns = me.$wrapper.find(`.job-card-link[data-name='${data.name}']`);

$(me.menu_btns).find(".btn-resume").hide();
$(me.menu_btns).find(".btn-pause").hide();
$(me.menu_btns).find(".btn-complete .btn").attr("disabled", true);

if (
data.for_quantity + data.process_loss_qty > data.total_completed_qty &&
Expand All @@ -203,15 +203,18 @@ class WorkstationDashboard {
!data.finished_good)
) {
if (!data.time_logs?.length) {
$(me.menu_actions).find(".btn-start").show();
$(me.menu_btns).find(".btn-start").show();
} else if (data.is_paused) {
$(me.menu_actions).find(".btn-resume").show();
$(me.menu_btns).find(".btn-start").hide();
$(me.menu_btns).find(".btn-resume").show();
} else if (data.for_quantity - data.manufactured_qty > 0) {
$(me.menu_btns).find(".btn-start").hide();
if (!data.is_paused) {
$(me.menu_actions).find(".btn-pause").show();
$(me.menu_btns).find(".btn-pause").show();
}

$(me.menu_actions).find(".btn-complete").show();
$(me.menu_btns).find(".btn-complete").show();
$(me.menu_btns).find(".btn-complete .btn").attr("disabled", false);
}
}
});
Expand Down Expand Up @@ -243,26 +246,26 @@ class WorkstationDashboard {
});

this.$wrapper.find(".btn-start").on("click", (e) => {
let job_card = $(e.currentTarget).closest("ul").attr("data-job-card");
let job_card = $(e.currentTarget).closest("div").attr("data-job-card");
this.start_job(job_card);
});

this.$wrapper.find(".btn-pause").on("click", (e) => {
let job_card = $(e.currentTarget).closest("ul").attr("data-job-card");
let job_card = $(e.currentTarget).closest("div").attr("data-job-card");
me.update_job_card(job_card, "pause_job", {
end_time: frappe.datetime.now_datetime(),
});
});

this.$wrapper.find(".btn-resume").on("click", (e) => {
let job_card = $(e.currentTarget).closest("ul").attr("data-job-card");
let job_card = $(e.currentTarget).closest("div").attr("data-job-card");
me.update_job_card(job_card, "resume_job", {
start_time: frappe.datetime.now_datetime(),
});
});

this.$wrapper.find(".btn-complete").on("click", (e) => {
let job_card = $(e.currentTarget).closest("ul").attr("data-job-card");
let job_card = $(e.currentTarget).closest("div").attr("data-job-card");
let for_quantity = $(e.currentTarget).attr("data-qty");
me.complete_job(job_card, for_quantity);
});
Expand Down Expand Up @@ -315,6 +318,12 @@ class WorkstationDashboard {
let me = this;

return [
{
label: __("Start Time"),
fieldname: "start_time",
fieldtype: "Datetime",
default: frappe.datetime.now_datetime(),
},
{
label: __("Employee"),
fieldname: "employee",
Expand All @@ -337,12 +346,6 @@ class WorkstationDashboard {
}
},
},
{
label: __("Start Time"),
fieldname: "start_time",
fieldtype: "Datetime",
default: frappe.datetime.now_datetime(),
},
{ fieldtype: "Section Break" },
{
label: __("Employees"),
Expand Down
10 changes: 9 additions & 1 deletion erpnext/manufacturing/doctype/workstation/workstation.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"workstation_name",
"workstation_type",
"plant_floor",
"disabled",
"column_break_3",
"production_capacity",
"warehouse",
Expand Down Expand Up @@ -240,13 +241,20 @@
"fieldname": "section_break_mqqv",
"fieldtype": "Section Break",
"hide_border": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
}
],
"hide_toolbar": 1,
"icon": "icon-wrench",
"idx": 1,
"image_field": "on_status_image",
"links": [],
"modified": "2024-06-20 14:17:13.806609",
"modified": "2024-09-26 13:41:12.279344",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Workstation",
Expand Down
Loading

0 comments on commit 029511f

Please sign in to comment.