using HH.Redis.ReisModel;
|
using HH.WMS.BLL;
|
using HH.WMS.BLL.Algorithm;
|
using HH.WMS.BLL.Basic;
|
using HH.WMS.BLL.Common;
|
using HH.WMS.BLL.InStock;
|
using HH.WMS.BLL.OutStock;
|
using HH.WMS.BLL.Pda;
|
using HH.WMS.BLL.SysMgr;
|
using HH.WMS.Common;
|
using HH.WMS.Common.Algorithm;
|
using HH.WMS.Common.External;
|
using HH.WMS.DAL;
|
using HH.WMS.DAL.Basic;
|
using HH.WMS.DAL.InStock;
|
using HH.WMS.DAL.Pda;
|
using HH.WMS.Entitys;
|
using HH.WMS.Entitys.Algorithm;
|
using HH.WMS.Entitys.Ams;
|
using HH.WMS.Entitys.Basic;
|
using HH.WMS.Entitys.Common;
|
using HH.WMS.Entitys.Entitys;
|
using HH.WMS.Entitys.Func;
|
using HH.WMS.WebApi.Areas.Common.Controllers;
|
using Newtonsoft.Json;
|
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Linq;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
|
namespace HH.WMS.WebApi.Areas.Pda.Controllers
|
{
|
/// <summary>
|
/// 宇寿PDA接口
|
/// </summary>
|
public class NtApiController : BaseController
|
{
|
|
#region 根据卸货区获取车牌号磅单号
|
/// <summary>
|
/// 根据卸货区获取车牌号磅单号
|
/// </summary>
|
/// <param name="areaCode">卸货区编码</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetPoundInfoByArea(string areaCode)
|
{
|
try
|
{
|
return BLLCreator.Create<NtApiBLL>().GetPoundInfoByArea(areaCode);
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetPoundInfoByArea异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
#endregion
|
|
#region 批量下达卸货区到称重点的任务
|
/// <summary>
|
/// 批量下达卸货区到称重点的任务
|
/// </summary>
|
/// <param name="areaCode">卸货区编码</param>
|
/// <returns></returns>
|
[HttpPost]
|
public OperateResult CallAGVCarry(List<TrayOnShelfEntity> lstNeedCarray)
|
{
|
try
|
{
|
return ValidateToken(lstNeedCarray[0].TokenId, t =>
|
{
|
if (t == null)
|
{
|
return OperateResult.Error("登陆人员信息获取失败!");
|
}
|
return BLLCreator.Create<NtApiBLL>().CallAGVCarry(lstNeedCarray, t);
|
});
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CallAGVCarry异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
#endregion
|
|
#region 检查托盘是否可用并返回托盘中物料信息
|
/// <summary>
|
/// 检查托盘是否可用并返回托盘中物料信息
|
/// </summary>
|
/// <param name="areaCode">卸货区编码</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult CheckMpTray(string trayCode, string itemClass)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>().CheckMpTray(trayCode, itemClass);
|
return result;
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckMpTray异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region 检查托盘是否可用并返回托盘中物料信息
|
/// <summary>
|
/// 检查托盘是否可用并返回托盘中物料信息
|
/// </summary>
|
/// <param name="areaCode">卸货区编码</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult CheckMpLocation(string locationCode, string itemClass)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>().CheckMpLocation(locationCode, itemClass);
|
return result;
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckMpLocation异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region 码盘保存
|
|
/// <summary>
|
/// 码盘保存
|
/// </summary>
|
/// <param name="tokenId">token验证值</param>
|
/// <param name="jsonData">数据Json</param>
|
/// <returns></returns>
|
/// <History>[HANHE(XDL)] CREATED BY 2018-11-17</History>
|
[HttpPost]
|
public string SaveSimPalletItemRelation(JObject jsonData)
|
{
|
try
|
{
|
ItemOnTrayEntity entity = JsonConvert.DeserializeObject<ItemOnTrayEntity>(jsonData.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
OperateResult oresult = BLLCreator.Create<NtApiBLL>(t).SaveSimPalletItemRelation(entity, t);
|
if (oresult.Success)
|
{
|
if (!entity.BIND_TRAY_LOCATION)
|
{
|
if (!string.IsNullOrEmpty(entity.CN_S_LOCATION_CODE))
|
{
|
oresult = BLLCreator.Create<NtApiBLL>(t).AddTrayLocationRelation(entity.CN_S_TRAY_CODE, entity.CN_S_LOCATION_CODE, t, entity.PROJECT_CODE);
|
if (!oresult.Success)
|
{
|
oresult.Msg = "码盘成功但绑定货位失败:" + oresult.Msg;
|
}
|
}
|
}
|
}
|
else
|
{
|
oresult.Msg = "码盘失败:" + oresult.Msg;
|
}
|
return JsonConvert.SerializeObject(oresult);
|
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("SaveSimPalletItemRelation异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message.ToString()));
|
}
|
}
|
#endregion
|
|
#region 根据卸货区判断库区中是否有执行中的任务
|
/// <summary>
|
/// 根据卸货区判断库区中是否有执行中的任务
|
/// </summary>
|
/// <param name="areaCode">卸货区编码</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult CheckTaskInArea(string areaCode)
|
{
|
try
|
{
|
return BLLCreator.Create<NtApiBLL>().CheckTaskInArea(areaCode);
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetPoundInfoByArea异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
#endregion
|
|
#region 整托上架自动 检查入库起点是否可用
|
/// <summary>
|
/// 检查入库起点是否可用
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult CheckInStockLocation(string locationCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>().CheckInStockLocation(locationCode);
|
|
return result;
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckInStockLocation异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
/// <summary>
|
/// 检查托盘是否可用
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult CheckInStockTray(string trayCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>().CheckInStockTray(trayCode);
|
|
return result;
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckInStockTray异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
#endregion
|
|
#region PDA接口-获取建议货位
|
/// <summary>
|
/// 整托获取建议货位-空货位
|
/// </summary>
|
/// <param name="areaCode">库区</param>
|
/// <param name="trayCode">托盘编码</param>
|
/// <param name="itemCode">物料编码</param>
|
/// <param name="locationQty">获取货位的数量</param>
|
/// <param name="tokenId">tokenId</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetZtEmptyCommandLocation(string areaCode, string trayCode, string itemCode, int locationQty)
|
{
|
try
|
{
|
//调用入库算法,获取空货位
|
|
|
List<areaPriorClass> lstTmpArea = new List<areaPriorClass>();
|
lstTmpArea.Add(new areaPriorClass { areaCode = areaCode, Prior = 1 });
|
|
InAssignEntity iAe = new InAssignEntity()
|
{
|
lstAreaPrior = lstTmpArea,
|
logicAreaCode = "",
|
objectCode = trayCode,
|
projectCode = "ntsd",
|
lockLocation = false,//是否需要锁定货位
|
needCalLock = false
|
};
|
iAe.lstDevice = null;
|
InAssignResultEntity irEresult = BLLCreator.Create<In_AlgorBLL>().InAssign(iAe);
|
if (!irEresult.Success)
|
{
|
return OperateResult.Error(irEresult.Msg);//货位获取失败!
|
}
|
List<locationEntity> lstLocation = new List<locationEntity>();
|
locationEntity lEntity = new locationEntity();
|
lEntity.locationCode = irEresult.locationCode;
|
lstLocation.Add(lEntity);
|
|
return OperateResult.Succeed("", lstLocation);
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetZtEmptyCommandLocation异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
#endregion
|
|
#region (PDA接口)整托上架自动 带绑定货位
|
/// <summary>
|
/// 整托执行上架 宇寿
|
/// </summary>
|
/// <param name="json">数据Json</param>
|
/// <returns></returns>
|
/// <History>[HANHE(XDL)] CREATED BY 2018-12-12</History>
|
[HttpPost]
|
public OperateResult SimZTShelfAutoWithBind(JObject json)
|
{
|
try
|
{
|
Log.Info("整托上架开始", "");
|
TrayOnShelfEntity entity = JsonConvert.DeserializeObject<TrayOnShelfEntity>(json.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
if (t == null)
|
{
|
return OperateResult.Error("登陆人员信息获取失败!");
|
}
|
OperateResult oresult = new OperateResult();
|
if (!entity.BIND_TRAY_LOCATION)
|
{
|
oresult = BLLCreator.Create<NtApiBLL>(t).AddTrayLocationRelation(entity.CN_S_TRAY_CODE, entity.CN_S_LOCATION_CODE, t, entity.projectCode);
|
if (oresult.Success)
|
{
|
oresult = BLLCreator.Create<NtApiBLL>().SimZTShelfAuto(entity, t);
|
}
|
}
|
else
|
{
|
oresult = BLLCreator.Create<NtApiBLL>().SimZTShelfAuto(entity, t);
|
}
|
|
return oresult;
|
});
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region 叫料
|
/// <summary>
|
/// 检查码盘货位是否可用
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckLocation(string locationCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>().CheckLocation(locationCode);
|
|
return JsonConvert.SerializeObject(result);
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckLocation异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
/// <summary>
|
/// 宇寿叫料
|
/// </summary>
|
/// <param name="locationCode">建议货位码</param>
|
/// <param name="areaCode">目标库区</param>
|
/// <param name="qTrayCode">起始托盘码</param>
|
/// <param name="mTrayCode">目的货位码</param>
|
/// <param name="tokenId">身份验证</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetCallMaterialAction(string locationCode, string areaCode, string qTrayCode, string mTrayCode, string TaskType, string tokenId)
|
{
|
try
|
{
|
return ValidateToken(tokenId, t =>
|
{
|
var logPara = LogType.LogPara("叫料");
|
if (t == null)
|
{
|
return OperateResult.Error("登陆人员信息获取失败!");
|
}
|
else
|
{
|
TrayOnShelfEntity entity = new TrayOnShelfEntity();
|
entity.CN_S_DEVICE_NO = mTrayCode; //目的货位码
|
entity.CN_S_LOCATION_CODE = locationCode; //建议货位码
|
entity.CN_S_END_AREA_CODE = areaCode;//目标库区
|
entity.CN_S_TRAY_CODE = qTrayCode; //起始托盘码
|
entity.CN_S_TASK_TYPE = TaskType; //任务类型
|
var result = BLLCreator.Create<NtApiBLL>().SimZTDownShelfAuto(entity, t);
|
if (result.Success)
|
{
|
//增加库区量表
|
TN_WM_LOCATION_EXTEntity startlocation = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetExtModel(" where CN_S_LOCATION_CODE='" + locationCode + "'");
|
BLLCreator.Create<YuShouApiBLL>().AddAllocQty(qTrayCode, startlocation.CN_S_STOCK_CODE, startlocation.CN_S_AREA_CODE, logPara);
|
}
|
return result;
|
}
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetCallMaterialAction异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
|
#endregion
|
|
#region 宇寿调用算法获取托盘
|
/// <summary>
|
/// 宇寿调用算法获取托盘
|
/// </summary>
|
/// <param name="stockCode">仓库编码</param>
|
/// <param name="areaCode">库区编码</param>
|
/// <param name="itemCode">物料编码</param>
|
/// <param name="traySpec">物料规格</param>
|
/// <param name="locationQty">物料数量</param>
|
/// <param name="tokenId">身份验证</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetLocationCodeAction(string stockCode, string areaCode, string itemCode, string traySpec, decimal locationQty, string tokenId)
|
{
|
try
|
{
|
return ValidateToken(tokenId, t =>
|
{
|
Log.Error("调用算法获取托盘:", "开始!");
|
if (t == null)
|
{
|
return OperateResult.Error("登陆人员信息获取失败!");
|
}
|
else
|
{
|
if (!string.IsNullOrEmpty(itemCode))
|
{
|
//检查物料编码是否正确
|
var item = BLLCreator.Create<TN_WMS_ITEMBLL>().GetItem(itemCode);
|
if (item == null)
|
{
|
return OperateResult.Error("当前物料编码未在AutoBom中找到!");
|
}
|
}
|
List<areaPriorClass> lstArea = new List<areaPriorClass>();
|
areaPriorClass areaClass = new areaPriorClass();
|
areaClass.areaCode = areaCode;
|
areaClass.Prior = 1;
|
lstArea.Add(areaClass);
|
//调用出库算法,获取待出去托盘
|
OutAssignEnitty oAe = new OutAssignEnitty()
|
{
|
projectCode = "ntsd",
|
lstAreaPrior = lstArea,
|
stockCode = stockCode,
|
itemCode = itemCode,
|
traySpec = traySpec,
|
itemQty = locationQty,
|
needCalLock = false,
|
lockLocation = false//是否需要锁定货位
|
};
|
OutAssignResultEntity oaEresult = BLLCreator.Create<Out_AlgorBLL>().OutAssign(oAe);
|
if (!oaEresult.Success)
|
{
|
Log.Error("调用出库算法,获取待出库托盘:", oaEresult.Msg);
|
return OperateResult.Error(oaEresult.Msg);//货位获取失败!
|
}
|
return OperateResult.Succeed("", oaEresult);
|
}
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetLocationCodeAction异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
#endregion
|
|
#region 绑定解绑相关接口
|
/// <summary>
|
/// 获取托盘中的物料信息
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string GetBindTrayDetail(string trayCode, string locationCode, string projectCode)
|
{
|
try
|
{
|
OperateResult result = new OperateResult();
|
string returnJson = string.Empty;
|
DataTable dt = new DataTable();
|
if (!string.IsNullOrEmpty(trayCode))
|
{
|
List<TN_WM_B_TRAY_LOCATIONEntity> lstEntity = DALCreator.Create<TN_WM_B_TRAY_LOCATIONDAL>().GetListByTrayCode(trayCode);
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetail(trayCode);
|
//判断托盘是否绑定了货位
|
if (lstEntity.Count == 0)
|
{
|
returnJson = JsonConvert.SerializeObject(OperateResult.Succeed("", dt));
|
}
|
else
|
{
|
returnJson = JsonConvert.SerializeObject(OperateResult.Succeed(lstEntity[0].CN_S_LOCATION_CODE, dt));
|
}
|
|
}
|
if (!string.IsNullOrEmpty(locationCode))
|
{
|
List<TN_WM_B_TRAY_LOCATIONEntity> lstEntity = DALCreator.Create<TN_WM_B_TRAY_LOCATIONDAL>().GetListByLocationCode(locationCode);
|
if (lstEntity.Count == 0)
|
{
|
returnJson = JsonConvert.SerializeObject(OperateResult.Succeed("", dt));
|
}
|
else
|
{
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetail(lstEntity[0].CN_S_TRAY_CODE);
|
returnJson = JsonConvert.SerializeObject(OperateResult.Succeed(lstEntity[0].CN_S_TRAY_CODE, dt));
|
}
|
}
|
return returnJson;
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetBindTrayDetail异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
|
|
/// <summary>
|
/// 绑定货位等同入库,增加仓库、库区库存
|
/// </summary>
|
/// <param name="trayCode">托盘编码</param>
|
/// <param name="locationCode">货位编码</param>
|
/// <returns></returns>
|
/// <History>[HANHE(XDL)] CREATED BY 2019-04-17</History>
|
[HttpGet]
|
public string AddTrayLocationRelation(string trayCode, string locationCode, string projectCode)
|
{
|
try
|
{
|
return ValidateToken(t =>
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>(t).AddTrayLocationRelation(trayCode, locationCode, t, projectCode);
|
|
return JsonConvert.SerializeObject(result);
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("AddTrayLocationRelation异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message.ToString()));
|
}
|
}
|
|
/// <summary>
|
/// 绑定货位等同出库,减少仓库、库区库存
|
/// </summary>
|
/// <param name="trayCode">托盘编码</param>
|
/// <param name="locationCode">货位编码</param>
|
/// <returns></returns>
|
/// <History>[HANHE(XDL)] CREATED BY 2019-04-17</History>
|
[HttpGet]
|
public string DeleteTrayLocationRelation(string trayCode, string locationCode, string projectCode)
|
{
|
try
|
{
|
return ValidateToken(t =>
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>(t).DeleteTrayLocationRelation(trayCode, locationCode, t, projectCode);
|
|
return JsonConvert.SerializeObject(result);
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("DeleteTrayLocationRelation异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message.ToString()));
|
}
|
}
|
|
#endregion
|
|
#region 并笼相关接口
|
|
/// <summary>
|
/// 获取托盘中的物料信息
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string GetTrayDetail(string trayCode)
|
{
|
try
|
{
|
OperateResult result = new OperateResult();
|
DataTable dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetail(trayCode);
|
//判断托盘是否在容器管理表中维护
|
TN_WM_B_TRAY_INFOEntity trayModel = BLLCreator.Create < TN_WM_B_TRAY_INFOBLL>().GetModel(trayCode);
|
if (trayModel != null)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Succeed(trayModel.CN_S_USE_STATE, dt));
|
}
|
else
|
{
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", dt));
|
}
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetTrayDetail异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
/// <summary>
|
/// 获取并筐区货位物料托盘信息
|
/// </summary>
|
/// <param name="locationCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetMergeTrayInfo(string locationCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>().GetMergeTrayInfo(locationCode);
|
|
return result;
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetMergeTrayInfo异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
/// <summary>
|
/// 获取待并笼托盘信息
|
/// </summary>
|
/// <param name="locationCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetNeedMergeTray(string areaCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>().GetNeedMergeTray(areaCode);
|
|
return result;
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetNeedMergeTray异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
/// <summary>
|
/// 整托下架接口
|
/// </summary>
|
/// <param name="jsonData"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public OperateResult SimZTDownShelfAuto(JObject jsonData)
|
{
|
try
|
{
|
TrayOnShelfEntity entity = JsonConvert.DeserializeObject<TrayOnShelfEntity>(jsonData.ToString());
|
var logPara = LogType.LogPara("下架");
|
return ValidateToken(entity.TokenId, t =>
|
{
|
OperateResult oresult = BLLCreator.Create<NtApiBLL>(t).SimZTDownShelfAuto(entity, t);
|
if (oresult.Success)
|
{
|
//增加库区量表
|
TN_WM_LOCATION_EXTEntity startlocation = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetExtModel(" where CN_S_LOCATION_CODE='" + entity.CN_S_LOCATION_CODE + "'");
|
BLLCreator.Create<YuShouApiBLL>().AddAllocQty(entity.CN_S_TRAY_CODE, startlocation.CN_S_STOCK_CODE, startlocation.CN_S_AREA_CODE, logPara);
|
}
|
return oresult;
|
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("SimZTDownShelfAuto异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
/// <summary>
|
/// 保存并笼数据
|
/// </summary>
|
/// <param name="locationCode"></param>
|
/// <param name="TokenId"></param>
|
/// <returns></returns>
|
|
[HttpGet]
|
public OperateResult SaveMerge(string locationCode, string isCreate, string inAreaCode, string trayUseState, string TokenId)
|
{
|
try
|
{
|
return ValidateToken(TokenId, t =>
|
{
|
OperateResult oresult = BLLCreator.Create<NtApiBLL>().SaveMergeTray(locationCode, isCreate, inAreaCode, trayUseState, t);
|
return oresult;
|
});
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("SaveMerge异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
[HttpPost]
|
public OperateResult SaveMergeNew(JObject jsonData)
|
{
|
try
|
{
|
ItemOnTrayEntity entity = JsonConvert.DeserializeObject<ItemOnTrayEntity>(jsonData.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
OperateResult oresult = BLLCreator.Create<NtApiBLL>().SaveMergeTrayNew(entity, t);
|
return oresult;
|
});
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("SaveMerge异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region 生成流转任务
|
/// <summary>
|
/// 生成流转任务(朝阳)
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
/// <history>[HanHe(XDL)] CREATED 2018/6/30</history>
|
[HttpGet]
|
public string CreateTransTask(string startPosition, string endPosition, string tranType, string taskPriority, string projectCode)
|
{
|
Log.Info("调用CreateTransTask", "请求参数:startPosition" + startPosition.ToString() + "; endPosition" + endPosition.ToString() + "; tranType" + tranType.ToString() + "; taskPriority" + taskPriority.ToString());
|
try
|
{
|
return ValidateToken(t =>
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>(t).CreateTransTask(startPosition, endPosition, tranType, taskPriority, projectCode, t);
|
|
return JsonConvert.SerializeObject(result);
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CreateTransTask异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message.ToString()));
|
}
|
}
|
|
#endregion
|
|
#region 南通看板
|
|
[HttpGet]
|
public string GetAllAgvStatus()
|
{
|
var result = WebApiManager.HttpAms_Get("api/AmsInf/GetAllAgvStatus");
|
return result;
|
}
|
|
[HttpGet]
|
public string GetMongoTaskStatus()
|
{
|
var result = WebApiManager.HttpAms_Get("api/AmsInf/GetMongoTaskStatus");
|
return result;
|
}
|
|
[HttpGet]
|
public OperateResult StockList()
|
{
|
try
|
{
|
if (SysCache.Stock == null || SysCache.Stock.Count == 0)
|
SysCache.Stock = BLLCreator.Create<TN_WMS_STOCKBLL>().GetStockList();
|
return OperateResult.Succeed(null, SysCache.Stock);
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
|
[HttpGet]
|
public OperateResult GetArea(string stockCode, int include)
|
{
|
List<AutoBomStockAreaEntity> areaList = BLLCreator.Create<TN_AB_B_STOCK_AREABLL>().GetArea(include, stockCode);
|
return OperateResult.Succeed("", areaList);
|
}
|
|
|
[HttpGet]
|
public OperateResult GetRowsList(string stockCode, string areaCode)
|
{
|
List<AutoBomStockStructreEntity> structreList = BLLCreator.Create<TN_WMS_STOCKBLL>().GetStructList(stockCode, areaCode);
|
structreList = structreList.OrderBy(e => e.CN_S_ROW).ToList();
|
return OperateResult.Succeed("", structreList);
|
}
|
|
[HttpGet]
|
public string GetTunnelLocations(string stockCode, string areaCode)
|
{
|
try
|
{
|
DataTable dt;
|
if (areaCode.Equals("CPKTE,CPKTD"))
|
{
|
dt = BLLCreator.Create<NtApiBLL>().ViewState(stockCode, areaCode, "");
|
}
|
else
|
{
|
dt = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().ViewState(stockCode, areaCode, "");
|
}
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", dt));
|
}
|
catch (Exception ex)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("查询异常!" + ex.ToString()));
|
}
|
}
|
|
#endregion
|
|
#region 检查并获取托盘信息
|
/// <summary>
|
/// 检查托盘是否可用并返回托盘中物料信息
|
/// </summary>
|
/// <param name="areaCode">卸货区编码</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetTrayInfo(string trayCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<NtApiBLL>().GetTrayInfo(trayCode);
|
return result;
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckMpTray异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
#region 新增或更新托盘信息
|
/// <summary>
|
/// 检查托盘是否可用并返回托盘中物料信息
|
/// </summary>
|
/// <param name="areaCode">卸货区编码</param>
|
/// <returns></returns>
|
[HttpPost]
|
public OperateResult UpdateTrayInfo(JObject jsonData)
|
{
|
try
|
{
|
TN_WM_B_TRAY_INFOEntity entity = JsonConvert.DeserializeObject<TN_WM_B_TRAY_INFOEntity>(jsonData.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
|
OperateResult result = BLLCreator.Create<NtApiBLL>().UpdateTrayInfo(entity, t);
|
return result;
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("UpdateTrayInfo异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
}
|
}
|