CM Munka lezárás hozzáadva
This commit is contained in:
parent
35fc79eb57
commit
4fd8480f72
|
|
@ -18,6 +18,7 @@ const CM_Fetch_WorkNumbers=async()=>
|
||||||
const user = await User.findOne({username: 'cmr'});
|
const user = await User.findOne({username: 'cmr'});
|
||||||
if (!user) return;
|
if (!user) return;
|
||||||
if (!user.canAdd.work) return;
|
if (!user.canAdd.work) return;
|
||||||
|
|
||||||
cmWorks.forEach( async element => {
|
cmWorks.forEach( async element => {
|
||||||
const foundWork= await Work.findOne({$or:[
|
const foundWork= await Work.findOne({$or:[
|
||||||
{ cmId: element.ID},
|
{ cmId: element.ID},
|
||||||
|
|
@ -91,6 +92,7 @@ const CM_Fetch_WorkNumbers=async()=>
|
||||||
}
|
}
|
||||||
else // Ha van már ilyen munka megnézzük módosították e.
|
else // Ha van már ilyen munka megnézzük módosították e.
|
||||||
{
|
{
|
||||||
|
//Módosítás
|
||||||
if (foundWork.title!=element.munkanev ||
|
if (foundWork.title!=element.munkanev ||
|
||||||
foundWork.body!=element.Megjegyzes ||
|
foundWork.body!=element.Megjegyzes ||
|
||||||
foundWork.poNumber!=element.KulsoRendSzam ||
|
foundWork.poNumber!=element.KulsoRendSzam ||
|
||||||
|
|
@ -112,6 +114,25 @@ const CM_Fetch_WorkNumbers=async()=>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Lezárás, ha nyitott, de a CM zárta
|
||||||
|
if (foundWork.state=='Opened' && element.Nyitott==7)
|
||||||
|
{
|
||||||
|
if (foundWork.title==element.munkanev &&
|
||||||
|
foundWork.body==element.Megjegyzes &&
|
||||||
|
foundWork.poNumber==element.KulsoRendSzam &&
|
||||||
|
foundWork.megrendelo==element.SzamlNev &&
|
||||||
|
foundWork.workNumber==element.Szovertek &&
|
||||||
|
foundWork.cmRendAzonosito==element.RendAzon &&
|
||||||
|
foundWork.state=='Opened')
|
||||||
|
{
|
||||||
|
if (element.ID==foundWork.cmId)
|
||||||
|
{
|
||||||
|
console.log("Lezárás történt a CM-ben."+foundWork.title);
|
||||||
|
await Work.findOneAndUpdate({'cmId': foundWork.cmId},{$set:{'state':'Closed'}})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//console.log(jsonData.val);
|
//console.log(jsonData.val);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue