AFR对接

master
zhangxiaofeng 11 months ago
parent 9e1408d689
commit aecdc87e70

@ -12,8 +12,8 @@ namespace djy.IService.Afr
#region 字典接口 #region 字典接口
List<CommonCNEN> GetCountry(string strlink, int page, int limit); List<CommonCNEN> GetCountry(string strlink, int page, int limit);
List<CommonMappiCode> GetCARRIER(); List<CommonMappiCode> GetCARRIER();
List<CommonCodeValue> GetCTNALL(); List<CommonMappiCode> GetCTNALL();
List<CommonCodeValue> GetPackage(); List<CommonMappiCode> GetPackage();
List<CodeDangerGradeDto> GetDangerousGoods(string strlink); List<CodeDangerGradeDto> GetDangerousGoods(string strlink);
List<CommonCodeValue> GetPort(string strlink, int page, int limit); List<CommonCodeValue> GetPort(string strlink, int page, int limit);
List<CommonCodeValue> GetVessel(string strlink, int page, int limit); List<CommonCodeValue> GetVessel(string strlink, int page, int limit);
@ -23,7 +23,8 @@ namespace djy.IService.Afr
Task<AFRMaster> Get(string gid); Task<AFRMaster> Get(string gid);
Task SaveInfo(AFRMaster input); Task SaveInfo(AFRMaster input);
Task Delete(string ids); Task Delete(string ids);
Task Send(string ids, string msgType); Task<string> Send(string ids, int sendType);
Task SaveReceipt(AFRReceiptDto input); Task SaveReceipt(AFRReceiptDto input);
Task<List<AFRMasterHistory>> GetHistory(string id);
} }
} }

@ -32,9 +32,18 @@ namespace djy.Model.Afr
public string ContainerNo { get; set; } public string ContainerNo { get; set; }
/// <summary> /// <summary>
/// 箱型 /// 箱型Code
/// </summary>
public string ContainerTypeCode { get; set; }
/// <summary>
/// 箱型Name
/// </summary>
public string ContainerTypeName { get; set; }
/// <summary>
/// 箱型MapCode
/// </summary> /// </summary>
public string ContainerType { get; set; } public string ContainerTypeMapCode { get; set; }
/// <summary> /// <summary>
/// 危品联系人(选填) /// 危品联系人(选填)
@ -92,14 +101,22 @@ namespace djy.Model.Afr
public string OriginCountryCode { get; set; } public string OriginCountryCode { get; set; }
/// <summary> /// <summary>
/// 包装 /// 包装Code
/// </summary>
public string PackingCode { get; set; }
/// <summary>
/// 包装Name
/// </summary>
public string PackingName { get; set; }
/// <summary>
/// 包装MapCode
/// </summary> /// </summary>
public string Packing { get; set; } public string PackingMapCode { get; set; }
/// <summary> /// <summary>
/// 包装代码 /// 包装MapName
/// </summary> /// </summary>
public string PackingCode { get; set; } public string PackingMapName { get; set; }
/// <summary> /// <summary>

@ -100,9 +100,19 @@ namespace djy.Model.Afr
public string MBLNO { get; set; } public string MBLNO { get; set; }
/// <summary> /// <summary>
/// 船公司 /// 船司Code
/// </summary>
public string ShipCompanyCode { get; set; }
/// <summary>
/// 船司Name
/// </summary> /// </summary>
public string ShipCompany { get; set; } public string ShipCompanyName { get; set; }
/// <summary>
/// 船司MapCode
/// </summary>
public string ShipCompanyMapCode { get; set; }
/// <summary> /// <summary>
/// 船东单运编号(选填) /// 船东单运编号(选填)

@ -34,7 +34,7 @@ namespace djy.Model.AFRDto
/// <summary> /// <summary>
/// 船公司 /// 船公司
/// </summary> /// </summary>
public string ShipCompany { get; set; } public string ShipCompanyName { get; set; }
/// <summary> /// <summary>
/// 操作用户名称 /// 操作用户名称
/// </summary> /// </summary>

@ -14,5 +14,6 @@ namespace djy.Model.AmsDto
public string Value { get; set; } public string Value { get; set; }
public string MapCode { get; set; } public string MapCode { get; set; }
public string MapName { get; set; }
} }
} }

@ -61,7 +61,7 @@ namespace djy.Service.AFR
{ {
try try
{ {
var List = DbBus.Get(DbList.Common).Select<CodeCarrier, MappingCarrier>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "Afr").ToList((cc, map) => new CommonMappiCode var List = DbBus.Get(DbList.Common).Select<CodeCarrier, MappingCarrier>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "AMS").ToList((cc, map) => new CommonMappiCode
{ {
Code = cc.Code, Code = cc.Code,
Value = cc.EnName, Value = cc.EnName,
@ -75,14 +75,15 @@ namespace djy.Service.AFR
} }
} }
public List<CommonCodeValue> GetCTNALL() public List<CommonMappiCode> GetCTNALL()
{ {
try try
{ {
var List = DbBus.Get(DbList.Common).Select<CodeCtn, MappingCtn>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "Afr").ToList((cc, map) => new CommonCodeValue var List = DbBus.Get(DbList.Common).Select<CodeCtn, MappingCtn>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "AMS").ToList((cc, map) => new CommonMappiCode
{ {
Code = cc.Code, Code = cc.Code,
Value = cc.Name, Value = cc.Name,
MapCode = map.MapCode
}).Distinct().ToList(); }).Distinct().ToList();
return List; return List;
} }
@ -92,14 +93,16 @@ namespace djy.Service.AFR
} }
} }
public List<CommonCodeValue> GetPackage() public List<CommonMappiCode> GetPackage()
{ {
try try
{ {
var List = DbBus.Get(DbList.Common).Select<CodePackage, MappingPackage>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "Afr").ToList((cc, map) => new CommonCodeValue var List = DbBus.Get(DbList.Common).Select<CodePackage, MappingPackage>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "AMS").ToList((cc, map) => new CommonMappiCode
{ {
Code = cc.Code, Code = cc.Code,
Value = cc.Name, Value = cc.Name,
MapCode = map.MapCode,
MapName = map.MapName
}).Distinct().ToList(); }).Distinct().ToList();
return List; return List;
} }
@ -210,7 +213,7 @@ namespace djy.Service.AFR
.WhereIf(!string.IsNullOrEmpty(input.MBLNO), m => m.MBLNO.Contains(input.MBLNO)) .WhereIf(!string.IsNullOrEmpty(input.MBLNO), m => m.MBLNO.Contains(input.MBLNO))
.WhereIf(!string.IsNullOrEmpty(input.UserName), m => m.UserName.Contains(input.UserName)) .WhereIf(!string.IsNullOrEmpty(input.UserName), m => m.UserName.Contains(input.UserName))
.WhereIf(!string.IsNullOrEmpty(input.DischargeHarbour), m => m.DischargeHarbour.Contains(input.DischargeHarbour)) .WhereIf(!string.IsNullOrEmpty(input.DischargeHarbour), m => m.DischargeHarbour.Contains(input.DischargeHarbour))
.WhereIf(!string.IsNullOrEmpty(input.ShipCompany), m => m.ShipCompany.Contains(input.ShipCompany)) .WhereIf(!string.IsNullOrEmpty(input.ShipCompanyName), m => m.ShipCompanyName.Contains(input.ShipCompanyName))
.WhereIf(input.CreateTimeStart != null, m => m.CreateTime >= input.CreateTimeStart) .WhereIf(input.CreateTimeStart != null, m => m.CreateTime >= input.CreateTimeStart)
.WhereIf(input.CreateTimeEnd != null, m => m.CreateTime <= input.CreateTimeEnd); .WhereIf(input.CreateTimeEnd != null, m => m.CreateTime <= input.CreateTimeEnd);
@ -484,14 +487,43 @@ namespace djy.Service.AFR
return history; return history;
} }
public Task Delete(string ids) public async Task Delete(string ids)
{ {
throw new NotImplementedException(); if (string.IsNullOrEmpty(ids))
{
return;
}
DateTime nowTime = DateTime.Now;
string[] idArr = ids.Split(',');
foreach (string id in idArr)
{
await using DbTransaction tran = await GetDbAmsTransaction();
await DbAMS.Update<AFRMaster>()
.Set(h => h.IsDel == true)
.Set(h => h.LastUpdate == nowTime)
.WithTransaction(tran)
.Where(h => id == h.GID)
.ExecuteAffrowsAsync();
await DbAMS.Update<AFRHouse>()
.Set(h => h.IsDel == true)
.Set(h => h.LastUpdate == nowTime)
.WithTransaction(tran)
.Where(h => h.PID == id)
.ExecuteAffrowsAsync();
tran.Commit();
}
} }
public Task Send(string ids, string msgType) public async Task<string> Send(string ids, int sendType)
{ {
throw new NotImplementedException(); return sendType switch
{
_ => "发送成功",
};
} }
public Task SaveReceipt(AFRReceiptDto input) public Task SaveReceipt(AFRReceiptDto input)
@ -499,5 +531,12 @@ namespace djy.Service.AFR
throw new NotImplementedException(); throw new NotImplementedException();
} }
public async Task<List<AFRMasterHistory>> GetHistory(string id)
{
var data = await DbAMS.Select<AFRMasterHistory>()
.Where(h => h.PID == id)
.ToListAsync();
return data;
}
} }
} }

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace djy_AfrApi.Controllers namespace djy_AfrApi.Controllers
@ -57,8 +58,8 @@ namespace djy_AfrApi.Controllers
/// </summary> /// </summary>
/// <param name="gid"></param> /// <param name="gid"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("Get")] [HttpGet("Detail")]
public async Task<Response<AFRMaster>> Get(string gid) public async Task<Response<AFRMaster>> Detail(string gid)
{ {
var model = await _afrService.Get(gid); var model = await _afrService.Get(gid);
return SuccessResp(model); return SuccessResp(model);
@ -97,14 +98,14 @@ namespace djy_AfrApi.Controllers
/// <summary> /// <summary>
/// 发送接口 /// 发送接口
/// </summary> /// </summary>
/// <param name="ids"></param> /// <param name="ids">主键集合</param>
/// <param name="msgType"></param> /// <param name="sendType">1:发送 2原始重发 3修改发送 4删除发送</param>
/// <returns></returns> /// <returns></returns>
[HttpGet("Send")] [HttpGet("Send")]
public async Task<Response> Send(string ids, string msgType) public async Task<Response> Send(string ids, int sendType)
{ {
await _afrService.Send(ids, msgType); string message = await _afrService.Send(ids, sendType);
return SuccessResp(); return SuccessResp(message);
} }
/// <summary> /// <summary>
@ -120,6 +121,19 @@ namespace djy_AfrApi.Controllers
return SuccessResp("接收成功"); return SuccessResp("接收成功");
} }
#endregion #endregion
/// <summary>
/// 获取历史记录
/// </summary>
/// <param name="id">主键</param>
/// <returns>历史记录列表</returns>
[HttpGet("GetHistory")]
public async Task<Response<List<AFRMasterHistory>>> GetHistory(string id)
{
var data = await _afrService.GetHistory(id);
return SuccessResp(data);
}
/// <summary> /// <summary>
/// 获取服务器当前时间 /// 获取服务器当前时间
/// </summary> /// </summary>

@ -28,12 +28,12 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns> /// <returns></returns>
[HttpGet("GetCountry")] [HttpGet("GetCountry")]
[RedisCaching] [RedisCaching]
public Response<List<CommonCNEN>> GetCountry(string strlink = "", int page = 0, int limit = 0) public Response<List<CommonCNEN>> GetCountry()
{ {
var result = new Response<List<CommonCNEN>>(); var result = new Response<List<CommonCNEN>>();
try try
{ {
result.Result = ser.GetCountry(strlink, page, limit); result.Result = ser.GetCountry("", 0, 0);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -71,9 +71,9 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns> /// <returns></returns>
[HttpGet("GetCTNALL")] [HttpGet("GetCTNALL")]
[RedisCaching] [RedisCaching]
public Response<List<CommonCodeValue>> GetCTNALL() public Response<List<CommonMappiCode>> GetCTNALL()
{ {
var result = new Response<List<CommonCodeValue>>(); var result = new Response<List<CommonMappiCode>>();
try try
{ {
result.Result = ser.GetCTNALL(); result.Result = ser.GetCTNALL();
@ -94,9 +94,9 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns> /// <returns></returns>
[HttpGet("GetPackage")] [HttpGet("GetPackage")]
[RedisCaching] [RedisCaching]
public Response<List<CommonCodeValue>> GetPackage() public Response<List<CommonMappiCode>> GetPackage()
{ {
var result = new Response<List<CommonCodeValue>>(); var result = new Response<List<CommonMappiCode>>();
try try
{ {
result.Result = ser.GetPackage(); result.Result = ser.GetPackage();
@ -115,12 +115,12 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns> /// <returns></returns>
[HttpGet("GetDangerousGoods")] [HttpGet("GetDangerousGoods")]
[RedisCaching] [RedisCaching]
public Response<List<CodeDangerGradeDto>> GetDangerousGoods(string strlink = "",int page = 0, int limit = 0) public Response<List<CodeDangerGradeDto>> GetDangerousGoods()
{ {
var result = new Response<List<CodeDangerGradeDto>>(); var result = new Response<List<CodeDangerGradeDto>>();
try try
{ {
result.Result = ser.GetDangerousGoods(strlink); result.Result = ser.GetDangerousGoods("");
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -158,12 +158,12 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns> /// <returns></returns>
[HttpGet("GetPort")] [HttpGet("GetPort")]
[RedisCaching] [RedisCaching]
public Response<List<CommonCodeValue>> GetPort(string strlink = "", int page = 0, int limit = 0) public Response<List<CommonCodeValue>> GetPort()
{ {
var result = new Response<List<CommonCodeValue>>(); var result = new Response<List<CommonCodeValue>>();
try try
{ {
result.Result = ser.GetPort(strlink, page, limit); result.Result = ser.GetPort("", 0, 0);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -180,12 +180,12 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns> /// <returns></returns>
[HttpGet("GetVessel")] [HttpGet("GetVessel")]
[RedisCaching] [RedisCaching]
public Response<List<CommonCodeValue>> GetVessel(string strlink = "", int page = 0,int limit =0) public Response<List<CommonCodeValue>> GetVessel()
{ {
var result = new Response<List<CommonCodeValue>>(); var result = new Response<List<CommonCodeValue>>();
try try
{ {
result.Result = ser.GetVessel(strlink, page,limit); result.Result = ser.GetVessel("", 0, 0);
} }
catch (Exception ex) catch (Exception ex)
{ {

@ -1,22 +1,19 @@
using Common.Tools; using Common.Tools;
using Common.Utilities; using Common.Utilities;
using djy_AfrApi.Attributes;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Controllers;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Diagnostics;
using System;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using NPOI.XWPF.UserModel;
using djy_AfrApi.Attributes;
namespace djy_AfrApi.Milldlewares namespace djy_AfrApi.Milldlewares
{ {
public class CommonCacheMiddleware public class CommonDataCacheMiddleware
{ {
private readonly RequestDelegate next; private readonly RequestDelegate next;
public CommonCacheMiddleware(RequestDelegate next) public CommonDataCacheMiddleware(RequestDelegate next)
{ {
this.next = next; this.next = next;
} }

@ -42,7 +42,7 @@ namespace djy_AfrApi.Middlewares
/// </summary> /// </summary>
public static IApplicationBuilder UseCommonCacheMiddleware(this IApplicationBuilder app) public static IApplicationBuilder UseCommonCacheMiddleware(this IApplicationBuilder app)
{ {
return app.UseMiddleware<CommonCacheMiddleware>(); return app.UseMiddleware<CommonDataCacheMiddleware>();
} }
} }
} }

Loading…
Cancel
Save