Commit c26b0e56 by Sxy

fix: 流程优化

parent c2842f9c
...@@ -114,7 +114,7 @@ class DeliverService extends ServiceBase { ...@@ -114,7 +114,7 @@ class DeliverService extends ServiceBase {
if (!deliverData) { if (!deliverData) {
throw new Error('没有此交付单'); 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('此状态下不可手动更新办理状态'); throw new Error('此状态下不可手动更新办理状态');
} }
let status; let status;
...@@ -124,6 +124,10 @@ class DeliverService extends ServiceBase { ...@@ -124,6 +124,10 @@ class DeliverService extends ServiceBase {
status = system.SERVERSESTATUS.DISPOSEING; status = system.SERVERSESTATUS.DISPOSEING;
txstatus = pushTx.TXSTATUS.DISPOSEING; txstatus = pushTx.TXSTATUS.DISPOSEING;
break; break;
case system.SERVERSESTATUS.DISPOSEING:
status = system.SERVERSESTATUS.POSTING;
txstatus = pushTx.TXSTATUS.POSTING;
break;
case system.SERVERSESTATUS.POSTING: case system.SERVERSESTATUS.POSTING:
status = system.SERVERSESTATUS.SUCCESS; status = system.SERVERSESTATUS.SUCCESS;
txstatus = pushTx.TXSTATUS.SUCCESS; txstatus = pushTx.TXSTATUS.SUCCESS;
...@@ -188,16 +192,17 @@ class DeliverService extends ServiceBase { ...@@ -188,16 +192,17 @@ class DeliverService extends ServiceBase {
} }
if ( if (
![system.SERVERSESTATUS.DISPOSEING, ![system.SERVERSESTATUS.DISPOSEING,
system.SERVERSESTATUS.SUCCESS, system.SERVERSESTATUS.SUCCESS,
system.SERVERSESTATUS.POSTING].includes(deliverData.delivery_status) system.SERVERSESTATUS.POSTING].includes(deliverData.delivery_status)
) { ) {
throw new Error('该交付单状态下不可提交'); 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 = { const STATUS = {
success: pushTx.TXSTATUS.SUCCESS, success: pushTx.TXSTATUS.SUCCESS,
posting: pushTx.TXSTATUS.POSTING, posting: pushTx.TXSTATUS.POSTING,
disposeing: pushTx.TXSTATUS.DISPOSEING
}; };
await pushTx.pushChangeOrder(STATUS[deliverData.delivery_status], deliverData.delivery_code, { await pushTx.pushChangeOrder(STATUS[deliverData.delivery_status], deliverData.delivery_code, {
...@@ -338,22 +343,14 @@ class DeliverService extends ServiceBase { ...@@ -338,22 +343,14 @@ class DeliverService extends ServiceBase {
} }
async addMail(pobj) { async addMail(pobj) {
/**
* 判断状态
* 保存 邮寄信息
* 更改流转状态
*/
const result = await this.dao.findInfo(pobj); const result = await this.dao.findInfo(pobj);
if (!result) { if (!result) {
throw new Error('交付单不可查看'); throw new Error('交付单不可查看');
} }
if (!result.qualification) {
throw new Error('请先上传资质信息');
}
if ( if (
![system.SERVERSESTATUS.DISPOSEING, ![system.SERVERSESTATUS.DISPOSEING,
system.SERVERSESTATUS.SUCCESS, system.SERVERSESTATUS.SUCCESS,
system.SERVERSESTATUS.POSTING].includes(result.delivery_status) system.SERVERSESTATUS.POSTING].includes(result.delivery_status)
) { ) {
throw new Error('该状态下不可填写邮寄信息'); throw new Error('该状态下不可填写邮寄信息');
} }
...@@ -367,38 +364,43 @@ class DeliverService extends ServiceBase { ...@@ -367,38 +364,43 @@ class DeliverService extends ServiceBase {
}; };
await pushTx.pushChangeOrder(STATUS[result.delivery_status], result.delivery_code, { await pushTx.pushChangeOrder(STATUS[result.delivery_status], result.delivery_code, {
qualification: result.qualification,
recipientInfo: { recipientInfo: {
...pobj.recipientInfo, ...pobj.recipientInfo,
phone: encryptStr(pobj.recipientInfo.phone), phone: encryptStr(pobj.recipientInfo.phone),
}, },
}); });
await this.materialDao.updateByWhere({
return this.db.transaction(async (t) => { proposerInfo,
await this.materialDao.updateByWhere({ }, {
proposerInfo, id: material.id,
}, {
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) { 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