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