非采购接口优化

This commit is contained in:
tongfei
2023-11-09 18:06:43 +08:00
parent 71efc00756
commit 6d0024fd49
8 changed files with 94 additions and 23 deletions

View File

@@ -81,7 +81,7 @@ namespace WMS.Web.Api.Controllers
if (loginInfo == null || loginInfo.UserInfo == null) if (loginInfo == null || loginInfo.UserInfo == null)
return ResultList<InStockTaskBillNoQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error); return ResultList<InStockTaskBillNoQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
var list= await _inStockTaskRepositories.GetListBy(new InStockTaskBillNoQueryRequest() { SourceBillNo=code,Type= (int)InstockType.Purchase }); var list= await _inStockTaskRepositories.GetListBy(new InStockTaskBillNoQueryRequest() { SourceBillNo=code,InstockType= (int)InstockType.Purchase });
return ResultList<InStockTaskBillNoQueryResponse>.ReSuccess(list); return ResultList<InStockTaskBillNoQueryResponse>.ReSuccess(list);
} }
@@ -92,7 +92,24 @@ namespace WMS.Web.Api.Controllers
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[Route("GetSourceOrder/{code}")] [Route("GetSourceOrder/{code}")]
public async Task<ResultList<InStockTaskBillNoQueryResponse>> InStockTask([FromRoute] string code) public async Task<ResultList<InStockTaskBillNoQueryResponse>> GetSourceOrder([FromRoute] string code)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultList<InStockTaskBillNoQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
var list= await _inStockTaskRepositories.GetListBy(new InStockTaskBillNoQueryRequest() { SourceBillNo = code, InstockType = null });
return ResultList<InStockTaskBillNoQueryResponse>.ReSuccess(list);
}
/// <summary>
/// 来源单的信息校准-对应金蝶-pad
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[HttpGet]
[Route("Adjust/{code}")]
public async Task<ResultList<InStockTaskBillNoQueryResponse>> Adjust([FromRoute] string code)
{ {
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null) if (loginInfo == null || loginInfo.UserInfo == null)

View File

@@ -115,13 +115,20 @@
<param name="code"></param> <param name="code"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:WMS.Web.Api.Controllers.InStockTaskController.InStockTask(System.String)"> <member name="M:WMS.Web.Api.Controllers.InStockTaskController.GetSourceOrder(System.String)">
<summary> <summary>
来源单-编号模糊查询-pad 来源单-编号模糊查询-pad
</summary> </summary>
<param name="code"></param> <param name="code"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:WMS.Web.Api.Controllers.InStockTaskController.Adjust(System.String)">
<summary>
来源单的信息校准-对应金蝶-pad
</summary>
<param name="code"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InStockTaskController.Contrast(WMS.Web.Core.Dto.InStockTask.ContrastMaterialsRequest)"> <member name="M:WMS.Web.Api.Controllers.InStockTaskController.Contrast(WMS.Web.Core.Dto.InStockTask.ContrastMaterialsRequest)">
<summary> <summary>
采购订单物料明细和箱物料明细-对比-pad 采购订单物料明细和箱物料明细-对比-pad

View File

@@ -1070,6 +1070,21 @@
箱号明细数量的总和 箱号明细数量的总和
</summary> </summary>
</member> </member>
<member name="T:WMS.Web.Core.Dto.InStockTask.InStockTaskBillNoQueryRequest">
<summary>
模糊查询来源单据-请求对象
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.InStockTask.InStockTaskBillNoQueryRequest.SourceBillNo">
<summary>
来源单据编号
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.InStockTask.InStockTaskBillNoQueryRequest.InstockType">
<summary>
来源单据类型
</summary>
</member>
<member name="T:WMS.Web.Core.Dto.InStockTask.InStockTaskBillNoQueryResponse"> <member name="T:WMS.Web.Core.Dto.InStockTask.InStockTaskBillNoQueryResponse">
<summary> <summary>
来源单号模糊查询响应对象 来源单号模糊查询响应对象

View File

@@ -2459,7 +2459,7 @@
</member> </member>
<member name="M:WMS.Web.Domain.Services.InStockTaskService.GetPurchaseInstockTask(System.String)"> <member name="M:WMS.Web.Domain.Services.InStockTaskService.GetPurchaseInstockTask(System.String)">
<summary> <summary>
来源单-编号模糊查询-pad 来源单-与金蝶校准-第二步-pad
</summary> </summary>
<param name="sourceBillNo"></param> <param name="sourceBillNo"></param>
<returns></returns> <returns></returns>

View File

@@ -4,10 +4,19 @@ using System.Text;
namespace WMS.Web.Core.Dto.InStockTask namespace WMS.Web.Core.Dto.InStockTask
{ {
/// <summary>
/// 模糊查询来源单据-请求对象
/// </summary>
public class InStockTaskBillNoQueryRequest public class InStockTaskBillNoQueryRequest
{ {
/// <summary>
/// 来源单据编号
/// </summary>
public string SourceBillNo { get; set; } public string SourceBillNo { get; set; }
public int? Type { get; set; } /// <summary>
/// 来源单据类型
/// </summary>
public int? InstockType { get; set; }
} }
} }

View File

@@ -40,7 +40,7 @@ namespace WMS.Web.Domain.Services
} }
/// <summary> /// <summary>
/// 来源单-编号模糊查询-pad /// 来源单-与金蝶校准-第二步-pad
/// </summary> /// </summary>
/// <param name="sourceBillNo"></param> /// <param name="sourceBillNo"></param>
/// <returns></returns> /// <returns></returns>
@@ -52,19 +52,41 @@ namespace WMS.Web.Domain.Services
bool isTransaction = false; bool isTransaction = false;
//2.查看是否有入库任务单 //2.查看是否有入库任务单
var tasks= await _inStockTaskRepositories.GetListBy(sourceBillNo); var task = await _inStockTaskRepositories.GetBy(sourceBillNo);
if (tasks == null || tasks.Count == 0) if (task == null)
return ResultList<InStockTaskBillNoQueryResponse>.ReFailure(ResultCodes.OrderNoData); return ResultList<InStockTaskBillNoQueryResponse>.ReFailure(ResultCodes.OrderNoData);
//3.有的话就同步一下金蝶的数据 //3.有的话就同步一下金蝶的数据
var billNos = tasks.Select(x => x.SourceBillNo).ToList(); var billNos = new List<string>();
billNos.Add(sourceBillNo);
//3.1这里要对入库任务单的类型逐一判断进行去ErpService找对应的单据类型重新获取这里只有采购后面再加其它的
if (task.Type == InstockType.Purchase)
{
var result = await this.SsynPurchaseInStock(billNos, isTransaction); var result = await this.SsynPurchaseInStock(billNos, isTransaction);
if (!result.IsSuccess) isRollback = true; if (!result.IsSuccess) isRollback = true;
}
else if (task.Type == InstockType.Miscellaneous)
{
}
else if (task.Type == InstockType.Assembled)
{
}
else if (task.Type == InstockType.Stkdirecttransfers)
{
}
else if (task.Type == InstockType.StktransferInst)
{
}
//4.提交事务 //4.提交事务
var isSuccess = _basicsRepositories.CommitTransaction(isRollback, _transaction); var isSuccess = _basicsRepositories.CommitTransaction(isRollback, _transaction);
if (!isSuccess) if (!isSuccess)
return ResultList < InStockTaskBillNoQueryResponse > .ReFailure(result.Message, result.Status); return ResultList<InStockTaskBillNoQueryResponse>.ReFailure(ResultCodes.AdjustError);
//5.再一次查询新的数据:并返回最后的结果 //5.再一次查询新的数据:并返回最后的结果

View File

@@ -40,6 +40,7 @@ namespace WMS.Web.Domain.Values
public static ValueTuple<int, string> ErpStockError = (80006, "获取Erp相关仓库数据失败请稍候再试"); public static ValueTuple<int, string> ErpStockError = (80006, "获取Erp相关仓库数据失败请稍候再试");
public static ValueTuple<int, string> ErpMaterialError = (80007, "获取Erp相关物料数据失败请稍候再试"); public static ValueTuple<int, string> ErpMaterialError = (80007, "获取Erp相关物料数据失败请稍候再试");
public static ValueTuple<int, string> BoxHaveError = (80008, "该箱信息已被记录,请重新选择箱号!"); public static ValueTuple<int, string> BoxHaveError = (80008, "该箱信息已被记录,请重新选择箱号!");
public static ValueTuple<int, string> AdjustError = (80009, "与金蝶校准发生错误,请稍候再试!");
} }
} }

View File

@@ -257,8 +257,8 @@ namespace WMS.Web.Repositories
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order }) .SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%") && (w.order.Status== InstockStatus.Part || w.order.Status==InstockStatus.Wait)); .Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%") && (w.order.Status== InstockStatus.Part || w.order.Status==InstockStatus.Wait));
if(dto.Type.HasValue) if(dto.InstockType.HasValue)
query = query.Where(w => (int)w.order.Type == dto.Type.Value); query = query.Where(w => (int)w.order.Type == dto.InstockType.Value);
var list = await query.Select(s => new InStockTaskBillNoQueryResponse() var list = await query.Select(s => new InStockTaskBillNoQueryResponse()
{ {