maker/checkercomplete:GWM
This commit is contained in:
parent
141fe387e2
commit
fd41194aee
@ -324,7 +324,15 @@ Pro42Data.forEach((Pro42Datavalue, key)=>{
|
||||
{
|
||||
Entities.create({ "losid":Pro42Datavalue.losid,"pan":Pro42Datavalue.pan,"cin":Pro42Datavalue.cin,"bizname":Pro42Datavalue.bizname,"entity_type":Pro42Datavalue.entity_type,"activity_group":Pro42Datavalue.activity_group,"biz_act_desc":Pro42Datavalue.biz_act_desc,"createdby":Pro42Datavalue.createdby})
|
||||
.then(Entitydata => {
|
||||
console.log(Entitydata.dataValues.id)
|
||||
|
||||
//process instance Id update
|
||||
const primeryId = Entitydata.dataValues.id;
|
||||
const user = "SMC";
|
||||
processInstanceId = camundaHelper.startFinancialsProcessInstance(Entitydata.dataValues.losid,Entitydata.dataValues.pan,user);
|
||||
processInstanceId.then(function(InstanceId){
|
||||
Entities.update({ "process_instance_id":InstanceId },{ where: { id: primeryId }});
|
||||
});
|
||||
|
||||
//create Entityfinyears data
|
||||
const Y1 = new Date().getFullYear();
|
||||
const Y2 = Y1-1;
|
||||
|
||||
@ -572,9 +572,133 @@ exports.Reassign = async (req, res) => {
|
||||
|
||||
};
|
||||
|
||||
exports.makerComplete = (req, res) => {
|
||||
try
|
||||
{
|
||||
const losid = req.query.losid;
|
||||
const entityid = req.query.entityid;
|
||||
|
||||
if(losid)
|
||||
{
|
||||
Entities.findAll({where : { losid : losid },attributes: [ 'id','process_instance_id'] })
|
||||
.then(data => {
|
||||
data.forEach((AllEntityData, key)=>{
|
||||
processInstanceId = AllEntityData.dataValues.process_instance_id;
|
||||
task_id = camundaHelper.financialsListOfProcessInstances(processInstanceId);
|
||||
task_id.then(function(task_id)
|
||||
{
|
||||
if(task_id != false)
|
||||
{
|
||||
formVariable = camundaHelper.financialsFormVariables(task_id);
|
||||
formVariable.then(function(form_result){
|
||||
formVariableResult = JSON.parse(form_result);
|
||||
let camunda_status = formVariableResult.process_status.value;
|
||||
if(camunda_status == "re_started" || camunda_status == "started")
|
||||
{
|
||||
value = true;
|
||||
camundaHelper.financialsTaskComplete(task_id,value);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});// end of foreach
|
||||
|
||||
setTimeout(()=>{
|
||||
res.send({'status':200,'message':"success",'data':"No data"});
|
||||
},3000)
|
||||
});//end of findAll query
|
||||
}
|
||||
else if(entityid)
|
||||
{
|
||||
Entities.findOne({where : { id : entityid },attributes: [ 'id','process_instance_id'] })
|
||||
.then(data => {
|
||||
const processInstanceId = data.dataValues.process_instance_id;
|
||||
task_id = camundaHelper.financialsListOfProcessInstances(processInstanceId);
|
||||
task_id.then(function(task_id)
|
||||
{
|
||||
if(task_id != false)
|
||||
{
|
||||
value = true;
|
||||
camundaHelper.financialsTaskComplete(task_id,value);
|
||||
setTimeout(()=>{
|
||||
res.send({'status':200,'message':"success",'data':"No data"});
|
||||
},1000)
|
||||
}
|
||||
});
|
||||
});//end of find one query
|
||||
} // end of else if part
|
||||
|
||||
}catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while Cheker Complete." ,'data': "No data"
|
||||
}); }
|
||||
|
||||
};
|
||||
|
||||
exports.checkerComplete = (req, res) => {
|
||||
try
|
||||
{
|
||||
const losid = req.query.losid;
|
||||
const entityid = req.query.entityid;
|
||||
|
||||
if(losid)
|
||||
{
|
||||
console.log(losid);
|
||||
Entities.findAll({where : { losid : losid },attributes: [ 'id','process_instance_id'] })
|
||||
.then(data => {
|
||||
data.forEach((AllEntityData, key)=>{
|
||||
processInstanceId = AllEntityData.dataValues.process_instance_id;
|
||||
task_id = camundaHelper.financialsListOfProcessInstances(processInstanceId);
|
||||
task_id.then(function(task_id)
|
||||
{
|
||||
if(task_id != false)
|
||||
{
|
||||
formVariable = camundaHelper.financialsFormVariables(task_id);
|
||||
formVariable.then(function(form_result){
|
||||
formVariableResult = JSON.parse(form_result);
|
||||
let camunda_status = formVariableResult.process_status.value;
|
||||
if(camunda_status == "maker_completed" )
|
||||
{
|
||||
value = true;
|
||||
camundaHelper.financialsTaskComplete(task_id,value);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});// end of foreach
|
||||
|
||||
setTimeout(()=>{
|
||||
res.send({'status':200,'message':"success",'data':"No data"});
|
||||
},3000)
|
||||
});//end of findAll query
|
||||
}
|
||||
else if(entityid)
|
||||
{
|
||||
console.log(entityid);
|
||||
Entities.findOne({where : { id : entityid },attributes: [ 'id','process_instance_id'] })
|
||||
.then(data => {
|
||||
const processInstanceId = data.dataValues.process_instance_id;
|
||||
task_id = camundaHelper.financialsListOfProcessInstances(processInstanceId);
|
||||
task_id.then(function(task_id)
|
||||
{
|
||||
if(task_id != false)
|
||||
{
|
||||
value = true;
|
||||
camundaHelper.financialsTaskComplete(task_id,value);
|
||||
setTimeout(()=>{
|
||||
res.send({'status':200,'message':"success",'data':"No data"});
|
||||
},1000)
|
||||
}
|
||||
});
|
||||
});//end of find one query
|
||||
} // end of else if part
|
||||
|
||||
}catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while Cheker Complete." ,'data': "No data"
|
||||
}); }
|
||||
|
||||
};
|
||||
|
||||
// exports.test = (req, res) => {
|
||||
|
||||
|
||||
@ -936,8 +936,10 @@ module.exports = app => {
|
||||
|
||||
|
||||
|
||||
//router.post("/doWorkPromise", master.doWorkPromise);
|
||||
//router.get("/test", master.test);
|
||||
|
||||
router.get("/makerComplete", master.makerComplete);
|
||||
|
||||
router.get("/checkerComplete", master.checkerComplete);
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user