Compare commits
No commits in common. "dev" and "leave-dev1.0.158" have entirely different histories.
dev
...
leave-dev1
16 changed files with 342 additions and 818 deletions
|
|
@ -1,24 +0,0 @@
|
|||
# Build artifacts
|
||||
bin/
|
||||
obj/
|
||||
|
||||
# IDE / tooling
|
||||
Properties/
|
||||
.vs/
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
# Source control
|
||||
.git/
|
||||
.gitignore
|
||||
|
||||
# Documentation
|
||||
*.md
|
||||
|
||||
# Docker
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
# สรุปการปรับปรุงระบบลงเวลา (CheckInConsumer)
|
||||
|
||||
วันที่แก้ไข: 23 มิถุนายน 2026
|
||||
|
||||
---
|
||||
|
||||
## ปัญหาเดิม
|
||||
|
||||
ตอนที่พนักงานลงเวลาพร้อมกันจำนวนมาก (ประมาณ 2,000 รายการ) ระบบประมวลผลทีละรายการ ทำให้ต้องรอคิวนานถึง **22 นาที** กว่าจะประมวลผลเสร็จทั้งหมด
|
||||
|
||||
เปรียบเทียบเหมือน **โต๊ะบัญชี 1 คน รับคิวทีละคน** ทั้งที่มีคนรอ 2,000 คน → คิวยาวมาก
|
||||
|
||||
---
|
||||
|
||||
## วิธีที่แก้ (เข้าใจง่าย ๆ)
|
||||
|
||||
### 1. เพิ่มคนช่วยประมวลผลพร้อมกัน (Concurrency)
|
||||
- **ก่อน:** ประมวลผลทีละรายการ (เหมือนมีโต๊ะบัญชี 1 โต๊ะ)
|
||||
- **หลัง:** ประมวลผลพร้อมกันได้สูงสุด **5 รายการ** (เหมือนเปิดโต๊ะบัญชี 5 โต๊ะ)
|
||||
|
||||
> ผลที่ได้: เวลารอคิวลดลงจาก **22 นาที → ประมาณ 4–5 นาที**
|
||||
|
||||
### 2. จัดคิวล่วงหน้าให้ RabbitMQ (Prefetch)
|
||||
- **ก่อน:** ระบบดึงข้อมูลมาทีละชิ้น ทำให้เสียเวลารอส่งต่อ
|
||||
- **หลัง:** ระบบดึงข้อมูลมาเป็นชุด ๆ ละ 20 ชิ้นไว้เตรียมพร้อม → ลดเวลารอระหว่างรายการ
|
||||
|
||||
### 3. ลดเวลารอเมื่อ API มีปัญหา (Timeout)
|
||||
- **ก่อน:** ถ้า API ค้าง ระบบจะรอนานถึง **5 นาที** ต่อรายการ
|
||||
- **หลัง:** ลดเหลือ **1 นาที** → รายการที่มีปัญหาจะถูกปฏิเสธเร็วขึ้น ไม่ทำให้คิวค้าง
|
||||
|
||||
### 4. ปรับปรุงการเชื่อมต่อ HTTP
|
||||
- เปลี่ยนระบบเชื่อมต่อให้รองรับการส่งคำขอหลายรายการพร้อมกันโดยไม่สะดุด
|
||||
|
||||
---
|
||||
|
||||
## ตัวเลขเปรียบเทียบ
|
||||
|
||||
| รายการ | ก่อนแก้ | หลังแก้ |
|
||||
|---|---|---|
|
||||
| จำนวนรายการที่ประมวลผลพร้อมกัน | 1 | 5 |
|
||||
| เวลารอคิวสูงสุด (2,000 รายการ) | ~22 นาที | ~4–5 นาที |
|
||||
| เวลารอเมื่อ API มีปัญหา | 5 นาที | 1 นาที |
|
||||
|
||||
---
|
||||
|
||||
## ไฟล์ที่แก้ไข
|
||||
|
||||
1. **`Program.cs`** — โค้ดหลักของตัวประมวลผลคิว
|
||||
2. **`appsettings.json`** — ไฟล์ตั้งค่าระบบ
|
||||
|
||||
---
|
||||
|
||||
## วิธีปรับความเร็วเพิ่มเติม (ไม่ต้องเขียนโค้ดใหม่)
|
||||
|
||||
ถ้าหลังทดสอบแล้วเห็นว่าระบบรับได้ และอยากให้เร็วขึ้นอีก ให้แก้ไขไฟล์ `appsettings.json` แล้ว restart โปรแกรมได้เลย:
|
||||
|
||||
```json
|
||||
{
|
||||
"MaxConcurrency": 10, ← เพิ่มจาก 5 เป็น 10 (ประมวลผลพร้อมกัน 10 รายการ)
|
||||
"PrefetchCount": 50, ← ควรตั้งเป็น ประมาณ MaxConcurrency × 2 ขึ้นไป
|
||||
"HttpTimeoutSeconds": 60 ← เวลารอ API วินาที
|
||||
}
|
||||
```
|
||||
|
||||
**ค่าที่ใช้และผลที่คาดการณ์:**
|
||||
- `MaxConcurrency = 5` → ใช้เวลา ~4–5 นาที (ค่าเริ่มต้นปลอดภัย)
|
||||
- `MaxConcurrency = 10` → ใช้เวลา ~2–3 นาที
|
||||
- `MaxConcurrency = 20` → ใช้เวลา ~1–2 นาที (ต้องตรวจสอบว่าระบบหลังบ้านรับไหวก่อน)
|
||||
|
||||
---
|
||||
|
||||
## ข้อควรระวัง / คำแนะนำ
|
||||
|
||||
1. **ควรทดสอบในระบบทดสอบก่อน** โดยดูว่า
|
||||
- ไม่มี error ในระบบหลัก (API)
|
||||
- ฐานข้อมูลไม่ช้าผิดปกติ
|
||||
- ไม่พบปัญหาลงเวลาซ้ำซ้อน
|
||||
|
||||
2. ถ้าพบปัญหา เช่น
|
||||
- มี error ใน API → **ลด** `MaxConcurrency` เหลือ 2 หรือ 3
|
||||
- ลงเวลาซ้ำ → แจ้งทีมเทคนิคเพื่อแก้ฝั่ง API เพิ่มเติม
|
||||
|
||||
3. **ค่า `MaxConcurrency = 5` เป็นค่าปลอดภัย** เพราะระบบ API ด้านหลังยังมีข้อจำกัดอยู่บางส่วน หากต้องการเพิ่มให้สูงกว่านี้ (เช่น 20–50) ควรปรึกษาทีมเทคนิคเพื่อปรับปรุงฝั่ง API ก่อน
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
## See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
## See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
#
|
||||
## This stage is used when running from VS in fast mode (Default for Debug configuration)
|
||||
#FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
|
||||
|
|
@ -21,7 +21,6 @@
|
|||
#ARG BUILD_CONFIGURATION=Release
|
||||
#RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
#
|
||||
|
||||
## This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
|
||||
#FROM base AS final
|
||||
#WORKDIR /app
|
||||
|
|
@ -30,25 +29,30 @@
|
|||
|
||||
|
||||
# ใช้ official .NET SDK image สำหรับการ build
|
||||
# Note: Build context = repository root (ตามที่ GitHub Actions ใช้)
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
|
||||
# กำหนด working directory ภายใน container
|
||||
WORKDIR /src
|
||||
|
||||
# copy เฉพาะ .csproj ก่อน เพื่อใช้ layer caching (restore เร็ว เก็บ cache นาน)
|
||||
COPY BMA.EHR.CheckInConsumer/BMA.EHR.CheckInConsumer.csproj ./BMA.EHR.CheckInConsumer/
|
||||
WORKDIR /src/BMA.EHR.CheckInConsumer
|
||||
RUN dotnet restore "BMA.EHR.CheckInConsumer.csproj"
|
||||
# คัดลอกไฟล์ .csproj และ restore dependencies
|
||||
# COPY *.csproj ./
|
||||
COPY . ./
|
||||
RUN dotnet restore
|
||||
|
||||
# คัดลอก source ที่เหลือแล้ว publish
|
||||
COPY BMA.EHR.CheckInConsumer/ ./
|
||||
RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
# คัดลอกไฟล์ทั้งหมดและ build
|
||||
COPY . ./
|
||||
RUN dotnet build -c Release -o /app/build
|
||||
# WORKDIR "/src/BMA.EHR.CheckInConsumer"
|
||||
# RUN dotnet build "BMA.EHR.CheckInConsumer.csproj" -c Release -o /app/build
|
||||
|
||||
# ใช้ stage ใหม่สำหรับ runtime (image เล็กลง)
|
||||
# ใช้ stage ใหม่สำหรับการ runtime
|
||||
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
|
||||
|
||||
# กำหนด working directory สำหรับ runtime
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/publish .
|
||||
# คัดลอกไฟล์จาก build stage มายัง runtime stage
|
||||
COPY --from=build /app/build .
|
||||
|
||||
# ระบุ entry point ของแอปพลิเคชัน
|
||||
ENTRYPOINT ["dotnet", "BMA.EHR.CheckInConsumer.dll"]
|
||||
|
|
|
|||
|
|
@ -18,13 +18,6 @@ var user = configuration["Rabbit:User"] ?? "";
|
|||
var pass = configuration["Rabbit:Password"] ?? "";
|
||||
var queue = configuration["Rabbit:Queue"] ?? "basic-queue";
|
||||
|
||||
// Concurrency & prefetch (configurable via appsettings.json)
|
||||
var maxConcurrency = int.TryParse(configuration["MaxConcurrency"], out var c) && c > 0 ? c : 5;
|
||||
var prefetchCount = ushort.TryParse(configuration["PrefetchCount"], out var p) && p > 0 ? p : (ushort)20;
|
||||
var httpTimeoutSec = int.TryParse(configuration["HttpTimeoutSeconds"], out var t) && t > 0 ? t : 60;
|
||||
|
||||
WriteToConsole($"Config -> MaxConcurrency: {maxConcurrency}, PrefetchCount: {prefetchCount}, HttpTimeout: {httpTimeoutSec}s");
|
||||
|
||||
// create connection
|
||||
var factory = new ConnectionFactory()
|
||||
{
|
||||
|
|
@ -39,29 +32,14 @@ using var channel = connection.CreateModel();
|
|||
|
||||
channel.QueueDeclare(queue: queue, durable: true, exclusive: false, autoDelete: false, arguments: null);
|
||||
|
||||
// Prefetch: RabbitMQ จะส่ง message หลายตัวมาที่ consumer พร้อมกัน (ลด network round-trip)
|
||||
channel.BasicQos(prefetchSize: 0, prefetchCount: prefetchCount, global: false);
|
||||
|
||||
// HttpClient แบบ SocketsHttpHandler พร้อม connection pooling รองรับ concurrent requests
|
||||
var socketsHandler = new SocketsHttpHandler
|
||||
{
|
||||
MaxConnectionsPerServer = maxConcurrency * 2,
|
||||
PooledConnectionLifetime = TimeSpan.FromMinutes(2),
|
||||
PooledConnectionIdleTimeout = TimeSpan.FromSeconds(30)
|
||||
};
|
||||
using var httpClient = new HttpClient(socketsHandler);
|
||||
httpClient.Timeout = TimeSpan.FromSeconds(httpTimeoutSec);
|
||||
|
||||
// SemaphoreSlim คุมจำนวน message ที่ประมวลผลพร้อมกัน (เนื่องจาก API มีข้อจำกัดเรื่อง concurrency)
|
||||
using var semaphore = new SemaphoreSlim(maxConcurrency, maxConcurrency);
|
||||
// Create a SINGLE static HttpClient instance to prevent socket exhaustion
|
||||
using var httpClient = new HttpClient();
|
||||
httpClient.Timeout = TimeSpan.FromSeconds(300); // 5 นาที
|
||||
|
||||
var consumer = new AsyncEventingBasicConsumer(channel);
|
||||
|
||||
consumer.Received += (model, ea) =>
|
||||
consumer.Received += async (model, ea) =>
|
||||
{
|
||||
// รอ semaphore ก่อนเริ่มประมวลผล
|
||||
semaphore.WaitAsync().ContinueWith(async _ =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var body = ea.Body.ToArray();
|
||||
|
|
@ -87,13 +65,6 @@ consumer.Received += (model, ea) =>
|
|||
WriteToConsole($"Error processing message: {ex.Message}");
|
||||
channel.BasicNack(ea.DeliveryTag, multiple: false, requeue: false);
|
||||
}
|
||||
finally
|
||||
{
|
||||
semaphore.Release();
|
||||
}
|
||||
}, TaskScheduler.Default).ConfigureAwait(false);
|
||||
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
channel.BasicConsume(queue: queue, autoAck: false, consumer: consumer);
|
||||
|
|
|
|||
|
|
@ -5,8 +5,5 @@
|
|||
"Password": "12345678",
|
||||
"Queue": "hrms-checkin-queue-dev"
|
||||
},
|
||||
"API": "https://localhost:7283/api/v1",
|
||||
"MaxConcurrency": 5,
|
||||
"PrefetchCount": 20,
|
||||
"HttpTimeoutSeconds": 60
|
||||
"API": "https://localhost:7283/api/v1"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1028,6 +1028,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; });
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
|
|
@ -1063,66 +1067,23 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// // คำสั่งไล่ออก หรือ ปลดออก Status หลังออกคำสั่งใช้ "REPORTED" เพื่อไม่ให้ส่งรายชื่อไปออกคำสั่งซ้ำได้
|
||||
// data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; });
|
||||
// var _profile = new List<ProfileComplaintInvestigate>();
|
||||
// DateTime _date = DateTime.Now;
|
||||
// foreach (var item in data)
|
||||
// {
|
||||
// _profile.Add(new ProfileComplaintInvestigate
|
||||
// {
|
||||
// PersonId = item.PersonId,
|
||||
// Prefix = item.Prefix,
|
||||
// FirstName = item.FirstName,
|
||||
// LastName = item.LastName,
|
||||
// CitizenId = item.CitizenId,
|
||||
// rootDnaId = item.rootDnaId,
|
||||
// child1DnaId = item.child1DnaId,
|
||||
// child2DnaId = item.child2DnaId,
|
||||
// child3DnaId = item.child3DnaId,
|
||||
// child4DnaId = item.child4DnaId,
|
||||
// profileType = item.profileType,
|
||||
// commandType = "C-PM-19",
|
||||
// CreatedAt = _date,
|
||||
// CreatedUserId = UserId,
|
||||
// CreatedFullName = FullName,
|
||||
// LastUpdatedAt = _date,
|
||||
// LastUpdateUserId = UserId,
|
||||
// LastUpdateFullName = FullName,
|
||||
// });
|
||||
// }
|
||||
// _context.ProfileComplaintInvestigate.AddRange(_profile);
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.Status = "REPORTED";
|
||||
profile.CommandTypeId = null;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
//// คำสั่งไล่ออก หรือ ปลดออก Status หลังออกคำสั่งใช้ "REPORTED" เพื่อไม่ให้ส่งรายชื่อไปออกคำสั่งซ้ำได้
|
||||
// data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; });
|
||||
var _profile = new List<ProfileComplaintInvestigate>();
|
||||
DateTime _date = DateTime.Now;
|
||||
foreach (var item in data)
|
||||
{
|
||||
_profile.Add(new ProfileComplaintInvestigate
|
||||
|
|
@ -1139,19 +1100,19 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
child4DnaId = item.child4DnaId,
|
||||
profileType = item.profileType,
|
||||
commandType = "C-PM-19",
|
||||
CreatedAt = now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
LastUpdatedAt = now,
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
CreatedAt = _date,
|
||||
CreatedUserId = UserId,
|
||||
CreatedFullName = FullName,
|
||||
LastUpdatedAt = _date,
|
||||
LastUpdateUserId = UserId,
|
||||
LastUpdateFullName = FullName,
|
||||
});
|
||||
}
|
||||
_context.ProfileComplaintInvestigate.AddRange(_profile);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
}
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1223,6 +1184,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; });
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
|
|
@ -1258,66 +1223,23 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// // คำสั่งไล่ออก หรือ ปลดออก Status หลังออกคำสั่งใช้ "REPORTED" เพื่อไม่ให้ส่งรายชื่อไปออกคำสั่งซ้ำได้
|
||||
// data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; });
|
||||
// var _profile = new List<ProfileComplaintInvestigate>();
|
||||
// DateTime _date = DateTime.Now;
|
||||
// foreach (var item in data)
|
||||
// {
|
||||
// _profile.Add(new ProfileComplaintInvestigate
|
||||
// {
|
||||
// PersonId = item.PersonId,
|
||||
// Prefix = item.Prefix,
|
||||
// FirstName = item.FirstName,
|
||||
// LastName = item.LastName,
|
||||
// CitizenId = item.CitizenId,
|
||||
// rootDnaId = item.rootDnaId,
|
||||
// child1DnaId = item.child1DnaId,
|
||||
// child2DnaId = item.child2DnaId,
|
||||
// child3DnaId = item.child3DnaId,
|
||||
// child4DnaId = item.child4DnaId,
|
||||
// profileType = item.profileType,
|
||||
// commandType = "C-PM-20",
|
||||
// CreatedAt = _date,
|
||||
// CreatedUserId = UserId,
|
||||
// CreatedFullName = FullName,
|
||||
// LastUpdatedAt = _date,
|
||||
// LastUpdateUserId = UserId,
|
||||
// LastUpdateFullName = FullName,
|
||||
// });
|
||||
// }
|
||||
// _context.ProfileComplaintInvestigate.AddRange(_profile);
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.Status = "REPORTED";
|
||||
profile.CommandTypeId = null;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
//// คำสั่งไล่ออก หรือ ปลดออก Status หลังออกคำสั่งใช้ "REPORTED" เพื่อไม่ให้ส่งรายชื่อไปออกคำสั่งซ้ำได้
|
||||
// data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; });
|
||||
var _profile = new List<ProfileComplaintInvestigate>();
|
||||
DateTime _date = DateTime.Now;
|
||||
foreach (var item in data)
|
||||
{
|
||||
_profile.Add(new ProfileComplaintInvestigate
|
||||
|
|
@ -1334,19 +1256,19 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
child4DnaId = item.child4DnaId,
|
||||
profileType = item.profileType,
|
||||
commandType = "C-PM-20",
|
||||
CreatedAt = now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
LastUpdatedAt = now,
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
CreatedAt = _date,
|
||||
CreatedUserId = UserId,
|
||||
CreatedFullName = FullName,
|
||||
LastUpdatedAt = _date,
|
||||
LastUpdateUserId = UserId,
|
||||
LastUpdateFullName = FullName,
|
||||
});
|
||||
}
|
||||
_context.ProfileComplaintInvestigate.AddRange(_profile);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
}
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1496,6 +1418,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
|
|
@ -1531,39 +1457,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// data.ForEach(profile => profile.Status = "DONE");
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
//// var _result = await _res.Content.ReadAsStringAsync();
|
||||
//// if (_res.IsSuccessStatusCode)
|
||||
//// {
|
||||
//// data.ForEach(profile => profile.Status = "DONE");
|
||||
//// await _context.SaveChangesAsync();
|
||||
//// }
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1651,6 +1562,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
|
|
@ -1686,39 +1601,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// data.ForEach(profile => profile.Status = "DONE");
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
//// var _result = await _res.Content.ReadAsStringAsync();
|
||||
//// if (_res.IsSuccessStatusCode)
|
||||
//// {
|
||||
//// data.ForEach(profile => profile.Status = "DONE");
|
||||
//// await _context.SaveChangesAsync();
|
||||
//// }
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1804,6 +1704,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
string? _null = null;
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
|
|
@ -1839,40 +1743,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.Status = "NEW";
|
||||
profile.CommandTypeId = null;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
//// var _result = await _res.Content.ReadAsStringAsync();
|
||||
//// if (_res.IsSuccessStatusCode)
|
||||
//// {
|
||||
//// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
//// await _context.SaveChangesAsync();
|
||||
//// }
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1958,6 +1846,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
string? _null = null;
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
|
|
@ -1993,40 +1885,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.Status = "NEW";
|
||||
profile.CommandTypeId = null;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
//// var _result = await _res.Content.ReadAsStringAsync();
|
||||
//// if (_res.IsSuccessStatusCode)
|
||||
//// {
|
||||
//// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
//// await _context.SaveChangesAsync();
|
||||
//// }
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2112,6 +1988,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
string? _null = null;
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
|
|
@ -2147,40 +2027,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.Status = "NEW";
|
||||
profile.CommandTypeId = null;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
//// var _result = await _res.Content.ReadAsStringAsync();
|
||||
//// if (_res.IsSuccessStatusCode)
|
||||
//// {
|
||||
//// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
//// await _context.SaveChangesAsync();
|
||||
//// }
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2266,6 +2130,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
string? _null = null;
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
|
|
@ -2301,40 +2169,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.Status = "NEW";
|
||||
profile.CommandTypeId = null;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
//// var _result = await _res.Content.ReadAsStringAsync();
|
||||
//// if (_res.IsSuccessStatusCode)
|
||||
//// {
|
||||
//// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
//// await _context.SaveChangesAsync();
|
||||
//// }
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2420,6 +2272,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
string? _null = null;
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
|
|
@ -2455,40 +2311,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.Status = "NEW";
|
||||
profile.CommandTypeId = null;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
//// var _result = await _res.Content.ReadAsStringAsync();
|
||||
//// if (_res.IsSuccessStatusCode)
|
||||
//// {
|
||||
//// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; });
|
||||
//// await _context.SaveChangesAsync();
|
||||
//// }
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2584,21 +2424,15 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
[HttpPost("command32/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportCommand32Execute([FromBody] ReportExecuteRequest req)
|
||||
{
|
||||
// C-PM-32 (คำสั่งยุติเรื่อง) ต้องยุติงานใน 2 track ที่เก็บอยู่คนละตาราง:
|
||||
// - data / resultData = ฝั่ง "การสอบสวน" (DisciplineInvestigate_ProfileComplaint)
|
||||
// - data1 / resultData1 = ฝั่ง "การพิจารณาลงโทษ" (DisciplineDisciplinary_ProfileComplaintInvestigate)
|
||||
// บุคคลเดียวกัน (profileId เดียวกัน) อาจอยู่ในทั้ง 2 track จึงต้องส่งให้ org แยก 2 ครั้ง (ห้าม merge รวมครั้งเดียว)
|
||||
var data = await _context.DisciplineInvestigate_ProfileComplaints
|
||||
.Include(x => x.DisciplineInvestigate)
|
||||
// .Where(x => x.IsReport == "REPORT")
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
var data1 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
|
||||
.Include(x => x.DisciplineDisciplinary)
|
||||
// .Where(x => x.IsReport == "REPORT")
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
data.ForEach(profile => profile.IsReport = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
string? _null = null;
|
||||
var resultData = (from p in data
|
||||
|
|
@ -2635,6 +2469,29 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
//// var _result = await _res.Content.ReadAsStringAsync();
|
||||
//// if (_res.IsSuccessStatusCode)
|
||||
//// {
|
||||
//// data.ForEach(profile => profile.IsReport = "DONE");
|
||||
//// await _context.SaveChangesAsync();
|
||||
//// }
|
||||
}
|
||||
|
||||
var data1 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
|
||||
.Include(x => x.DisciplineDisciplinary)
|
||||
// .Where(x => x.IsReport == "REPORT")
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
var resultData1 = (from p in data1
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
|
|
@ -2668,69 +2525,23 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
|
||||
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.rootShortName != null ? p.rootShortName : "")))),
|
||||
}).ToList();
|
||||
|
||||
#region Old: Circular Flow
|
||||
// var baseAPIOrg = _configuration["API"];
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// data.ForEach(profile => profile.IsReport = "DONE");
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData1,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// data1.ForEach(profile => profile.IsReport = "DONE");
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profile.IsReport = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data1.ForEach(profile =>
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
profile.IsReport = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
data = resultData1,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
data1.ForEach(profile => profile.IsReport = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
//
|
||||
// NOTE สำหรับฝั่ง Node (C-PM-32 เท่านั้น):
|
||||
// - response.result เป็น object { data, data1 } (ไม่ใช่ array เหมือนคำสั่งอื่น)
|
||||
// data = รายการฝั่ง "การสอบสวน" → ยิง POST {API}/org/command/excexute/salary-leave-discipline ครั้งที่ 1
|
||||
// data1 = รายการฝั่ง "การพิจารณาลงโทษ" → ยิง POST {API}/org/command/excexute/salary-leave-discipline ครั้งที่ 2
|
||||
// - ต้องยิง 2 ครั้งตามลำดับ data ก่อน → data1 (ห้าม merge รวมในครั้งเดียว เพราะ profileId อาจซ้ำข้าม 2 track)
|
||||
// - คำสั่งอื่น (C-PM-19/20/25/26/27/28/29/30/31) response.result เป็น array → ยิง org 1 ครั้ง
|
||||
return Success(new { data = resultData, data1 = resultData1 });
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1062,14 +1062,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -1293,14 +1286,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -1508,14 +1494,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -1728,14 +1707,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -1971,14 +1943,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -2074,7 +2039,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-47 โปรดเกล้าฯ แต่งตั้งให้ดำรงตำแหน่ง
|
||||
/// ออกคำสั่ง C-PM-47
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -2149,14 +2114,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
|
|||
|
|
@ -2032,13 +2032,9 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
placementProfile.ForEach(profile =>
|
||||
{
|
||||
profile.PlacementStatus = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
if (req.refIds.Length > 0)
|
||||
{
|
||||
profile.commandId = req.refIds[0].commandId;
|
||||
|
|
@ -2442,13 +2438,9 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
placementProfile.ForEach(profile =>
|
||||
{
|
||||
profile.PlacementStatus = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
if (req.refIds.Length > 0)
|
||||
{
|
||||
profile.commandId = req.refIds[0].commandId;
|
||||
|
|
@ -2718,14 +2710,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.PlacementStatus = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.PlacementStatus = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -2975,14 +2960,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.PlacementStatus = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.PlacementStatus = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -3215,14 +3193,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.PlacementStatus = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.PlacementStatus = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
|
|||
|
|
@ -828,14 +828,10 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var firstRef = req.refIds.FirstOrDefault();
|
||||
var commandNoText = firstRef != null ? $"{firstRef.commandNo}/{firstRef.commandYear.ToThaiYear()}" : null;
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.commandNo = commandNoText;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -1306,14 +1306,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
Console.WriteLine($"[ReceiveReportExcecute] Saving changes to database for {data.Count} profiles");
|
||||
await _context.SaveChangesAsync();
|
||||
Console.WriteLine($"[ReceiveReportExcecute] Process completed successfully at {DateTime.Now}");
|
||||
|
|
|
|||
|
|
@ -686,14 +686,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
|
|||
|
|
@ -1212,14 +1212,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
return Success(resultData);
|
||||
|
|
|
|||
|
|
@ -926,14 +926,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -1190,14 +1183,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
|
|||
|
|
@ -629,7 +629,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-18 ให้ออกจากราชการ && C-PM-43 ให้ลูกจ้างออกจากราชการ
|
||||
/// ออกคำสั่ง C-PM-18 คำสั่งให้ออกจากราชการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -712,14 +712,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
|
|||
|
|
@ -2972,14 +2972,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -3171,14 +3164,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -3413,14 +3399,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
data.ForEach(profile => profile.RetirementResign.Status = "CANCEL");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -2468,14 +2468,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Return resultData for Node to process directly (Linear Flow)
|
||||
|
|
@ -2707,14 +2700,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
// New: Linear Flow - Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var now = DateTime.Now;
|
||||
data.ForEach(profile =>
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = now;
|
||||
});
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL");
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue