diff --git a/ds-wms-service/DS.WMS.Core/Info/Interface/IClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientInfoService.cs index 1bab498e..af921a82 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Interface/IClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientInfoService.cs @@ -31,6 +31,13 @@ public interface IClientInfoService /// DataResult GetClientInfo(string id); + /// + /// 批量删除发票抬头 + /// + /// + /// + Task DeleteInvoiceHeaderAsync(IdModel idModel); + /// /// 批量删除 /// diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs index 2224728e..33ed5f78 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs @@ -105,6 +105,17 @@ public class ClientInfoService : ServiceBase, IClientInfoService return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); } + /// + /// 批量删除发票抬头 + /// + /// + /// + public async Task DeleteInvoiceHeaderAsync(IdModel idModel) + { + int rows = await TenantDb.Deleteable().Where(x => idModel.Ids.Contains(x.Id)).ExecuteCommandAsync(); + return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + } + /// /// 批量删除 /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BillTraceRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BillTraceRes.cs index cf5372d1..8b92fee4 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BillTraceRes.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BillTraceRes.cs @@ -10,6 +10,29 @@ namespace DS.WMS.Core.Op.Dtos /// 运踪接口返回结果 /// public class BillTraceRes + { + /// + /// 是否成功 + /// + public bool Success { get; set; } + /// + /// 提示消息 + /// + public string Message { get; set; } + /// + /// 结果编码。0:成功 + /// + public string Code { get; set; } + /// + /// 返回数据 + /// + public List Data { get; set; } + + } + /// + /// 运踪接口返回结果 + /// + public class BillTraceUnsubscribeRes { /// /// 是否成功 @@ -29,4 +52,22 @@ namespace DS.WMS.Core.Op.Dtos public string Data { get; set; } } + public class BillTraceDetail { + + public bool IsSuccess { get; set; } + + /// + /// 提示消息 + /// + public string Message { get; set; } + + /// + /// 提单号 + /// + public string MBLNO { get; set; } + /// + /// 分享链接 + /// + public string ShareLink { get; set; } + } } diff --git a/ds-wms-service/DS.WMS.Core/Op/EDI/EDIMapperInfo.cs b/ds-wms-service/DS.WMS.Core/Op/EDI/EDIMapperInfo.cs new file mode 100644 index 00000000..f7aaaff3 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/EDI/EDIMapperInfo.cs @@ -0,0 +1,25 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Op.EDI +{ + /// + /// edi映射信息 + /// + public class EDIMapperInfo + { + /// + /// 映射代码 + /// + public string MapCode { get; set; } + + /// + /// 映射名称 + /// + public string MapName { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportCommonService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportCommonService.cs index f90acdfb..788c39b5 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportCommonService.cs @@ -1,6 +1,7 @@ using DS.Module.Core; using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Op.Dtos; +using DS.WMS.Core.Op.EDI; using SqlSugar; using System; using System.Collections.Generic; @@ -84,5 +85,22 @@ namespace DS.WMS.Core.Op.Interface /// /// public string GetClientCode(long Id, SqlSugarScopeProvider tenantDb, bool isEDI = true); + + + /// + /// 获取场站映射名称 + /// + /// + /// + /// + public EDIMapperInfo GetYardMapper(long Id, SqlSugarScopeProvider tenantDb); + + /// + /// 获取船公司映射名称 + /// + /// + /// + /// + public EDIMapperInfo GetCarrierMapper(long Id, SqlSugarScopeProvider tenantDb); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs index f0736467..ced69f9d 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs @@ -329,6 +329,8 @@ namespace DS.WMS.Core.Op.Method return client.CodeName; } } + + /// /// 获取场站代码 /// @@ -346,6 +348,56 @@ namespace DS.WMS.Core.Op.Method } return yard.EDICode.IsNull() ? yard.CodeName : yard.EDICode; } + + /// + /// 获取场站映射名称 + /// + /// + /// + /// + public EDIMapperInfo GetYardMapper(long Id, SqlSugarScopeProvider tenantDb) + { + + var yard = tenantDb.Queryable().First(v => v.Id == Id && v.Status == StatusEnum.Enable.ToEnumInt()); + if (yard.IsNull()) + { + throw new Exception("请检查场站信息"); + } + var code = yard.EDICode.IsNull() ? yard.CodeName : yard.EDICode; + + var map= tenantDb.Queryable().Where(v => v.Code == code).Select().First(); + + if (map.IsNull()) + { + throw new Exception("请维护场站映射信息"); + } + return map; + } + + /// + /// 获取船公司映射名称 + /// + /// + /// + /// + public EDIMapperInfo GetCarrierMapper(long Id, SqlSugarScopeProvider tenantDb) + { + + var yard = tenantDb.Queryable().First(v => v.Id == Id && v.Status == StatusEnum.Enable.ToEnumInt()); + if (yard.IsNull()) + { + throw new Exception("请检查船公司信息"); + } + var code = yard.EDICode.IsNull() ? yard.CodeName : yard.EDICode; + + var map = tenantDb.Queryable().Where(v => v.Code == code).Select().First(); + + if (map.IsNull()) + { + throw new Exception("请维护船公司映射信息"); + } + return map; + } /// /// 获取船公司代码 /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs index 9022d3fe..dc18cd00 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs @@ -27,12 +27,23 @@ namespace DS.WMS.Core.Op.Method return await Task.FromResult(DataResult.Failed("未传入正确参数!")); } var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var userKey = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userKey" && x.TenantId == 1288018625843826688).First().Value; - var userPwd = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userPwd" && x.TenantId == 1288018625843826688).First().Value; - var userId = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userId" && x.TenantId == 1288018625843826688).First().Value; + //var userKey = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userKey" && x.TenantId == 1288018625843826688).First().Value; + //var userPwd = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userPwd" && x.TenantId == 1288018625843826688).First().Value; + //var userId = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userId" && x.TenantId == 1288018625843826688).First().Value; var reqUrl = db.Queryable().Filter(null, true).Where(x => x.Code == "request_seae_billtraceurl" && x.TenantId == 1288018625843826688).First().Value; var resUrl = db.Queryable().Filter(null, true).Where(x => x.Code == "response_seae_billtraceurl" && x.TenantId == 1288018625843826688).First().Value; + var account = seaComService.GetCodeThirdParty("BillTraceSubcribe", user.UserId, tenantDb); + + if (account.IsNull()) + { + return await Task.FromResult(DataResult.Failed("未配置运踪订阅第三方账号信息!")); + } + if (account.AppSecret.IsNull()|| account.AppKey.IsNull()|| account.RegistContractName.IsNull()) + { + return await Task.FromResult(DataResult.Failed("请检查运踪订阅第三方账号关键参数!")); + } + BillTraceMain billdto = new BillTraceMain(); List billTraceList = new List(); foreach (var item in req) @@ -70,13 +81,27 @@ namespace DS.WMS.Core.Op.Method { return await Task.FromResult(DataResult.Failed($"场站代号配置未找到:{yardCode}")); } + //var carrierMap = tenantDb.Queryable().Where(x => x.Code == yardCode && x.Module == "BillTrace").First(); + //if (yardMap.IsNull()) + //{ + // return await Task.FromResult(DataResult.Failed($"船公司代号配置未找到:{yardCode}")); + //} + var carrierName =string.Empty; + if (string.IsNullOrEmpty(carrierCode)) + { + carrierName = ""; + } + else + { + carrierName = seaComService.GetCarrierMapper(item.CarrierId, tenantDb).MapName; + } billTraceList.Add(new BillTraceReq { BusinessId = item.BusinessId, MBLNO = item.MBLNO, - YARD = item.Yard == "" ? null : item.Yard, + YARD = yardMap.MapName, YardCode = yardMap.MapCode == "" ? null : yardMap.MapCode, - CARRIER = item.Carrier == "" ? null : item.Carrier, + CARRIER = carrierName, CARRIERID = carrierCode == "" ? null : carrierCode, isBook = item.isBook }); @@ -110,10 +135,10 @@ namespace DS.WMS.Core.Op.Method } billdto.Children = billTraceList; - billdto.Key = userKey; - billdto.PWD = userPwd; + billdto.Key = account.AppKey; + billdto.PWD = account.AppSecret; billdto.url = resUrl; - billdto.Gid = userId; + billdto.Gid = account.RegistContractName; billdto.PushBackKey = user.TenantId;//根据回传的租户Id回调 var json = billdto.ToJsonString(); @@ -124,7 +149,7 @@ namespace DS.WMS.Core.Op.Method reqUrl += "/"; } - reqUrl += "BillTrace/UpdateMblno"; + reqUrl += "BillTrace/SubcribeOrUpdateBilltrace"; var result = RequestHelper.Post(postData.ToJsonString(), reqUrl); @@ -136,7 +161,7 @@ namespace DS.WMS.Core.Op.Method } else { - return await Task.FromResult(DataResult.Success(res.Data)); + return await Task.FromResult(DataResult.Success(res.Data.ToJsonString())); } } @@ -152,18 +177,28 @@ namespace DS.WMS.Core.Op.Method return await Task.FromResult(DataResult.Failed("未传入正确参数!")); } var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var userKey = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userKey" && x.TenantId == 1288018625843826688).First().Value; - var userPwd = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userPwd" && x.TenantId == 1288018625843826688).First().Value; - var userId = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userId" && x.TenantId == 1288018625843826688).First().Value; + //var userKey = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userKey" && x.TenantId == 1288018625843826688).First().Value; + //var userPwd = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userPwd" && x.TenantId == 1288018625843826688).First().Value; + //var userId = db.Queryable().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userId" && x.TenantId == 1288018625843826688).First().Value; var reqUrl = db.Queryable().Filter(null, true).Where(x => x.Code == "request_seae_billtraceurl" && x.TenantId == 1288018625843826688).First().Value; var resUrl = db.Queryable().Filter(null, true).Where(x => x.Code == "response_seae_billtraceurl" && x.TenantId == 1288018625843826688).First().Value; + var account = seaComService.GetCodeThirdParty("BillTraceSubcribe", user.UserId, tenantDb); + + if (account.IsNull()) + { + return await Task.FromResult(DataResult.Failed("未配置运踪订阅第三方账号信息!")); + } + if (account.AppSecret.IsNull() || account.AppKey.IsNull() || account.RegistContractName.IsNull()) + { + return await Task.FromResult(DataResult.Failed("请检查运踪订阅第三方账号关键参数!")); + } BillTraceUnsubscribeDto reqDto = new BillTraceUnsubscribeDto() { Children = new List(), - Key = userKey, - PWD = userPwd, - Gid = userId, + Key = account.AppKey, + PWD = account.AppSecret, + Gid = account.RegistContractName, PushBackKey= user.TenantId, }; foreach (var item in req) @@ -191,7 +226,7 @@ namespace DS.WMS.Core.Op.Method var postData = new { msg = json }; var result = RequestHelper.Post(postData.ToJsonString(), reqUrl); - var res = JsonConvert.DeserializeObject(result); + var res = JsonConvert.DeserializeObject(result); if (!res.Success) { diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs index c54395c8..5e888127 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs @@ -120,16 +120,16 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction if (!result.Succeeded) return result; - if (task.TaskStatus != TaskStatusEnum.Create) - { - await TenantDb.Updateable().SetColumns(x => x.TaskStatus == TaskStatusEnum.Create) + var instance = result.Data as FlowInstance; + var markers = FlowInstanceService.GetNextMarkers(instance); + + await TenantDb.Updateable() + .SetColumns(x => x.TaskStatus == TaskStatusEnum.Create) + .SetColumns(x => x.RecvUsers == string.Join(',', markers)) .Where(x => x.BusinessId == request.BusinessId && x.BusinessType == request.BusinessType && x.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT) .ExecuteCommandAsync(); - - } - return result; } diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientInfoController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientInfoController.cs index f50b5bb7..0725f93b 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientInfoController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientInfoController.cs @@ -64,7 +64,21 @@ public class ClientInfoController : ApiController } /// - /// 根据ID删除 + /// 根据ID删除发票明细 + /// + /// + /// + [HttpPost, Route("DeleteInvoiceHeader")] + public async Task DeleteInvoiceHeaderAsync(IdModel idModel) + { + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); + + return await _invokeService.DeleteInvoiceHeaderAsync(idModel); + } + + /// + /// 根据ID删除往来单位 /// /// ///