schangxiang@126.com
2025-09-09 3d8966ba2c81e7e0365c8b123e861d18ee4f94f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import BaseService from "../baseService";
import { BaseDestination } from "../../entity/basicInfo/workshop/baseDestination";
import { Not } from "typeorm";
 
/**
 * 货主信息
 */
export default class ConsignorService extends BaseService {
  //#region 添加保存前事件
  /**
   * 添加保存前事件
   */
  public async onAddSaveBefore(t: BaseDestination) {
    let userInfo = await this.userInfo;
    this.info.result = true;
 
    //判断目的地名称是否重复
    let where = {
      destinationName: t.destinationName,
      userProduct_Id: userInfo.userProduct_Id,
      destination_Id: Not(0)
    };
    if (t.destination_Id > 0) {
      where.destination_Id = Not(t.destination_Id);
    }
 
    let count = await this.dbRead.count(BaseDestination, where);
    if (count) {
      this.info.msg = "当前目的地名称,【" + t.destinationName + "】已存在不允许重复添加,无法添加!";
      this.info.result = false;
    }
    // if (!t.destination_Id) {
    //   t.password = this.ctx.helper.md5EncodingSalt("000000");
    // }
 
    return this.info;
  }
  //#endregion
}