非采购上架接口
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,6 +8,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.SingleData;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
@@ -123,22 +125,22 @@ namespace WMS.Web.Api.Controllers
|
||||
/// <summary>
|
||||
/// 根据仓库获取金蝶子仓库
|
||||
/// </summary>
|
||||
/// <param name="id">仓库id</param>
|
||||
/// <param name="number">仓库编码</param>
|
||||
/// <param name="name">模糊匹配</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetErp_SubUcStock/{id}")]
|
||||
public async Task<Result<List<UcStockResponse>>> GetErp_SubUcStock([FromRoute] int id)
|
||||
[Route("GetErp_SubUcStock/{number}")]
|
||||
public async Task<Result<List<UcStockResponse>>> GetErp_SubUcStock([FromRoute] string number, [FromQuery] string name)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return Result<List<UcStockResponse>>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
|
||||
List<UcStockResponse> list = new List<UcStockResponse>();
|
||||
var code = _singleDataService.GetSingleDataCode(SingleAction.Stocks, loginInfo.UserInfo.CompanyId, id);
|
||||
if (code.Substring(0, 2).Equals("HD") || code.Substring(0, 2).Equals("GD"))
|
||||
if (number.Substring(0, 2).Equals("HD") || number.Substring(0, 2).Equals("GD"))
|
||||
{
|
||||
var subs = await _erpService.BillQueryForSubStock(code);
|
||||
foreach (var s in subs.Data)
|
||||
var subs = await _erpService.BillQueryForSubStock(number);
|
||||
foreach (var s in subs.Data.Where(w=> EF.Functions.Like(w.Name, "%" + name + "%")))
|
||||
{
|
||||
list.Add(new UcStockResponse()
|
||||
{
|
||||
@@ -152,6 +154,42 @@ namespace WMS.Web.Api.Controllers
|
||||
return Result<List<UcStockResponse>>.ReSuccess(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取出库单客户下拉列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetCustomers")]
|
||||
public async Task<Result<List<PullDownStrResponse>>> GetCustomers()
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return Result<List<PullDownStrResponse>>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
var customers = await _erpService.BillQueryForCustomer();
|
||||
var orgs = await _erpService.BillQueryForOrg();
|
||||
List<PullDownStrResponse> pullList = new List<PullDownStrResponse>();
|
||||
foreach (var c in customers.Data)
|
||||
{
|
||||
pullList.Add(new PullDownStrResponse()
|
||||
{
|
||||
Id = "c_" + c.Id,
|
||||
Name = c.Name,
|
||||
Code = c.Number
|
||||
});
|
||||
}
|
||||
foreach (var o in orgs.Data)
|
||||
{
|
||||
pullList.Add(new PullDownStrResponse()
|
||||
{
|
||||
Id = "o_" + o.Id,
|
||||
Name = o.Name,
|
||||
Code = o.Number
|
||||
});
|
||||
}
|
||||
|
||||
return Result<List<PullDownStrResponse>>.ReSuccess(pullList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取仓位:模糊名称
|
||||
/// </summary>
|
||||
|
||||
@@ -283,11 +283,18 @@
|
||||
<param name="id">仓库id</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetErp_SubUcStock(System.Int32)">
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetErp_SubUcStock(System.String,System.String)">
|
||||
<summary>
|
||||
根据仓库获取金蝶子仓库
|
||||
</summary>
|
||||
<param name="id">仓库id</param>
|
||||
<param name="number">仓库编码</param>
|
||||
<param name="name">模糊匹配</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetCustomers">
|
||||
<summary>
|
||||
获取出库单客户下拉列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetSubUcStockByName(System.String)">
|
||||
|
||||
@@ -465,9 +465,24 @@
|
||||
单据类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.EnumStatusResponse.ShelfMethod">
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.Customer.ErpCustomerDto">
|
||||
<summary>
|
||||
非采购上架方式
|
||||
客户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.Customer.ErpCustomerDto.Id">
|
||||
<summary>
|
||||
ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.Customer.ErpCustomerDto.Number">
|
||||
<summary>
|
||||
编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.Customer.ErpCustomerDto.Name">
|
||||
<summary>
|
||||
名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.ErpBillQueryDto">
|
||||
@@ -780,6 +795,26 @@
|
||||
含税单价 取对应发货通知单对应物料编码行的 含税单价
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.PullDownStrResponse">
|
||||
<summary>
|
||||
key为string 下拉列表对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.PullDownStrResponse.Id">
|
||||
<summary>
|
||||
id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.PullDownStrResponse.Code">
|
||||
<summary>
|
||||
编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.PullDownStrResponse.Name">
|
||||
<summary>
|
||||
名字
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.Purchase.ErpPurchaseInStockResultDto">
|
||||
<summary>
|
||||
erp-采购入库-返回数据源
|
||||
@@ -1535,36 +1570,6 @@
|
||||
同步成功或者失败
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest">
|
||||
<summary>
|
||||
非采购单上架请求对象-按箱
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.TaskId">
|
||||
<summary>
|
||||
单据ID(等同-入库任务单ID)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.ShelfMethod">
|
||||
<summary>
|
||||
上架方式
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Boxs">
|
||||
<summary>
|
||||
箱集合
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.TaskDetails">
|
||||
<summary>
|
||||
入库任务单明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Details">
|
||||
<summary>
|
||||
入库单明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.InStock.PurchaseShelfRequest">
|
||||
<summary>
|
||||
采购上架-请求对象
|
||||
|
||||
@@ -459,12 +459,6 @@
|
||||
</summary>
|
||||
<param name="creatorId"></param>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.InStockTask.NoPurchaseShelf(System.Int32)">
|
||||
<summary>
|
||||
非采购上架
|
||||
</summary>
|
||||
<param name="creatorId"></param>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Entitys.InStockTaskBox">
|
||||
<summary>
|
||||
erp入库任务单的对应box箱信息表
|
||||
@@ -757,7 +751,7 @@
|
||||
明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.Create(System.Int32,System.Int32,WMS.Web.Domain.Values.OutStockType)">
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.Create(System.Int32,WMS.Web.Domain.Entitys.OutStockTask)">
|
||||
<summary>
|
||||
创建
|
||||
</summary>
|
||||
@@ -1536,14 +1530,6 @@
|
||||
<param name="loginInfo"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IInStockService.ShelfNoPurchase(WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest,WMS.Web.Core.Dto.Login.LoginInDto)">
|
||||
<summary>
|
||||
上架-非采购订单
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<param name="loginInDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IInStockService.GetInfoByBox(System.String)">
|
||||
<summary>
|
||||
获取任务单:根据箱号信息
|
||||
@@ -1551,7 +1537,7 @@
|
||||
<param name="boxBillNo"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IInStockService.Update(WMS.Web.Core.Dto.InStockTask.UpdateInStockTaskRequest,System.Int32,System.Nullable{System.Boolean},System.Boolean,System.Boolean)">
|
||||
<member name="M:WMS.Web.Domain.IService.IInStockService.Update(WMS.Web.Core.Dto.InStockTask.UpdateInStockTaskRequest,System.Int32,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
修改-入库任务信息
|
||||
</summary>
|
||||
@@ -1652,6 +1638,14 @@
|
||||
<param name="supplierId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IErpBasicDataExtendService.GetCustomerName(System.Collections.Generic.List{WMS.Web.Core.Dto.Erp.Customer.ErpCustomerDto},System.Int32)">
|
||||
<summary>
|
||||
获取客户名称
|
||||
</summary>
|
||||
<param name="erpCustomers"></param>
|
||||
<param name="customerId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IErpBasicDataExtendService.GetStockName(System.Collections.Generic.List{WMS.Web.Core.Dto.Erp.ErpStockDto},System.Int32)">
|
||||
<summary>
|
||||
获取仓库名称
|
||||
@@ -1736,6 +1730,12 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IErpService.BillQueryForCustomer">
|
||||
<summary>
|
||||
客户
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IErpService.BillQueryForStock">
|
||||
<summary>
|
||||
获取仓库信息
|
||||
@@ -1823,7 +1823,7 @@
|
||||
出库任务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IOutStockTaskService.SsynDeliveryNoticeOutStock(System.Boolean,System.Collections.Generic.List{System.String})">
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IOutStockTaskService.BillQueryForDeliveryNoticeOutStock(System.Boolean,System.Collections.Generic.List{System.String})">
|
||||
<summary>
|
||||
采购发货通知单
|
||||
</summary>
|
||||
@@ -1854,6 +1854,13 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IOutStockTaskService.Ssyn(System.Collections.Generic.List{System.String})">
|
||||
<summary>
|
||||
同步金蝶数据 不传源订单号则更新所有
|
||||
</summary>
|
||||
<param name="sourceBillNos"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.IService.Public.ISingleDataService">
|
||||
<summary>
|
||||
单点数据返回服务接口
|
||||
@@ -2336,14 +2343,6 @@
|
||||
<param name="loginInfo"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.InStockService.ShelfNoPurchase(WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest,WMS.Web.Core.Dto.Login.LoginInDto)">
|
||||
<summary>
|
||||
非采购单上架-按箱
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<param name="loginInDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.InStockService.GetInfoByBox(System.String)">
|
||||
<summary>
|
||||
获取任务单:根据箱号信息
|
||||
@@ -2351,7 +2350,7 @@
|
||||
<param name="boxBillNo"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.InStockService.ShelfSave(WMS.Web.Core.Dto.InStock.PurchaseShelfRequest,WMS.Web.Domain.Values.InstockType,System.Int32,System.Boolean)">
|
||||
<member name="M:WMS.Web.Domain.Services.InStockService.Save(WMS.Web.Core.Dto.InStock.PurchaseShelfRequest,WMS.Web.Domain.Values.InstockType,System.Int32,System.Boolean)">
|
||||
<summary>
|
||||
采购上架-保存
|
||||
</summary>
|
||||
@@ -2360,16 +2359,7 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.InStockService.ShelfNoPurchaseSave(WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest,System.Int32,System.Boolean)">
|
||||
<summary>
|
||||
非采购上架-按箱-保存
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<param name="staffId"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.InStockService.Update(WMS.Web.Core.Dto.InStockTask.UpdateInStockTaskRequest,System.Int32,System.Nullable{System.Boolean},System.Boolean,System.Boolean)">
|
||||
<member name="M:WMS.Web.Domain.Services.InStockService.Update(WMS.Web.Core.Dto.InStockTask.UpdateInStockTaskRequest,System.Int32,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
修改-入库任务信息
|
||||
</summary>
|
||||
@@ -2455,7 +2445,7 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.OutStockTaskService.SsynDeliveryNoticeOutStock(System.Boolean,System.Collections.Generic.List{System.String})">
|
||||
<member name="M:WMS.Web.Domain.Services.OutStockTaskService.BillQueryForDeliveryNoticeOutStock(System.Boolean,System.Collections.Generic.List{System.String})">
|
||||
<summary>
|
||||
发货通知单同步数据
|
||||
</summary>
|
||||
@@ -2494,6 +2484,13 @@
|
||||
<param name="sourceBillNos"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.OutStockTaskService.Ssyn(System.Collections.Generic.List{System.String})">
|
||||
<summary>
|
||||
同步金蝶数据 不传源订单号则更新所有
|
||||
</summary>
|
||||
<param name="sourceBillNos"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Services.Public.ErpBasicDataExtendService">
|
||||
<summary>
|
||||
erp基础数据:扩展服务
|
||||
@@ -2547,6 +2544,14 @@
|
||||
<param name="supplierId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.Public.ErpBasicDataExtendService.GetCustomerName(System.Collections.Generic.List{WMS.Web.Core.Dto.Erp.Customer.ErpCustomerDto},System.Int32)">
|
||||
<summary>
|
||||
获取客户名称
|
||||
</summary>
|
||||
<param name="erpCustomers"></param>
|
||||
<param name="customerId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.Public.ErpBasicDataExtendService.GetStockName(System.Collections.Generic.List{WMS.Web.Core.Dto.Erp.ErpStockDto},System.Int32)">
|
||||
<summary>
|
||||
获取仓库名称
|
||||
@@ -2606,6 +2611,12 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.Public.ErpService.BillQueryForCustomer">
|
||||
<summary>
|
||||
客户
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.Public.ErpService.BillQueryForStock">
|
||||
<summary>
|
||||
erp:仓库
|
||||
@@ -3146,6 +3157,11 @@
|
||||
分布式调出单
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Values.Erp.FormIdParam.BD_Customer">
|
||||
<summary>
|
||||
客户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Values.InstockStatus">
|
||||
<summary>
|
||||
入库状态
|
||||
@@ -3371,21 +3387,6 @@
|
||||
序列号操作类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Values.ShelfMethod">
|
||||
<summary>
|
||||
非采购上架方式
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Values.ShelfMethod.Box">
|
||||
<summary>
|
||||
按箱上架
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Values.ShelfMethod.Product">
|
||||
<summary>
|
||||
按产品上架
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Values.Single.SingleAction">
|
||||
<summary>
|
||||
对接单点的接口方法-枚举
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace WMS.Web.Core.Dto.ChangeBoxRecord
|
||||
/// <summary>
|
||||
/// 原箱子ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "原箱子不能为空")]
|
||||
public int SrcBoxId { get; set; }
|
||||
/// <summary>
|
||||
/// 目标箱子ID
|
||||
|
||||
27
src/WMS.Web.Core/Dto/Erp/Customer/ErpCustomerDto.cs
Normal file
27
src/WMS.Web.Core/Dto/Erp/Customer/ErpCustomerDto.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Erp.Customer
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户
|
||||
/// </summary>
|
||||
public class ErpCustomerDto
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
25
src/WMS.Web.Core/Dto/Erp/PullDownStrResponse.cs
Normal file
25
src/WMS.Web.Core/Dto/Erp/PullDownStrResponse.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Erp
|
||||
{
|
||||
/// <summary>
|
||||
/// key为string 下拉列表对象
|
||||
/// </summary>
|
||||
public class PullDownStrResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 名字
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -73,10 +73,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 创建
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId,int taskId, OutStockType type)
|
||||
public void Create(int creatorId, OutStockTask task)
|
||||
{
|
||||
this.TaskId = taskId;
|
||||
this.Type = type;
|
||||
this.TaskId = task.Id;
|
||||
this.Type = task.Type;
|
||||
this.DeliveryOrgId = task.DeliveryOrgId;
|
||||
this.ReceiptCustomerId = task.ReceiptCustomerId;
|
||||
this.CreatorId = creatorId;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace WMS.Web.Domain.IService
|
||||
public interface IChangeMoveBoxService
|
||||
{
|
||||
//改箱保存
|
||||
Task<Result> ChangeBoxSave(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo);
|
||||
Task<Result> ChangeBoxSave(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo, bool isTransaction=true);
|
||||
//移箱保存
|
||||
Task<Result> MoveBoxSave(SaveMoveBoxRecordRequest dto, LoginInDto loginInfo);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.Customer;
|
||||
using WMS.Web.Core.Dto.Erp.Org;
|
||||
using WMS.Web.Core.Dto.Erp.Supplier;
|
||||
|
||||
@@ -58,6 +59,13 @@ namespace WMS.Web.Domain.IService.Public
|
||||
/// <param name="supplierId"></param>
|
||||
/// <returns></returns>
|
||||
string GetSupplierName(List<ErpSupplierDto> erpSuppliers, int supplierId);
|
||||
/// <summary>
|
||||
/// 获取客户名称
|
||||
/// </summary>
|
||||
/// <param name="erpCustomers"></param>
|
||||
/// <param name="customerId"></param>
|
||||
/// <returns></returns>
|
||||
string GetCustomerName(List<ErpCustomerDto> erpCustomers, int customerId);
|
||||
|
||||
/// <summary>
|
||||
/// 获取仓库名称
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.Customer;
|
||||
using WMS.Web.Core.Dto.Erp.Org;
|
||||
using WMS.Web.Core.Dto.Erp.OutStock;
|
||||
using WMS.Web.Core.Dto.Erp.Purchase;
|
||||
@@ -66,7 +67,11 @@ namespace WMS.Web.Domain.IService.Public
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<ResultList<ErpSupplierDto>> BillQueryForSupplier();
|
||||
|
||||
/// <summary>
|
||||
/// 客户
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<ResultList<ErpCustomerDto>> BillQueryForCustomer();
|
||||
/// <summary>
|
||||
/// 获取仓库信息
|
||||
/// </summary>
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace WMS.Web.Domain.IService.Public
|
||||
/// </summary>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<Result> SsynDeliveryNoticeOutStock(bool isTransaction,List<string> sourceBillNos = null);
|
||||
Task<Result> BillQueryForDeliveryNoticeOutStock(bool isTransaction,List<string> sourceBillNos = null);
|
||||
/// <summary>
|
||||
/// erp:单据查询-直接调拨出库
|
||||
/// </summary>
|
||||
@@ -44,5 +44,11 @@ namespace WMS.Web.Domain.IService.Public
|
||||
Task<Result> Repeal(OperateRequest dto, LoginInDto loginInfo);
|
||||
//出库任务作废
|
||||
Task<Result> merge(OperateRequest dto, LoginInDto loginInfo);
|
||||
/// <summary>
|
||||
/// 同步金蝶数据 不传源订单号则更新所有
|
||||
/// </summary>
|
||||
/// <param name="sourceBillNos"></param>
|
||||
/// <returns></returns>
|
||||
Task<Result> Ssyn(List<string> sourceBillNos = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,28 +44,11 @@ namespace WMS.Web.Domain.QuartzJob
|
||||
{
|
||||
try
|
||||
{
|
||||
//1.事务
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isTransaction = false;
|
||||
//2.记录:开始时间
|
||||
var begindatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"出库单-同步金蝶入库单数据:执行开始时间->{begindatetime}");
|
||||
//3.同步数据
|
||||
var result = await _outStockTaskService.SsynDeliveryNoticeOutStock(isTransaction);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
result = await _outStockTaskService.BillQueryForTransferDirectOutStock(isTransaction);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
result = await _outStockTaskService.BillQueryForTransferOutOutStock(isTransaction);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
result = await _outStockTaskService.BillQueryForMisDeliveryOutStock(isTransaction);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
result = await _outStockTaskService.BillQueryForAssembledAppOutStock(isTransaction);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
|
||||
//4.提交事务
|
||||
var isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
|
||||
var result = await _outStockTaskService.Ssyn(null);
|
||||
//5.记录:结束时间
|
||||
var enddatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"出库单-同步金蝶入库单数据:执行结束时间->{begindatetime}");
|
||||
|
||||
@@ -43,22 +43,28 @@ namespace WMS.Web.Domain.Services
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> ChangeBoxSave(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo)
|
||||
public async Task<Result> ChangeBoxSave(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo, bool isTransaction = false)
|
||||
{
|
||||
List<Box> boxList = new List<Box>();
|
||||
//原箱有可能没有
|
||||
var srcBox = await _boxRepositories.Get(dto.SrcBoxId);
|
||||
var destBox = await _boxRepositories.Get(dto.DestBoxId);
|
||||
if (srcBox == null) return Result.ReFailure(ResultCodes.BoxNoData);
|
||||
//if (srcBox == null) return Result.ReFailure(ResultCodes.BoxNoData);
|
||||
if (destBox == null) return Result.ReFailure(ResultCodes.BoxNoData);
|
||||
var l = dto.Details.Select(s => (s.MaterialId, s.Qty, s.SerialNumbers)).ToList();
|
||||
//原箱移出
|
||||
var res = srcBox.Out(l);
|
||||
Result res;
|
||||
if (srcBox != null)
|
||||
{
|
||||
res = srcBox.Out(l);
|
||||
if (!res.IsSuccess) return res;
|
||||
}
|
||||
//目标箱移入
|
||||
res = destBox.In(l);
|
||||
if (!res.IsSuccess) return res;
|
||||
|
||||
if (srcBox != null)
|
||||
boxList.Add(srcBox);
|
||||
if (destBox != null)
|
||||
boxList.Add(destBox);
|
||||
|
||||
//var entity = _mapper.Map<ChangeBoxRecord>(dto);\
|
||||
@@ -72,8 +78,9 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
//需要填写序列号
|
||||
//需要修改库存
|
||||
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
isSuccess = await _changeBoxRecordRepositories.AddRange(list, false);
|
||||
@@ -84,9 +91,12 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
|
||||
//提交事务
|
||||
if (isTransaction)
|
||||
{
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
@@ -28,15 +28,17 @@ namespace WMS.Web.Domain.Services
|
||||
public readonly IBasicsRepositories _transactionRepositories;
|
||||
private readonly IOutStockRepositories _outStockRepositories;
|
||||
private readonly IOutStockTaskRepositories _outStockTaskRepositories;
|
||||
private readonly IOutStockTaskService _outStockTaskService;
|
||||
public OutStockService(IMapper mapper, ILoginService loginService,
|
||||
IBasicsRepositories transactionRepositories,
|
||||
IOutStockRepositories outStockRepositories, IOutStockTaskRepositories outStockTaskRepositories)
|
||||
IOutStockRepositories outStockRepositories, IOutStockTaskRepositories outStockTaskRepositories, IOutStockTaskService outStockTaskService)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_loginService = loginService;
|
||||
_transactionRepositories = transactionRepositories;
|
||||
_outStockRepositories = outStockRepositories;
|
||||
_outStockTaskRepositories = outStockTaskRepositories;
|
||||
_outStockTaskService = outStockTaskService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 出库单
|
||||
@@ -48,15 +50,20 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
var outStockTask = await _outStockTaskRepositories.Get(dto.TaskId);
|
||||
//OutStock entity = await _outStockRepositories.GetByTaskId(dto.TaskId);
|
||||
//同步该订单最新数据到wms系统
|
||||
List<string> nos = new List<string>();
|
||||
nos.Add(outStockTask.SourceBillNo);
|
||||
var res = await _outStockTaskService.Ssyn(nos);
|
||||
if (!res.IsSuccess) return Result.ReSuccess();
|
||||
|
||||
OutStock entity = new OutStock();
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask.Id, outStockTask.Type);
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask);
|
||||
foreach (var d in dto.Details)
|
||||
{
|
||||
//任务单明细
|
||||
var tDetail = outStockTask.Details.FirstOrDefault(f => f.MaterialId == d.MaterialId);
|
||||
if (tDetail == null) continue;
|
||||
var res = outStockTask.OutStock(d.MaterialId, d.Qty);
|
||||
res = outStockTask.OutStock(d.MaterialId, d.Qty);
|
||||
if (!res.IsSuccess) return res;
|
||||
|
||||
var outd = _mapper.Map<OutStockDetails>(tDetail);
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace WMS.Web.Domain.Services
|
||||
/// </summary>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> SsynDeliveryNoticeOutStock(bool isTransaction, List<string> sourceBillNos = null)
|
||||
public async Task<Result> BillQueryForDeliveryNoticeOutStock(bool isTransaction, List<string> sourceBillNos = null)
|
||||
{
|
||||
//1.获取金蝶数据:采购订单数据
|
||||
var erp_result = await _erpService.BillQueryForDeliveryNoticeOutStock(sourceBillNos);
|
||||
@@ -231,5 +231,99 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
return await this.SsynDate(erp_result.Data.ToList(), isTransaction);
|
||||
}
|
||||
/// <summary>
|
||||
/// 同步金蝶数据 不传源订单号则更新所有
|
||||
/// </summary>
|
||||
/// <param name="sourceBillNos"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> Ssyn(List<string> sourceBillNos = null)
|
||||
{
|
||||
//1.事务
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
Result result;
|
||||
//定时任务更新
|
||||
if (sourceBillNos == null)
|
||||
{
|
||||
|
||||
//更新时间范围内所有
|
||||
result= await BillQueryForDeliveryNoticeOutStock(false, null);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
result = await BillQueryForTransferDirectOutStock(false, null);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
result = await BillQueryForTransferOutOutStock(false, null);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
result = await BillQueryForAssembledAppOutStock(false, null);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
result = await BillQueryForMisDeliveryOutStock(false, null);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
|
||||
//同步成功后 更新定时开始时间
|
||||
if (!isRollback)
|
||||
{
|
||||
}
|
||||
|
||||
//4.提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
//根据指定单号更新
|
||||
List<string> DeliveryNotice_Nos = new List<string>();
|
||||
List<string> TransferDirect_Nos = new List<string>();
|
||||
List<string> TransferOut_Nos = new List<string>();
|
||||
List<string> AssembledApp_Nos = new List<string>();
|
||||
List<string> MisDeliveryOut_Nos = new List<string>();
|
||||
var taskList = await _outStockTaskRepositories.GetListBySourceBillNo(sourceBillNos);
|
||||
foreach (var entity in taskList)
|
||||
{
|
||||
if (entity.Type == OutStockType.Sal)
|
||||
DeliveryNotice_Nos.Add(entity.SourceBillNo);
|
||||
else if (entity.Type == OutStockType.Stkdirecttransfers)
|
||||
TransferDirect_Nos.Add(entity.SourceBillNo);
|
||||
else if (entity.Type == OutStockType.StktransferInst)
|
||||
TransferOut_Nos.Add(entity.SourceBillNo);
|
||||
else if (entity.Type == OutStockType.Assembled)
|
||||
AssembledApp_Nos.Add(entity.SourceBillNo);
|
||||
else if (entity.Type == OutStockType.Miscellaneous)
|
||||
MisDeliveryOut_Nos.Add(entity.SourceBillNo);
|
||||
}
|
||||
|
||||
if (DeliveryNotice_Nos.Count() > 0)
|
||||
{
|
||||
result= await BillQueryForDeliveryNoticeOutStock(false, DeliveryNotice_Nos);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
}
|
||||
if (TransferDirect_Nos.Count() > 0)
|
||||
{
|
||||
result = await BillQueryForDeliveryNoticeOutStock(false, TransferDirect_Nos);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
}
|
||||
if (TransferOut_Nos.Count() > 0)
|
||||
{
|
||||
result = await BillQueryForDeliveryNoticeOutStock(false, TransferOut_Nos);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
}
|
||||
if (AssembledApp_Nos.Count() > 0)
|
||||
{
|
||||
result = await BillQueryForDeliveryNoticeOutStock(false, AssembledApp_Nos);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
}
|
||||
if (MisDeliveryOut_Nos.Count() > 0)
|
||||
{
|
||||
result = await BillQueryForDeliveryNoticeOutStock(false, MisDeliveryOut_Nos);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
}
|
||||
|
||||
//4.提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.Customer;
|
||||
using WMS.Web.Core.Dto.Erp.Org;
|
||||
using WMS.Web.Core.Dto.Erp.Supplier;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
@@ -100,6 +101,17 @@ namespace WMS.Web.Domain.Services.Public
|
||||
var supplier = erpSuppliers.Where(x => x.Id == supplierId).FirstOrDefault();
|
||||
return supplier == null ? "" : supplier.Name;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取客户名称
|
||||
/// </summary>
|
||||
/// <param name="erpCustomers"></param>
|
||||
/// <param name="customerId"></param>
|
||||
/// <returns></returns>
|
||||
public string GetCustomerName(List<ErpCustomerDto> erpCustomers, int customerId)
|
||||
{
|
||||
var supplier = erpCustomers.Where(x => x.Id == customerId).FirstOrDefault();
|
||||
return supplier == null ? "" : supplier.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取仓库名称
|
||||
@@ -136,5 +148,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
var stock = erpStocks.Where(x => x.Id == stockId).FirstOrDefault();
|
||||
return stock == null ? "" : stock.Code;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.ServiceModel;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.Customer;
|
||||
using WMS.Web.Core.Dto.Erp.Org;
|
||||
using WMS.Web.Core.Dto.Erp.OutStock;
|
||||
using WMS.Web.Core.Dto.Erp.Purchase;
|
||||
@@ -397,7 +398,74 @@ namespace WMS.Web.Domain.Services.Public
|
||||
return ResultList<ErpSupplierDto>.ReFailure(ResultCodes.ErpSupplierError);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 客户
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<ResultList<ErpCustomerDto>> BillQueryForCustomer()
|
||||
{
|
||||
try
|
||||
{
|
||||
//1.获取缓存中的供应商数据;
|
||||
var cache_key = "erp_customer_list";
|
||||
var customers = _memoryCache.Get<List<ErpCustomerDto>>(cache_key);
|
||||
if (customers == null || customers.Count == 0)
|
||||
{
|
||||
|
||||
//2.先登录金蝶-拿到token
|
||||
var token_result = await this.Init();
|
||||
if (!token_result.IsSuccess)
|
||||
return ResultList<ErpCustomerDto>.ReFailure(token_result);
|
||||
|
||||
//3.获取金蝶供应商:拼接参数和条件
|
||||
var query = new ErpBillQueryDto(token_result.Data);
|
||||
var param = new ErpBillQueryParamDto(FormIdParam.BD_Customer.ToString());
|
||||
param.FieldKeys = "FCUSTID,FNumber,FName";
|
||||
param.Limit = 10000;
|
||||
//查询条件:备注其中的条件值以金蝶的值为准!!!
|
||||
param.FilterString = "";
|
||||
|
||||
//备注:因为供应商数据不是很多,就不能和获取物料一样循环获取;组织这里就获取10000条数据就行了
|
||||
var beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"供应商拉取-开始时间:{beginTime}");
|
||||
//4.参数json化
|
||||
query.Data = JsonConvert.SerializeObject(param);
|
||||
var json = JsonConvert.SerializeObject(query);
|
||||
|
||||
//5.请求查询接口并返回数据
|
||||
var result_json = await _client.ExecuteBillQueryAsync(json);
|
||||
var result = JsonConvert.DeserializeObject<List<List<string>>>(result_json);
|
||||
|
||||
var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"供应商拉取-结束时间:{endTime}");
|
||||
//6.拼装
|
||||
var list = new List<ErpCustomerDto>();
|
||||
foreach (var item in result)
|
||||
{
|
||||
var lis = new ErpCustomerDto();
|
||||
lis.Id = int.Parse(item[0]);
|
||||
lis.Number = item[1];
|
||||
lis.Name = item[2];
|
||||
list.Add(lis);
|
||||
|
||||
}
|
||||
//5.供应商集合进行缓存
|
||||
_memoryCache.Set(cache_key, list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(12)));
|
||||
_logger.LogInformation($"供应商拉取-总条数:{list.Count}");
|
||||
return ResultList<ErpCustomerDto>.ReSuccess(list);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return ResultList<ErpCustomerDto>.ReSuccess(customers);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return ResultList<ErpCustomerDto>.ReFailure(ResultCodes.ErpSupplierError);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// erp:仓库
|
||||
/// </summary>
|
||||
@@ -1006,6 +1074,8 @@ namespace WMS.Web.Domain.Services.Public
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,10 @@ namespace WMS.Web.Domain.Values.Erp
|
||||
/// <summary>
|
||||
/// 分布式调出单
|
||||
/// </summary>
|
||||
STK_TRANSFEROUT=15
|
||||
STK_TRANSFEROUT=15,
|
||||
/// <summary>
|
||||
/// 客户
|
||||
/// </summary>
|
||||
BD_Customer=16
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace WMS.Web.Repositories
|
||||
var staffList = await _basicsRepositories.GetStaffListAsync(_loginRepositories.CompanyId);
|
||||
ids = staffList.Where(w => EF.Functions.Like(w.Name, "%" + dto.Creator + "%")).Select(s => s.Id).ToList();
|
||||
}
|
||||
|
||||
#region erp基础资料
|
||||
List<int> mIds = new List<int>();
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
if (!materials_result.IsSuccess)
|
||||
@@ -100,13 +100,36 @@ namespace WMS.Web.Repositories
|
||||
mIds = materials.Where(w => EF.Functions.Like(w.MaterialNumber, "%" + dto.MaterialNumber + "%")).Select(s => s.MaterialId).ToList();
|
||||
}
|
||||
|
||||
//取组织
|
||||
var org_result = await _erpService.BillQueryForOrg();
|
||||
if (!org_result.IsSuccess)
|
||||
return (new List<OutStockQueryInfoResponse>(), 0);
|
||||
var orgs = org_result.Data.ToList();
|
||||
|
||||
//取客户
|
||||
var customer_result = await _erpService.BillQueryForCustomer();
|
||||
if (!customer_result.IsSuccess)
|
||||
return (new List<OutStockQueryInfoResponse>(), 0);
|
||||
var customers = customer_result.Data.ToList();
|
||||
|
||||
#endregion
|
||||
|
||||
var query = _context.OutStockDetails
|
||||
.GroupJoin(_context.OutStock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
.OrderByDescending(o => o.order.Id)
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
//if (!string.IsNullOrEmpty(dto.ReceiptCustomer))
|
||||
if (!string.IsNullOrEmpty(dto.ReceiptCustomer))
|
||||
{
|
||||
var rec_type = dto.ReceiptCustomer.Substring(0, 1);
|
||||
var rec_id = Convert.ToInt32(dto.ReceiptCustomer.Substring(2, dto.ReceiptCustomer.Length - 1));
|
||||
|
||||
if (rec_type.Equals("c"))//差销售出库单(客户)
|
||||
query = query.Where(w => rec_id == w.order.ReceiptCustomerId && w.order.Type == OutStockType.Sal);
|
||||
else//查其他单据(组织)
|
||||
query = query.Where(w => rec_id == w.order.ReceiptCustomerId && w.order.Type != OutStockType.Sal);
|
||||
}
|
||||
if (mIds.Count() != 0)
|
||||
query = query.Where(w => mIds.Contains(w.detail.MaterialId));
|
||||
if (ids.Count() > 0)
|
||||
@@ -139,8 +162,10 @@ namespace WMS.Web.Repositories
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockId),
|
||||
SourceBillNo = s.order.SourceBillNo,
|
||||
SaleBillNo = s.detail.SaleBillNo,
|
||||
DeliveryOrg = "",
|
||||
ReceiptCustomer = "",
|
||||
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
|
||||
ReceiptCustomer = s.order.Type == OutStockType.Sal
|
||||
? _erpBasicDataExtendService.GetCustomerName(customers, s.order.ReceiptCustomerId)
|
||||
: _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
|
||||
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
|
||||
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
|
||||
|
||||
@@ -214,6 +214,7 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto)
|
||||
{
|
||||
#region erp基础资料
|
||||
List<int> mIds = new List<int>();
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
if (!materials_result.IsSuccess)
|
||||
@@ -224,14 +225,38 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
mIds = materials.Where(w => EF.Functions.Like(w.MaterialNumber, "%" + dto.MaterialNumber + "%")).Select(s => s.MaterialId).ToList();
|
||||
}
|
||||
|
||||
//取组织
|
||||
var org_result = await _erpService.BillQueryForOrg();
|
||||
if (!org_result.IsSuccess)
|
||||
return (new List<OutStockTaskQueryInfoResponse>(), 0);
|
||||
var orgs = org_result.Data.ToList();
|
||||
|
||||
//取客户
|
||||
var customer_result = await _erpService.BillQueryForCustomer();
|
||||
if (!customer_result.IsSuccess)
|
||||
return (new List<OutStockTaskQueryInfoResponse>(), 0);
|
||||
var customers = customer_result.Data.ToList();
|
||||
|
||||
#endregion
|
||||
|
||||
var query = _context.OutStockTaskDetails
|
||||
.GroupJoin(_context.OutStockTask, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
.OrderByDescending(o => o.order.Id)
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
//if (!string.IsNullOrEmpty(dto.ReceiptCustomer))
|
||||
if (mIds.Count()!=0)
|
||||
if (!string.IsNullOrEmpty(dto.ReceiptCustomer))
|
||||
{
|
||||
var rec_type = dto.ReceiptCustomer.Substring(0, 1);
|
||||
var rec_id = Convert.ToInt32(dto.ReceiptCustomer.Substring(2, dto.ReceiptCustomer.Length - 1));
|
||||
|
||||
if (rec_type.Equals("c"))//差销售出库单(客户)
|
||||
query = query.Where(w => rec_id == w.order.ReceiptCustomerId && w.order.Type == OutStockType.Sal);
|
||||
else//查其他单据(组织)
|
||||
query = query.Where(w => rec_id == w.order.ReceiptCustomerId && w.order.Type != OutStockType.Sal);
|
||||
}
|
||||
if (mIds.Count() != 0)
|
||||
query = query.Where(w => mIds.Contains(w.detail.MaterialId));
|
||||
if (dto.Ids.Count() > 0)
|
||||
query = query.Where(w => dto.Ids.Contains(w.detail.Id));
|
||||
@@ -255,18 +280,20 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
#region dto组装
|
||||
Id = s.order.Id,
|
||||
DetailId=s.detail.Id,
|
||||
BillNo =s.order.BillNo,
|
||||
DetailId = s.detail.Id,
|
||||
BillNo = s.order.BillNo,
|
||||
Status = s.order.Status.GetRemark(),
|
||||
Type = s.order.Type.GetRemark(),
|
||||
CreateTime = s.order.OperateTime.DateToStringSeconds(),
|
||||
OutStockBeginTime= s.detail.OutStockBeginTime.DateToStringSeconds(),
|
||||
OutStockBeginTime = s.detail.OutStockBeginTime.DateToStringSeconds(),
|
||||
OutStockEndTime = s.detail.OutStockEndTime.DateToStringSeconds(),
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockId),
|
||||
SourceBillNo = s.order.SourceBillNo,
|
||||
SaleBillNo = s.detail.SaleBillNo,
|
||||
DeliveryOrg = "",
|
||||
ReceiptCustomer = "",
|
||||
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
|
||||
ReceiptCustomer = s.order.Type == OutStockType.Sal
|
||||
? _erpBasicDataExtendService.GetCustomerName(customers, s.order.ReceiptCustomerId)
|
||||
: _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
|
||||
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
|
||||
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
|
||||
|
||||
Reference in New Issue
Block a user