Commit dac5383c by 蒋勇

diliverdao

parent f500d02d
......@@ -7,98 +7,112 @@ class DeliverybillDao extends Dao {
extraWhere(qobj, qw, qc) {//根据业务员id获取交付单信息的组装条件
qc.raw = true;
qc.where.product_code = qc.where.product_code || {
[this.db.Op.notIn]: ["ICP", "EDI"]
}
if(qobj.bizpath && qobj.bizpath!=""){
if(qobj.bizpath.indexOf("myDeliver")>0){//说明是从商机列表过来的
qw["salesman_id"]=qobj.userid;
//检查查询的用户所属公司是否是平台运营公司-1,如果是则不添加公司查询条件, 不添加路径条件,返回所有数据
if (qobj.company_id == 1) {
return qw
} else {
//需要添加公司查询条件
qw["facilitator_id"] = Number(qobj.company_id)
// 为空说明是管理员,不需设置组织结构过滤
if (qobj.opath && qobj.opath != "") {
qw["salesman_opcode"] = qobj.opath
}
}
//不是来自平台前端查询
if (qobj.bizpath && qobj.bizpath.indexOf("pmx") < 0) {
qc.where.product_code = qc.where.product_code || {
[this.db.Op.notIn]: ["ICP", "EDI"]
}
if (qobj.bizpath && qobj.bizpath != "") {
if (qobj.bizpath.indexOf("myDeliver") > 0) {//说明是从商机列表过来的
qw["salesman_id"] = qobj.userid;
}
}
}
}
return qw;
}
/*根据交付单编号获取订单详情*/
async findInfoByDeliverCode(qobj){
var qcwhere = {"delivery_code":qobj.deliverNumber};
async findInfoByDeliverCode(qobj) {
var qcwhere = { "delivery_code": qobj.deliverNumber };
return await this.findOne(qcwhere);
}
}
/*根据交付单编号更新状态信息*/
async updateStatusByDeliverCode(qobj,t){
var setobj = {"delivery_status":qobj.deliverStatus};
if (qobj.statusReason && qobj.statusReason != 'undefined'){
async updateStatusByDeliverCode(qobj, t) {
var setobj = { "delivery_status": qobj.deliverStatus };
if (qobj.statusReason && qobj.statusReason != 'undefined') {
setobj.close_reason = qobj.statusReason;
}
var whereobj = {"delivery_code":qobj.deliverNumber};
return await this.updateByWhere(setobj,whereobj,t);
var whereobj = { "delivery_code": qobj.deliverNumber };
return await this.updateByWhere(setobj, whereobj, t);
}
/*根据交付单更新交付材料信息*/
async UpdateInfoByDeliverCode(qobj,t){//公司注册、云上园区注册时填写交付材料
var whereobj = {"delivery_code":qobj.deliverNumber};
var setobj = {"delivery_info":qobj.deliveryInfo};
return await this.updateByWhere(setobj,whereobj,t);
async UpdateInfoByDeliverCode(qobj, t) {//公司注册、云上园区注册时填写交付材料
var whereobj = { "delivery_code": qobj.deliverNumber };
var setobj = { "delivery_info": qobj.deliveryInfo };
return await this.updateByWhere(setobj, whereobj, t);
}
/*插入交付单信息*/
async insertInfo(qobj,t){//到时候看交付单信息后再确定
async insertInfo(qobj, t) {//到时候看交付单信息后再确定
var obj = {
"demand_code":qobj.businessMode,
"scheme_number":qobj.schemeNumber,
"delivery_code":qobj.deliverNumber,
"delivery_status":"received"
"demand_code": qobj.businessMode,
"scheme_number": qobj.schemeNumber,
"delivery_code": qobj.deliverNumber,
"delivery_status": "received"
};
if (qobj.businessName && qobj.businessName != 'undefined'){
if (qobj.businessName && qobj.businessName != 'undefined') {
obj.product_name = qobj.businessName;
}
if (qobj.businessType && qobj.businessType != 'undefined'){
if (qobj.businessType && qobj.businessType != 'undefined') {
obj.product_code = qobj.businessType;
//if (qobj.businessType == "companyCase" || qobj.businessType == "psCase"){
obj.delivery_info.payStatus = "待交付";
//}
}
if (qobj.channelSource && qobj.channelSource != 'undefined'){
if (qobj.channelSource && qobj.channelSource != 'undefined') {
obj.source_name = qobj.channelSource;
}
if (qobj.channelNumber && qobj.channelNumber != 'undefined'){
if (qobj.channelNumber && qobj.channelNumber != 'undefined') {
obj.source_number = qobj.channelNumber;
}
if (qobj.skuCode && qobj.skuCode != 'undefined'){
if (qobj.skuCode && qobj.skuCode != 'undefined') {
obj.sku_code = qobj.skuCode;
}
if (qobj.serviceCode && qobj.serviceCode != 'undefined'){
if (qobj.serviceCode && qobj.serviceCode != 'undefined') {
obj.service_address = qobj.serviceCode;
}
if (qobj.servicerCode && qobj.servicerCode != 'undefined'){
if (qobj.servicerCode && qobj.servicerCode != 'undefined') {
obj.facilitator_id = qobj.servicerCode;
}
if (qobj.servicerName && qobj.servicerName != 'undefined'){
if (qobj.servicerName && qobj.servicerName != 'undefined') {
obj.facilitator_name = qobj.servicerName;
}
if (qobj.clerkName && qobj.clerkName != 'undefined'){
if (qobj.clerkName && qobj.clerkName != 'undefined') {
obj.salesman_name = qobj.clerkName;
}
if (qobj.clerkPhone && qobj.clerkPhone != 'undefined'){
if (qobj.clerkPhone && qobj.clerkPhone != 'undefined') {
obj.salesman_phone = qobj.clerkPhone
}
if (qobj.clerkOpcode && qobj.clerkOpcode != 'undefined'){
if (qobj.clerkOpcode && qobj.clerkOpcode != 'undefined') {
obj.salesman_opcode = qobj.clerkOpcode;
}
if (qobj.clerkId && qobj.clerkId != 'undefined'){
if (qobj.clerkId && qobj.clerkId != 'undefined') {
obj.salesman_id = qobj.clerkId;
}
if (qobj.payAmount && qobj.payAmount != 'undefined'){
if (qobj.payAmount && qobj.payAmount != 'undefined') {
obj.selling_price = qobj.payAmount;
}
// if (qobj.deliverStatus && qobj.deliverStatus != 'undefined'){
// obj.delivery_status = qobj.deliverStatus;
// }
if (qobj.costPrice && qobj.costPrice != 'undefined'){
if (qobj.costPrice && qobj.costPrice != 'undefined') {
obj.cost_price = qobj.costPrice;
}
if (qobj.statusReason && qobj.statusReason != 'undefined'){
if (qobj.statusReason && qobj.statusReason != 'undefined') {
obj.close_reason = qobj.statusReason;
}
// if (qobj.isWhether && qobj.isWhether != 'undefined'){
......@@ -131,13 +145,13 @@ class DeliverybillDao extends Dao {
// if (qobj.isRenew && qobj.isRenew != 'undefined'){
// obj.delivery_info.isRenew = qobj.isRenew;
// }
if (qobj.contactsName && qobj.contactsName != 'undefined'){
if (qobj.contactsName && qobj.contactsName != 'undefined') {
obj.delivery_info.contactsName = qobj.contactsName;
}
if (qobj.contactsPhone && qobj.contactsPhone != 'undefined'){
if (qobj.contactsPhone && qobj.contactsPhone != 'undefined') {
obj.delivery_info.contactsPhone = qobj.contactsPhone;
}
return await this.create(obj,t);
return await this.create(obj, t);
}
......
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