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: ui for selecting shelf in bom

Brad Barbinc1560106f38a
diff --git a/apps/erp/app/modules/items/items.models.ts b/apps/erp/app/modules/items/items.models.ts
index 5fcfccb68b..04f0c4fc90 100644
--- a/apps/erp/app/modules/items/items.models.ts
+++ b/apps/erp/app/modules/items/items.models.ts
@@ -190,7 +190,7 @@ export const materialValidatorWithGeneratedIds = z.object({
});
export const methodMaterialValidator = z.object({
- id: zfd.text(z.string().optional()),
+ id: z.string().min(1, { message: "Material ID is required" }),
makeMethodId: z.string().min(1, { message: "Make method is required" }),
order: zfd.numeric(z.number().min(0)),
itemType: z.enum(methodItemType, {
@@ -211,7 +211,8 @@ export const methodMaterialValidator = z.object({
unitOfMeasureCode: z
.string()
.min(1, { message: "Unit of Measure is required" }),
- shelfId: z.string().optional().nullable(),
+ useDefaultShelf: zfd.checkbox(),
+ shelfId: zfd.text(z.string().optional()),
});
export const methodOperationValidator = z
diff --git a/apps/erp/app/modules/items/items.service.ts b/apps/erp/app/modules/items/items.service.ts
index f3a1e321c6..3564155c49 100644
--- a/apps/erp/app/modules/items/items.service.ts
+++ b/apps/erp/app/modules/items/items.service.ts
@@ -2382,12 +2382,12 @@ export async function upsertMethodMaterial(
client: SupabaseClient<Database>,
methodMaterial:
- | (Omit<z.infer<typeof methodMaterialValidator>, "id"> & {
+ | (z.infer<typeof methodMaterialValidator> & {
companyId: string;
createdBy: string;
customFields?: Json;
})
- | (Omit<z.infer<typeof methodMaterialValidator>, "id"> & {
+ | (z.infer<typeof methodMaterialValidator> & {
id: string;
updatedBy: string;
customFields?: Json;
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
index 629e9fa90d..933cdf42ad 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
@@ -17,6 +17,7 @@ import {
DropdownMenuTrigger,
HStack,
IconButton,
+ Label,
toast,
Tooltip,
TooltipContent,
@@ -33,12 +34,17 @@ import {
useSearchParams,
} from "@remix-run/react";
import { AnimatePresence, LayoutGroup, motion } from "framer-motion";
+import { nanoid } from "nanoid";
import type { Dispatch, SetStateAction } from "react";
import { useCallback, useEffect, useState } from "react";
import { flushSync } from "react-dom";
import {
LuChevronDown,
+ LuChevronRight,
+ LuCog,
LuExternalLink,
+ LuGitPullRequest,
+ LuGitPullRequestCreateArrow,
LuLock,
LuSettings2,
LuSquareFunction,
@@ -50,10 +56,10 @@ import type { Configuration } from "~/components/Configurator/types";
import {
DefaultMethodType,
Hidden,
- InputControlled,
Item,
Number,
Select,
+ Shelf,
Submit,
UnitOfMeasure,
} from "~/components/Form";
@@ -123,13 +129,14 @@ const initialMethodMaterial: Omit<Material, "makeMethodId" | "order"> & {
description: string;
} = {
itemId: "",
-
// @ts-expect-error
itemType: "Item" as const,
methodType: "Buy" as const,
description: "",
quantity: 1,
unitOfMeasureCode: "EA",
+ useDefaultShelf: true,
+ shelfId: undefined,
};
const BillOfMaterial = ({
@@ -213,48 +220,50 @@ const BillOfMaterial = ({
const onAddItem = () => {
if (isReadOnly) return;
- const temporaryId = Math.random().toString(16).slice(2);
- setSelectedItemId(temporaryId);
+ const materialId = nanoid();
+ setSelectedItemId(materialId);
let newOrder = 1;
if (materials.length) {
newOrder = Math.max(...materials.map((item) => item.data.order)) + 1;
}
+ const newMaterial: Material = {
+ ...initialMethodMaterial,
+ id: materialId,
+ order: newOrder,
+ makeMethodId,
+ };
+
setTemporaryItems((prev) => ({
...prev,
- [temporaryId]: {
- ...initialMethodMaterial,
- id: temporaryId,
- order: newOrder,
- makeMethodId,
- } as Material,
+ [materialId]: newMaterial,
}));
setOrderState((prev) => ({
...prev,
- [temporaryId]: newOrder,
+ [materialId]: newOrder,
}));
};
const onRemoveItem = async (id: string) => {
if (isReadOnly) return;
- if (isTemporaryId(id)) {
+ // Check if this is a temporary item (exists in temporaryItems state)
+ if (temporaryItems[id]) {
setTemporaryItems((prev) => {
const { [id]: _, ...rest } = prev;
return rest;
});
- return;
+ } else {
+ fetcher.submit(new FormData(), {
+ method: "post",
+ action: path.to.deleteMethodMaterial(id),
+ });
}
- fetcher.submit(new FormData(), {
- method: "post",
- action: path.to.deleteMethodMaterial(id),
- });
-
- // Optimistically remove from state
- setTemporaryItems((prev) => {
+ setSelectedItemId(null);
+ setOrderState((prev) => {
const { [id]: _, ...rest } = prev;
return rest;
});
@@ -285,7 +294,7 @@ const BillOfMaterial = ({
const updates = Object.entries(newOrderState).reduce<
Record<string, number>
>((acc, [id, order]) => {
- if (!isTemporaryId(id)) {
+ if (!temporaryItems[id]) {
acc[id] = order;
}
return acc;
@@ -423,8 +432,8 @@ const BillOfMaterial = ({
item={item}
methodOperations={operations}
orderState={orderState}
- rulesByField={rulesByField}
temporaryItems={temporaryItems}
+ rulesByField={rulesByField}
onConfigure={onConfigure}
setOrderState={setOrderState}
setSelectedItemId={setSelectedItemId}
@@ -500,7 +509,7 @@ const BillOfMaterial = ({
.map(
(m) => getItemReadableId(items, m.data.itemId) ?? ""
)
- .filter(Boolean),
+ .filter((i) => !!i),
},
})
}
@@ -533,15 +542,12 @@ const BillOfMaterial = ({
export default BillOfMaterial;
-function isTemporaryId(id: string) {
- return id.length < 20;
-}
-
function MaterialForm({
configurable,
isReadOnly,
item,
methodOperations,
+ temporaryItems,
rulesByField,
onConfigure,
setOrderState,
@@ -567,33 +573,21 @@ function MaterialForm({
const unitOfMeasures = useUnitOfMeasure();
+ const sourceDisclosure = useDisclosure({
+ defaultIsOpen: true,
+ });
+ const backflushDisclosure = useDisclosure();
+
useEffect(() => {
- // replace the temporary id with the actual id
+ // Remove from temporary items after successful submission
if (methodMaterialFetcher.data && methodMaterialFetcher.data.id) {
- if (isTemporaryId(item.id)) {
- setTemporaryItems((prev) => {
- const { [item.id]: _, ...rest } = prev;
- return rest;
- });
-
- setOrderState((prev) => {
- const order = prev[item.id];
- const { [item.id]: _, ...rest } = prev;
- return {
- ...rest,
- [methodMaterialFetcher.data!.id!]: order,
- };
- });
- }
- setSelectedItemId(null);
+ // Clear temporary item after successful save
+ setTemporaryItems((prev) => {
+ const { [item.id]: _, ...rest } = prev;
+ return rest;
+ });
}
- }, [
- item.id,
- methodMaterialFetcher.data,
- setTemporaryItems,
- setOrderState,
- setSelectedItemId,
- ]);
+ }, [item.id, methodMaterialFetcher.data, setTemporaryItems]);
const [itemType, setItemType] = useState<MethodItemType>(item.data.itemType);
const [itemData, setItemData] = useState<{
@@ -601,15 +595,21 @@ function MaterialForm({
methodType: MethodType;
description: string;
unitOfMeasureCode: string;
+ methodOperationId: string | undefined;
quantity: number;
kit: boolean;
+ useDefaultShelf: boolean;
+ shelfId: string | undefined;
}>({
itemId: item.data.itemId ?? "",
methodType: item.data.methodType ?? "Buy",
description: item.data.description ?? "",
unitOfMeasureCode: item.data.unitOfMeasureCode ?? "EA",
+ methodOperationId: item.data.methodOperationId ?? undefined,
quantity: item.data.quantity ?? 1,
kit: item.data.kit ?? false,
+ useDefaultShelf: item.data.useDefaultShelf ?? true,
+ shelfId: item.data.shelfId ?? undefined,
});
const onTypeChange = (value: MethodItemType | "Item") => {
@@ -623,6 +623,9 @@ function MaterialForm({
description: "",
unitOfMeasureCode: "EA",
kit: false,
+ useDefaultShelf: true,
+ shelfId: undefined,
+ methodOperationId: undefined,
});
};
@@ -665,20 +668,15 @@ function MaterialForm({
return (
<ValidatedForm
action={
- isTemporaryId(item.id)
+ temporaryItems[item.id]
? path.to.newMethodMaterial
: path.to.methodMaterial(item.id!)
}
method="post"
defaultValues={item.data}
validator={methodMaterialValidator}
- className="w-full py-2"
+ className="w-full flex flex-col gap-y-4"
fetcher={methodMaterialFetcher}
- onSubmit={() => {
- if (!isTemporaryId(item.id)) {
- setSelectedItemId(null);
- }
- }}
>
<div>
<Hidden name="id" />
@@ -686,193 +684,267 @@ function MaterialForm({
<Hidden name="order" />
<Hidden name="kit" value={itemData.kit.toString()} />
</div>
- <VStack>
- <div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3">
- <Item
- disabledItems={[params.itemId!]}
- name="itemId"
- label={itemType}
- includeInactive
- type={itemType}
- validItemTypes={["Consumable", "Material", "Part"]}
- isConfigured={rulesByField.has(key("itemId"))}
- onChange={(value) => {
- onItemChange(value?.value as string);
- }}
- onConfigure={
- configurable && !isTemporaryId(item.id)
- ? () =>
- onConfigure({
- label: "Part",
- field: key("itemId"),
- code: rulesByField.get(key("itemId"))?.code,
- defaultValue: itemData.itemId,
- returnType: {
- type: "text",
- helperText:
- "the unique item identifier of the item (not the part number). you can get the item id from the key icon in the properties panel.",
- },
- })
- : undefined
- }
- onTypeChange={onTypeChange}
- />
- <InputControlled
- name="description"
- label="Description"
- isDisabled
- value={itemData.description}
- isConfigured={rulesByField.has(key("description"))}
- onConfigure={
- configurable && !isTemporaryId(item.id)
- ? () =>
- onConfigure({
- label: "Description",
- field: key("description"),
- code: rulesByField.get(key("description"))?.code,
- defaultValue: itemData.description,
- returnType: {
- type: "text",
- },
- })
- : undefined
- }
- onChange={(newValue) => {
- setItemData((d) => ({ ...d, description: newValue }));
- }}
- />
- <Select
- name="methodOperationId"
- label="Operation"
- isOptional
- options={methodOperations.map((o) => ({
- value: o.id!,
- label: o.description,
- }))}
- />
-
- <DefaultMethodType
- name="methodType"
- label="Method Type"
- value={itemData.methodType}
- isConfigured={rulesByField.has(key("methodType"))}
- onConfigure={
- configurable && !isTemporaryId(item.id)
- ? () =>
- onConfigure({
- label: "Method Type",
- field: key("methodType"),
- code: rulesByField.get(key("methodType"))?.code,
- defaultValue: itemData.methodType,
- returnType: {
- type: "enum",
- listOptions: methodType,
- },
- })
- : undefined
- }
- replenishmentSystem="Buy and Make"
- />
- <Number
- name="quantity"
- label="Quantity"
- isConfigured={rulesByField.has(key("quantity"))}
- onConfigure={
- configurable && !isTemporaryId(item.id)
- ? () =>
- onConfigure({
- label: "Quantity",
- field: key("quantity"),
- code: rulesByField.get(key("quantity"))?.code,
- defaultValue: itemData.quantity,
- returnType: { type: "numeric" },
- })
- : undefined
- }
- />
- <UnitOfMeasure
- name="unitOfMeasureCode"
- value={itemData.unitOfMeasureCode}
- onChange={(newValue) =>
- setItemData((d) => ({
- ...d,
- unitOfMeasureCode: newValue?.value ?? "EA",
- }))
- }
- isConfigured={rulesByField.has(key("unitOfMeasureCode"))}
- onConfigure={
- configurable && !isTemporaryId(item.id)
- ? () =>
- onConfigure({
- label: "Unit of Measure",
- field: key("unitOfMeasureCode"),
- code: rulesByField.get(key("unitOfMeasureCode"))?.code,
- defaultValue: itemData.unitOfMeasureCode,
- returnType: {
- type: "enum",
- listOptions: unitOfMeasures.map((u) => u.value),
- },
- })
- : undefined
- }
- />
- </div>
- <motion.div
- className="flex flex-1 items-center justify-end w-full pt-2"
- initial={{ opacity: 0, filter: "blur(4px)" }}
- animate={{ opacity: 1, filter: "blur(0px)" }}
- transition={{
- type: "spring",
- bounce: 0,
- duration: 0.55,
+ <div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3">
+ <Item
+ disabledItems={[params.itemId!]}
+ name="itemId"
+ label={itemType}
+ includeInactive
+ type={itemType}
+ validItemTypes={["Consumable", "Material", "Part"]}
+ isConfigured={rulesByField.has(key("itemId"))}
+ onChange={(value) => {
+ onItemChange(value?.value as string);
}}
- >
- <motion.div
- layout
- className="flex items-center justify-between gap-2 w-full"
- >
- {itemData.methodType === "Make" ? (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- leftIcon={<MethodIcon type={"Make"} isKit={itemData.kit} />}
- variant="secondary"
- size="sm"
- rightIcon={<LuChevronDown />}
- >
- {itemData.kit ? "Kit" : "Subassembly"}
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent>
- <DropdownMenuRadioGroup
- value={itemData.kit ? "Kit" : "Subassembly"}
- onValueChange={(value) => {
- setItemData((d) => ({
- ...d,
- kit: value === "Kit",
- }));
- }}
- >
- <DropdownMenuRadioItem value="Subassembly">
- Subassembly
- </DropdownMenuRadioItem>
- <DropdownMenuRadioItem value="Kit">
- Kit
- </DropdownMenuRadioItem>
- </DropdownMenuRadioGroup>
- </DropdownMenuContent>
- </DropdownMenu>
- ) : (
- <div />
- )}
+ onConfigure={
+ configurable && !temporaryItems[item.id]
+ ? () =>
+ onConfigure({
+ label: "Part",
+ field: key("itemId"),
+ code: rulesByField.get(key("itemId"))?.code,
+ defaultValue: itemData.itemId,
+ returnType: {
+ type: "text",
+ helperText:
+ "the unique item identifier of the item (not the part number). you can get the item id from the key icon in the properties panel.",
+ },
+ })
+ : undefined
+ }
+ onTypeChange={onTypeChange}
+ />
+ <Number
+ name="quantity"
+ label="Quantity"
+ isConfigured={rulesByField.has(key("quantity"))}
+ onConfigure={
+ configurable && !temporaryItems[item.id]
+ ? () =>
+ onConfigure({
+ label: "Quantity",
+ field: key("quantity"),
+ code: rulesByField.get(key("quantity"))?.code,
+ defaultValue: itemData.quantity,
+ returnType: { type: "numeric" },
+ })
+ : undefined
+ }
+ />
+ <UnitOfMeasure
+ name="unitOfMeasureCode"
+ value={itemData.unitOfMeasureCode}
+ onChange={(newValue) =>
+ setItemData((d) => ({
+ ...d,
+ unitOfMeasureCode: newValue?.value ?? "EA",
+ }))
+ }
+ isReadOnly={true}
+ isConfigured={rulesByField.has(key("unitOfMeasureCode"))}
+ onConfigure={
+ configurable && !temporaryItems[item.id]
+ ? () =>
+ onConfigure({
+ label: "Unit of Measure",
+ field: key("unitOfMeasureCode"),
+ code: rulesByField.get(key("unitOfMeasureCode"))?.code,
+ defaultValue: itemData.unitOfMeasureCode,
+ returnType: {
+ type: "enum",
+ listOptions: unitOfMeasures.map((u) => u.value),
+ },
+ })
+ : undefined
+ }
+ />
+ </div>
+ {itemData.methodType !== "Make" && (
+ <>
+ <div className="border border-border rounded-md shadow-sm p-4 flex flex-col gap-4 w-full">
+ <HStack
+ className="w-full justify-between cursor-pointer"
+ onClick={sourceDisclosure.onToggle}
+ >
+ <HStack>
+ <LuGitPullRequest />
+ <Label>Pull From</Label>
+ </HStack>
+ <HStack>
+ <Badge variant="secondary">
+ <MethodIcon
+ type={itemData.methodType}
+ className="size-3 mr-1"
+ />
+ {itemData.methodType}
+ </Badge>
+ <Badge variant="secondary">
+ <LuGitPullRequest className="size-3 mr-1" />
+ Default Shelf
+ </Badge>
+ <IconButton
+ icon={<LuChevronRight />}
+ aria-label={
+ sourceDisclosure.isOpen
+ ? "Collapse Source"
+ : "Expand Source"
+ }
+ variant="ghost"
+ onClick={(e) => {
+ e.stopPropagation();
+ sourceDisclosure.onToggle();
+ }}
+ className={`transition-transform ${
+ sourceDisclosure.isOpen ? "rotate-90" : ""
+ }`}
+ />
+ </HStack>
+ </HStack>
+ <div
+ className={`grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3 pb-4 ${
+ sourceDisclosure.isOpen ? "" : "hidden"
+ }`}
+ >
+ <DefaultMethodType
+ name="methodType"
+ label="Method Type"
+ value={itemData.methodType}
+ isConfigured={rulesByField.has(key("methodType"))}
+ onConfigure={
+ configurable && !temporaryItems[item.id]
+ ? () =>
+ onConfigure({
+ label: "Method Type",
+ field: key("methodType"),
+ code: rulesByField.get(key("methodType"))?.code,
+ defaultValue: itemData.methodType,
+ returnType: {
+ type: "enum",
+ listOptions: methodType,
+ },
+ })
+ : undefined
+ }
+ replenishmentSystem="Buy and Make"
+ />
- <div className="flex items-center gap-2">
- <Submit isDisabled={isReadOnly}>Save</Submit>
+ <Shelf name="shelfId" label="Shelf" isOptional />
</div>
- </motion.div>
+ </div>
+
+ <div className="border border-border rounded-md shadow-sm p-4 flex flex-col gap-4 w-full">
+ <HStack
+ className="w-full justify-between cursor-pointer"
+ onClick={backflushDisclosure.onToggle}
+ >
+ <HStack>
+ <LuGitPullRequestCreateArrow />
+ <Label>Backflush</Label>
+ </HStack>
+ <HStack>
+ <Badge
+ variant={
+ methodOperations.length > 0 ? "secondary" : "destructive"
+ }
+ >
+ <LuCog className="size-3 mr-1" />
+ {itemData.methodOperationId
+ ? methodOperations.find(
+ (o) => o.id === itemData.methodOperationId
+ )?.description || "Selected Operation"
+ : "First Operation"}
+ </Badge>
+ <IconButton
+ icon={<LuChevronRight />}
+ aria-label={
+ backflushDisclosure.isOpen
+ ? "Collapse Backflush"
+ : "Expand Backflush"
+ }
+ variant="ghost"
+ size="md"
+ onClick={(e) => {
+ e.stopPropagation();
+ backflushDisclosure.onToggle();
+ }}
+ className={`transition-transform ${
+ backflushDisclosure.isOpen ? "rotate-90" : ""
+ }`}
+ />
+ </HStack>
+ </HStack>
+ <div
+ className={`grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3 pb-4 ${
+ backflushDisclosure.isOpen ? "" : "hidden"
+ }`}
+ >
+ <Select
+ name="methodOperationId"
+ label="Operation"
+ isOptional
+ options={methodOperations.map((o) => ({
+ value: o.id!,
+ label: o.description,
+ }))}
+ />
+ </div>
+ </div>
+ </>
+ )}
+
+ <motion.div
+ className="flex flex-1 items-center justify-end w-full"
+ initial={{ opacity: 0, filter: "blur(4px)" }}
+ animate={{ opacity: 1, filter: "blur(0px)" }}
+ transition={{
+ type: "spring",
+ bounce: 0,
+ duration: 0.55,
+ }}
+ >
+ <motion.div
+ layout
+ className="flex items-center justify-between gap-2 w-full"
+ >
+ {itemData.methodType === "Make" ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ leftIcon={<MethodIcon type={"Make"} isKit={itemData.kit} />}
+ variant="secondary"
+ size="sm"
+ rightIcon={<LuChevronDown />}
+ >
+ {itemData.kit ? "Kit" : "Subassembly"}
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent>
+ <DropdownMenuRadioGroup
+ value={itemData.kit ? "Kit" : "Subassembly"}
+ onValueChange={(value) => {
+ setItemData((d) => ({
+ ...d,
+ kit: value === "Kit",
+ }));
+ }}
+ >
+ <DropdownMenuRadioItem value="Subassembly">
+ Subassembly
+ </DropdownMenuRadioItem>
+ <DropdownMenuRadioItem value="Kit">Kit</DropdownMenuRadioItem>
+ </DropdownMenuRadioGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : (
+ <div />
+ )}
+
+ <div className="flex items-center gap-2">
+ <Submit isDisabled={isReadOnly}>Save</Submit>
+ </div>
</motion.div>
- </VStack>
+ </motion.div>
</ValidatedForm>
);
}
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
index 87c8544ae8..42c1e7d30a 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -13,6 +13,7 @@ import {
CardContent,
CardHeader,
CardTitle,
+ cn,
Count,
DropdownMenu,
DropdownMenuContent,
@@ -22,17 +23,16 @@ import {
IconButton,
Label,
Loading,
+ toast,
ToggleGroup,
ToggleGroupItem,
Tooltip,
TooltipContent,
TooltipTrigger,
- VStack,
- cn,
- toast,
useDebounce,
useDisclosure,
useThrottle,
+ VStack,
} from "@carbon/react";
import { Editor, generateHTML } from "@carbon/react/Editor";
import { formatRelativeTime } from "@carbon/utils";
@@ -1236,7 +1236,7 @@ function OperationForm({
setupDisclosure.isOpen ? "Collapse Setup" : "Expand Setup"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
setupDisclosure.onToggle();
@@ -1347,7 +1347,7 @@ function OperationForm({
laborDisclosure.isOpen ? "Collapse Labor" : "Expand Labor"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
laborDisclosure.onToggle();
@@ -1459,7 +1459,7 @@ function OperationForm({
: "Expand Machine"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
machineDisclosure.onToggle();
@@ -1572,7 +1572,7 @@ function OperationForm({
: "Expand Procedure"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
procedureDisclosure.onToggle();
diff --git a/apps/erp/app/modules/production/production.models.ts b/apps/erp/app/modules/production/production.models.ts
index c4478b121f..e8a003d093 100644
--- a/apps/erp/app/modules/production/production.models.ts
+++ b/apps/erp/app/modules/production/production.models.ts
@@ -556,7 +556,7 @@ export const jobOperationValidatorForReleasedJob = baseJobOperationValidator
);
const baseMaterialValidator = z.object({
- id: zfd.text(z.string().optional()),
+ id: z.string().min(1, { message: "Material ID is required" }),
description: z.string().min(1, { message: "Description is required" }),
jobMakeMethodId: z.string().min(1, { message: "Make method is required" }),
itemType: z.enum(methodItemType, {
diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.ts
index 864226de08..1898c2cc9d 100644
--- a/apps/erp/app/modules/production/production.service.ts
+++ b/apps/erp/app/modules/production/production.service.ts
@@ -1635,22 +1635,21 @@ export async function upsertJob(
export async function upsertJobMaterial(
client: SupabaseClient<Database>,
jobMaterial:
- | (Omit<z.infer<typeof jobMaterialValidator>, "id"> & {
+ | (z.infer<typeof jobMaterialValidator> & {
jobId: string;
jobOperationId?: string;
companyId: string;
createdBy: string;
customFields?: Json;
})
- | (Omit<z.infer<typeof jobMaterialValidator>, "id"> & {
- id: string;
+ | (z.infer<typeof jobMaterialValidator> & {
jobId: string;
jobOperationId?: string;
updatedBy: string;
customFields?: Json;
})
) {
- if ("id" in jobMaterial) {
+ if ("updatedBy" in jobMaterial) {
return client
.from("jobMaterial")
.update(sanitize(jobMaterial))
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
index 68e335e1e2..d3590c0663 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
@@ -26,6 +26,7 @@ import {
import { getItemReadableId } from "@carbon/utils";
import { Link, useFetcher, useFetchers, useParams } from "@remix-run/react";
import { AnimatePresence, LayoutGroup, motion } from "framer-motion";
+import { nanoid } from "nanoid";
import type { Dispatch, SetStateAction } from "react";
import { useCallback, useEffect, useState } from "react";
import {
@@ -299,47 +300,50 @@ const JobBillOfMaterial = ({
const onAddItem = () => {
if (!permissions.can("update", "production") || isDisabled) return;
- const temporaryId = Math.random().toString(16).slice(2);
- setSelectedItemId(temporaryId);
+ const materialId = nanoid();
+ setSelectedItemId(materialId);
let newOrder = 1;
if (items.length) {
newOrder = Math.max(...items.map((item) => item.data.order)) + 1;
}
+ const newMaterial: Material = {
+ ...initialMethodMaterial,
+ id: materialId,
+ order: newOrder,
+ jobMakeMethodId,
+ };
+
setTemporaryItems((prev) => ({
...prev,
- [temporaryId]: {
- ...initialMethodMaterial,
- id: temporaryId,
- order: newOrder,
- jobMakeMethodId,
- } as Material,
+ [materialId]: newMaterial,
}));
setOrderState((prev) => ({
...prev,
- [temporaryId]: newOrder,
+ [materialId]: newOrder,
}));
};
const onRemoveItem = async (id: string) => {
if (!permissions.can("update", "production") || isDisabled) return;
- if (isTemporaryId(id)) {
+ // Check if this is a temporary item (exists in temporaryItems state)
+ if (temporaryItems[id]) {
setTemporaryItems((prev) => {
const { [id]: _, ...rest } = prev;
return rest;
});
- return;
+ } else {
+ fetcher.submit(new FormData(), {
+ method: "post",
+ action: path.to.deleteJobMaterial(jobId, id),
+ });
}
- fetcher.submit(new FormData(), {
- method: "post",
- action: path.to.deleteJobMaterial(jobId, id),
- });
-
- setTemporaryItems((prev) => {
+ setSelectedItemId(null);
+ setOrderState((prev) => {
const { [id]: _, ...rest } = prev;
return rest;
});
@@ -358,7 +362,7 @@ const JobBillOfMaterial = ({
const updates = Object.entries(newOrderState).reduce<
Record<string, number>
>((acc, [id, order]) => {
- if (!isTemporaryId(id)) {
+ if (!temporaryItems[id]) {
acc[id] = order;
}
return acc;
@@ -433,7 +437,7 @@ const JobBillOfMaterial = ({
onClick={
isOpen
? () => {
- if (isTemporaryId(item.id)) {
+ if (temporaryItems[item.id]) {
setTemporaryItems((prev) => {
const { [item.id]: _, ...rest } = prev;
return rest;
@@ -577,10 +581,6 @@ const JobBillOfMaterial = ({
export default JobBillOfMaterial;
-function isTemporaryId(id: string) {
- return id.length < 20;
-}
-
function MaterialForm({
item,
isDisabled,
@@ -613,31 +613,15 @@ function MaterialForm({
const baseCurrency = company?.baseCurrencyCode ?? "USD";
useEffect(() => {
+ // Remove from temporary items after successful submission
if (methodMaterialFetcher.data && methodMaterialFetcher.data.id) {
- if (isTemporaryId(item.id)) {
- setTemporaryItems((prev) => {
- const { [item.id]: _, ...rest } = prev;
- return rest;
- });
-
- setOrderState((prev) => {
- const order = prev[item.id];
- const { [item.id]: _, ...rest } = prev;
- return {
- ...rest,
- [methodMaterialFetcher.data!.id!]: order,
- };
- });
- }
- setSelectedItemId(null);
+ // Clear temporary item after successful save
+ setTemporaryItems((prev) => {
+ const { [item.id]: _, ...rest } = prev;
+ return rest;
+ });
}
- }, [
- item.id,
- methodMaterialFetcher.data,
- setTemporaryItems,
- setOrderState,
- setSelectedItemId,
- ]);
+ }, [item.id, methodMaterialFetcher.data, setTemporaryItems]);
const [itemType, setItemType] = useState<MethodItemType>(item.data.itemType);
const [itemData, setItemData] = useState<{
@@ -722,7 +706,7 @@ function MaterialForm({
return (
<ValidatedForm
action={
- isTemporaryId(item.id)
+ temporaryItems[item.id]
? path.to.newJobMaterial(jobId)
: path.to.jobMaterial(jobId, item.id!)
}
@@ -736,11 +720,6 @@ function MaterialForm({
}
className="w-full"
fetcher={methodMaterialFetcher}
- onSubmit={() => {
- if (!isTemporaryId(item.id)) {
- setSelectedItemId(null);
- }
- }}
>
<Hidden name="id" />
<Hidden name="jobMakeMethodId" />
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
index 078f0cbd1c..9373d7068b 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
@@ -2278,7 +2278,7 @@ function OperationForm({
setupDisclosure.isOpen ? "Collapse Setup" : "Expand Setup"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
setupDisclosure.onToggle();
@@ -2356,7 +2356,7 @@ function OperationForm({
laborDisclosure.isOpen ? "Collapse Labor" : "Expand Labor"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
laborDisclosure.onToggle();
@@ -2436,7 +2436,7 @@ function OperationForm({
: "Expand Machine"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
machineDisclosure.onToggle();
@@ -2510,7 +2510,7 @@ function OperationForm({
: "Expand Costing"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
costingDisclosure.onToggle();
@@ -2601,7 +2601,7 @@ function OperationForm({
: "Expand Procedure"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
procedureDisclosure.onToggle();
diff --git a/apps/erp/app/modules/sales/sales.models.ts b/apps/erp/app/modules/sales/sales.models.ts
index 4dd5e2291e..c9de428cf8 100644
--- a/apps/erp/app/modules/sales/sales.models.ts
+++ b/apps/erp/app/modules/sales/sales.models.ts
@@ -213,7 +213,7 @@ export const quoteLineValidator = z.object({
export const quoteMaterialValidator = z
.object({
- id: zfd.text(z.string().optional()),
+ id: z.string().min(1, { message: "Material ID is required" }),
quoteMakeMethodId: z
.string()
.min(1, { message: "Make method is required" }),
diff --git a/apps/erp/app/modules/sales/sales.service.ts b/apps/erp/app/modules/sales/sales.service.ts
index 3f285bba11..755992e47d 100644
--- a/apps/erp/app/modules/sales/sales.service.ts
+++ b/apps/erp/app/modules/sales/sales.service.ts
@@ -2309,7 +2309,7 @@ export async function upsertQuoteLineMethod(
export async function upsertQuoteMaterial(
client: SupabaseClient<Database>,
quoteMaterial:
- | (Omit<z.infer<typeof quoteMaterialValidator>, "id"> & {
+ | (z.infer<typeof quoteMaterialValidator> & {
quoteId: string;
quoteLineId: string;
quoteOperationId?: string;
@@ -2317,8 +2317,7 @@ export async function upsertQuoteMaterial(
createdBy: string;
customFields?: Json;
})
- | (Omit<z.infer<typeof quoteMaterialValidator>, "id"> & {
- id: string;
+ | (z.infer<typeof quoteMaterialValidator> & {
quoteId: string;
quoteLineId: string;
quoteOperationId?: string;
@@ -2326,7 +2325,7 @@ export async function upsertQuoteMaterial(
customFields?: Json;
})
) {
- if ("id" in quoteMaterial) {
+ if ("updatedBy" in quoteMaterial) {
return client
.from("quoteMaterial")
.update(sanitize(quoteMaterial))
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
index 337ae539b0..09d8075ce9 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
@@ -27,6 +27,7 @@ import {
import { getItemReadableId } from "@carbon/utils";
import { Link, useFetcher, useFetchers, useParams } from "@remix-run/react";
import { AnimatePresence, LayoutGroup, motion } from "framer-motion";
+import { nanoid } from "nanoid";
import type { Dispatch, SetStateAction } from "react";
import { useCallback, useEffect, useState } from "react";
import {
@@ -306,48 +307,50 @@ const QuoteBillOfMaterial = ({
const onAddItem = () => {
if (!permissions.can("update", "sales") || isDisabled) return;
- const temporaryId = Math.random().toString(16).slice(2);
- setSelectedItemId(temporaryId);
+ const materialId = nanoid();
+ setSelectedItemId(materialId);
let newOrder = 1;
if (items.length) {
newOrder = Math.max(...items.map((item) => item.data.order)) + 1;
}
+ const newMaterial: Material = {
+ ...initialMethodMaterial,
+ id: materialId,
+ order: newOrder,
+ quoteMakeMethodId,
+ };
+
setTemporaryItems((prev) => ({
...prev,
- [temporaryId]: {
- ...initialMethodMaterial,
- id: temporaryId,
- order: newOrder,
- quoteMakeMethodId,
- } as Material,
+ [materialId]: newMaterial,
}));
setOrderState((prev) => ({
...prev,
- [temporaryId]: newOrder,
+ [materialId]: newOrder,
}));
};
const onRemoveItem = async (id: string) => {
if (!permissions.can("update", "sales") || isDisabled) return;
- if (isTemporaryId(id)) {
+ // Check if this is a temporary item (exists in temporaryItems state)
+ if (temporaryItems[id]) {
setTemporaryItems((prev) => {
const { [id]: _, ...rest } = prev;
return rest;
});
- return;
+ } else {
+ fetcher.submit(new FormData(), {
+ method: "post",
+ action: path.to.deleteQuoteMaterial(quoteId, lineId, id),
+ });
}
- fetcher.submit(new FormData(), {
- method: "post",
- action: path.to.deleteQuoteMaterial(quoteId, lineId, id),
- });
-
- // Optimistically remove from state
- setTemporaryItems((prev) => {
+ setSelectedItemId(null);
+ setOrderState((prev) => {
const { [id]: _, ...rest } = prev;
return rest;
});
@@ -382,7 +385,7 @@ const QuoteBillOfMaterial = ({
const updates = Object.entries(newOrderState).reduce<
Record<string, number>
>((acc, [id, order]) => {
- if (!isTemporaryId(id)) {
+ if (!temporaryItems[id]) {
acc[id] = order;
}
return acc;
@@ -572,10 +575,6 @@ const QuoteBillOfMaterial = ({
export default QuoteBillOfMaterial;
-function isTemporaryId(id: string) {
- return id.length < 20;
-}
-
function MaterialForm({
item,
isDisabled,
@@ -608,31 +607,15 @@ function MaterialForm({
const baseCurrency = company?.baseCurrencyCode ?? "USD";
useEffect(() => {
+ // Remove from temporary items after successful submission
if (methodMaterialFetcher.data && methodMaterialFetcher.data.id) {
- if (isTemporaryId(item.id)) {
- setTemporaryItems((prev) => {
- const { [item.id]: _, ...rest } = prev;
- return rest;
- });
-
- setOrderState((prev) => {
- const order = prev[item.id];
- const { [item.id]: _, ...rest } = prev;
- return {
- ...rest,
- [methodMaterialFetcher.data!.id!]: order,
- };
- });
- }
- setSelectedItemId(null);
+ // Clear temporary item after successful save
+ setTemporaryItems((prev) => {
+ const { [item.id]: _, ...rest } = prev;
+ return rest;
+ });
}
- }, [
- item.id,
- methodMaterialFetcher.data,
- setTemporaryItems,
- setOrderState,
- setSelectedItemId,
- ]);
+ }, [item.id, methodMaterialFetcher.data, setTemporaryItems]);
const [itemType, setItemType] = useState<MethodItemType>(item.data.itemType);
const [itemData, setItemData] = useState<{
@@ -708,7 +691,7 @@ function MaterialForm({
return (
<ValidatedForm
action={
- isTemporaryId(item.id)
+ temporaryItems[item.id]
? path.to.newQuoteMaterial(quoteId, lineId)
: path.to.quoteMaterial(quoteId, lineId, item.id!)
}
@@ -717,11 +700,6 @@ function MaterialForm({
validator={quoteMaterialValidator}
className="w-full"
fetcher={methodMaterialFetcher}
- onSubmit={() => {
- if (!isTemporaryId(item.id)) {
- setSelectedItemId(null);
- }
- }}
>
<Hidden name="id" />
<Hidden name="quoteMakeMethodId" />
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
index 83c5273bc7..707dc66645 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
@@ -13,6 +13,7 @@ import {
CardContent,
CardHeader,
CardTitle,
+ cn,
Count,
DropdownMenu,
DropdownMenuContent,
@@ -22,16 +23,15 @@ import {
IconButton,
Label,
Loading,
+ toast,
ToggleGroup,
ToggleGroupItem,
Tooltip,
TooltipContent,
TooltipTrigger,
- VStack,
- cn,
- toast,
useDebounce,
useDisclosure,
+ VStack,
} from "@carbon/react";
import { Editor, generateHTML } from "@carbon/react/Editor";
import { formatRelativeTime } from "@carbon/utils";
@@ -1987,7 +1987,7 @@ function OperationForm({
setupDisclosure.isOpen ? "Collapse Setup" : "Expand Setup"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
setupDisclosure.onToggle();
@@ -2064,7 +2064,7 @@ function OperationForm({
laborDisclosure.isOpen ? "Collapse Labor" : "Expand Labor"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
laborDisclosure.onToggle();
@@ -2144,7 +2144,7 @@ function OperationForm({
: "Expand Machine"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
machineDisclosure.onToggle();
@@ -2217,7 +2217,7 @@ function OperationForm({
: "Expand Costing"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
costingDisclosure.onToggle();
@@ -2307,7 +2307,7 @@ function OperationForm({
: "Expand Procedure"
}
variant="ghost"
- size="sm"
+ size="md"
onClick={(e) => {
e.stopPropagation();
procedureDisclosure.onToggle();
diff --git a/apps/erp/app/routes/x+/items+/methods+/material.new.tsx b/apps/erp/app/routes/x+/items+/methods+/material.new.tsx
index 1366191524..937f21f74b 100644
--- a/apps/erp/app/routes/x+/items+/methods+/material.new.tsx
+++ b/apps/erp/app/routes/x+/items+/methods+/material.new.tsx
@@ -21,14 +21,13 @@ export async function action({ request, params }: ActionFunctionArgs) {
return validationError(validation.error);
}
- const { id, ...data } = validation.data;
-
const insertMethodMaterial = await upsertMethodMaterial(client, {
- ...data,
+ ...validation.data,
companyId,
createdBy: userId,
customFields: setCustomFields(formData),
});
+
if (insertMethodMaterial.error) {
return json(
{
diff --git a/apps/erp/app/routes/x+/job+/methods+/$jobId.material.new.tsx b/apps/erp/app/routes/x+/job+/methods+/$jobId.material.new.tsx
index 8587966672..bee27e3c48 100644
--- a/apps/erp/app/routes/x+/job+/methods+/$jobId.material.new.tsx
+++ b/apps/erp/app/routes/x+/job+/methods+/$jobId.material.new.tsx
@@ -30,11 +30,9 @@ export async function action({ request, params }: ActionFunctionArgs) {
return validationError(validation.error);
}
- const { id, ...data } = validation.data;
-
const serviceRole = getCarbonServiceRole();
const insertJobMaterial = await upsertJobMaterial(serviceRole, {
- ...data,
+ ...validation.data,
jobId,
companyId,
createdBy: userId,
@@ -65,7 +63,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
);
}
- if (data.methodType === "Make") {
+ if (validation.data.methodType === "Make") {
const materialMakeMethod = await serviceRole
.from("jobMaterialWithMakeMethodId")
.select("*")
@@ -83,7 +81,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
);
}
const makeMethod = await upsertJobMaterialMakeMethod(serviceRole, {
- sourceId: data.itemId,
+ sourceId: validation.data.itemId,
targetId: materialMakeMethod.data?.jobMaterialMakeMethodId!,
companyId,
userId,
diff --git a/apps/erp/app/routes/x+/quote+/methods+/$quoteId.$lineId.material.new.tsx b/apps/erp/app/routes/x+/quote+/methods+/$quoteId.$lineId.material.new.tsx
index 1686167102..956080e8d4 100644
--- a/apps/erp/app/routes/x+/quote+/methods+/$quoteId.$lineId.material.new.tsx
+++ b/apps/erp/app/routes/x+/quote+/methods+/$quoteId.$lineId.material.new.tsx
@@ -31,11 +31,9 @@ export async function action({ request, params }: ActionFunctionArgs) {
return validationError(validation.error);
}
- const { id, ...data } = validation.data;
-
const serviceRole = getCarbonServiceRole();
const insertQuoteMaterial = await upsertQuoteMaterial(serviceRole, {
- ...data,
+ ...validation.data,
quoteId,
quoteLineId: lineId,
companyId,
@@ -67,7 +65,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
);
}
- if (data.methodType === "Make") {
+ if (validation.data.methodType === "Make") {
const materialMakeMethod = await serviceRole
.from("quoteMaterialWithMakeMethodId")
.select("*")
@@ -85,7 +83,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
);
}
const makeMethod = await upsertQuoteMaterialMakeMethod(serviceRole, {
- sourceId: data.itemId,
+ sourceId: validation.data.itemId,
targetId: materialMakeMethod.data?.quoteMaterialMakeMethodId!,
companyId,
userId,
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 04fee3e238..81c53b093e 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -9180,6 +9180,9 @@ export default {
{
$ref: "#/parameters/rowFilter.methodMaterial.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.methodMaterial.shelfId",
+ },
{
$ref: "#/parameters/select",
},
@@ -9299,6 +9302,9 @@ export default {
{
$ref: "#/parameters/rowFilter.methodMaterial.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.methodMaterial.shelfId",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -9372,6 +9378,9 @@ export default {
{
$ref: "#/parameters/rowFilter.methodMaterial.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.methodMaterial.shelfId",
+ },
{
$ref: "#/parameters/body.methodMaterial",
},
@@ -47799,41 +47808,38 @@ export default {
tags: ["nonConformanceJobOperation"],
},
},
- "/salesInvoiceShipment": {
+ "/pickList": {
get: {
parameters: [
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.id",
+ $ref: "#/parameters/rowFilter.pickList.id",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingCost",
+ $ref: "#/parameters/rowFilter.pickList.locationId",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.locationId",
- },
- {
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingMethodId",
+ $ref: "#/parameters/rowFilter.pickList.status",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingTermId",
+ $ref: "#/parameters/rowFilter.pickList.createdDate",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.customFields",
+ $ref: "#/parameters/rowFilter.pickList.completedDate",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.companyId",
+ $ref: "#/parameters/rowFilter.pickList.companyId",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdAt",
+ $ref: "#/parameters/rowFilter.pickList.createdAt",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdBy",
+ $ref: "#/parameters/rowFilter.pickList.createdBy",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedAt",
+ $ref: "#/parameters/rowFilter.pickList.updatedAt",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedBy",
+ $ref: "#/parameters/rowFilter.pickList.updatedBy",
},
{
$ref: "#/parameters/select",
@@ -47862,7 +47868,7 @@ export default {
description: "OK",
schema: {
items: {
- $ref: "#/definitions/salesInvoiceShipment",
+ $ref: "#/definitions/pickList",
},
type: "array",
},
@@ -47871,12 +47877,12 @@ export default {
description: "Partial Content",
},
},
- tags: ["salesInvoiceShipment"],
+ tags: ["pickList"],
},
post: {
parameters: [
{
- $ref: "#/parameters/body.salesInvoiceShipment",
+ $ref: "#/parameters/body.pickList",
},
{
$ref: "#/parameters/select",
@@ -47890,42 +47896,39 @@ export default {
description: "Created",
},
},
- tags: ["salesInvoiceShipment"],
+ tags: ["pickList"],
},
delete: {
parameters: [
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.id",
+ $ref: "#/parameters/rowFilter.pickList.id",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingCost",
+ $ref: "#/parameters/rowFilter.pickList.locationId",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.locationId",
+ $ref: "#/parameters/rowFilter.pickList.status",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingMethodId",
+ $ref: "#/parameters/rowFilter.pickList.createdDate",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingTermId",
+ $ref: "#/parameters/rowFilter.pickList.completedDate",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.customFields",
+ $ref: "#/parameters/rowFilter.pickList.companyId",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.companyId",
+ $ref: "#/parameters/rowFilter.pickList.createdAt",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdAt",
+ $ref: "#/parameters/rowFilter.pickList.createdBy",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdBy",
+ $ref: "#/parameters/rowFilter.pickList.updatedAt",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedAt",
- },
- {
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedBy",
+ $ref: "#/parameters/rowFilter.pickList.updatedBy",
},
{
$ref: "#/parameters/preferReturn",
@@ -47936,45 +47939,42 @@ export default {
description: "No Content",
},
},
- tags: ["salesInvoiceShipment"],
+ tags: ["pickList"],
},
patch: {
parameters: [
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.id",
+ $ref: "#/parameters/rowFilter.pickList.id",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingCost",
+ $ref: "#/parameters/rowFilter.pickList.locationId",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.locationId",
+ $ref: "#/parameters/rowFilter.pickList.status",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingMethodId",
+ $ref: "#/parameters/rowFilter.pickList.createdDate",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingTermId",
+ $ref: "#/parameters/rowFilter.pickList.completedDate",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.customFields",
+ $ref: "#/parameters/rowFilter.pickList.companyId",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.companyId",
+ $ref: "#/parameters/rowFilter.pickList.createdAt",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdAt",
+ $ref: "#/parameters/rowFilter.pickList.createdBy",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdBy",
+ $ref: "#/parameters/rowFilter.pickList.updatedAt",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedAt",
+ $ref: "#/parameters/rowFilter.pickList.updatedBy",
},
{
- $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedBy",
- },
- {
- $ref: "#/parameters/body.salesInvoiceShipment",
+ $ref: "#/parameters/body.pickList",
},
{
$ref: "#/parameters/preferReturn",
@@ -47985,152 +47985,44 @@ export default {
description: "No Content",
},
},
- tags: ["salesInvoiceShipment"],
+ tags: ["pickList"],
},
},
- "/supplierQuoteFavorite": {
- get: {
- parameters: [
- {
- $ref: "#/parameters/rowFilter.supplierQuoteFavorite.supplierQuoteId",
- },
- {
- $ref: "#/parameters/rowFilter.supplierQuoteFavorite.userId",
- },
- {
- $ref: "#/parameters/select",
- },
- {
- $ref: "#/parameters/order",
- },
- {
- $ref: "#/parameters/range",
- },
- {
- $ref: "#/parameters/rangeUnit",
- },
- {
- $ref: "#/parameters/offset",
- },
- {
- $ref: "#/parameters/limit",
- },
- {
- $ref: "#/parameters/preferCount",
- },
- ],
- responses: {
- "200": {
- description: "OK",
- schema: {
- items: {
- $ref: "#/definitions/supplierQuoteFavorite",
- },
- type: "array",
- },
- },
- "206": {
- description: "Partial Content",
- },
- },
- tags: ["supplierQuoteFavorite"],
- },
- post: {
- parameters: [
- {
- $ref: "#/parameters/body.supplierQuoteFavorite",
- },
- {
- $ref: "#/parameters/select",
- },
- {
- $ref: "#/parameters/preferPost",
- },
- ],
- responses: {
- "201": {
- description: "Created",
- },
- },
- tags: ["supplierQuoteFavorite"],
- },
- delete: {
- parameters: [
- {
- $ref: "#/parameters/rowFilter.supplierQuoteFavorite.supplierQuoteId",
- },
- {
- $ref: "#/parameters/rowFilter.supplierQuoteFavorite.userId",
- },
- {
- $ref: "#/parameters/preferReturn",
- },
- ],
- responses: {
- "204": {
- description: "No Content",
- },
- },
- tags: ["supplierQuoteFavorite"],
- },
- patch: {
- parameters: [
- {
- $ref: "#/parameters/rowFilter.supplierQuoteFavorite.supplierQuoteId",
- },
- {
- $ref: "#/parameters/rowFilter.supplierQuoteFavorite.userId",
- },
- {
- $ref: "#/parameters/body.supplierQuoteFavorite",
- },
- {
- $ref: "#/parameters/preferReturn",
- },
- ],
- responses: {
- "204": {
- description: "No Content",
- },
- },
- tags: ["supplierQuoteFavorite"],
- },
- },
- "/purchaseOrderPayment": {
+ "/salesInvoiceShipment": {
get: {
parameters: [
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.id",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.id",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingCost",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierLocationId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.locationId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierContactId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingMethodId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentTermId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingTermId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentComplete",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.customFields",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.companyId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.companyId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedAt",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdAt",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedBy",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdBy",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.customFields",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedAt",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.tags",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedBy",
},
{
$ref: "#/parameters/select",
@@ -48159,7 +48051,7 @@ export default {
description: "OK",
schema: {
items: {
- $ref: "#/definitions/purchaseOrderPayment",
+ $ref: "#/definitions/salesInvoiceShipment",
},
type: "array",
},
@@ -48168,12 +48060,12 @@ export default {
description: "Partial Content",
},
},
- tags: ["purchaseOrderPayment"],
+ tags: ["salesInvoiceShipment"],
},
post: {
parameters: [
{
- $ref: "#/parameters/body.purchaseOrderPayment",
+ $ref: "#/parameters/body.salesInvoiceShipment",
},
{
$ref: "#/parameters/select",
@@ -48187,42 +48079,42 @@ export default {
description: "Created",
},
},
- tags: ["purchaseOrderPayment"],
+ tags: ["salesInvoiceShipment"],
},
delete: {
parameters: [
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.id",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.id",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingCost",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierLocationId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.locationId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierContactId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingMethodId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentTermId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingTermId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentComplete",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.customFields",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.companyId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.companyId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedAt",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdAt",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedBy",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdBy",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.customFields",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedAt",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.tags",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedBy",
},
{
$ref: "#/parameters/preferReturn",
@@ -48233,45 +48125,45 @@ export default {
description: "No Content",
},
},
- tags: ["purchaseOrderPayment"],
+ tags: ["salesInvoiceShipment"],
},
patch: {
parameters: [
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.id",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.id",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingCost",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierLocationId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.locationId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierContactId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingMethodId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentTermId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.shippingTermId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentComplete",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.customFields",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.companyId",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.companyId",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedAt",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdAt",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedBy",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.createdBy",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.customFields",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedAt",
},
{
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.tags",
+ $ref: "#/parameters/rowFilter.salesInvoiceShipment.updatedBy",
},
{
- $ref: "#/parameters/body.purchaseOrderPayment",
+ $ref: "#/parameters/body.salesInvoiceShipment",
},
{
$ref: "#/parameters/preferReturn",
@@ -48282,35 +48174,332 @@ export default {
description: "No Content",
},
},
- tags: ["purchaseOrderPayment"],
+ tags: ["salesInvoiceShipment"],
},
},
- "/nonConformanceInvestigationType": {
+ "/supplierQuoteFavorite": {
get: {
parameters: [
{
- $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.id",
- },
- {
- $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.companyId",
- },
- {
- $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.name",
- },
- {
- $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.active",
- },
- {
- $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.createdAt",
- },
- {
- $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.createdBy",
- },
- {
- $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.updatedAt",
+ $ref: "#/parameters/rowFilter.supplierQuoteFavorite.supplierQuoteId",
},
{
- $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.updatedBy",
+ $ref: "#/parameters/rowFilter.supplierQuoteFavorite.userId",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/supplierQuoteFavorite",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["supplierQuoteFavorite"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.supplierQuoteFavorite",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["supplierQuoteFavorite"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.supplierQuoteFavorite.supplierQuoteId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.supplierQuoteFavorite.userId",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["supplierQuoteFavorite"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.supplierQuoteFavorite.supplierQuoteId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.supplierQuoteFavorite.userId",
+ },
+ {
+ $ref: "#/parameters/body.supplierQuoteFavorite",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["supplierQuoteFavorite"],
+ },
+ },
+ "/purchaseOrderPayment": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierLocationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierContactId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentTermId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentComplete",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.tags",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/purchaseOrderPayment",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["purchaseOrderPayment"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.purchaseOrderPayment",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["purchaseOrderPayment"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierLocationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierContactId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentTermId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentComplete",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.tags",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["purchaseOrderPayment"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierLocationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.invoiceSupplierContactId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentTermId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentComplete",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.updatedBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderPayment.tags",
+ },
+ {
+ $ref: "#/parameters/body.purchaseOrderPayment",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["purchaseOrderPayment"],
+ },
+ },
+ "/nonConformanceInvestigationType": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.active",
+ },
+ {
+ $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.nonConformanceInvestigationType.updatedBy",
},
{
$ref: "#/parameters/select",
@@ -50640,6 +50829,222 @@ export default {
tags: ["quoteOperationParameter"],
},
},
+ "/pickListLine": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.pickListId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.jobId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.jobMaterialId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.itemId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.fromShelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.toShelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.quantity",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.pickedQuantity",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.updatedBy",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/pickListLine",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["pickListLine"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.pickListLine",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["pickListLine"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.pickListId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.jobId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.jobMaterialId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.itemId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.fromShelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.toShelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.quantity",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.pickedQuantity",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.updatedBy",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["pickListLine"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.pickListId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.jobId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.jobMaterialId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.itemId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.fromShelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.toShelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.quantity",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.pickedQuantity",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.pickListLine.updatedBy",
+ },
+ {
+ $ref: "#/parameters/body.pickListLine",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["pickListLine"],
+ },
+ },
"/item": {
get: {
parameters: [
@@ -63396,6 +63801,12 @@ export default {
format: "boolean",
type: "boolean",
},
+ shelfId: {
+ description:
+ "Note:\nThis is a Foreign Key to `shelf.id`.<fk table='shelf' column='id'/>",
+ format: "text",
+ type: "string",
+ },
},
type: "object",
},
@@ -64495,6 +64906,7 @@ export default {
status: {
enum: [
"Draft",
+ "Staged",
"Ready",
"In Progress",
"Paused",
@@ -68864,6 +69276,7 @@ export default {
default: "Draft",
enum: [
"Draft",
+ "Staged",
"Ready",
"In Progress",
"Paused",
@@ -70722,6 +71135,12 @@ export default {
"Audio",
"Other",
"Model",
+ "Pick Transfer",
+ "Vehicle Transfer",
+ "Scrap Transfer",
+ "Quarantine Transfer",
+ "Customer Transfer",
+ "Rejection Transfer",
],
format: 'public."documentType"',
type: "string",
@@ -80069,6 +80488,12 @@ export default {
"Audio",
"Other",
"Model",
+ "Pick Transfer",
+ "Vehicle Transfer",
+ "Scrap Transfer",
+ "Quarantine Transfer",
+ "Customer Transfer",
+ "Rejection Transfer",
],
format: 'public."documentType"',
type: "string",
@@ -81709,6 +82134,74 @@ export default {
},
type: "object",
},
+ pickList: {
+ required: [
+ "id",
+ "locationId",
+ "status",
+ "createdDate",
+ "companyId",
+ "createdAt",
+ "createdBy",
+ ],
+ properties: {
+ id: {
+ default: "public.xid()",
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "text",
+ type: "string",
+ },
+ locationId: {
+ description:
+ "Note:\nThis is a Foreign Key to `location.id`.<fk table='location' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ status: {
+ default: "Draft",
+ enum: ["Draft", "Released", "In Progress", "Completed"],
+ format: 'public."pickListStatus"',
+ type: "string",
+ },
+ createdDate: {
+ default: "now()",
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ completedDate: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ companyId: {
+ description:
+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ createdAt: {
+ default: "now()",
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ createdBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ updatedAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ updatedBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ },
+ type: "object",
+ },
salesInvoiceShipment: {
required: [
"id",
@@ -83089,6 +83582,98 @@ export default {
},
type: "object",
},
+ pickListLine: {
+ required: [
+ "id",
+ "pickListId",
+ "itemId",
+ "quantity",
+ "pickedQuantity",
+ "companyId",
+ "createdAt",
+ "createdBy",
+ ],
+ properties: {
+ id: {
+ default: "public.xid()",
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "text",
+ type: "string",
+ },
+ pickListId: {
+ format: "text",
+ type: "string",
+ },
+ jobId: {
+ description:
+ "Note:\nThis is a Foreign Key to `job.id`.<fk table='job' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ jobMaterialId: {
+ description:
+ "Note:\nThis is a Foreign Key to `jobMaterial.id`.<fk table='jobMaterial' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ itemId: {
+ description:
+ "Note:\nThis is a Foreign Key to `item.id`.<fk table='item' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ fromShelfId: {
+ description:
+ "Note:\nThis is a Foreign Key to `shelf.id`.<fk table='shelf' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ toShelfId: {
+ description:
+ "Note:\nThis is a Foreign Key to `shelf.id`.<fk table='shelf' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ quantity: {
+ default: 0,
+ format: "numeric",
+ type: "number",
+ },
+ pickedQuantity: {
+ default: 0,
+ format: "numeric",
+ type: "number",
+ },
+ companyId: {
+ description:
+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ createdAt: {
+ default: "now()",
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ createdBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ updatedAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ updatedBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ },
+ type: "object",
+ },
item: {
required: [
"id",
@@ -90262,6 +90847,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.methodMaterial.shelfId": {
+ name: "shelfId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.pickMethod": {
name: "pickMethod",
description: "pickMethod",
@@ -110956,6 +111547,75 @@ export default {
in: "query",
type: "string",
},
+ "body.pickList": {
+ name: "pickList",
+ description: "pickList",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/pickList",
+ },
+ },
+ "rowFilter.pickList.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickList.locationId": {
+ name: "locationId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickList.status": {
+ name: "status",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickList.createdDate": {
+ name: "createdDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickList.completedDate": {
+ name: "completedDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickList.companyId": {
+ name: "companyId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickList.createdAt": {
+ name: "createdAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickList.createdBy": {
+ name: "createdBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickList.updatedAt": {
+ name: "updatedAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickList.updatedBy": {
+ name: "updatedBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.salesInvoiceShipment": {
name: "salesInvoiceShipment",
description: "salesInvoiceShipment",
@@ -112498,6 +113158,99 @@ export default {
in: "query",
type: "string",
},
+ "body.pickListLine": {
+ name: "pickListLine",
+ description: "pickListLine",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/pickListLine",
+ },
+ },
+ "rowFilter.pickListLine.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.pickListId": {
+ name: "pickListId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.jobId": {
+ name: "jobId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.jobMaterialId": {
+ name: "jobMaterialId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.itemId": {
+ name: "itemId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.fromShelfId": {
+ name: "fromShelfId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.toShelfId": {
+ name: "toShelfId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.quantity": {
+ name: "quantity",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.pickedQuantity": {
+ name: "pickedQuantity",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.companyId": {
+ name: "companyId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.createdAt": {
+ name: "createdAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.createdBy": {
+ name: "createdBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.updatedAt": {
+ name: "updatedAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.pickListLine.updatedBy": {
+ name: "updatedBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.item": {
name: "item",
description: "item",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 1f7d7e2211..59535bdd07 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -13100,6 +13100,7 @@ export type Database = {
productionQuantity: number | null
quantity: number
scrapQuantity: number
+ shelfId: string | null
tags: string[] | null
unitOfMeasureCode: string
updatedAt: string | null
@@ -13122,6 +13123,7 @@ export type Database = {
productionQuantity?: number | null
quantity: number
scrapQuantity?: number
+ shelfId?: string | null
tags?: string[] | null
unitOfMeasureCode: string
updatedAt?: string | null
@@ -13144,6 +13146,7 @@ export type Database = {
productionQuantity?: number | null
quantity?: number
scrapQuantity?: number
+ shelfId?: string | null
tags?: string[] | null
unitOfMeasureCode?: string
updatedAt?: string | null
@@ -13311,6 +13314,13 @@ export type Database = {
referencedRelation: "methodOperation"
referencedColumns: ["id"]
},
+ {
+ foreignKeyName: "methodMaterial_shelfId_fkey"
+ columns: ["shelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
{
foreignKeyName: "methodMaterial_unitOfMeasureCode_fkey"
columns: ["unitOfMeasureCode", "companyId"]
@@ -18492,6 +18502,399 @@ export type Database = {
}
Relationships: []
}
+ pickList: {
+ Row: {
+ companyId: string
+ completedDate: string | null
+ createdAt: string
+ createdBy: string
+ createdDate: string
+ id: string
+ locationId: string
+ status: Database["public"]["Enums"]["pickListStatus"]
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ companyId: string
+ completedDate?: string | null
+ createdAt?: string
+ createdBy: string
+ createdDate?: string
+ id?: string
+ locationId: string
+ status?: Database["public"]["Enums"]["pickListStatus"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ companyId?: string
+ completedDate?: string | null
+ createdAt?: string
+ createdBy?: string
+ createdDate?: string
+ id?: string
+ locationId?: string
+ status?: Database["public"]["Enums"]["pickListStatus"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "pickList_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "pickList_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "pickList_locationId_fkey"
+ columns: ["locationId"]
+ isOneToOne: false
+ referencedRelation: "location"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
+ pickListLine: {
+ Row: {
+ companyId: string
+ createdAt: string
+ createdBy: string
+ fromShelfId: string | null
+ id: string
+ itemId: string
+ jobId: string | null
+ jobMaterialId: string | null
+ pickedQuantity: number
+ pickListId: string
+ quantity: number
+ toShelfId: string | null
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ companyId: string
+ createdAt?: string
+ createdBy: string
+ fromShelfId?: string | null
+ id?: string
+ itemId: string
+ jobId?: string | null
+ jobMaterialId?: string | null
+ pickedQuantity?: number
+ pickListId: string
+ quantity?: number
+ toShelfId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ companyId?: string
+ createdAt?: string
+ createdBy?: string
+ fromShelfId?: string | null
+ id?: string
+ itemId?: string
+ jobId?: string | null
+ jobMaterialId?: string | null
+ pickedQuantity?: number
+ pickListId?: string
+ quantity?: number
+ toShelfId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "pickListLine_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "pickListLine_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "pickListLine_fromShelfId_fkey"
+ columns: ["fromShelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "consumables"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "item"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "materials"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "parts"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "tools"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobId_fkey"
+ columns: ["jobId"]
+ isOneToOne: false
+ referencedRelation: "job"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobId_fkey"
+ columns: ["jobId"]
+ isOneToOne: false
+ referencedRelation: "jobs"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobId_fkey"
+ columns: ["jobId"]
+ isOneToOne: false
+ referencedRelation: "openProductionOrders"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobMaterialId_fkey"
+ columns: ["jobMaterialId"]
+ isOneToOne: false
+ referencedRelation: "jobMaterial"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobMaterialId_fkey"
+ columns: ["jobMaterialId"]
+ isOneToOne: false
+ referencedRelation: "jobMaterialWithMakeMethodId"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobMaterialId_fkey"
+ columns: ["jobMaterialId"]
+ isOneToOne: false
+ referencedRelation: "openJobMaterialLines"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_pickListId_fkey"
+ columns: ["pickListId", "companyId"]
+ isOneToOne: false
+ referencedRelation: "pickList"
+ referencedColumns: ["id", "companyId"]
+ },
+ {
+ foreignKeyName: "pickListLine_toShelfId_fkey"
+ columns: ["toShelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
pickMethod: {
Row: {
companyId: string
@@ -41072,14 +41475,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -45497,14 +45900,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -48100,6 +48503,7 @@ export type Database = {
parentMaterialId: string
quantity: number
revision: string
+ shelfId: string
unitCost: number
version: number
}[]
@@ -48121,6 +48525,7 @@ export type Database = {
order: number
parentMaterialId: string
quantity: number
+ shelfId: string
unitCost: number
unitOfMeasureCode: string
}[]
@@ -49062,6 +49467,12 @@ export type Database = {
| "Audio"
| "Other"
| "Model"
+ | "Pick Transfer"
+ | "Vehicle Transfer"
+ | "Scrap Transfer"
+ | "Quarantine Transfer"
+ | "Customer Transfer"
+ | "Rejection Transfer"
externalLinkDocumentType: "Quote" | "SupplierQuote" | "Customer"
factor:
| "Hours/Piece"
@@ -49167,6 +49578,7 @@ export type Database = {
| "Waiting"
jobStatus:
| "Draft"
+ | "Staged"
| "Ready"
| "In Progress"
| "Paused"
@@ -49250,6 +49662,7 @@ export type Database = {
| "Fixture"
paymentTermCalculationMethod: "Net" | "End of Month" | "Day of Month"
periodType: "Week" | "Day" | "Month"
+ pickListStatus: "Draft" | "Released" | "In Progress" | "Completed"
procedureStatus: "Draft" | "Active" | "Archived"
procedureStepType:
| "Value"
@@ -50144,6 +50557,12 @@ export const Constants = {
"Audio",
"Other",
"Model",
+ "Pick Transfer",
+ "Vehicle Transfer",
+ "Scrap Transfer",
+ "Quarantine Transfer",
+ "Customer Transfer",
+ "Rejection Transfer",
],
externalLinkDocumentType: ["Quote", "SupplierQuote", "Customer"],
factor: [
@@ -50259,6 +50678,7 @@ export const Constants = {
],
jobStatus: [
"Draft",
+ "Staged",
"Ready",
"In Progress",
"Paused",
@@ -50350,6 +50770,7 @@ export const Constants = {
],
paymentTermCalculationMethod: ["Net", "End of Month", "Day of Month"],
periodType: ["Week", "Day", "Month"],
+ pickListStatus: ["Draft", "Released", "In Progress", "Completed"],
procedureStatus: ["Draft", "Active", "Archived"],
procedureStepType: [
"Value",
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 1f7d7e2211..59535bdd07 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -13100,6 +13100,7 @@ export type Database = {
productionQuantity: number | null
quantity: number
scrapQuantity: number
+ shelfId: string | null
tags: string[] | null
unitOfMeasureCode: string
updatedAt: string | null
@@ -13122,6 +13123,7 @@ export type Database = {
productionQuantity?: number | null
quantity: number
scrapQuantity?: number
+ shelfId?: string | null
tags?: string[] | null
unitOfMeasureCode: string
updatedAt?: string | null
@@ -13144,6 +13146,7 @@ export type Database = {
productionQuantity?: number | null
quantity?: number
scrapQuantity?: number
+ shelfId?: string | null
tags?: string[] | null
unitOfMeasureCode?: string
updatedAt?: string | null
@@ -13311,6 +13314,13 @@ export type Database = {
referencedRelation: "methodOperation"
referencedColumns: ["id"]
},
+ {
+ foreignKeyName: "methodMaterial_shelfId_fkey"
+ columns: ["shelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
{
foreignKeyName: "methodMaterial_unitOfMeasureCode_fkey"
columns: ["unitOfMeasureCode", "companyId"]
@@ -18492,6 +18502,399 @@ export type Database = {
}
Relationships: []
}
+ pickList: {
+ Row: {
+ companyId: string
+ completedDate: string | null
+ createdAt: string
+ createdBy: string
+ createdDate: string
+ id: string
+ locationId: string
+ status: Database["public"]["Enums"]["pickListStatus"]
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ companyId: string
+ completedDate?: string | null
+ createdAt?: string
+ createdBy: string
+ createdDate?: string
+ id?: string
+ locationId: string
+ status?: Database["public"]["Enums"]["pickListStatus"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ companyId?: string
+ completedDate?: string | null
+ createdAt?: string
+ createdBy?: string
+ createdDate?: string
+ id?: string
+ locationId?: string
+ status?: Database["public"]["Enums"]["pickListStatus"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "pickList_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "pickList_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "pickList_locationId_fkey"
+ columns: ["locationId"]
+ isOneToOne: false
+ referencedRelation: "location"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
+ pickListLine: {
+ Row: {
+ companyId: string
+ createdAt: string
+ createdBy: string
+ fromShelfId: string | null
+ id: string
+ itemId: string
+ jobId: string | null
+ jobMaterialId: string | null
+ pickedQuantity: number
+ pickListId: string
+ quantity: number
+ toShelfId: string | null
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ companyId: string
+ createdAt?: string
+ createdBy: string
+ fromShelfId?: string | null
+ id?: string
+ itemId: string
+ jobId?: string | null
+ jobMaterialId?: string | null
+ pickedQuantity?: number
+ pickListId: string
+ quantity?: number
+ toShelfId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ companyId?: string
+ createdAt?: string
+ createdBy?: string
+ fromShelfId?: string | null
+ id?: string
+ itemId?: string
+ jobId?: string | null
+ jobMaterialId?: string | null
+ pickedQuantity?: number
+ pickListId?: string
+ quantity?: number
+ toShelfId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "pickListLine_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "pickListLine_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "pickListLine_fromShelfId_fkey"
+ columns: ["fromShelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "consumables"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "item"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "materials"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "parts"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_itemId_fkey"
+ columns: ["itemId"]
+ isOneToOne: false
+ referencedRelation: "tools"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobId_fkey"
+ columns: ["jobId"]
+ isOneToOne: false
+ referencedRelation: "job"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobId_fkey"
+ columns: ["jobId"]
+ isOneToOne: false
+ referencedRelation: "jobs"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobId_fkey"
+ columns: ["jobId"]
+ isOneToOne: false
+ referencedRelation: "openProductionOrders"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobMaterialId_fkey"
+ columns: ["jobMaterialId"]
+ isOneToOne: false
+ referencedRelation: "jobMaterial"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobMaterialId_fkey"
+ columns: ["jobMaterialId"]
+ isOneToOne: false
+ referencedRelation: "jobMaterialWithMakeMethodId"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_jobMaterialId_fkey"
+ columns: ["jobMaterialId"]
+ isOneToOne: false
+ referencedRelation: "openJobMaterialLines"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_pickListId_fkey"
+ columns: ["pickListId", "companyId"]
+ isOneToOne: false
+ referencedRelation: "pickList"
+ referencedColumns: ["id", "companyId"]
+ },
+ {
+ foreignKeyName: "pickListLine_toShelfId_fkey"
+ columns: ["toShelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickListLine_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
pickMethod: {
Row: {
companyId: string
@@ -41072,14 +41475,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -45497,14 +45900,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -48100,6 +48503,7 @@ export type Database = {
parentMaterialId: string
quantity: number
revision: string
+ shelfId: string
unitCost: number
version: number
}[]
@@ -48121,6 +48525,7 @@ export type Database = {
order: number
parentMaterialId: string
quantity: number
+ shelfId: string
unitCost: number
unitOfMeasureCode: string
}[]
@@ -49062,6 +49467,12 @@ export type Database = {
| "Audio"
| "Other"
| "Model"
+ | "Pick Transfer"
+ | "Vehicle Transfer"
+ | "Scrap Transfer"
+ | "Quarantine Transfer"
+ | "Customer Transfer"
+ | "Rejection Transfer"
externalLinkDocumentType: "Quote" | "SupplierQuote" | "Customer"
factor:
| "Hours/Piece"
@@ -49167,6 +49578,7 @@ export type Database = {
| "Waiting"
jobStatus:
| "Draft"
+ | "Staged"
| "Ready"
| "In Progress"
| "Paused"
@@ -49250,6 +49662,7 @@ export type Database = {
| "Fixture"
paymentTermCalculationMethod: "Net" | "End of Month" | "Day of Month"
periodType: "Week" | "Day" | "Month"
+ pickListStatus: "Draft" | "Released" | "In Progress" | "Completed"
procedureStatus: "Draft" | "Active" | "Archived"
procedureStepType:
| "Value"
@@ -50144,6 +50557,12 @@ export const Constants = {
"Audio",
"Other",
"Model",
+ "Pick Transfer",
+ "Vehicle Transfer",
+ "Scrap Transfer",
+ "Quarantine Transfer",
+ "Customer Transfer",
+ "Rejection Transfer",
],
externalLinkDocumentType: ["Quote", "SupplierQuote", "Customer"],
factor: [
@@ -50259,6 +50678,7 @@ export const Constants = {
],
jobStatus: [
"Draft",
+ "Staged",
"Ready",
"In Progress",
"Paused",
@@ -50350,6 +50770,7 @@ export const Constants = {
],
paymentTermCalculationMethod: ["Net", "End of Month", "Day of Month"],
periodType: ["Week", "Day", "Month"],
+ pickListStatus: ["Draft", "Released", "In Progress", "Completed"],
procedureStatus: ["Draft", "Active", "Archived"],
procedureStepType: [
"Value",
diff --git a/packages/database/supabase/functions/pick/index.ts b/packages/database/supabase/functions/pick/index.ts
index c829fd287d..4449eacfb7 100644
--- a/packages/database/supabase/functions/pick/index.ts
+++ b/packages/database/supabase/functions/pick/index.ts
@@ -1,12 +1,10 @@
import { serve } from "https://deno.land/[email protected]/http/server.ts";
-import { nanoid } from "https://deno.land/x/[email protected]/mod.ts";
import { z } from "npm:zod@^3.24.1";
import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";
import { getSupabaseServiceRole } from "../lib/supabase.ts";
import { corsHeaders } from "../lib/headers.ts";
-import { getNextSequence } from "../shared/get-next-sequence.ts";
const pool = getConnectionPool(1);
const db = getDatabaseClient<DB>(pool);
@@ -63,387 +61,10 @@ serve(async (req: Request) => {
);
switch (type) {
- case "stageJob": {
- const { jobId } = payload;
-
- // Get job and its location
- const { data: job, error: jobError } = await client
- .from("job")
- .select("*, locationId")
- .eq("id", jobId)
- .eq("companyId", companyId)
- .single();
-
- if (jobError || !job) {
- return new Response(JSON.stringify({ error: "Job not found" }), {
- status: 404,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- });
- }
-
- if (job.status !== "Draft") {
- return new Response(
- JSON.stringify({ error: "Only draft jobs can be staged" }),
- {
- status: 400,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- // Get all job materials with their shelf requirements
- const { data: jobMaterials, error: materialsError } = await client
- .from("jobMaterial")
- .select("*, item:itemId(id, name, readableId)")
- .eq("jobId", jobId)
- .eq("companyId", companyId);
-
- if (materialsError) {
- return new Response(
- JSON.stringify({ error: "Failed to fetch job materials" }),
- {
- status: 500,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- // Get inventory quantities for each material
- const warnings = [];
- for (const material of jobMaterials || []) {
- const { data: inventory } = await client.rpc(
- "get_inventory_quantities",
- {
- p_company_id: companyId,
- p_item_id: material.itemId,
- p_location_id: job.locationId,
- }
- );
-
- const quantityOnHand = inventory?.[0]?.quantityOnHand || 0;
- const requiredQuantity = material.quantity;
-
- if (quantityOnHand < requiredQuantity) {
- warnings.push({
- itemId: material.itemId,
- itemName: material.item?.name,
- required: requiredQuantity,
- available: quantityOnHand,
- shortage: requiredQuantity - quantityOnHand,
- shelfId: material.shelfId,
- });
- }
- }
-
- // Update job status to Staged
- const { error: updateError } = await client
- .from("job")
- .update({
- status: "Staged",
- updatedBy: userId,
- updatedAt: new Date().toISOString(),
- })
- .eq("id", jobId)
- .eq("companyId", companyId);
-
- if (updateError) {
- return new Response(
- JSON.stringify({ error: "Failed to update job status" }),
- {
- status: 500,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- return new Response(
- JSON.stringify({
- success: true,
- jobId,
- warnings,
- }),
- {
- status: 200,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- case "generatePickList": {
- const { locationId, jobIds } = payload;
-
- // Get all staged jobs at this location
- let jobQuery = client
- .from("job")
- .select("id, locationId, shelfId")
- .eq("companyId", companyId)
- .eq("locationId", locationId)
- .eq("status", "Staged");
-
- if (jobIds && jobIds.length > 0) {
- jobQuery = jobQuery.in("id", jobIds);
- }
-
- const { data: jobs, error: jobsError } = await jobQuery;
-
- if (jobsError || !jobs || jobs.length === 0) {
- return new Response(
- JSON.stringify({ error: "No staged jobs found" }),
- {
- status: 404,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- // Create pick list
- const pickListId = `PL-${nanoid(10)}`;
- const { error: pickListError } = await client.from("pickList").insert({
- id: pickListId,
- locationId,
- status: "Draft",
- companyId,
- createdBy: userId,
- });
-
- if (pickListError) {
- return new Response(
- JSON.stringify({ error: "Failed to create pick list" }),
- {
- status: 500,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- // Aggregate materials from all jobs
- const pickListLines = [];
- for (const job of jobs) {
- const { data: jobMaterials } = await client
- .from("jobMaterial")
- .select("*")
- .eq("jobId", job.id)
- .eq("companyId", companyId);
-
- for (const material of jobMaterials || []) {
- if (material.shelfId || job.shelfId) {
- pickListLines.push({
- id: `PLL-${nanoid(10)}`,
- pickListId,
- jobId: job.id,
- jobMaterialId: material.id,
- itemId: material.itemId,
- fromShelfId: material.shelfId,
- toShelfId: job.shelfId,
- quantity: material.quantity,
- pickedQuantity: 0,
- companyId,
- createdBy: userId,
- });
- }
- }
- }
-
- if (pickListLines.length > 0) {
- const { error: linesError } = await client
- .from("pickListLine")
- .insert(pickListLines);
-
- if (linesError) {
- return new Response(
- JSON.stringify({ error: "Failed to create pick list lines" }),
- {
- status: 500,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
- }
-
- return new Response(
- JSON.stringify({
- success: true,
- pickListId,
- linesCreated: pickListLines.length,
- }),
- {
- status: 200,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- case "executePick": {
- const { pickListLineId, pickedQuantity } = payload;
-
- return await db.transaction().execute(async (trx) => {
- // Get the pick list line
- const { data: pickListLine, error: lineError } = await client
- .from("pickListLine")
- .select("*, pickList:pickListId(locationId)")
- .eq("id", pickListLineId)
- .eq("companyId", companyId)
- .single();
-
- if (lineError || !pickListLine) {
- return new Response(
- JSON.stringify({ error: "Pick list line not found" }),
- {
- status: 404,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- // Update picked quantity
- const { error: updateError } = await client
- .from("pickListLine")
- .update({
- pickedQuantity,
- updatedBy: userId,
- updatedAt: new Date().toISOString(),
- })
- .eq("id", pickListLineId)
- .eq("companyId", companyId);
-
- if (updateError) {
- return new Response(
- JSON.stringify({ error: "Failed to update pick list line" }),
- {
- status: 500,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- // Create item ledger entry for the transfer
- if (pickListLine.fromShelfId && pickListLine.toShelfId) {
- const ledgerSequence = await getNextSequence(
- trx,
- "itemLedger",
- companyId
- );
-
- await trx
- .insertInto("itemLedger")
- .values({
- id: `IL-${ledgerSequence}`,
- companyId,
- entryType: "Transfer",
- documentType: "Pick Transfer",
- documentId: pickListLineId,
- itemId: pickListLine.itemId,
- locationId: pickListLine.pickList?.locationId,
- shelfId: pickListLine.fromShelfId,
- quantity: -pickedQuantity,
- postingDate: new Date(),
- createdBy: userId,
- })
- .execute();
-
- await trx
- .insertInto("itemLedger")
- .values({
- id: `IL-${ledgerSequence + 1}`,
- companyId,
- entryType: "Transfer",
- documentType: "Pick Transfer",
- documentId: pickListLineId,
- itemId: pickListLine.itemId,
- locationId: pickListLine.pickList?.locationId,
- shelfId: pickListLine.toShelfId,
- quantity: pickedQuantity,
- postingDate: new Date(),
- createdBy: userId,
- })
- .execute();
- }
-
- return new Response(
- JSON.stringify({
- success: true,
- pickListLineId,
- pickedQuantity,
- }),
- {
- status: 200,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- });
- }
-
- case "completePickList": {
- const { pickListId } = payload;
-
- // Verify all lines are fully picked
- const { data: lines, error: linesError } = await client
- .from("pickListLine")
- .select("id, quantity, pickedQuantity")
- .eq("pickListId", pickListId)
- .eq("companyId", companyId);
-
- if (linesError) {
- return new Response(
- JSON.stringify({ error: "Failed to fetch pick list lines" }),
- {
- status: 500,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- const incomplete = lines?.filter(
- (line) => line.pickedQuantity < line.quantity
- );
-
- if (incomplete && incomplete.length > 0) {
- return new Response(
- JSON.stringify({
- error: "Not all lines are fully picked",
- incompleteLines: incomplete.length,
- }),
- {
- status: 400,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- // Update pick list status
- const { error: updateError } = await client
- .from("pickList")
- .update({
- status: "Completed",
- completedDate: new Date().toISOString(),
- updatedBy: userId,
- updatedAt: new Date().toISOString(),
- })
- .eq("id", pickListId)
- .eq("companyId", companyId);
-
- if (updateError) {
- return new Response(
- JSON.stringify({ error: "Failed to complete pick list" }),
- {
- status: 500,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
- return new Response(
- JSON.stringify({
- success: true,
- pickListId,
- }),
- {
- status: 200,
- headers: { ...corsHeaders, "Content-Type": "application/json" },
- }
- );
- }
-
+ case "stageJob":
+ case "generatePickList":
+ case "executePick":
+ case "completePickList":
default:
return new Response(
JSON.stringify({ error: "Invalid operation type" }),
diff --git a/packages/database/supabase/migrations/20251007014240_pick-lists.sql b/packages/database/supabase/migrations/20251007014240_pick-lists.sql
index 44e7e59862..f9ac306626 100644
--- a/packages/database/supabase/migrations/20251007014240_pick-lists.sql
+++ b/packages/database/supabase/migrations/20251007014240_pick-lists.sql
@@ -38,17 +38,6 @@ CREATE OR REPLACE VIEW "jobMaterialWithMakeMethodId" WITH(SECURITY_INVOKER=true)
ON jmm."parentMaterialId" = jm."id"
INNER JOIN "item" i ON i.id = jm."itemId";
--- Add Staged status to job status enum
-DO $$
-BEGIN
- IF NOT EXISTS (SELECT 1 FROM pg_type t
- JOIN pg_enum e ON t.oid = e.enumtypid
- WHERE t.typname = 'jobStatus' AND e.enumlabel = 'Staged') THEN
- -- Add 'Staged' value after 'Draft' in the enum
- ALTER TYPE "jobStatus" ADD VALUE 'Staged' AFTER 'Draft';
- END IF;
-END $$;
-
-- Create pick list status enum
CREATE TYPE "pickListStatus" AS ENUM (
'Draft',
@@ -57,9 +46,10 @@ CREATE TYPE "pickListStatus" AS ENUM (
'Completed'
);
--- Create pickList table
+
CREATE TABLE "pickList" (
"id" TEXT NOT NULL DEFAULT xid(),
+ "pickListId" TEXT NOT NULL,
"locationId" TEXT NOT NULL,
"status" "pickListStatus" NOT NULL DEFAULT 'Draft',
"createdDate" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
@@ -69,6 +59,8 @@ CREATE TABLE "pickList" (
"createdBy" TEXT NOT NULL,
"updatedAt" TIMESTAMP WITH TIME ZONE,
"updatedBy" TEXT,
+ "customFields" JSONB,
+ "tags" TEXT[],
CONSTRAINT "pickList_pkey" PRIMARY KEY ("id", "companyId"),
CONSTRAINT "pickList_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "location" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
@@ -80,7 +72,48 @@ CREATE TABLE "pickList" (
CREATE INDEX "pickList_locationId_idx" ON "pickList" ("locationId");
CREATE INDEX "pickList_status_idx" ON "pickList" ("status");
--- Create pickListLine table
+
+CREATE POLICY "SELECT" ON "public"."pickList"
+FOR SELECT USING (
+ "companyId" = ANY (
+ (
+ SELECT
+ get_companies_with_employee_role()
+ )::text[]
+ )
+);
+
+CREATE POLICY "INSERT" ON "public"."pickList"
+FOR INSERT WITH CHECK (
+ "companyId" = ANY (
+ (
+ SELECT
+ get_companies_with_employee_permission ('inventory_create')
+ )::text[]
+ )
+);
+
+CREATE POLICY "UPDATE" ON "public"."pickList"
+FOR UPDATE USING (
+ "companyId" = ANY (
+ (
+ SELECT
+ get_companies_with_employee_permission ('inventory_update')
+ )::text[]
+ )
+);
+
+CREATE POLICY "DELETE" ON "public"."pickList"
+FOR DELETE USING (
+ "companyId" = ANY (
+ (
+ SELECT
+ get_companies_with_employee_permission ('inventory_delete')
+ )::text[]
+ )
+);
+
+
CREATE TABLE "pickListLine" (
"id" TEXT NOT NULL DEFAULT xid(),
"pickListId" TEXT NOT NULL,
@@ -113,43 +146,45 @@ CREATE INDEX "pickListLine_pickListId_idx" ON "pickListLine" ("pickListId");
CREATE INDEX "pickListLine_jobId_idx" ON "pickListLine" ("jobId");
CREATE INDEX "pickListLine_itemId_idx" ON "pickListLine" ("itemId");
--- Extend itemLedger documentType enum with pick and transfer types
-DO $$
-BEGIN
- IF NOT EXISTS (SELECT 1 FROM pg_type t
- JOIN pg_enum e ON t.oid = e.enumtypid
- WHERE t.typname = 'documentType' AND e.enumlabel = 'Pick Transfer') THEN
- ALTER TYPE "documentType" ADD VALUE 'Pick Transfer';
- END IF;
- IF NOT EXISTS (SELECT 1 FROM pg_type t
- JOIN pg_enum e ON t.oid = e.enumtypid
- WHERE t.typname = 'documentType' AND e.enumlabel = 'Vehicle Transfer') THEN
- ALTER TYPE "documentType" ADD VALUE 'Vehicle Transfer';
- END IF;
- IF NOT EXISTS (SELECT 1 FROM pg_type t
- JOIN pg_enum e ON t.oid = e.enumtypid
- WHERE t.typname = 'documentType' AND e.enumlabel = 'Scrap Transfer') THEN
- ALTER TYPE "documentType" ADD VALUE 'Scrap Transfer';
- END IF;
- IF NOT EXISTS (SELECT 1 FROM pg_type t
- JOIN pg_enum e ON t.oid = e.enumtypid
- WHERE t.typname = 'documentType' AND e.enumlabel = 'Quarantine Transfer') THEN
- ALTER TYPE "documentType" ADD VALUE 'Quarantine Transfer';
- END IF;
+CREATE POLICY "SELECT" ON "public"."pickListLine"
+FOR SELECT USING (
+ "companyId" = ANY (
+ (
+ SELECT
+ get_companies_with_employee_role()
+ )::text[]
+ )
+);
- IF NOT EXISTS (SELECT 1 FROM pg_type t
- JOIN pg_enum e ON t.oid = e.enumtypid
- WHERE t.typname = 'documentType' AND e.enumlabel = 'Customer Transfer') THEN
- ALTER TYPE "documentType" ADD VALUE 'Customer Transfer';
- END IF;
+CREATE POLICY "INSERT" ON "public"."pickListLine"
+FOR INSERT WITH CHECK (
+ "companyId" = ANY (
+ (
+ SELECT
+ get_companies_with_employee_permission ('inventory_create')
+ )::text[]
+ )
+);
- IF NOT EXISTS (SELECT 1 FROM pg_type t
- JOIN pg_enum e ON t.oid = e.enumtypid
- WHERE t.typname = 'documentType' AND e.enumlabel = 'Rejection Transfer') THEN
- ALTER TYPE "documentType" ADD VALUE 'Rejection Transfer';
- END IF;
-END $$;
+CREATE POLICY "UPDATE" ON "public"."pickListLine"
+FOR UPDATE USING (
+ "companyId" = ANY (
+ (
+ SELECT
+ get_companies_with_employee_permission ('inventory_update')
+ )::text[]
+ )
+);
+CREATE POLICY "DELETE" ON "public"."pickListLine"
+FOR DELETE USING (
+ "companyId" = ANY (
+ (
+ SELECT
+ get_companies_with_employee_permission ('inventory_delete')
+ )::text[]
+ )
+);
\ No newline at end of file
diff --git a/packages/database/supabase/migrations/20251007014346_update-job-method-rpcs-with-shelf.sql b/packages/database/supabase/migrations/20251007014346_update-job-method-rpcs-with-shelf.sql
index 33d9e15128..851231e5de 100644
--- a/packages/database/supabase/migrations/20251007014346_update-job-method-rpcs-with-shelf.sql
+++ b/packages/database/supabase/migrations/20251007014346_update-job-method-rpcs-with-shelf.sql
@@ -1,11 +1,10 @@
--- Update get_job_methods_by_method_id to include shelfId
DROP FUNCTION IF EXISTS get_job_methods_by_method_id;
CREATE OR REPLACE FUNCTION get_job_methods_by_method_id(mid TEXT)
RETURNS TABLE (
"jobId" TEXT,
"methodMaterialId" TEXT,
"jobMakeMethodId" TEXT,
- "jobMaterialMakeMethodId" TEXT,
+ "jobMaterialMakeMethodId" TEXT,
"itemId" TEXT,
"itemReadableId" TEXT,
"description" TEXT,
@@ -21,13 +20,13 @@ RETURNS TABLE (
"shelfId" TEXT
) AS $$
WITH RECURSIVE material AS (
- SELECT
+ SELECT
"jobId",
- "id",
+ "id",
"id" AS "jobMakeMethodId",
'Make'::"methodType" AS "methodType",
"id" AS "jobMaterialMakeMethodId",
- "itemId",
+ "itemId",
'Part' AS "itemType",
1::NUMERIC AS "quantity",
0::NUMERIC AS "unitCost",
@@ -36,18 +35,18 @@ WITH RECURSIVE material AS (
FALSE AS "kit",
TRUE AS "isRoot",
NULL::TEXT AS "shelfId"
- FROM
- "jobMakeMethod"
- WHERE
+ FROM
+ "jobMakeMethod"
+ WHERE
"id" = mid
- UNION
- SELECT
+ UNION
+ SELECT
child."jobId",
- child."id",
+ child."id",
child."jobMakeMethodId",
child."methodType",
child."jobMaterialMakeMethodId",
- child."itemId",
+ child."itemId",
child."itemType",
child."quantity",
child."unitCost",
@@ -56,14 +55,14 @@ WITH RECURSIVE material AS (
child."kit",
FALSE AS "isRoot",
child."shelfId"
- FROM
- "jobMaterialWithMakeMethodId" child
+ FROM
+ "jobMaterialWithMakeMethodId" child
INNER JOIN material parent ON parent."jobMaterialMakeMethodId" = child."jobMakeMethodId"
WHERE parent."methodType" = 'Make'
-)
-SELECT
+)
+SELECT
material."jobId",
- material.id as "methodMaterialId",
+ material.id as "methodMaterialId",
material."jobMakeMethodId",
material."jobMaterialMakeMethodId",
material."itemId",
@@ -79,11 +78,12 @@ SELECT
material."kit",
material."isRoot",
material."shelfId"
-FROM material
+FROM material
INNER JOIN item ON material."itemId" = item.id
ORDER BY "order"
$$ LANGUAGE sql STABLE;
+
-- Update get_job_method to include shelfId
DROP FUNCTION IF EXISTS get_job_method;
CREATE OR REPLACE FUNCTION get_job_method(jid TEXT)
@@ -175,3 +175,94 @@ INNER JOIN item ON material."itemId" = item.id
WHERE material."jobId" = jid
ORDER BY "order"
$$ LANGUAGE sql STABLE;
+
+DROP FUNCTION IF EXISTS get_job_method;
+CREATE OR REPLACE FUNCTION get_job_method(jid TEXT)
+RETURNS TABLE (
+ "jobId" TEXT,
+ "methodMaterialId" TEXT,
+ "jobMakeMethodId" TEXT,
+ "jobMaterialMakeMethodId" TEXT,
+ "itemId" TEXT,
+ "itemReadableId" TEXT,
+ "description" TEXT,
+ "itemType" TEXT,
+ "quantity" NUMERIC,
+ "unitCost" NUMERIC,
+ "methodType" "methodType",
+ "parentMaterialId" TEXT,
+ "order" DOUBLE PRECISION,
+ "isRoot" BOOLEAN,
+ "kit" BOOLEAN,
+ "revision" TEXT,
+ "version" NUMERIC(10,2),
+ "shelfId" TEXT
+) AS $$
+WITH RECURSIVE material AS (
+ SELECT
+ "jobId",
+ "id",
+ "id" AS "jobMakeMethodId",
+ 'Make'::"methodType" AS "methodType",
+ "id" AS "jobMaterialMakeMethodId",
+ "itemId",
+ 'Part' AS "itemType",
+ 1::NUMERIC AS "quantity",
+ 0::NUMERIC AS "unitCost",
+ "parentMaterialId",
+ CAST(1 AS DOUBLE PRECISION) AS "order",
+ TRUE AS "isRoot",
+ FALSE AS "kit",
+ "version",
+ NULL::TEXT AS "shelfId"
+ FROM
+ "jobMakeMethod"
+ WHERE
+ "jobId" = jid
+ AND "parentMaterialId" IS NULL
+ UNION
+ SELECT
+ child."jobId",
+ child."id",
+ child."jobMakeMethodId",
+ child."methodType",
+ child."jobMaterialMakeMethodId",
+ child."itemId",
+ child."itemType",
+ child."quantity",
+ child."unitCost",
+ parent."id" AS "parentMaterialId",
+ child."order",
+ FALSE AS "isRoot",
+ child."kit",
+ child."version",
+ child."shelfId"
+ FROM
+ "jobMaterialWithMakeMethodId" child
+ INNER JOIN material parent ON parent."jobMaterialMakeMethodId" = child."jobMakeMethodId"
+ WHERE parent."methodType" = 'Make'
+)
+SELECT
+ material."jobId",
+ material.id as "methodMaterialId",
+ material."jobMakeMethodId",
+ material."jobMaterialMakeMethodId",
+ material."itemId",
+ item."readableIdWithRevision" AS "itemReadableId",
+ item."name" AS "description",
+ material."itemType",
+ material."quantity",
+ material."unitCost",
+ material."methodType",
+ material."parentMaterialId",
+ material."order",
+ material."isRoot",
+ material."kit",
+ item."revision",
+ material."version",
+ material."shelfId"
+FROM material
+INNER JOIN item ON material."itemId" = item.id
+WHERE material."jobId" = jid
+ORDER BY "order"
+$$ LANGUAGE sql STABLE;
\ No newline at end of file