Commit 16700268 by 王勇飞

Merge branch 'tx-fi-tax' of gitlab.gongsibao.com:jiangyong/zhichan into tx-fi-tax

parents 74748e88 376bca69
...@@ -16,7 +16,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -16,7 +16,7 @@ class DeliverybillCtl extends CtlBase {
this.logService = system.getObject("service.bizchance.statuslogSve"); this.logService = system.getObject("service.bizchance.statuslogSve");
this.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
this.fitaxschemeService = system.getObject("service.bizchance.fitaxschemeSve"); this.fitaxschemeService = system.getObject("service.bizchance.fitaxschemeSve");
this.bizoptService = system.getObject("service.bizchance.bizoptSve"); this.bizoptService = system.getObject("service.bizchance.bizoptSve");
} }
/** /**
...@@ -29,7 +29,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -29,7 +29,7 @@ class DeliverybillCtl extends CtlBase {
const rs = await this.service.findAndCountAll(pobj); const rs = await this.service.findAndCountAll(pobj);
let result = []; let result = [];
for (let val of rs.results.rows) { for (let val of rs.results.rows) {
let { id, delivery_code, service_address, delivery_info, created_at, updated_at, delivery_status, salesman_name } = val; let { id, delivery_code, service_address, delivery_info, created_at, updated_at, delivery_status, delivery_man_name } = val;
result.push({ result.push({
deliveryId: id, // id deliveryId: id, // id
deliveryNumber: delivery_code, // 交付单编号 deliveryNumber: delivery_code, // 交付单编号
...@@ -40,7 +40,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -40,7 +40,7 @@ class DeliverybillCtl extends CtlBase {
companyBizType: delivery_info.companyBizType,// 公司类型 1-商贸型;2-服务型;3-特殊行业;4-其他 companyBizType: delivery_info.companyBizType,// 公司类型 1-商贸型;2-服务型;3-特殊行业;4-其他
contactsName: delivery_info.contactsName,// 联系人 contactsName: delivery_info.contactsName,// 联系人
contactsPhone: delivery_info.contactsPhone,// 联系电话 contactsPhone: delivery_info.contactsPhone,// 联系电话
owner: salesman_name,//所属人 owner: delivery_man_name,//所属人
deliveryStatus: delivery_status, // 交付单状态 deliveryStatus: delivery_status, // 交付单状态
setupStatus: delivery_info.setupStatus || System.SERVERSESTATUS.NOTSETUP,//建账状态 notsetup | setup setupStatus: delivery_info.setupStatus || System.SERVERSESTATUS.NOTSETUP,//建账状态 notsetup | setup
createdAt: created_at, createdAt: created_at,
...@@ -130,7 +130,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -130,7 +130,7 @@ class DeliverybillCtl extends CtlBase {
*/ */
async distributionPerson(pobj, qobj, req) { async distributionPerson(pobj, qobj, req) {
try { try {
if (!Array.isArray(pobj.numbers) && pobj.numbers.length > 0) { if (!Array.isArray(pobj.numbers) || pobj.numbers.length <= 0) {
throw new Error("numbers 为数组 且 不能为空"); throw new Error("numbers 为数组 且 不能为空");
} }
if (!pobj.nickName) { if (!pobj.nickName) {
...@@ -198,7 +198,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -198,7 +198,7 @@ class DeliverybillCtl extends CtlBase {
obj.demand_code = scheme.demand_code; obj.demand_code = scheme.demand_code;
//根据需求编号获取业务员信息 //根据需求编号获取业务员信息
var bizopt = await this.bizoptService.findInfoByDemandCode({ "demand_code": obj.demand_code }); var bizopt = await this.bizoptService.findInfoByDemandCode({ "demand_code": obj.demand_code });
if (bizopt){ if (bizopt) {
obj.salesman_opcode = bizopt.salesman_opcode; obj.salesman_opcode = bizopt.salesman_opcode;
obj.salesman_id = bizopt.salesman_id; obj.salesman_id = bizopt.salesman_id;
obj.salesman_name = bizopt.salesman_name; obj.salesman_name = bizopt.salesman_name;
...@@ -206,7 +206,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -206,7 +206,7 @@ class DeliverybillCtl extends CtlBase {
obj.delivery_man_opcode = bizopt.salesman_opcode; obj.delivery_man_opcode = bizopt.salesman_opcode;
obj.delivery_man_id = bizopt.salesman_id; obj.delivery_man_id = bizopt.salesman_id;
obj.delivery_man_name = bizopt.salesman_name; obj.delivery_man_name = bizopt.salesman_name;
} }
} }
......
...@@ -20,17 +20,17 @@ class DeliverybillDao extends Dao { ...@@ -20,17 +20,17 @@ class DeliverybillDao extends Dao {
filters.push({ filters.push({
$or: [ $or: [
{ {
salesman_opcode: { delivery_man_opcode: {
$eq: null $eq: null
} }
}, { }, {
salesman_opcode: { $like: `%${qobj.opath}%` } delivery_man_opcode: { $like: `%${qobj.opath}%` }
} }
] ]
}); });
} else { // 销售 查询自己的 } else { // 销售 查询自己的
filters.push({ filters.push({
salesman_opcode: { $like: `%${qobj.opath}%` } delivery_man_opcode: { $like: `%${qobj.opath}%` }
}); });
} }
...@@ -99,7 +99,7 @@ class DeliverybillDao extends Dao { ...@@ -99,7 +99,7 @@ class DeliverybillDao extends Dao {
if (qc.where.owner) { if (qc.where.owner) {
filters.push({ filters.push({
salesman_name: qc.where.owner delivery_man_name: qc.where.owner
}); });
delete qc.where.owner; delete qc.where.owner;
} }
......
...@@ -113,7 +113,7 @@ class DeliverybillService extends ServiceBase { ...@@ -113,7 +113,7 @@ class DeliverybillService extends ServiceBase {
area: deliverData.service_address, // 服务 地区 编码 area: deliverData.service_address, // 服务 地区 编码
contactsName: deliverData.delivery_info.contactsName,// 联系人 contactsName: deliverData.delivery_info.contactsName,// 联系人
contactsPhone: deliverData.delivery_info.contactsPhone,// 联系电话 contactsPhone: deliverData.delivery_info.contactsPhone,// 联系电话
owner: deliverData.salesman_name,//所属人 owner: deliverData.delivery_man_name,//所属人
deliveryStatus: deliverData.delivery_status, // 交付单状态 deliveryStatus: deliverData.delivery_status, // 交付单状态
setupStatus: deliverData.delivery_info.setupStatus || System.SERVERSESTATUS.NOTSETUP,//建账状态 notsetup | setup setupStatus: deliverData.delivery_info.setupStatus || System.SERVERSESTATUS.NOTSETUP,//建账状态 notsetup | setup
createdAt: deliverData.created_at, createdAt: deliverData.created_at,
...@@ -154,10 +154,9 @@ class DeliverybillService extends ServiceBase { ...@@ -154,10 +154,9 @@ class DeliverybillService extends ServiceBase {
throw new Error("请检查单号是否正确"); throw new Error("请检查单号是否正确");
} }
await this.dao.updateByWhere({ await this.dao.updateByWhere({
salesman_id: userId, delivery_man_id: userId,
salesman_opcode: opCode, delivery_man_opcode: opCode,
salesman_phone: phone, delivery_man_name: nickName
salesman_name: nickName
}, { }, {
delivery_code: { delivery_code: {
$in: numbers $in: numbers
...@@ -174,9 +173,9 @@ class DeliverybillService extends ServiceBase { ...@@ -174,9 +173,9 @@ class DeliverybillService extends ServiceBase {
}, },
operation_type: "distribution", operation_type: "distribution",
operation_details: { operation_details: {
isFirst: val.salesman_id ? true : false, isFirst: val.delivery_man_id ? true : false,
fromUserId: val.salesman_id, fromUserId: val.delivery_man_id,
fromUserName: val.salesman_name, fromUserName: val.delivery_man_name,
toUserId: userId, toUserId: userId,
toUserName: nickName toUserName: nickName
}, },
......
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