Commit 0dd1f60c by 兰国旗

laolan

parent e0390119
...@@ -813,6 +813,7 @@ class RegCenterOrderService{ ...@@ -813,6 +813,7 @@ class RegCenterOrderService{
console.log("regNeedClose+++",pobj) console.log("regNeedClose+++",pobj)
var ab = pobj.actionBody; var ab = pobj.actionBody;
var app = pobj.appInfo; var app = pobj.appInfo;
var uappId;
if (!app || !app.uapp_id) { if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道"); return system.getResultFail(-100, "未知渠道");
} }
...@@ -826,52 +827,57 @@ class RegCenterOrderService{ ...@@ -826,52 +827,57 @@ class RegCenterOrderService{
}); });
if (!needinfo || !needinfo.id) { if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息"); return system.getResultFail(-201, "未知需求信息");
}else{
uappId = needinfo.uapp_id
} }
if (needinfo.status == "ygb" || needinfo.status == "ycd") { if (needinfo.status == "ygb" || needinfo.status == "ycd") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); 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 where: { needNo: needinfo.needNo, isInvalid: 0 }, raw: true
}); });
console.log('nnnsss-----', ns) console.log('nnnsss-----', ns)
var i; var i;
var needObj = {}; var needObj = {};
var nsLength = ns.length var updateSolution = {}
if (ns.length > 0) { var nsLength = ns.rows.length
if (nsLength > 0) {
for (i = 0; i < nsLength; i++) { for (i = 0; i < nsLength; i++) {
if (ns[i].id) { if (ns.rows[i].id) {
if (ns[i].status == "ywc") { ns.rows[i]['uapp_id'] = uappId;
return system.getResultFail(-103, "方案状态错误,不能废弃"+ ns[i].statusName +"方案"); 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) { if (flowStatus && ["SUCCESS"].indexOf(flowStatus) == 0) {
return system.getResultFail(-104, "方案状态为已完成,不能关闭需求"); return system.getResultFail(-104, "方案状态为已完成,不能关闭需求");
} }
var self = this var self = this
updateSolution = {
status: "yzf",
isInvalid: 1
}
await this.needsolutionDao.db.transaction(async function (t) { await this.needsolutionDao.db.transaction(async function (t) {
needObj = { needObj = {
id: needinfo.id, status: "ygb", notes: ab.note status: "ygb", notes: ab.note
}; };
await this.needinfoDao.update(needObj, t);//关闭需求 await self.needinfoDao.updateByWhere(needObj, { where :{id: needinfo.id }, t });//关闭需求
await self.needsolutionDao.model.update({ status: "yzf", isInvalid: 1 }, { where: { id: ns.id }, transaction: t });//方案废弃 // await self.needsolutionDao.update({ status: "yzf", isInvalid: 1 }, { where: { id: ns.rows[i].id }, transaction: t });//方案废弃
// return system.getResultSuccess(ns.orderNo); var a= await self.needsolutionDao.updateByWhere(updateSolution, { where: { id: ns.rows[i].id }, t });//方案废弃
console.log("aaaa---",a)
}) })
return system.getResultSuccess(ns);
} }
} }
}else{ }else{
needObj = { needObj = {
id: needinfo.id, status: "ygb", notes: ab.note id: needinfo.id, status: "ygb", notes: ab.note
}; };
await this.needinfoDao.update(needObj) await this.needinfoDao.updateByWhere(needObj,{where :{id: needinfo.id}})
console.log('needObj----', ns) return system.getResultSuccess(needinfo);
ns['uapp_id'] = needinfo.uapp_id;
console.log('guanbi ns -----', ns)
} }
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