Compare commits
10 Commits
7cc3778506
...
57966ac9de
| Author | SHA1 | Date | |
|---|---|---|---|
| 57966ac9de | |||
| 6910550de7 | |||
| 1f8b8a7248 | |||
| cfed981928 | |||
| 0efe74d4b1 | |||
| c35db2e209 | |||
| e1cdeb740b | |||
| 3c9e75dc3c | |||
| 64b5b0d248 | |||
| 668eae9719 |
@@ -36,7 +36,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"admConfig": {
|
"admConfig": {
|
||||||
"build": 579,
|
"build": 585,
|
||||||
"oldBuild": "backend-0.1.3.zip"
|
"oldBuild": "backend-0.1.3.zip"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -285,9 +285,15 @@ export const labelingProcess = async ({
|
|||||||
// "ocp",
|
// "ocp",
|
||||||
// `Error Booking in label: ${book.errors[0].message}`
|
// `Error Booking in label: ${book.errors[0].message}`
|
||||||
// );
|
// );
|
||||||
|
createLog(
|
||||||
|
"error",
|
||||||
|
"labeling",
|
||||||
|
"ocp",
|
||||||
|
`There was an error booking in the label: ${book?.errors[0]?.message}`
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: `Error Booking in label: ${book.errors[0]?.message}`,
|
message: `Error Booking in label: ${book?.errors[0]?.message}`,
|
||||||
data: book,
|
data: book,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export const isMainMatStaged = async (lot: any) => {
|
|||||||
|
|
||||||
const mainMateiral = res.filter((n: any) => n.IsMainMaterial);
|
const mainMateiral = res.filter((n: any) => n.IsMainMaterial);
|
||||||
|
|
||||||
if (mainMateiral[0]?.noMaterialShortage === "no") {
|
if (mainMateiral[0]?.noMaterialShortage === "noMM") {
|
||||||
isStaged = {
|
isStaged = {
|
||||||
message: `Main material: ${mainMateiral[0].MaterialHumanReadableId} - ${mainMateiral[0].MaterialDescription}: is not staged for ${lot.lot} `,
|
message: `Main material: ${mainMateiral[0].MaterialHumanReadableId} - ${mainMateiral[0].MaterialDescription}: is not staged for ${lot.lot} `,
|
||||||
success: false,
|
success: false,
|
||||||
@@ -77,7 +77,11 @@ export const isMainMatStaged = async (lot: any) => {
|
|||||||
|
|
||||||
if (checkColorSetting[0].value === "1") {
|
if (checkColorSetting[0].value === "1") {
|
||||||
const autoConsumeColor = res.filter(
|
const autoConsumeColor = res.filter(
|
||||||
(n: any) => !n.IsMainMaterial && !n.isManual
|
(n: any) =>
|
||||||
|
!n.IsMainMaterial &&
|
||||||
|
!n.isManual &&
|
||||||
|
n.noPKGShortage !== "pkgGood" &&
|
||||||
|
n.noPKGShortage !== "noPkg"
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
autoConsumeColor.some(
|
autoConsumeColor.some(
|
||||||
@@ -100,7 +104,11 @@ export const isMainMatStaged = async (lot: any) => {
|
|||||||
|
|
||||||
// // for manual consume color
|
// // for manual consume color
|
||||||
const manualConsumeColor = res.filter(
|
const manualConsumeColor = res.filter(
|
||||||
(n: any) => !n.IsMainMaterial && n.isManual
|
(n: any) =>
|
||||||
|
!n.IsMainMaterial &&
|
||||||
|
n.isManual &&
|
||||||
|
n.noPKGShortage !== "pkgGood" &&
|
||||||
|
n.noPKGShortage !== "noPkg"
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
manualConsumeColor.some(
|
manualConsumeColor.some(
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export const activeArticle = `
|
export const activeArticle = `
|
||||||
|
use AlplaPROD_test1
|
||||||
|
|
||||||
SELECT V_Artikel.IdArtikelvarianten,
|
SELECT V_Artikel.IdArtikelvarianten,
|
||||||
V_Artikel.Bezeichnung,
|
V_Artikel.Bezeichnung,
|
||||||
V_Artikel.ArtikelvariantenTypBez,
|
V_Artikel.ArtikelvariantenTypBez,
|
||||||
@@ -45,7 +47,10 @@ V_Artikel.ArtikelvariantenTypBez = 'Sleeve' or
|
|||||||
V_Artikel.ArtikelvariantenTypBez = 'Plastic Bag' or
|
V_Artikel.ArtikelvariantenTypBez = 'Plastic Bag' or
|
||||||
V_Artikel.ArtikelvariantenTypBez = 'Purch Spout' or
|
V_Artikel.ArtikelvariantenTypBez = 'Purch Spout' or
|
||||||
V_Artikel.ArtikelvariantenTypBez = 'Seal' or
|
V_Artikel.ArtikelvariantenTypBez = 'Seal' or
|
||||||
V_Artikel.ArtikelvariantenTypBez = 'Tape'
|
V_Artikel.ArtikelvariantenTypBez = 'Tape' or
|
||||||
|
V_Artikel.ArtikelvariantenTypBez = 'Box' or
|
||||||
|
V_Artikel.ArtikelvariantenTypBez = 'Label IML' or
|
||||||
|
V_Artikel.ArtikelvariantenTypBez = 'Pallet Runner'
|
||||||
THEN 'PKG'
|
THEN 'PKG'
|
||||||
WHEN V_Artikel.ArtikelvariantenTypBez='HD-PE' or
|
WHEN V_Artikel.ArtikelvariantenTypBez='HD-PE' or
|
||||||
V_Artikel.ArtikelvariantenTypBez='HD-PE PCR' or
|
V_Artikel.ArtikelvariantenTypBez='HD-PE PCR' or
|
||||||
@@ -111,16 +116,17 @@ sales.[KdArtBez] as CustomerArticleDescription,
|
|||||||
round(V_Artikel.Zyklus, 2) as CycleTime,
|
round(V_Artikel.Zyklus, 2) as CycleTime,
|
||||||
Sypronummer as salesAgreement,
|
Sypronummer as salesAgreement,
|
||||||
V_Artikel.ProdArtikelBez as ProductFamily
|
V_Artikel.ProdArtikelBez as ProductFamily
|
||||||
|
,REPLACE(pur.UOM,'UOM:','') as UOM
|
||||||
--,*
|
--,*
|
||||||
FROM AlplaPROD_test1.dbo.V_Artikel (nolock)
|
FROM dbo.V_Artikel (nolock)
|
||||||
|
|
||||||
join
|
join
|
||||||
AlplaPROD_test1.dbo.V_Artikelvarianten on AlplaPROD_test1.dbo.V_Artikel.IdArtikelvarianten =
|
dbo.V_Artikelvarianten (nolock) on AlplaPROD_usbow1.dbo.V_Artikel.IdArtikelvarianten =
|
||||||
AlplaPROD_test1.dbo.V_Artikelvarianten.IdArtikelvarianten
|
dbo.V_Artikelvarianten.IdArtikelvarianten
|
||||||
|
|
||||||
join
|
join
|
||||||
AlplaPROD_test1.dbo.V_FibuKonten_BASIS on AlplaPROD_test1.dbo.V_Artikelvarianten.IdFibuKonto =
|
dbo.V_FibuKonten_BASIS (nolock) on dbo.V_Artikelvarianten.IdFibuKonto =
|
||||||
AlplaPROD_test1.dbo.V_FibuKonten_BASIS.IdFibuKonto
|
dbo.V_FibuKonten_BASIS.IdFibuKonto
|
||||||
|
|
||||||
|
|
||||||
-- adding in the sales price
|
-- adding in the sales price
|
||||||
@@ -134,7 +140,7 @@ left join
|
|||||||
,[KdArtNr]
|
,[KdArtNr]
|
||||||
,[KdArtBez]
|
,[KdArtBez]
|
||||||
--,*
|
--,*
|
||||||
from AlplaPROD_test1.dbo.T_HistoryVK (nolock)
|
from dbo.T_HistoryVK (nolock)
|
||||||
where
|
where
|
||||||
--GueltigabDatum > getDate() - 120
|
--GueltigabDatum > getDate() - 120
|
||||||
--and
|
--and
|
||||||
@@ -142,7 +148,25 @@ left join
|
|||||||
and StandardKunde = 1 -- default address
|
and StandardKunde = 1 -- default address
|
||||||
) a
|
) a
|
||||||
where RN = 1) as sales
|
where RN = 1) as sales
|
||||||
on AlplaPROD_test1.dbo.V_Artikel.IdArtikelvarianten = sales.av
|
on dbo.V_Artikel.IdArtikelvarianten = sales.av
|
||||||
|
|
||||||
|
/* adding the purchase price info */
|
||||||
|
left join
|
||||||
|
(select * from
|
||||||
|
(select
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY IdArtikelvarianten ORDER BY GueltigabDatum DESC) AS RN,
|
||||||
|
IdArtikelvarianten as av
|
||||||
|
,GueltigabDatum as validDate
|
||||||
|
,EKPreis as price
|
||||||
|
,LiefArtNr as supplierNr
|
||||||
|
,case when len(Bemerkung) > 4 and Bemerkung like '%UOM%' then LEFT(Bemerkung, CHARINDEX(' ', Bemerkung) - 1) else 'UOM:1' end as UOM
|
||||||
|
--,*
|
||||||
|
from dbo.T_HistoryEK (nolock)
|
||||||
|
where
|
||||||
|
StandardLieferant = 1 -- default address
|
||||||
|
) a
|
||||||
|
where RN = 1) as pur
|
||||||
|
on dbo.V_Artikel.IdArtikelvarianten = pur.av
|
||||||
|
|
||||||
where V_Artikel.aktiv = 1
|
where V_Artikel.aktiv = 1
|
||||||
|
|
||||||
|
|||||||
@@ -23,69 +23,59 @@
|
|||||||
|
|
||||||
export const mmQuery = `
|
export const mmQuery = `
|
||||||
use [test1_AlplaPROD2.0_Read]
|
use [test1_AlplaPROD2.0_Read]
|
||||||
|
declare @lot as NVARCHAR(max) = [lotNumber]
|
||||||
/*
|
/*
|
||||||
checks all needed material including pkg
|
Material demands for this lot
|
||||||
|
|
||||||
we only want to monitor the manual materials and the mm materail to make sure they are good.
|
|
||||||
|
|
||||||
for auto consume materails this will be compared with another query.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
SELECT lot.ProductionLotHumanReadableId
|
select
|
||||||
,MaterialHumanReadableId
|
MaterialHumanReadableId
|
||||||
,MaterialDescription
|
,MaterialDescription
|
||||||
--IsMainMaterial,
|
-- check box is staged so we could book in even if we used preprint.
|
||||||
,case when SourcingState in (1, 2) then 1
|
,case when SourcingState in (1, 2) then 1
|
||||||
when x.ProvidedAmount > 0 then 1
|
when x.ProvidedAmount > 0 then 1
|
||||||
when x.EffectiveConsumption > 0 then 1
|
when x.EffectiveConsumption > 0 then 1
|
||||||
else 0 end as Staged
|
else 0 end as Staged
|
||||||
,x.ProvidedAmount as Provided
|
|
||||||
,x.EffectiveConsumption as consumption
|
|
||||||
,x.TotalDemand as totalDemand ,
|
|
||||||
case when cp.Pieces = 1 then (lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces else
|
|
||||||
(a.Weight *((case when cp.Percentage is null then 80.25 else cp.Percentage end) / 100) * ((lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces)) / 1000 end totalNeeded
|
|
||||||
,l.qty as invForAutoConsume
|
|
||||||
/* remaining needed to complete the lot */
|
|
||||||
--,x.TotalDemand - x.EffectiveConsumption as remainingNeeded
|
|
||||||
/* do we have enough staged or scanned to the lot? */
|
|
||||||
,case when (case when x.ProvidedAmount <> 0
|
|
||||||
then x.ProvidedAmount else x.EffectiveConsumption end) >
|
|
||||||
(case when cp.Pieces = 1 then (lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces else
|
|
||||||
(a.Weight *((case when cp.Percentage is null then 80.25 else cp.Percentage end) / 100) * ((lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces)) / 1000 end)
|
|
||||||
then 'good'
|
|
||||||
else 'no' end as noMaterialShortage
|
|
||||||
-- pkg check
|
|
||||||
,case when pkg.QuantityPosition is null then null else
|
|
||||||
(case when l.qty > (lot.TotalProducedLoadingUnits+1) * pkg.QuantityPosition then 'pkgGood' else 'noPkg' end) end as noPKGShortage
|
|
||||||
|
|
||||||
,case when cp.Percentage is null then
|
|
||||||
case when l.qty > ((lot.TotalProducedLoadingUnits +1) * pkg.QuantityPosition) then 'autoConsumeOk' else 'autoConsumeNOK' end else
|
|
||||||
(case when l.qty > (a.Weight *((case when cp.Percentage is null then 80.25 else cp.Percentage end) / 100) * ((lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces)) / 1000 and IsManualProcess = 0
|
|
||||||
then 'autoConsumeOk' else 'autoConsumeNOK' end) end as autoConsumeCheck
|
|
||||||
,x.IsManualProcess as isManual
|
,x.IsManualProcess as isManual
|
||||||
,IsMainMaterial
|
,IsMainMaterial
|
||||||
|
-- lot stuff
|
||||||
,lot.TotalPlannedLoadingUnits
|
,lot.TotalPlannedLoadingUnits
|
||||||
,lot.TotalProducedLoadingUnits
|
,lot.TotalProducedLoadingUnits
|
||||||
,lot.TotalPlannedLoadingUnits - lot.TotalProducedLoadingUnits as remainingPallets
|
,lot.TotalPlannedLoadingUnits - lot.TotalProducedLoadingUnits as remainingPallets
|
||||||
,case when cp.Percentage is null then 80.25 else cp.Percentage end as Percentage -- this is to over come the alternate mm put in planning
|
,x.ProvidedAmount as Provided -- this is what has been provided most of the time this is due to a silo attachment
|
||||||
,case when cp.Pieces is not null then cp.Pieces else pkg.QuantityPosition end as peices
|
,x.EffectiveConsumption as consumption -- this is how much was consummed via cmd 112
|
||||||
FROM [issueMaterial].[MaterialDemand] x (nolock)
|
,x.TotalDemand as totalDemand -- the total demand needed to finish the lot out
|
||||||
|
|
||||||
|
,case when pkg.QuantityPosition >= 0.001 then ((lot.TotalProducedLoadingUnits+1) * pkg.QuantityPosition) else
|
||||||
|
(a.Weight *(cp.Percentage / 100) * ((lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces)) / 1000 end totalNeeded
|
||||||
|
|
||||||
|
,case when IsMainMaterial = 1 then case when (case when x.ProvidedAmount <> 0
|
||||||
|
then x.ProvidedAmount else x.EffectiveConsumption end) >
|
||||||
|
(case when pkg.QuantityPosition >= 0.001 then (lot.TotalProducedLoadingUnits+1) * pkg.QuantityPosition else
|
||||||
|
(a.Weight *(cp.Percentage / 100) * ((lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces)) / 1000 end)
|
||||||
|
then 'mmGood'
|
||||||
|
else 'noMM' end else null end as noMaterialShortage
|
||||||
|
|
||||||
|
-- pkg check
|
||||||
|
,case when pkg.QuantityPosition is null then null else
|
||||||
|
(case when l.qty > ((lot.TotalProducedLoadingUnits+1) * pkg.QuantityPosition) then 'pkgGood' else 'noPkg' end) end as noPKGShortage
|
||||||
|
-- autoconsume
|
||||||
|
,case when cp.Percentage is null then
|
||||||
|
case when l.qty > ((lot.TotalProducedLoadingUnits +1) * pkg.QuantityPosition) then 'autoConsumeOk' else 'autoConsumeNOK' end else
|
||||||
|
(case when l.qty > (a.Weight *(cp.Percentage / 100) * ((lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces)) / 1000 and IsManualProcess = 0
|
||||||
|
then 'autoConsumeOk' else 'autoConsumeNOK' end) end as autoConsumeCheck
|
||||||
|
-- stock amounts
|
||||||
|
,l.qty as invForAutoConsume
|
||||||
|
,x.IsManualProcess as isManual
|
||||||
|
,IsMainMaterial
|
||||||
|
,case when cp.Percentage is null then 0 else cp.Percentage end as Percentage
|
||||||
|
,pkg.QuantityPosition
|
||||||
|
from [issueMaterial].[MaterialDemand] x (nolock)
|
||||||
|
|
||||||
|
/* production lot info */
|
||||||
left join
|
left join
|
||||||
[productionControlling].[ProducedLot] as lot on
|
[productionControlling].[ProducedLot] as lot on
|
||||||
lot.Id = x.ProductionLotId
|
lot.Id = x.ProductionLotId
|
||||||
|
|
||||||
/* av data */
|
|
||||||
left join
|
|
||||||
[masterData].[Article] as a on
|
|
||||||
a.id = lot.ArticleId
|
|
||||||
|
|
||||||
/* compound*/
|
|
||||||
left join
|
|
||||||
[masterData].[CompoundPosition] as cp on
|
|
||||||
cp.CompoundId = a.CompoundId
|
|
||||||
and cp.ArticleId = x.MaterialId
|
|
||||||
|
|
||||||
/* packagaing */
|
/* packagaing */
|
||||||
left join
|
left join
|
||||||
[masterData].[PackagingInstructionPosition] as pkg on
|
[masterData].[PackagingInstructionPosition] as pkg on
|
||||||
@@ -97,6 +87,17 @@ left join
|
|||||||
[masterData].[PackagingInstruction] as p on
|
[masterData].[PackagingInstruction] as p on
|
||||||
p.id = lot.PackagingId
|
p.id = lot.PackagingId
|
||||||
|
|
||||||
|
/* av data */
|
||||||
|
left join
|
||||||
|
[masterData].[Article] as a on
|
||||||
|
a.id = lot.ArticleId
|
||||||
|
|
||||||
|
/* compound*/
|
||||||
|
left join
|
||||||
|
[masterData].[CompoundPosition] as cp on
|
||||||
|
cp.CompoundId = a.CompoundId
|
||||||
|
and cp.ArticleId = x.MaterialId
|
||||||
|
|
||||||
/* current stock info for auto consumption*/
|
/* current stock info for auto consumption*/
|
||||||
left join
|
left join
|
||||||
(select
|
(select
|
||||||
@@ -104,14 +105,15 @@ IdArtikelVarianten
|
|||||||
,ArtikelVariantenBez
|
,ArtikelVariantenBez
|
||||||
,sum(VerfuegbareMengeSum) as qty
|
,sum(VerfuegbareMengeSum) as qty
|
||||||
|
|
||||||
from AlplaPROD_test1.dbo.V_LagerPositionenBarcodes as i (nolock)
|
from AlplaPROD_usweb1.dbo.V_LagerPositionenBarcodes as i (nolock)
|
||||||
|
|
||||||
left join
|
left join
|
||||||
AlplaPROD_test1.dbo.V_LagerAbteilungen as l (nolock) on
|
AlplaPROD_usweb1.dbo.V_LagerAbteilungen as l (nolock) on
|
||||||
l.IdLagerAbteilung = i.IdLagerAbteilung
|
l.IdLagerAbteilung = i.IdLagerAbteilung
|
||||||
where autoverbrauch = 1 and aktiv = 1
|
where autoverbrauch = 1 and aktiv = 1
|
||||||
group by IdArtikelVarianten,ArtikelVariantenBez
|
group by IdArtikelVarianten,ArtikelVariantenBez
|
||||||
) as l on
|
) as l on
|
||||||
l.IdArtikelVarianten = MaterialHumanReadableId
|
l.IdArtikelVarianten = MaterialHumanReadableId
|
||||||
where lot.ProductionLotHumanReadableId = [lotNumber]
|
|
||||||
|
where lot.ProductionLotHumanReadableId = @lot
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user