oo
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user