jianghaiqing 3 months ago
commit f38a864e1e

@ -683,6 +683,9 @@ public static class MultiLanguageConst
[Description("开票信息不完整,请检查每张发票是否添加了费用明细")]
public const string InvoiceIncomplete = "Invoice_Incomplete";
[Description("请通过用户管理功能设置证件号码后再提交开票")]
public const string DrawerIDNumberIsNull = "Drawer_IDNumber_IsNull";
#endregion
#region 预订舱API

@ -21,6 +21,18 @@ namespace DS.WMS.Core.Application.Entity
[SugarColumn(ColumnDescription = "申请单ID", IsNullable = false)]
public long ApplicationId { get; set; }
/// <summary>
/// 发票商品编码ID
/// </summary>
[SugarColumn(ColumnDescription = "发票商品编码ID", IsNullable = true)]
public long? CodeId { get; set; }
///// <summary>
///// 发票商品编码
///// </summary>
//[Navigate(NavigateType.OneToOne, nameof(CodeId))]
//public CodeInvoice? CodeInvoice { get; set; }
/// <summary>
/// 明细项名称
/// </summary>

@ -5,6 +5,7 @@ using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Entity;
@ -511,7 +512,7 @@ namespace DS.WMS.Core.Application.Method
await TenantDb.Deleteable<InvoiceDetail>().Where(x => x.ApplicationId == application.Id).ExecuteCommandAsync();
//然后根据申请单明细重新生成
await CreateInvoiceDetailsAsync([application]);
await FillInvoiceDetailsAsync([application]);
if (application.InvoiceDetails?.Count > 0)
{
@ -528,8 +529,8 @@ namespace DS.WMS.Core.Application.Method
await base.OnSaveAsync(application, fees);
}
//生成发票明细
async Task CreateInvoiceDetailsAsync(IEnumerable<InvoiceApplication> applications)
//根据费用明细填充发票明细
async Task FillInvoiceDetailsAsync(IEnumerable<InvoiceApplication> applications)
{
foreach (var application in applications)
{
@ -539,7 +540,8 @@ namespace DS.WMS.Core.Application.Method
if (application.Details.Count > 0 && (application.InvoiceDetails == null || application.InvoiceDetails.Count == 0))
{
var ids = application.Details.Select(x => x.RecordId).ToList();
var feesCodes = await TenantDb.Queryable<FeeRecord>().InnerJoin<FeeCode>((f, c) => f.FeeId == c.Id && ids.Contains(f.Id))
var feesCodes = await TenantDb.Queryable<FeeRecord>()
.InnerJoin<FeeCode>((f, c) => f.FeeId == c.Id && ids.Contains(f.Id))
.Select((f, c) => new
{
FeeId = c.Id,
@ -551,10 +553,24 @@ namespace DS.WMS.Core.Application.Method
Name = x.Key,
FeeIds = x.Select(y => y.FeeId)
}).ToList();
var goodsNames = list.Select(x => x.Name);
var invCodes = await TenantDb.Queryable<CodeInvoice>().Where(x => goodsNames.Contains(x.Name))
.Select(x => new
{
x.Id,
x.Name,
x.DefaultCurrency,
x.TaxRate,
x.Specification,
x.Unit
}).ToListAsync();
application.InvoiceDetails = new List<InvoiceDetail>(list.Count);
foreach (var item in list)
{
var invDetail = new InvoiceDetail
var invCode = invCodes.Find(x => x.Name == item.Name);
var detail = new InvoiceDetail
{
ApplicationId = application.Id,
Name = item.Name,
@ -563,10 +579,18 @@ namespace DS.WMS.Core.Application.Method
TaxUnitPrice = application.Details.FindAll(x => item.FeeIds.Contains(x.FeeId)).Sum(x => x.ApplyAmount),
Category = DetailCategory.InvoiceApplication
};
invDetail.TaxAmount = invDetail.TaxUnitPrice * application.TaxRate;
invDetail.UnitPrice = invDetail.TaxUnitPrice - invDetail.TaxAmount;
invDetail.Amount = invDetail.TaxUnitPrice * invDetail.Quantity;
application.InvoiceDetails.Add(invDetail);
if (invCode != null)
{
detail.TaxRate = invCode.TaxRate;
detail.Specification = invCode.Specification;
detail.Unit = invCode.Unit;
}
detail.TaxAmount = detail.TaxUnitPrice * application.TaxRate;
detail.UnitPrice = detail.TaxUnitPrice - detail.TaxAmount;
detail.Amount = detail.TaxUnitPrice * detail.Quantity;
application.InvoiceDetails.Add(detail);
}
}
}
@ -615,7 +639,7 @@ namespace DS.WMS.Core.Application.Method
await TenantDb.Deleteable<InvoiceDetail>().Where(x => appIds.Contains(x.ApplicationId)).ExecuteCommandAsync();
await CreateInvoiceDetailsAsync(applications);
await FillInvoiceDetailsAsync(applications);
var invDetails = applications.SelectMany(x => x.InvoiceDetails).ToList();
if (invDetails.Count > 0)
await TenantDb.Insertable(invDetails).ExecuteCommandAsync();

@ -40,12 +40,36 @@ namespace DS.WMS.Core.Code.Entity
[SugarColumn(ColumnDescription = "零税率标识")]
public ZeroTaxRateIdentification Identification { get; set; }
/// <summary>
/// 税收分类编码
/// </summary>
[SugarColumn(ColumnDescription = "税收分类编码", Length = 100, IsNullable = true)]
public string? TaxClassificationCode { get; set; }
/// <summary>
/// 税收分类名称
/// </summary>
[SugarColumn(ColumnDescription = "税收分类名称", Length = 100, IsNullable = true)]
public string? TaxClassificationName { get; set; }
/// <summary>
/// 是否含税
/// </summary>
[SugarColumn(ColumnDescription = "是否含税")]
public bool IsIncludingTax { get; set; }
/// <summary>
/// 是否享受优惠政策
/// </summary>
[SugarColumn(ColumnDescription = "是否享受优惠政策")]
public bool HasPreferentialPolicy { get; set; }
/// <summary>
/// 优惠政策说明
/// </summary>
[SugarColumn(ColumnDescription = "优惠政策说明", Length = 200, IsNullable = true)]
public string? PreferentialPolicyDescription { get; set; }
/// <summary>
/// 是否默认商品名
/// </summary>

@ -22,13 +22,6 @@ public interface IFeeCustTemplateDetailService
/// <param name="model"></param>
/// <returns></returns>
Task<DataResult> EditAsync(FeeCustTemplateDetailReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<FeeCustTemplateDetailRes> GetFeeCustTemplateDetailInfo(string id);
/// <summary>
/// 根据ID批量删除

@ -61,20 +61,6 @@ namespace DS.WMS.Core.Fee.Method
}
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<FeeCustTemplateDetailRes> GetFeeCustTemplateDetailInfo(string id)
{
var data = TenantDb.Queryable<FeeCustTemplateDetail>()
.Where(x => x.Id == long.Parse(id))
.Select<FeeCustTemplateDetailRes>()
.First();
return DataResult<FeeCustTemplateDetailRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 根据ID批量删除
/// </summary>

@ -1,6 +1,9 @@
using DS.Module.Core;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Application.Method;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Sys.Entity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
@ -33,6 +36,16 @@ namespace DS.WMS.Core.Invoice.Method
{
ArgumentNullException.ThrowIfNull(ids, nameof(ids));
long userId = long.Parse(User.UserId);
var userInfo = await Db.Queryable<SysUser>().Where(x => x.Id == userId).Select(x => new
{
x.UserName,
x.IdCardNo
}).FirstAsync();
if (string.IsNullOrEmpty(userInfo.IdCardNo))
return DataResult<string>.FailedWithDesc(MultiLanguageConst.DrawerIDNumberIsNull);
//请求参数设置
InvoiceIssuanceRequest request = new()
{
@ -55,11 +68,12 @@ namespace DS.WMS.Core.Invoice.Method
hjse = x.InvoiceAmount * x.TaxRate,
hjje = x.InvoiceAmount - x.InvoiceAmount * x.TaxRate,
jshj = x.InvoiceAmount,
clerk = x.CreateUserName, //开票人
kprzjhm = "", //证件号
clerk = userInfo.UserName, //开票人
kprzjhm = userInfo.IdCardNo, //证件号
kprzjlx = "201", //身份证,
//---------发票明细---------
invoiceDetail = x.InvoiceDetails.Select(y => new InvoiceDetailInfo
invoiceDetail = SqlFunc.Subqueryable<InvoiceDetail>().Where(y => y.ApplicationId == x.Id)
.LeftJoin<CodeInvoice>((y, z) => y.CodeId == z.Id).ToList((y, z) => new InvoiceDetailInfo
{
mxxh = SqlFunc.RowNumber(y.Id), //x.InvoiceDetails.IndexOf(y) + 1,
xmmc = y.Name,
@ -71,9 +85,10 @@ namespace DS.WMS.Core.Invoice.Method
taxRate = y.TaxRate.ToString(),
tax = y.TaxAmount,
taxIncludedAmount = y.TaxUnitPrice,
goodsCode = "", //商品和服务税收分类合并编码
invoiceLineProperty = "00"
}).ToList()
goodsCode = z.Code, //商品和服务税收分类合并编码
invoiceLineProperty = "00",
favouredPolicyFlag = z.PreferentialPolicyDescription
})
}).ToListAsync()
};

@ -4,6 +4,7 @@ using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Op.Entity;
using Masuit.Tools.Systems;
using SqlSugar;
using System.ComponentModel;
namespace DS.WMS.Core.Op.Dtos;
@ -1458,4 +1459,10 @@ public class SeaExportRes
///
/// </summary>
public long OrgId { get; set; }
/// <summary>
/// 创建人名称
/// </summary>
[Description("创建人名称")]
public string CreateUserName { get; set; }
}

@ -347,7 +347,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
string[] ids = FlowInstanceService.GetMarkers(instance);
//变更任务接收人为所有审批执行人
var users = await FillInUserInfoAsync(ids.Select(long.Parse).ToArray());
result = await ManagerService.TransferTask(task.BusinessId, task.TaskType, users);
result = await ManagerService.TransferTask(task.BusinessId, task.TaskType, users, TenantDb);
if (result.Succeeded)
{
task.RecvUsers = string.Join(",", ids);

@ -3,6 +3,7 @@ using DS.Module.DjyServiceStatus;
using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Entity;
using Microsoft.AspNetCore.Http;
using SqlSugar;
using System.Linq.Expressions;
namespace DS.WMS.Core.TaskPlat.Interface
@ -66,7 +67,7 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <param name="bsno">业务主键</param>
/// <param name="taskBaseTypeEnum">业务类型</param>
/// <param name="userInfos">要转交的人员信息列表</param>
Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos);
Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos, SqlSugarScopeProvider? tenantDb = null);
/// <summary>

@ -558,12 +558,24 @@ namespace DS.WMS.Core.TaskPlat.Method
// 如果任务状态为已完成,则查询任务完成时任务对应模块的配置中要设置的业务状态,然后进行设置
if (taskStatusEnum == TaskStatusEnum.Complete && bsno != null)
if (taskStatusEnum == TaskStatusEnum.Complete)
{
string? statusCode = await tenantDb.Queryable<TaskFlowModule>().Where(x => x.ModuleType == 2 && x.TaskType == taskInfo.TASK_TYPE).Select(x => x.BusinessStatusCode).FirstAsync();
if (!string.IsNullOrEmpty(statusCode))
long? orderId = bsno;
if (orderId == null)
{
if (long.TryParse(taskInfo.BOOK_ORDER_NO, out long temp))
{
orderId = temp;
}
}
if (orderId != null)
{
await seaExportCommonService.Value.SetGoodsStatus(statusCode, (long)bsno, tenantDb);
string? statusCode = await tenantDb.Queryable<TaskFlowModule>().Where(x => x.ModuleType == 2 && x.TaskType == taskInfo.TASK_TYPE).Select(x => x.BusinessStatusCode).FirstAsync();
if (!string.IsNullOrEmpty(statusCode))
{
await seaExportCommonService.Value.SetGoodsStatus(statusCode, (long)orderId, tenantDb);
}
}
}

@ -146,9 +146,9 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <param name="bsno">业务主键</param>
/// <param name="taskBaseTypeEnum">业务类型</param>
/// <param name="userInfos">要转交的人员信息列表</param>
public async Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos)
public async Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos, SqlSugarScopeProvider? tenantDb = null)
{
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
tenantDb ??= saasDbService.GetBizDbScopeById(user.TenantId);
try
{
var taskId = await tenantDb.Queryable<TaskBaseInfo>().ClearFilter(typeof(IOrgId))
@ -165,9 +165,9 @@ namespace DS.WMS.Core.TaskPlat.Method
logger.LogInformation("接收到任务转交报文 任务主键={id} 转交人员列表={userinfo}", taskId, JsonConvert.SerializeObject(userInfos));
//await tenantDb.Ado.BeginTranAsync();
await tenantDb.Ado.BeginTranAsync();
await tenantDb.Deleteable<TaskBaseAllocation>(x => x.TaskId == taskId).ExecuteCommandHasChangeAsync();
await tenantDb.Deleteable<TaskBaseAllocation>().Where(x => x.TaskId == taskId).ExecuteCommandAsync();
var allocationList = userInfos.Select(x => new TaskBaseAllocation
{
@ -179,7 +179,7 @@ namespace DS.WMS.Core.TaskPlat.Method
}).ToList();
await tenantDb.Insertable(allocationList).ExecuteCommandAsync();
//await tenantDb.Ado.CommitTranAsync();
await tenantDb.Ado.CommitTranAsync();
return DataResult.Successed("操作成功!", MultiLanguageConst.DataUpdateSuccess);
}
catch (Exception)
@ -1652,9 +1652,8 @@ namespace DS.WMS.Core.TaskPlat.Method
var taskNo = await tenantDb.Queryable<TaskBaseInfo>().ClearFilter(typeof(IOrgId)).Where(a => a.Id == taskInfo.Id).Select(a => a.TASK_NO).FirstAsync();
//回写任务号
var result = new DataResult(ResultCode.Success, "新增任务成功", data: taskNo);
var result = new DataResult(ResultCode.Success, "新增任务成功", data: taskInfo.TASK_NO);
return await Task.FromResult(result);
}
@ -2730,7 +2729,7 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <summary>
/// 测试用

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NameOfLastUsedPublishProfile>D:\Source\Repos\DS8\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup>

Loading…
Cancel
Save