oo
This commit is contained in:
@@ -104,11 +104,21 @@ namespace MyCode.Project.Domain.Message.Request.JackYun
|
||||
/// <summary>
|
||||
/// 是否正品
|
||||
/// </summary>
|
||||
public Byte isCertified { get; set; }
|
||||
public int isCertified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条形码
|
||||
/// </summary>
|
||||
public String skuBarcode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public String rowRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 匹配货品信息的外部货品编号
|
||||
/// </summary>
|
||||
public String outSkuCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
using MyCode.Project.Infrastructure.JackYun;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MyCode.Project.Domain.Message.Request.JackYun
|
||||
{
|
||||
public class CreateAndStockoutGetRequestBizData : BaseRequestBizData
|
||||
{
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public String memo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源,默认ERP
|
||||
/// </summary>
|
||||
public String source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 制单人
|
||||
/// </summary>
|
||||
public String @operator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联单据编号
|
||||
/// 可随机,保证不重复即可
|
||||
/// </summary>
|
||||
public String relDataId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 出库类型(204:其他出库;210:残次品出库;206:生产领料;205:采购退货;215:维修还厂;)
|
||||
/// </summary>
|
||||
public int outType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仓库code
|
||||
/// </summary>
|
||||
public String outWarehouseCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请人姓名
|
||||
/// </summary>
|
||||
public String applyUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货品明细
|
||||
/// </summary>
|
||||
public List<stockOutDetailViews> stockOutDetailViews { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 收发货人信息
|
||||
///// </summary>
|
||||
//public StockInExpressInfo stockInExpressInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请人部门
|
||||
/// </summary>
|
||||
public String applyDepartName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请时间
|
||||
/// </summary>
|
||||
public DateTime applyDate { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class stockOutDetailViews
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 价格
|
||||
/// </summary>
|
||||
public decimal skuPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联实际业务明细表的id
|
||||
/// </summary>
|
||||
public long relDetailId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格id
|
||||
/// </summary>
|
||||
public long skuId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public decimal skuCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货品编号
|
||||
/// </summary>
|
||||
public String goodsNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计量单位名称
|
||||
/// </summary>
|
||||
public String unitName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否正品
|
||||
/// </summary>
|
||||
public int isCertified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条形码
|
||||
/// </summary>
|
||||
public String skuBarcode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public String rowRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 匹配货品信息的外部货品编号
|
||||
/// </summary>
|
||||
public String outSkuCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,7 @@
|
||||
<Compile Include="Message\Act\Common\ExcelData.cs" />
|
||||
<Compile Include="Message\Act\Common\RequestModel.cs" />
|
||||
<Compile Include="Message\Request\JackYun\CreateAndStockinGetRequestBizData.cs" />
|
||||
<Compile Include="Message\Request\JackYun\CreateAndStockoutGetRequestBizData.cs" />
|
||||
<Compile Include="Message\Request\JackYun\OrderTradeFullInfoGetRequestBizData.cs" />
|
||||
<Compile Include="Message\Request\KingDee\BillDelete.cs" />
|
||||
<Compile Include="Message\Request\KingDee\BillSave.cs" />
|
||||
|
||||
@@ -8,11 +8,13 @@ using MyCode.Project.Domain;
|
||||
using MyCode.Project.Domain.Model;
|
||||
using MyCode.Project.Infrastructure.Common;
|
||||
using MyCode.Project.Domain.Message;
|
||||
using MyCode.Project.Domain.Message.Response.JackYun;
|
||||
|
||||
namespace MyCode.Project.Domain.Repositories
|
||||
{
|
||||
public interface IWMStoJackyunInventoryMovementView1Repository : IRepository<WMStoJackyunInventoryMovementView1>
|
||||
{
|
||||
|
||||
}
|
||||
List<CreateAndStockinResp> GetInventoryMovement();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,6 +279,16 @@ namespace MyCode.Project.Infrastructure.Enumeration
|
||||
/// </summary>
|
||||
[Enum("添加销售渠道", "erp.salechannel.create")]
|
||||
SALESCHANNELCREATE,
|
||||
/// <summary>
|
||||
/// 创建出库申请单并出库
|
||||
/// </summary>
|
||||
[Enum("创建出库申请单并出库", "erp.stock.createandstockout")]
|
||||
CREATEANDSTOCKOUT,
|
||||
/// <summary>
|
||||
/// 创建入库申请单并入库
|
||||
/// </summary>
|
||||
[Enum("创建入库申请单并入库", "erp.stock.createandstockin")]
|
||||
CREATEANDSTOCKIN,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ namespace MyCode.Project.Repositories
|
||||
public WMStoJackyunInventoryMovementView1Repository(MyCodeSqlSugarClient context) : base(context)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// 查询可执行申请入库/出库数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<CreateAndStockinResp> GetInventoryMovement()
|
||||
{
|
||||
string sql = $@"
|
||||
@@ -32,7 +36,7 @@ namespace MyCode.Project.Repositories
|
||||
,[过账日期] AS [applyDate]
|
||||
,[备注] AS [rowRemark]
|
||||
,[status] AS [status]
|
||||
FROM [YunTong].[dbo].[WMStoJackyun_InventoryMovement_View1]
|
||||
FROM [dbo].[WMStoJackyun_InventoryMovement_View1]
|
||||
WHERE [status] = 0";
|
||||
var list = this.SelectList<CreateAndStockinResp>(sql);
|
||||
return list;
|
||||
|
||||
@@ -29,7 +29,5 @@ namespace MyCode.Project.Services
|
||||
/// <param name="now"></param>
|
||||
/// <returns></returns>
|
||||
void TaskSendInventoryMovement(DateTime now);
|
||||
|
||||
List<CreateAndStockinResp> GetInventoryMovement();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
using MyCode.Project.Domain.Message.Request.JackYun;
|
||||
using MyCode.Project.Domain.Repositories;
|
||||
using MyCode.Project.Infrastructure.Common;
|
||||
using MyCode.Project.Infrastructure.Enumeration;
|
||||
using MyCode.Project.Infrastructure.JackYun;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MyCode.Project.Services.Implementation
|
||||
{
|
||||
public class JackYunStockinService : ServiceBase, IJackYunStockinService
|
||||
{
|
||||
private IWMStoJackyunInventoryMovementView1Repository _wMStoJackyunInventoryMovementView1Repository;
|
||||
|
||||
public JackYunStockinService(IWMStoJackyunInventoryMovementView1Repository wMStoJackyunInventoryMovementView1Repository)
|
||||
{
|
||||
_wMStoJackyunInventoryMovementView1Repository = wMStoJackyunInventoryMovementView1Repository;
|
||||
}
|
||||
|
||||
|
||||
public JackyunResponse Call(string method, string version, BaseRequestBizData bizData)
|
||||
{
|
||||
//接口返回值
|
||||
JackyunResponse response = null;
|
||||
//返回值字符串
|
||||
string strResponse = null;
|
||||
try
|
||||
{
|
||||
//请求吉客云开放接口。
|
||||
strResponse = JackyunOpenHttpUtils.Post(method, version, bizData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response = new JackyunResponse();
|
||||
response.onFail(ex.Message, "CLIENT_EXCEPTION");
|
||||
return response;
|
||||
}
|
||||
|
||||
return JsonHelper.ToObject<JackyunResponse>(strResponse);
|
||||
}
|
||||
|
||||
public void TaskSendInventoryMovement(DateTime now)
|
||||
{
|
||||
var list = _wMStoJackyunInventoryMovementView1Repository.GetInventoryMovement();
|
||||
//过滤入库数据
|
||||
var InStockHead = list.Where(t=>t.type == "+").Select(p => p.relDataId).Distinct().ToList();
|
||||
InStockHead.ForEach(relDataId =>
|
||||
{
|
||||
CreateAndStockinGetRequestBizData requestBizData = new CreateAndStockinGetRequestBizData();
|
||||
List<StockInDetailViews> stockInDetailViews = new List<StockInDetailViews>();
|
||||
|
||||
var InStockEntry = list.Where(t => t.relDataId == relDataId).ToList();
|
||||
|
||||
requestBizData.inType = 204;
|
||||
requestBizData.inWarehouseCode = InStockEntry.First().inWarehouseCode;
|
||||
requestBizData.relDataId = relDataId;
|
||||
requestBizData.applyDate = InStockEntry.First().applyDate;
|
||||
requestBizData.@operator = "WMS";
|
||||
requestBizData.source = "OPEN";
|
||||
InStockEntry.ForEach(row =>
|
||||
{
|
||||
StockInDetailViews StockInDetail = new StockInDetailViews();
|
||||
StockInDetail.relDetailId = (long)Convert.ToDecimal(row.relDetailId);
|
||||
StockInDetail.skuCount = row.skuCount;
|
||||
StockInDetail.isCertified = 1;
|
||||
StockInDetail.rowRemark = row.rowRemark;
|
||||
StockInDetail.outSkuCode = row.outSkuCode;
|
||||
StockInDetail.skuBarcode = row.skuBarcode;
|
||||
stockInDetailViews.Add(StockInDetail);
|
||||
});
|
||||
requestBizData.stockInDetailViews = stockInDetailViews;
|
||||
string lggl = JsonHelper.ToJson(requestBizData);
|
||||
LogHelper.Info(lggl);
|
||||
JackyunResponse response = Call(EnumAttribute.GetAttribute(ApiEnum.CREATEANDSTOCKIN).Value, "1.0", requestBizData);
|
||||
string ll = JsonHelper.ToJson(response);
|
||||
LogHelper.Info(ll);
|
||||
});
|
||||
|
||||
|
||||
//过滤出库数据
|
||||
var OutStockHead = list.Where(t => t.type != "+").Select(p => p.relDataId).Distinct().ToList();
|
||||
OutStockHead.ForEach(relDataId =>
|
||||
{
|
||||
CreateAndStockoutGetRequestBizData requestBizData = new CreateAndStockoutGetRequestBizData();
|
||||
List<stockOutDetailViews> stockOutDetailViews = new List<stockOutDetailViews>();
|
||||
|
||||
var OutStockEntry = list.Where(t => t.relDataId == relDataId).ToList();
|
||||
|
||||
requestBizData.outType = 204;
|
||||
requestBizData.outWarehouseCode = OutStockEntry.First().inWarehouseCode;
|
||||
requestBizData.relDataId = relDataId;
|
||||
requestBizData.applyDate = OutStockEntry.First().applyDate;
|
||||
requestBizData.@operator = "WMS";
|
||||
requestBizData.source = "OPEN";
|
||||
OutStockEntry.ForEach(row =>
|
||||
{
|
||||
stockOutDetailViews stockOutDetail = new stockOutDetailViews();
|
||||
stockOutDetail.relDetailId = (long)Convert.ToDecimal(row.relDetailId);
|
||||
stockOutDetail.skuCount = row.skuCount;
|
||||
stockOutDetail.isCertified = 1;
|
||||
stockOutDetail.rowRemark = row.rowRemark;
|
||||
stockOutDetail.outSkuCode = row.outSkuCode;
|
||||
stockOutDetail.skuBarcode = row.skuBarcode;
|
||||
stockOutDetailViews.Add(stockOutDetail);
|
||||
});
|
||||
requestBizData.stockOutDetailViews = stockOutDetailViews;
|
||||
string lggl = JsonHelper.ToJson(requestBizData);
|
||||
LogHelper.Info(lggl);
|
||||
JackyunResponse response = Call(EnumAttribute.GetAttribute(ApiEnum.CREATEANDSTOCKOUT).Value, "1.0", requestBizData);
|
||||
string ll = JsonHelper.ToJson(response);
|
||||
LogHelper.Info(ll);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,6 +115,7 @@
|
||||
<Compile Include="BLL\WebSocketBLL.cs" />
|
||||
<Compile Include="Implementation\AnsyDataProcessService.cs" />
|
||||
<Compile Include="Implementation\ApiLogService.cs" />
|
||||
<Compile Include="Implementation\JackYunStockinService.cs" />
|
||||
<Compile Include="Implementation\WMSService.cs" />
|
||||
<Compile Include="Implementation\JackYunService.cs" />
|
||||
<Compile Include="Implementation\JackYunTaskService.cs" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using MyCode.Project.Domain.Model;
|
||||
using MyCode.Project.Infrastructure.Common;
|
||||
using MyCode.Project.Services;
|
||||
using MyCode.Project.Services.Implementation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
@@ -15,26 +16,27 @@ namespace MyCode.Project.WebApi.Controllers
|
||||
|
||||
private IJackYunTaskService _jackYunTaskService;
|
||||
private IWMSService _wMSService;
|
||||
private IJackYunStockinService _jackYunStockinService;
|
||||
|
||||
|
||||
public TestController(IJackYunTaskService jackYunTaskService, IWMSService wMSService )
|
||||
public TestController(IJackYunTaskService jackYunTaskService, IWMSService wMSService , IJackYunStockinService jackYunStockinService)
|
||||
{
|
||||
_jackYunTaskService = jackYunTaskService;
|
||||
_wMSService = wMSService;
|
||||
_jackYunStockinService = jackYunStockinService;
|
||||
}
|
||||
|
||||
#region 调度运行抓吉客云销售订单
|
||||
//#region 调度运行抓吉客云销售订单
|
||||
|
||||
/// <summary>
|
||||
/// 调度运行抓吉客云销售订单
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public void TaskGetJackYunOrder(string now)
|
||||
{
|
||||
_jackYunTaskService.TaskGetJackYunOrder(now);
|
||||
}
|
||||
#endregion
|
||||
///// <summary>
|
||||
///// 调度运行抓吉客云销售订单
|
||||
///// </summary>
|
||||
//[HttpGet]
|
||||
//[AllowAnonymous]
|
||||
//public void TaskGetJackYunOrder(string now)
|
||||
//{
|
||||
// _jackYunTaskService.TaskGetJackYunOrder(now);
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
|
||||
#region 抓WMS订单
|
||||
@@ -165,7 +167,18 @@ namespace MyCode.Project.WebApi.Controllers
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 调度运行上传申请出入库申请单
|
||||
|
||||
/// <summary>
|
||||
/// 调度运行上传申请出入库申请单
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public void TaskSendJackYunInOrOutStock()
|
||||
{
|
||||
_jackYunStockinService.TaskSendInventoryMovement(DateTime.Now);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user