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: warn on shipment line where quantity exceeds job quantity

Brad Barbin5a3cc31525b8
diff --git a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx
index a8d1db5720..28d3abd0d9 100644
--- a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx
+++ b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx
@@ -324,8 +324,19 @@ function ShipmentLineItem({
const splitDisclosure = useDisclosure();
const deleteDisclosure = useDisclosure();
+ // Check if shipped quantity exceeds job quantity for job fulfillments
+ const isJobOverShipped =
+ line.fulfillment?.type === "Job" &&
+ (line.shippedQuantity || 0) > (line.fulfillment?.job?.quantity || 0);
+
return (
- <div className={cn("flex flex-col border-b p-6 gap-6 relative", className)}>
+ <div
+ className={cn(
+ "flex flex-col border-b p-6 gap-6 relative",
+
+ className
+ )}
+ >
<div className="absolute top-6 right-6">
{line.fulfillment?.type === "Job" ? (
<div className="flex flex-col items-end gap-0">
@@ -396,8 +407,19 @@ function ShipmentLineItem({
<div className="flex flex-grow items-center justify-between gap-2 pl-4 w-1/2">
<HStack spacing={4}>
<VStack spacing={1}>
- <label className="text-xs text-muted-foreground">Shipped</label>
-
+ <div className="flex items-center justify-between gap-1 w-full">
+ <label className="text-xs text-muted-foreground">Shipped</label>
+ {isJobOverShipped && (
+ <Tooltip>
+ <TooltipTrigger>
+ <LuCircleAlert className="text-red-500" />
+ </TooltipTrigger>
+ <TooltipContent>
+ Shipped quantity exceeds job quantity
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </div>
<NumberField
value={line.shippedQuantity || 0}
onChange={(value) => {
@@ -424,7 +446,10 @@ function ShipmentLineItem({
}}
>
<NumberInput
- className="disabled:bg-transparent disabled:opacity-100 min-w-[100px]"
+ className={cn(
+ "disabled:bg-transparent disabled:opacity-100 min-w-[100px]",
+ isJobOverShipped && "border-red-500 border-2"
+ )}
isDisabled={
isReadOnly ||
(line.fulfillment?.type === "Job" &&
diff --git a/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx b/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx
index 19082df36b..8453e4e1a5 100644
--- a/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx
+++ b/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx
@@ -74,25 +74,7 @@ const ItemCostingForm = ({ initialValues }: ItemCostingFormProps) => {
helperText="Weighted average cost over last year calculated when the invoice is posted"
/>
- {/* <Number
- name="salesHistory"
- label="Sales History"
- formatOptions={{
- style: "currency",
- currency: baseCurrency,
-
- }}
- isReadOnly
- />
- <Number
- name="salesHistoryQty"
- label="Sales History Qty"
- formatOptions={{
- maximumSignificantDigits: 3,
- }}
- isReadOnly
- />
- <Boolean name="costIsAdjusted" label="Cost Is Adjusted" /> */}
+ {/* <Boolean name="costIsAdjusted" label="Cost Is Adjusted" /> */}
<CustomFormFields table="partCost" />
</div>
</CardContent>
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx
index 61b4a44d18..8968cd574f 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx
@@ -244,7 +244,7 @@ const SalesOrderLineForm = ({
<ModalCardBody>
<Hidden name="id" />
<Hidden name="salesOrderId" />
- <Hidden name="itemId" value={itemData?.itemId} />
+
{!isEditing && (
<Hidden
name="description"