ส่งสำเนาห้ามซ้ำ
This commit is contained in:
parent
5b56e311fe
commit
e28f554275
1 changed files with 40 additions and 39 deletions
|
|
@ -2327,7 +2327,7 @@ export class CommandController extends Controller {
|
||||||
let _commandSend = await this.commandSendRepository.findOne({
|
let _commandSend = await this.commandSendRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
commandId: command.id,
|
commandId: command.id,
|
||||||
profileId: _posMasterCommission?.current_holder.id ?? _null,
|
profileId: _posMasterCommission?.current_holderId ?? _null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!_commandSend && _posMasterCommission != null) {
|
if (!_commandSend && _posMasterCommission != null) {
|
||||||
|
|
@ -2384,7 +2384,7 @@ export class CommandController extends Controller {
|
||||||
_commandSend = await this.commandSendRepository.findOne({
|
_commandSend = await this.commandSendRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
commandId: command.id,
|
commandId: command.id,
|
||||||
profileId: _posMasterInformation?.current_holder.id ?? _null,
|
profileId: _posMasterInformation?.current_holderId ?? _null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!_commandSend && _posMasterInformation != null) {
|
if (!_commandSend && _posMasterInformation != null) {
|
||||||
|
|
@ -2441,7 +2441,7 @@ export class CommandController extends Controller {
|
||||||
_commandSend = await this.commandSendRepository.findOne({
|
_commandSend = await this.commandSendRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
commandId: command.id,
|
commandId: command.id,
|
||||||
profileId: _posMasterOfficer?.current_holder.id ?? _null,
|
profileId: _posMasterOfficer?.current_holderId ?? _null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!_commandSend && _posMasterOfficer != null) {
|
if (!_commandSend && _posMasterOfficer != null) {
|
||||||
|
|
@ -2626,42 +2626,43 @@ export class CommandController extends Controller {
|
||||||
const _commandSend = await this.commandSendRepository.findOne({
|
const _commandSend = await this.commandSendRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
commandId: command.id,
|
commandId: command.id,
|
||||||
profileId: item.current_holder.id,
|
profileId: item.current_holderId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_commandSend) return;
|
if (!_commandSend) {
|
||||||
let commandSend = new CommandSend();
|
let commandSend = new CommandSend();
|
||||||
commandSend.citizenId = item.current_holder.citizenId;
|
commandSend.citizenId = item.current_holder.citizenId;
|
||||||
commandSend.prefix = item.current_holder.prefix;
|
commandSend.prefix = item.current_holder.prefix;
|
||||||
commandSend.firstName = item.current_holder.firstName;
|
commandSend.firstName = item.current_holder.firstName;
|
||||||
commandSend.lastName = item.current_holder.lastName;
|
commandSend.lastName = item.current_holder.lastName;
|
||||||
commandSend.position = item.current_holder.position;
|
commandSend.position = item.current_holder.position;
|
||||||
commandSend.org = item.orgRoot.orgRootName;
|
commandSend.org = item.orgRoot.orgRootName;
|
||||||
commandSend.profileId = item.current_holder.id;
|
commandSend.profileId = item.current_holderId;
|
||||||
commandSend.commandId = command.id;
|
commandSend.commandId = command.id;
|
||||||
commandSend.createdUserId = request.user.sub;
|
commandSend.createdUserId = request.user.sub;
|
||||||
commandSend.createdFullName = request.user.name;
|
commandSend.createdFullName = request.user.name;
|
||||||
commandSend.createdAt = new Date();
|
commandSend.createdAt = new Date();
|
||||||
commandSend.lastUpdateUserId = request.user.sub;
|
commandSend.lastUpdateUserId = request.user.sub;
|
||||||
commandSend.lastUpdateFullName = request.user.name;
|
commandSend.lastUpdateFullName = request.user.name;
|
||||||
commandSend.lastUpdatedAt = new Date();
|
commandSend.lastUpdatedAt = new Date();
|
||||||
await this.commandSendRepository.save(commandSend);
|
await this.commandSendRepository.save(commandSend);
|
||||||
if (commandSend && commandSend.id) {
|
if (commandSend && commandSend.id) {
|
||||||
let _ccName = new Array("EMAIL", "INBOX");
|
let _ccName = new Array("EMAIL", "INBOX");
|
||||||
let _dataSendCC = new Array();
|
let _dataSendCC = new Array();
|
||||||
for (let i = 0; i < _ccName.length; i++) {
|
for (let i = 0; i < _ccName.length; i++) {
|
||||||
_dataSendCC.push({
|
_dataSendCC.push({
|
||||||
commandSendId: commandSend.id,
|
commandSendId: commandSend.id,
|
||||||
name: _ccName[i],
|
name: _ccName[i],
|
||||||
createdUserId: request.user.sub,
|
createdUserId: request.user.sub,
|
||||||
createdFullName: request.user.name,
|
createdFullName: request.user.name,
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
lastUpdateUserId: request.user.sub,
|
lastUpdateUserId: request.user.sub,
|
||||||
lastUpdateFullName: request.user.name,
|
lastUpdateFullName: request.user.name,
|
||||||
lastUpdatedAt: new Date(),
|
lastUpdatedAt: new Date(),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
await this.commandSendCCRepository.save(_dataSendCC);
|
||||||
}
|
}
|
||||||
await this.commandSendCCRepository.save(_dataSendCC);
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
@ -2681,11 +2682,11 @@ export class CommandController extends Controller {
|
||||||
relations: ["current_holder", "orgRoot"],
|
relations: ["current_holder", "orgRoot"],
|
||||||
});
|
});
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
_posMasterNext.map(async (item) => {
|
_posMasterNext.map(async (item: any) => {
|
||||||
const _commandSend = await this.commandSendRepository.findOne({
|
const _commandSend = await this.commandSendRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
commandId: command.id,
|
commandId: command.id,
|
||||||
profileId: item.current_holder.id,
|
profileId: item.current_holderId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// if (_commandSend) return;
|
// if (_commandSend) return;
|
||||||
|
|
@ -2697,7 +2698,7 @@ export class CommandController extends Controller {
|
||||||
commandSend.lastName = item.current_holder.lastName;
|
commandSend.lastName = item.current_holder.lastName;
|
||||||
commandSend.position = item.current_holder.position;
|
commandSend.position = item.current_holder.position;
|
||||||
commandSend.org = item.orgRoot.orgRootName;
|
commandSend.org = item.orgRoot.orgRootName;
|
||||||
commandSend.profileId = item.current_holder.id;
|
commandSend.profileId = item.current_holderId;
|
||||||
commandSend.commandId = command.id;
|
commandSend.commandId = command.id;
|
||||||
commandSend.createdUserId = request.user.sub;
|
commandSend.createdUserId = request.user.sub;
|
||||||
commandSend.createdFullName = request.user.name;
|
commandSend.createdFullName = request.user.name;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue