summaryrefslogtreecommitdiff
path: root/src/app/api/stock-opname/route.tsx
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-07-04 11:53:01 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-07-04 11:53:01 +0700
commit9a80c0a767c6a35a489b9d45654ae60f7ddc6794 (patch)
tree719161efc93b3abb408fa77d1d78e8193dc86df2 /src/app/api/stock-opname/route.tsx
parenta711c3d7f3a41bb5ac20485723a0f629fbfde1b7 (diff)
<iman> update stock opname logic
Diffstat (limited to 'src/app/api/stock-opname/route.tsx')
-rw-r--r--src/app/api/stock-opname/route.tsx11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/app/api/stock-opname/route.tsx b/src/app/api/stock-opname/route.tsx
index 250e70b..9f44158 100644
--- a/src/app/api/stock-opname/route.tsx
+++ b/src/app/api/stock-opname/route.tsx
@@ -186,7 +186,7 @@ const computeIsDifferent = async ({
// anyCountEqWithOnhand: [totalQty['COUNT1'], totalQty['COUNT2'], totalQty['COUNT3']].includes(onhandQty),
anyCountEqWithOnhand: totalQty['COUNT1'] === onhandQty || totalQty['COUNT2'] === onhandQty || totalQty['COUNT1'] === onhandQty ,
anyCountEqWithAllQty: [totalQty['COUNT1'], totalQty['COUNT2'], totalQty['COUNT3']].includes(allQty),
- count1EqWithCount2: totalQty['COUNT1'] !== null && totalQty['COUNT2'] !== null && totalQty['COUNT1'] === totalQty['COUNT2'],
+ count1EqWithCount2: totalQty['COUNT1'] !== null && totalQty['COUNT2'] !== null && totalQty['COUNT1'] === totalQty['COUNT2'] && totalQty['COUNT3'] === null,
count1EqWithCount3: totalQty['COUNT1'] !== null && totalQty['COUNT3'] !== null && totalQty['COUNT1'] === totalQty['COUNT3'],
count2EqWithCount3: totalQty['COUNT2'] !== null && totalQty['COUNT3'] !== null && totalQty['COUNT2'] === totalQty['COUNT3'],
}
@@ -216,10 +216,11 @@ const computeIsDifferent = async ({
const detailCondition = {
verificationCheckAll: _.isNumber(VERIFICATION.quantity),
- anyCountEqWithOnhand: totalQty['COUNT1'] === onhandQty || totalQty['COUNT2'] === onhandQty || totalQty['COUNT1'] === onhandQty ,
- count1EqWithCount2: COUNT1.quantity === COUNT2.quantity,
+ anyCountEqWithOnhand: totalQty['COUNT1'] === onhandQty || totalQty['COUNT2'] === onhandQty || totalQty['COUNT3'] === onhandQty ,
+ count1EqWithCount2: totalQty['COUNT3'] === 0 && COUNT1.quantity === COUNT2.quantity,
count1EqWithCount3: COUNT1.quantity === COUNT3.quantity,
count2EqWithCount3: COUNT2.quantity === COUNT3.quantity && (COUNT2.quantity === 0 && COUNT3.quantity === 0),
+ // count3EqWithCount1_2: (COUNT3.quantity !== COUNT1.quantity) && (COUNT3.quantity !== COUNT2.quantity) && (COUNT1.quantity === COUNT2.quantity) && (COUNT3.quantity !== onhandQty)
}
if (
@@ -234,17 +235,17 @@ const computeIsDifferent = async ({
isDifferent = true;
break;
}
+ console.log('----------------------------------BATAS SUCI ATAS NEW STOCK ------------------------------');
console.log('Is Different2222:', isDifferent);
console.log('Conditions:', detailCondition);
}
- console.log('----------------------------------BATAS SUCI ATAS------------------------------');
console.log('Total Quantity:', totalQty);
console.log('Onhand Quantity:', onhandQty);
console.log('Difference Quantity:', differenceQty);
console.log('Conditions:', conditional);
console.log('Is Different tambah data:', isDifferent);
- console.log('----------------------------------BATAS SUCI BAWAH------------------------------');
+ console.log('----------------------------------BATAS SUCI BAWAH NEW STOCK------------------------------');
await prisma.product.update({
where: { id: product.id },