Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: add notes on any produciton quantity (not just scrap)

Brad Barbin52030d11247a
diff --git a/apps/erp/app/modules/production/ui/Jobs/ProductionQuantityForm.tsx b/apps/erp/app/modules/production/ui/Jobs/ProductionQuantityForm.tsx
index 17822af4fe..1672130b10 100644
--- a/apps/erp/app/modules/production/ui/Jobs/ProductionQuantityForm.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/ProductionQuantityForm.tsx
@@ -78,11 +78,9 @@ const ProductionQuantityForm = ({
}
/>
{type === "Scrap" && (
- <>
- <ScrapReason name="scrapReasonId" label="Scrap Reason" />
- <TextArea name="notes" label="Notes" />
- </>
+ <ScrapReason name="scrapReasonId" label="Scrap Reason" />
)}
+ <TextArea name="notes" label="Notes" />
</VStack>
</DrawerBody>
<DrawerFooter>
diff --git a/apps/erp/app/routes/x+/job+/$jobId.quantities.$id.tsx b/apps/erp/app/routes/x+/job+/$jobId.quantities.$id.tsx
index bb4a3cd503..a4eb08737e 100644
--- a/apps/erp/app/routes/x+/job+/$jobId.quantities.$id.tsx
+++ b/apps/erp/app/routes/x+/job+/$jobId.quantities.$id.tsx
@@ -53,7 +53,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
// If the type is not Scrap, set the scrapReasonId and notes to null
if (data.type !== "Scrap") {
data.scrapReasonId = undefined;
- data.notes = undefined;
}
const update = await updateProductionQuantity(client, {
diff --git a/apps/mes/app/components/JobOperation.tsx b/apps/mes/app/components/JobOperation.tsx
index f5d8fcebbf..f31caf24d3 100644
--- a/apps/mes/app/components/JobOperation.tsx
+++ b/apps/mes/app/components/JobOperation.tsx
@@ -1535,10 +1535,10 @@ function QuantityModal({
const [quantity, setQuantity] = useState(type === "finish" ? 0 : 1);
const titleMap = {
- scrap: `Log Scrap for ${operation.itemReadableId}`,
- rework: `Log Rework for ${operation.itemReadableId}`,
- complete: `Log Completed for ${operation.itemReadableId}`,
- finish: `Close Out ${operation.itemReadableId}`,
+ scrap: `Log scrap for ${operation.itemReadableId}`,
+ rework: `Log rework for ${operation.itemReadableId}`,
+ complete: `Log completed for ${operation.itemReadableId}`,
+ finish: `Close out ${operation.itemReadableId}`,
};
const isOperationComplete =
@@ -1637,17 +1637,20 @@ function QuantityModal({
<TextArea label="Notes" name="notes" />
</>
) : (
- <NumberControlled
- name="totalQuantity"
- label="Total Quantity"
- value={
- quantity +
- (type === "rework"
- ? operation.quantityReworked
- : operation.quantityComplete)
- }
- isReadOnly
- />
+ <>
+ <NumberControlled
+ name="totalQuantity"
+ label="Total Quantity"
+ value={
+ quantity +
+ (type === "rework"
+ ? operation.quantityReworked
+ : operation.quantityComplete)
+ }
+ isReadOnly
+ />
+ <TextArea label="Notes" name="notes" />
+ </>
)}
</VStack>
</ModalBody>
diff --git a/apps/mes/app/services/models.ts b/apps/mes/app/services/models.ts
index 98671a9781..cfb2b18471 100644
--- a/apps/mes/app/services/models.ts
+++ b/apps/mes/app/services/models.ts
@@ -91,6 +91,7 @@ export const finishValidator = z.object({
export const nonScrapQuantityValidator = finishValidator.extend({
quantity: zfd.numeric(z.number().positive()),
+ notes: zfd.text(z.string().optional()),
});
export const scrapQuantityValidator = nonScrapQuantityValidator.extend({