Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: plant floor design changes #43382

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 8 additions & 0 deletions erpnext/manufacturing/doctype/bom_creator/bom_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"stock_uom",
"conversion_factor",
"do_not_explode",
"operation",
]


Expand Down Expand Up @@ -64,6 +65,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 @@ -409,6 +411,11 @@ def create_bom(self, row, production_item_wise_rm):
},
)

elif row.item_code == self.item_code and self.routing:
bom.routing = self.routing
bom.with_operations = 1
bom.transfer_material_against = "Work Order"

for field in BOM_FIELDS:
if self.get(field):
bom.set(field, self.get(field))
Expand Down Expand Up @@ -595,6 +602,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
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
Loading