import BaseService from "../baseService";
|
import { Not } from "typeorm";
|
import { FeeBaseStoragefee } from "../../entity/finance/base/feeBaseStoragefee";
|
|
/**
|
* 仓储费设置
|
*/
|
export default class StorageFeeService extends BaseService {
|
//#region 添加保存前事件
|
/**
|
* 添加保存前事件
|
*/
|
public async onAddSaveBefore(t: FeeBaseStoragefee) {
|
let userInfo = await this.userInfo;
|
this.info.result = true;
|
|
//判断条码是否重复
|
let where = {
|
storage_Id: t.storage_Id,
|
consignor_Id: t.consignor_Id,
|
userProduct_Id: userInfo.userProduct_Id,
|
storagefee_Id: Not(0)
|
};
|
// 修改
|
if (t.storagefee_Id > 0) {
|
where.storagefee_Id = Not(t.storagefee_Id);
|
}
|
|
let count = await this.dbRead.count(FeeBaseStoragefee, where);
|
if (count) {
|
this.info.msg = `当前仓库【${t.storageName}】与货主【${t.consignorName}】已存在不允许重复添加!`;
|
this.info.result = false;
|
}
|
|
return this.info;
|
}
|
//#endregion
|
}
|