Commit 0dd1f60c by 兰国旗

laolan

parent e0390119
......@@ -813,6 +813,7 @@ class RegCenterOrderService{
console.log("regNeedClose+++",pobj)
var ab = pobj.actionBody;
var app = pobj.appInfo;
var uappId;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
......@@ -826,52 +827,57 @@ class RegCenterOrderService{
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
}else{
uappId = needinfo.uapp_id
}
if (needinfo.status == "ygb" || needinfo.status == "ycd") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
//获取方案信息
var ns = await this.needsolutionDao.model.findAll({
var ns = await this.needsolutionDao.model.findAndCountAll({
where: { needNo: needinfo.needNo, isInvalid: 0 }, raw: true
});
console.log('nnnsss-----', ns)
var i;
var needObj = {};
var nsLength = ns.length
if (ns.length > 0) {
var updateSolution = {}
var nsLength = ns.rows.length
if (nsLength > 0) {
for (i = 0; i < nsLength; i++) {
if (ns[i].id) {
if (ns[i].status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃"+ ns[i].statusName +"方案");
if (ns.rows[i].id) {
ns.rows[i]['uapp_id'] = uappId;
if (ns.rows[i].status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃"+ ns.rows[i].statusName +"方案");
}
var flowStatus = ns[i].solutionContent && ns[i].solutionContent.status ? ns[i].solutionContent.status : "";
var flowStatus = ns.rows[i].solutionContent && ns.rows[i].solutionContent.status ? ns.rows[i].solutionContent.status : "";
if (flowStatus && ["SUCCESS"].indexOf(flowStatus) == 0) {
return system.getResultFail(-104, "方案状态为已完成,不能关闭需求");
}
var self = this
updateSolution = {
status: "yzf",
isInvalid: 1
}
await this.needsolutionDao.db.transaction(async function (t) {
needObj = {
id: needinfo.id, status: "ygb", notes: ab.note
status: "ygb", notes: ab.note
};
await this.needinfoDao.update(needObj, t);//关闭需求
await self.needsolutionDao.model.update({ status: "yzf", isInvalid: 1 }, { where: { id: ns.id }, transaction: t });//方案废弃
// return system.getResultSuccess(ns.orderNo);
await self.needinfoDao.updateByWhere(needObj, { where :{id: needinfo.id }, t });//关闭需求
// await self.needsolutionDao.update({ status: "yzf", isInvalid: 1 }, { where: { id: ns.rows[i].id }, transaction: t });//方案废弃
var a= await self.needsolutionDao.updateByWhere(updateSolution, { where: { id: ns.rows[i].id }, t });//方案废弃
console.log("aaaa---",a)
})
return system.getResultSuccess(ns);
}
}
}else{
needObj = {
id: needinfo.id, status: "ygb", notes: ab.note
};
await this.needinfoDao.update(needObj)
console.log('needObj----', ns)
ns['uapp_id'] = needinfo.uapp_id;
console.log('guanbi ns -----', ns)
await this.needinfoDao.updateByWhere(needObj,{where :{id: needinfo.id}})
return system.getResultSuccess(needinfo);
}
return system.getResultSuccess(ns);
}
//交付商通知状态变更
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment