Commit c26b0e56 by Sxy

fix: 流程优化

parent c2842f9c
......@@ -114,7 +114,7 @@ class DeliverService extends ServiceBase {
if (!deliverData) {
throw new Error('没有此交付单');
}
if (![system.SERVERSESTATUS.SUBMITING, system.SERVERSESTATUS.POSTING].includes(deliverData.delivery_status)) {
if (![system.SERVERSESTATUS.SUBMITING, system.SERVERSESTATUS.DISPOSEING, system.SERVERSESTATUS.POSTING].includes(deliverData.delivery_status)) {
throw new Error('此状态下不可手动更新办理状态');
}
let status;
......@@ -124,6 +124,10 @@ class DeliverService extends ServiceBase {
status = system.SERVERSESTATUS.DISPOSEING;
txstatus = pushTx.TXSTATUS.DISPOSEING;
break;
case system.SERVERSESTATUS.DISPOSEING:
status = system.SERVERSESTATUS.POSTING;
txstatus = pushTx.TXSTATUS.POSTING;
break;
case system.SERVERSESTATUS.POSTING:
status = system.SERVERSESTATUS.SUCCESS;
txstatus = pushTx.TXSTATUS.SUCCESS;
......@@ -193,11 +197,12 @@ class DeliverService extends ServiceBase {
) {
throw new Error('该交付单状态下不可提交');
}
if ([system.SERVERSESTATUS.SUCCESS, system.SERVERSESTATUS.POSTING].includes(deliverData.delivery_status)) {
if ([system.SERVERSESTATUS.SUCCESS, system.SERVERSESTATUS.POSTING, system.SERVERSESTATUS.DISPOSEING].includes(deliverData.delivery_status)) {
// 给腾讯 发消息
const STATUS = {
success: pushTx.TXSTATUS.SUCCESS,
posting: pushTx.TXSTATUS.POSTING,
disposeing: pushTx.TXSTATUS.DISPOSEING
};
await pushTx.pushChangeOrder(STATUS[deliverData.delivery_status], deliverData.delivery_code, {
......@@ -338,18 +343,10 @@ class DeliverService extends ServiceBase {
}
async addMail(pobj) {
/**
* 判断状态
* 保存 邮寄信息
* 更改流转状态
*/
const result = await this.dao.findInfo(pobj);
if (!result) {
throw new Error('交付单不可查看');
}
if (!result.qualification) {
throw new Error('请先上传资质信息');
}
if (
![system.SERVERSESTATUS.DISPOSEING,
system.SERVERSESTATUS.SUCCESS,
......@@ -367,38 +364,43 @@ class DeliverService extends ServiceBase {
};
await pushTx.pushChangeOrder(STATUS[result.delivery_status], result.delivery_code, {
qualification: result.qualification,
recipientInfo: {
...pobj.recipientInfo,
phone: encryptStr(pobj.recipientInfo.phone),
},
});
return this.db.transaction(async (t) => {
await this.materialDao.updateByWhere({
proposerInfo,
}, {
id: material.id,
}, t);
if (system.SERVERSESTATUS.DISPOSEING === result.delivery_status) {
await this.dao.updateByWhere({
delivery_status: system.SERVERSESTATUS.POSTING,
}, {
id: pobj.id,
}, t);
this.statuslogDao.create({
flow_type: system.FLOWCODE.DELIVERY,
flow_id: pobj.id,
status_code: system.SERVERSESTATUS.POSTING,
salesman_id: pobj.userid,
salesman_name: pobj.username,
});
}
return 'success';
});
return "SUCCESS"
// return this.db.transaction(async (t) => {
// await this.materialDao.updateByWhere({
// proposerInfo,
// }, {
// id: material.id,
// }, t);
// if (system.SERVERSESTATUS.DISPOSEING === result.delivery_status) {
// await this.dao.updateByWhere({
// delivery_status: system.SERVERSESTATUS.POSTING,
// }, {
// id: pobj.id,
// }, t);
// this.statuslogDao.create({
// flow_type: system.FLOWCODE.DELIVERY,
// flow_id: pobj.id,
// status_code: system.SERVERSESTATUS.POSTING,
// salesman_id: pobj.userid,
// salesman_name: pobj.username,
// });
// }
// return 'success';
// });
}
async findAnnualReportInfo(pobj) {
......
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