|
|
@ -11,9 +11,11 @@ using djy.Model.Afr;
|
|
|
|
using djy.Model.AFRDto;
|
|
|
|
using djy.Model.AFRDto;
|
|
|
|
using djy.Model.Ams;
|
|
|
|
using djy.Model.Ams;
|
|
|
|
using djy.Model.AmsDto;
|
|
|
|
using djy.Model.AmsDto;
|
|
|
|
|
|
|
|
using djy.Model.Converter;
|
|
|
|
using djy.Service.DjyService;
|
|
|
|
using djy.Service.DjyService;
|
|
|
|
using FreeSql;
|
|
|
|
using FreeSql;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
@ -426,7 +428,7 @@ namespace djy.Service.AFR
|
|
|
|
.WithTransaction(tran)
|
|
|
|
.WithTransaction(tran)
|
|
|
|
.ExecuteAffrowsAsync();
|
|
|
|
.ExecuteAffrowsAsync();
|
|
|
|
|
|
|
|
|
|
|
|
await SaveHistoryAsync(input.GID, input.HouseList, "新增", 0, "创建了单据", tran);
|
|
|
|
await SaveHistoryAsync(input.GID, input.HouseList, "新增", 0, "创建了单据", null, tran);
|
|
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
tran.Commit();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -558,7 +560,7 @@ namespace djy.Service.AFR
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await DbAMS.Insert(waitInsertHouseList).WithTransaction(tran).ExecuteAffrowsAsync();
|
|
|
|
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())
|
|
|
|
if (waitDeleteHouseGids.Any())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -569,7 +571,7 @@ namespace djy.Service.AFR
|
|
|
|
.Where(h => waitDeleteHouseGids.Contains(h.GID))
|
|
|
|
.Where(h => waitDeleteHouseGids.Contains(h.GID))
|
|
|
|
.ExecuteAffrowsAsync();
|
|
|
|
.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())
|
|
|
|
if (waitUpdateHouseGids.Any())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -579,7 +581,7 @@ namespace djy.Service.AFR
|
|
|
|
.WithTransaction(tran)
|
|
|
|
.WithTransaction(tran)
|
|
|
|
.ExecuteAffrowsAsync();
|
|
|
|
.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,
|
|
|
|
masterBillNo = masterItem.MBLNO,
|
|
|
|
shippingNo = masterItem.ShippingNo,
|
|
|
|
shippingNo = masterItem.ShippingNo,
|
|
|
|
clause = masterItem.Clause, //test
|
|
|
|
clause = masterItem.Clause,
|
|
|
|
consignmentType = masterItem.ConsignmentType,
|
|
|
|
consignmentType = masterItem.ConsignmentType,
|
|
|
|
dischargeHarbour = masterItem.DischargeHarbour,
|
|
|
|
dischargeHarbour = masterItem.DischargeHarbour,
|
|
|
|
dischargeHarbourCode = masterItem.DischargeHarbourCode,
|
|
|
|
dischargeHarbourCode = masterItem.DischargeHarbourCode,
|
|
|
@ -874,7 +876,7 @@ namespace djy.Service.AFR
|
|
|
|
loadDate = masterItem.LoadDate,
|
|
|
|
loadDate = masterItem.LoadDate,
|
|
|
|
loadHarbour = masterItem.LoadHarbour,
|
|
|
|
loadHarbour = masterItem.LoadHarbour,
|
|
|
|
loadHarbourCode = masterItem.LoadHarbourCode,
|
|
|
|
loadHarbourCode = masterItem.LoadHarbourCode,
|
|
|
|
requesterDea = sysOptionConfig.Webconfig.requesterDea, //test
|
|
|
|
requesterDea = sysOptionConfig.Webconfig.requesterDea,
|
|
|
|
shipCompany = masterItem.ShipCompanyMapCode,
|
|
|
|
shipCompany = masterItem.ShipCompanyMapCode,
|
|
|
|
vessel = masterItem.Vessel,
|
|
|
|
vessel = masterItem.Vessel,
|
|
|
|
voyage = masterItem.Voyno
|
|
|
|
voyage = masterItem.Voyno
|
|
|
@ -1035,7 +1037,26 @@ namespace djy.Service.AFR
|
|
|
|
.ExecuteAffrowsAsync();
|
|
|
|
.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
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1335,15 +1356,23 @@ namespace djy.Service.AFR
|
|
|
|
/// 保存操作历史或回执接收历史
|
|
|
|
/// 保存操作历史或回执接收历史
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="mid">主单主键</param>
|
|
|
|
/// <param name="mid">主单主键</param>
|
|
|
|
/// <param name="hids">分单主键列表</param>
|
|
|
|
/// <param name="houseList">分单列表</param>
|
|
|
|
/// <param name="state">状态</param>
|
|
|
|
/// <param name="state">状态</param>
|
|
|
|
/// <param name="type">0:人工操作历史;1:回执接收历史</param>
|
|
|
|
/// <param name="type">0:人工操作历史;1:回执接收历史</param>
|
|
|
|
/// <param name="remark"></param>
|
|
|
|
/// <param name="remark"></param>
|
|
|
|
|
|
|
|
/// <param name="requestLog">请求的详细日志内容</param>
|
|
|
|
/// <param name="tran"></param>
|
|
|
|
/// <param name="tran"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <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,
|
|
|
|
List<AFRMasterHistory> list = new(houseList.Count());
|
|
|
|
string state,
|
|
|
|
|
|
|
|
int type,
|
|
|
|
|
|
|
|
string remark,
|
|
|
|
|
|
|
|
string requestLog = null,
|
|
|
|
|
|
|
|
DbTransaction tran = null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<AFRMasterHistory> historyList = new(houseList.Count());
|
|
|
|
|
|
|
|
List<HistoryDetail> detailList = new(houseList.Count());
|
|
|
|
foreach (AFRHouse item in houseList)
|
|
|
|
foreach (AFRHouse item in houseList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var history = new AFRMasterHistory()
|
|
|
|
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}";
|
|
|
|
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)
|
|
|
|
if (tran == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await DbAMS.Insert(list).ExecuteAffrowsAsync();
|
|
|
|
await DbAMS.Insert(historyList).ExecuteAffrowsAsync();
|
|
|
|
|
|
|
|
await DbAMS.Insert(detailList).ExecuteAffrowsAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await DbAMS.Insert(list).WithTransaction(tran).ExecuteAffrowsAsync();
|
|
|
|
await DbAMS.Insert(historyList).WithTransaction(tran).ExecuteAffrowsAsync();
|
|
|
|
|
|
|
|
await DbAMS.Insert(detailList).WithTransaction(tran).ExecuteAffrowsAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|