|
|
|
@ -11,9 +11,11 @@ using djy.Model.Afr;
|
|
|
|
|
using djy.Model.AFRDto;
|
|
|
|
|
using djy.Model.Ams;
|
|
|
|
|
using djy.Model.AmsDto;
|
|
|
|
|
using djy.Model.Converter;
|
|
|
|
|
using djy.Service.DjyService;
|
|
|
|
|
using FreeSql;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
@ -426,7 +428,7 @@ namespace djy.Service.AFR
|
|
|
|
|
.WithTransaction(tran)
|
|
|
|
|
.ExecuteAffrowsAsync();
|
|
|
|
|
|
|
|
|
|
await SaveHistoryAsync(input.GID, input.HouseList, "新增", 0, "创建了单据", tran);
|
|
|
|
|
await SaveHistoryAsync(input.GID, input.HouseList, "新增", 0, "创建了单据", null, tran);
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
@ -558,7 +560,7 @@ namespace djy.Service.AFR
|
|
|
|
|
{
|
|
|
|
|
await DbAMS.Insert(waitInsertHouseList).WithTransaction(tran).ExecuteAffrowsAsync();
|
|
|
|
|
|
|
|
|
|
await SaveHistoryAsync(input.GID, waitInsertHouseList, "新增", 0, "创建了分单", tran);
|
|
|
|
|
await SaveHistoryAsync(input.GID, waitInsertHouseList, "新增", 0, "创建了分单", null, tran);
|
|
|
|
|
}
|
|
|
|
|
if (waitDeleteHouseGids.Any())
|
|
|
|
|
{
|
|
|
|
@ -569,7 +571,7 @@ namespace djy.Service.AFR
|
|
|
|
|
.Where(h => waitDeleteHouseGids.Contains(h.GID))
|
|
|
|
|
.ExecuteAffrowsAsync();
|
|
|
|
|
|
|
|
|
|
await SaveHistoryAsync(input.GID, waitDeleteHouseGids.Select(gid => new AFRHouse() { GID = gid }), "删除", 0, "删除了单据", tran);
|
|
|
|
|
await SaveHistoryAsync(input.GID, waitDeleteHouseGids.Select(gid => new AFRHouse() { GID = gid }), "删除", 0, "删除了单据", null, tran);
|
|
|
|
|
}
|
|
|
|
|
if (waitUpdateHouseGids.Any())
|
|
|
|
|
{
|
|
|
|
@ -579,7 +581,7 @@ namespace djy.Service.AFR
|
|
|
|
|
.WithTransaction(tran)
|
|
|
|
|
.ExecuteAffrowsAsync();
|
|
|
|
|
|
|
|
|
|
await SaveHistoryAsync(input.GID, waitUpdateHouseList, "修改", 0, "修改了单据", tran);
|
|
|
|
|
await SaveHistoryAsync(input.GID, waitUpdateHouseList, "修改", 0, "修改了单据", null, tran);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 箱子执行
|
|
|
|
@ -863,7 +865,7 @@ namespace djy.Service.AFR
|
|
|
|
|
{
|
|
|
|
|
masterBillNo = masterItem.MBLNO,
|
|
|
|
|
shippingNo = masterItem.ShippingNo,
|
|
|
|
|
clause = masterItem.Clause, //test
|
|
|
|
|
clause = masterItem.Clause,
|
|
|
|
|
consignmentType = masterItem.ConsignmentType,
|
|
|
|
|
dischargeHarbour = masterItem.DischargeHarbour,
|
|
|
|
|
dischargeHarbourCode = masterItem.DischargeHarbourCode,
|
|
|
|
@ -874,7 +876,7 @@ namespace djy.Service.AFR
|
|
|
|
|
loadDate = masterItem.LoadDate,
|
|
|
|
|
loadHarbour = masterItem.LoadHarbour,
|
|
|
|
|
loadHarbourCode = masterItem.LoadHarbourCode,
|
|
|
|
|
requesterDea = sysOptionConfig.Webconfig.requesterDea, //test
|
|
|
|
|
requesterDea = sysOptionConfig.Webconfig.requesterDea,
|
|
|
|
|
shipCompany = masterItem.ShipCompanyMapCode,
|
|
|
|
|
vessel = masterItem.Vessel,
|
|
|
|
|
voyage = masterItem.Voyno
|
|
|
|
@ -1035,7 +1037,26 @@ namespace djy.Service.AFR
|
|
|
|
|
.ExecuteAffrowsAsync();
|
|
|
|
|
|
|
|
|
|
// 记录历史
|
|
|
|
|
await SaveHistoryAsync(masterItem.GID, houseList, state, 0, "发送了单据");
|
|
|
|
|
// 生成详细的发送日志
|
|
|
|
|
string requestLog = JsonConvert.SerializeObject(requestDto, Formatting.Indented, new JsonSerializerSettings()
|
|
|
|
|
{
|
|
|
|
|
ContractResolver = new LogPropertyWriteResolver(),
|
|
|
|
|
DateFormatString = "yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
});
|
|
|
|
|
await SaveHistoryAsync(masterItem.GID, houseList, state, 0, "发送了单据", requestLog);
|
|
|
|
|
|
|
|
|
|
//await SaveHistoryAsync(masterItem.GID, houseList, "新增发送成功", 0, "发送了单据", requestLog);
|
|
|
|
|
//requestDto.masterBillInfo.estimatedArrivalTime = new DateTime(1999,12,12);
|
|
|
|
|
//requestDto.houseBillInfoList[0].notifyName = "测试人";
|
|
|
|
|
//requestDto.houseBillInfoList[0].ctnInfo.insertList[0].containerNo = "12312312";
|
|
|
|
|
|
|
|
|
|
//string requestLog2 = JsonConvert.SerializeObject(requestDto, Formatting.Indented, new JsonSerializerSettings()
|
|
|
|
|
//{
|
|
|
|
|
// ContractResolver = new LogPropertyWriteResolver(),
|
|
|
|
|
// DateFormatString = "yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
//});
|
|
|
|
|
//await SaveHistoryAsync(masterItem.GID, houseList, "修改发送成功", 0, "发送了单据", requestLog2);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -1335,15 +1356,23 @@ namespace djy.Service.AFR
|
|
|
|
|
/// 保存操作历史或回执接收历史
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="mid">主单主键</param>
|
|
|
|
|
/// <param name="hids">分单主键列表</param>
|
|
|
|
|
/// <param name="houseList">分单列表</param>
|
|
|
|
|
/// <param name="state">状态</param>
|
|
|
|
|
/// <param name="type">0:人工操作历史;1:回执接收历史</param>
|
|
|
|
|
/// <param name="remark"></param>
|
|
|
|
|
/// <param name="requestLog">请求的详细日志内容</param>
|
|
|
|
|
/// <param name="tran"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private async Task SaveHistoryAsync(string mid, IEnumerable<AFRHouse> houseList, string state, int type, string remark, DbTransaction tran = null)
|
|
|
|
|
private async Task SaveHistoryAsync(string mid,
|
|
|
|
|
IEnumerable<AFRHouse> houseList,
|
|
|
|
|
string state,
|
|
|
|
|
int type,
|
|
|
|
|
string remark,
|
|
|
|
|
string requestLog = null,
|
|
|
|
|
DbTransaction tran = null)
|
|
|
|
|
{
|
|
|
|
|
List<AFRMasterHistory> list = new(houseList.Count());
|
|
|
|
|
List<AFRMasterHistory> historyList = new(houseList.Count());
|
|
|
|
|
List<HistoryDetail> detailList = new(houseList.Count());
|
|
|
|
|
foreach (AFRHouse item in houseList)
|
|
|
|
|
{
|
|
|
|
|
var history = new AFRMasterHistory()
|
|
|
|
@ -1364,15 +1393,27 @@ namespace djy.Service.AFR
|
|
|
|
|
{
|
|
|
|
|
history.Remark = $"您的单据 {item.HouseBillNo} 于 {(DateTime)history.CreateTime:yyyy-MM-dd HH:mm:ss} 接收到回执:{remark}";
|
|
|
|
|
}
|
|
|
|
|
list.Add(history);
|
|
|
|
|
historyList.Add(history);
|
|
|
|
|
|
|
|
|
|
if (requestLog != null)
|
|
|
|
|
{
|
|
|
|
|
detailList.Add(new HistoryDetail()
|
|
|
|
|
{
|
|
|
|
|
HistoryID = history.GID,
|
|
|
|
|
RequestLog = requestLog,
|
|
|
|
|
Type = 3
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (tran == null)
|
|
|
|
|
{
|
|
|
|
|
await DbAMS.Insert(list).ExecuteAffrowsAsync();
|
|
|
|
|
await DbAMS.Insert(historyList).ExecuteAffrowsAsync();
|
|
|
|
|
await DbAMS.Insert(detailList).ExecuteAffrowsAsync();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await DbAMS.Insert(list).WithTransaction(tran).ExecuteAffrowsAsync();
|
|
|
|
|
await DbAMS.Insert(historyList).WithTransaction(tran).ExecuteAffrowsAsync();
|
|
|
|
|
await DbAMS.Insert(detailList).WithTransaction(tran).ExecuteAffrowsAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|