优化接口
This commit is contained in:
@@ -25,7 +25,6 @@ namespace WMS.Web.Core.Dto.InStock
|
||||
/// <summary>
|
||||
/// 客户编码
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "客户编码不能为空")]
|
||||
public string CustomerCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -784,6 +784,7 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation($"入库单->开始下推 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 数据: {JsonConvert.SerializeObject(dto)}");
|
||||
//下推动作
|
||||
var res = await sc_erpService.Push(dto);
|
||||
if (!res.IsSuccess)
|
||||
@@ -795,7 +796,8 @@ namespace WMS.Web.Domain.Services
|
||||
var resPurchaseInStock = await sc_erpService.BillQueryForPurchaseInStock(id);
|
||||
var purchaseInStock = resPurchaseInStock.Data;
|
||||
purchaseInStock.Details[0].Qty = erpDetail.Qty;
|
||||
|
||||
string formId = dto.TargetFormId.ToString();
|
||||
//批号生成和同步
|
||||
if (string.IsNullOrEmpty(erpDetail.BatchBillNo))
|
||||
{
|
||||
var current_erp_material = await sc_erpService.BillQueryForMaterialByNumber(erpDetail.MaterialNumber);
|
||||
@@ -803,12 +805,13 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
//1.获取最新的erp明细信息
|
||||
var billNo_new = await sc_inStockRepositories.GetLastBillNo();
|
||||
//erp明细:生成批号
|
||||
//erp明细:最新批号
|
||||
int new_firstBillNo = billNo_new == null ? 0 : (billNo_new.FirstBillNo.HasValue ? billNo_new.FirstBillNo.Value : 0);
|
||||
int new_lastBillNo = billNo_new == null ? 0 : (billNo_new.LastBillNo.HasValue ? billNo_new.LastBillNo.Value : 0);
|
||||
|
||||
//生成批号
|
||||
erpDetail.GenerateBatchBillNo(new_firstBillNo, new_lastBillNo, current_erp_material.IsBatchManage);
|
||||
_logger.LogInformation($"入库单->批号{erpDetail.BatchBillNo}");
|
||||
//赋值批号
|
||||
if (!string.IsNullOrEmpty(erpDetail.BatchBillNo))
|
||||
{
|
||||
purchaseInStock.Details[0].Lot = new ErpLotSaveDto();
|
||||
@@ -822,12 +825,11 @@ namespace WMS.Web.Domain.Services
|
||||
purchaseInStock.Details[0].Lot.Number = erpDetail.BatchBillNo;
|
||||
}
|
||||
|
||||
string formId = dto.TargetFormId.ToString();
|
||||
_logger.LogInformation($"入库单->开始同步金蝶 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 数据: {JsonConvert.SerializeObject(dto)}");
|
||||
_logger.LogInformation($"入库单->下推成功 开始保存 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 数据: {JsonConvert.SerializeObject(purchaseInStock)}");
|
||||
var res_s = await sc_erpService.Save<ErpPurchaseInStockSaveDto>(purchaseInStock, formId);
|
||||
if (!res_s.IsSuccess)
|
||||
{
|
||||
_logger.LogInformation($"入库单->修改数量失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{res_s.Message}");
|
||||
_logger.LogInformation($"入库单->保存失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{res_s.Message}");
|
||||
return (Result.ReFailure(res_s.Message, res_s.Status), SyncStatus.SubmitFail, id);
|
||||
}
|
||||
//提交
|
||||
|
||||
@@ -1566,10 +1566,11 @@ namespace WMS.Web.Domain.Services.Public
|
||||
var param = new ErpSave<T>(formId, dto);
|
||||
query.Data = JsonConvert.SerializeObject(param);
|
||||
|
||||
_logger.LogInformation("同步数据保存:测试" + JsonConvert.SerializeObject(query));
|
||||
//保存
|
||||
var result_json = await _client.SaveAsync(JsonConvert.SerializeObject(query));
|
||||
|
||||
_logger.LogInformation("入库单->开始同步金蝶:保存参数" + JsonConvert.SerializeObject(query)+" 结果->"+ result_json);
|
||||
|
||||
JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json);
|
||||
|
||||
if (jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower() == "true")
|
||||
@@ -1605,6 +1606,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
//提交
|
||||
query.Data = JsonConvert.SerializeObject(dto);
|
||||
var result_json = await _client.SubmitAsync(JsonConvert.SerializeObject(query));
|
||||
_logger.LogInformation("入库单->开始同步金蝶:提交参数" + JsonConvert.SerializeObject(query) + " 结果->" + result_json);
|
||||
JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json);
|
||||
|
||||
if (jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower() == "true")
|
||||
@@ -1636,6 +1638,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
//提交
|
||||
query.Data = JsonConvert.SerializeObject(dto);
|
||||
var result_json = await _client.AuditAsync(JsonConvert.SerializeObject(query));
|
||||
_logger.LogInformation("入库单->开始同步金蝶:审核参数" + JsonConvert.SerializeObject(query) + " 结果->" + result_json);
|
||||
JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json);
|
||||
|
||||
if (jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower() == "true")
|
||||
@@ -1730,7 +1733,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
//下推
|
||||
string json = JsonConvert.SerializeObject(query);
|
||||
var result_json = await _client.PushAsync(json);
|
||||
|
||||
_logger.LogInformation("入库单->开始同步金蝶:提交参数" + json + " 结果->" + result_json);
|
||||
JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json);
|
||||
var isSuccess = jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user