using HH.WMS.BLL;
|
using HH.WMS.BLL.CoreServer;
|
using HH.WMS.Common;
|
using HH.WMS.Entitys;
|
using HH.WMS.Entitys.Common;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
|
namespace HH.WMS.InterfaceWebApi.Areas.OpenApi.Controllers
|
{
|
public class OtherSysApiController : ApiController
|
{
|
/// <summary>
|
/// DLL调用,出库确认更新
|
/// </summary>
|
/// <param name="opFromNo">WMS出库单中的来源单号</param>
|
/// <param name="opType">出库类型(其他出库、销售出库)</param>
|
/// <returns></returns>
|
[HttpGet]
|
public string UpdateRdrecordCheckFlag(string opFromNo, string opType)
|
{
|
OperateResult updateState = new OperateResult() { Success = true, Msg = "" };
|
try
|
{
|
Log.Info("开始进入出库确认更新", opFromNo + "||" + opType);
|
string tableName = "";//表名
|
switch (opType)
|
{
|
case "其他出库":
|
tableName = "Rdrecord09$Rdrecords09";
|
break;
|
case "销售出库":
|
tableName = "Rdrecord32$Rdrecords32";
|
break;
|
default:
|
break;
|
}
|
|
Log.Info("确认tableName", tableName);
|
|
string opDatastr = WebApiManager.HttpWMS_Get("Api/Out/GetOutU8Data?opNo=" + opFromNo);
|
|
Log.Info("获取WMS数据", opDatastr);
|
|
OperateResult opData = JsonConvert.DeserializeObject<OperateResult>(opDatastr);
|
|
TN_WM_OUT_MSTEntity outMst = JsonConvert.DeserializeObject<TN_WM_OUT_MSTEntity>(opData.Data.ToString());
|
|
if (string.IsNullOrEmpty(tableName))
|
{
|
updateState.Success = false;
|
updateState.Msg = "更新失败,根据提供的业务类型,未定位到具体表!";
|
return JsonConvert.SerializeObject(updateState);
|
}
|
|
Log.Info("解析WMS数据成功,开始更新中间表", "");
|
SqlExecuteResult result = BLLCreator.Create<OutDataBLL>().UpdateRdrecordCheckFlag(opFromNo, tableName, outMst);
|
if (!result.Success)
|
{
|
updateState.Success = false;
|
updateState.Msg = result.Exception.ToString();
|
Log.Info("出库确认更新", JsonConvert.SerializeObject(updateState));
|
}
|
return JsonConvert.SerializeObject(updateState);
|
}
|
catch (Exception ex)
|
{
|
updateState.Success = false;
|
updateState.Msg = ex.Message.ToString();
|
Log.Info("抛异常", ex.Message.ToString());
|
return JsonConvert.SerializeObject(updateState);
|
}
|
|
}
|
}
|
}
|