using HH.Redis.ReisModel;
|
using HH.WMS.BLL;
|
using HH.WMS.BLL.Algorithm;
|
using HH.WMS.BLL.AllQuery;
|
using HH.WMS.BLL.Basic;
|
using HH.WMS.BLL.Check;
|
using HH.WMS.BLL.Common;
|
using HH.WMS.BLL.External;
|
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.Ams;
|
using HH.WMS.Entitys.Basic;
|
using HH.WMS.Entitys.Check;
|
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 YuShouApiController : BaseController
|
{
|
|
/// <summary>
|
/// 根据作业区类型获取库区列表
|
/// </summary>
|
/// <param name="areaClass">作业区类型</param>
|
/// <returns></returns>
|
[HttpGet]
|
public string GetAreaByAreaClass(string areaClass)
|
{
|
try
|
{
|
return ValidateToken(x =>
|
{
|
if (string.IsNullOrEmpty(areaClass))
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("请提供作业区类型!"));
|
}
|
List<AutoBomStockAreaEntity> areaModel = BLLCreator.Create<TN_AB_B_STOCK_AREABLL>().GetAreaByAreaClassYS(areaClass);
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", areaModel));
|
});
|
}
|
catch (Exception ex)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
|
/// <summary>
|
/// 通过多个作业区类型获取库区集合
|
/// </summary>
|
/// <param name="areaClass"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string GetAreaByManyClass(string areasClass)
|
{
|
try
|
{
|
return ValidateToken(x =>
|
{
|
if (string.IsNullOrEmpty(areasClass))
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("请提供作业区类型!"));
|
}
|
List<AutoBomStockAreaEntity> areaModel = BLLCreator.Create<TN_AB_B_STOCK_AREABLL>().GetAreaByManyClassYS(areasClass);
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", areaModel));
|
});
|
}
|
catch (Exception ex)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
|
#region 装箱保存
|
|
/// <summary>
|
/// 装箱保存
|
/// </summary>
|
/// <param name="boxingCode"></param>
|
/// <param name="itemCode"></param>
|
/// <param name="weight"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IHttpActionResult BoxingSave(string boxingCode, string itemCode, string weight, string lotNo, string figureNo)
|
{
|
var logPara = LogType.LogPara("装箱保存");
|
Log.Detail(logPara, "接收参数为:boxingCode:" + boxingCode + ",itemCode" + ", weight:" + weight + ", lotNo: " + lotNo + ", figureNo:" + figureNo);
|
|
//检查物料编码是否正确
|
var item = BLLCreator.Create<TN_WMS_ITEMBLL>().GetItem(itemCode);
|
if (item == null)
|
{
|
return Json(new { Success = false, Message = "当前物料编码未在AutoBom中找到!" });
|
}
|
Log.Detail(logPara, "获取物料实体:" + LogDescribe.Content(item));
|
|
var boxingInfo = BLLCreator.Create<DapperBLL<TN_WM_B_TRAY_INFOEntity>>().GetSingleEntity(new { CN_S_TRAY_TYPE = "料箱", CN_S_TRAY_CODE = boxingCode });
|
if (boxingInfo == null)
|
{
|
return Json(new { Success = false, Message = "当前料箱码不在数据库中!" });
|
}
|
|
try
|
{
|
double itemWeight = Convert.ToDouble(weight) - Convert.ToDouble(boxingInfo.CN_F_GROSSWEIGHT);
|
if (itemWeight <= 0)
|
{
|
return Json(new { Success = false, Message = "当前总重量必须大于料箱自重" + boxingInfo.CN_F_GROSSWEIGHT + "KG!" });
|
}
|
else
|
{
|
weight = itemWeight.ToString();
|
}
|
}
|
catch (Exception ex)
|
{
|
return Json(new { Success = false, Message = "重量数据维护不正确!原因:" + ex.Message });
|
}
|
|
//查询当前是否有该装箱码记录
|
var printBarCode = BLLCreator.Create<MONGO_PRINT_BARCODEBLL>().GetValue(boxingCode);
|
//如果有,更新记录
|
if (printBarCode != null)
|
{
|
var result = BLLCreator.Create<MONGO_PRINT_BARCODEBLL>().UpdateWeight(boxingCode, weight, lotNo, figureNo, item);
|
if (!result)
|
{
|
return Json(new { Success = false, Message = "更新重量失败!" });
|
}
|
}//如果没有 新增
|
else
|
{
|
var printBarCodeDto = new MONGO_PRINT_BARCODE
|
{
|
CN_S_UNIQUE_CODE = boxingCode,
|
CN_S_ARRIVAL_NO = "",
|
CN_N_QGP = 0,
|
CN_T_CREATE = DateTime.Now.AddHours(8),
|
//CN_S_PRODUCTION_BATCH = weight,
|
CN_S_SERIAL_NO = weight,
|
CN_S_ITEM_CODE = item.CN_S_ITEM_CODE,
|
CN_S_ITEM_NAME = item.CN_S_ITEM_NAME,
|
CN_F_PACKING_QTY = 1,
|
CN_S_MODEL = item.CN_S_MODEL,
|
CN_S_FIGURE_NO = figureNo,//item.CN_S_FIGURE_NO,
|
CN_S_MEASURE_UNIT = item.CN_S_MEASURE_UNIT,
|
CN_S_LOT_NO = lotNo,
|
CN_S_IS_USE = "Y"
|
};
|
Log.Detail(logPara, "添加装箱记录实体:" + JsonConvert.SerializeObject(printBarCodeDto));
|
|
var result = BLLCreator.Create<MONGO_PRINT_BARCODEBLL>().AddPrintBarcode(new List<MONGO_PRINT_BARCODE>{
|
printBarCodeDto
|
});
|
|
Log.Detail(logPara, "添加装箱记录结果:" + result);
|
}
|
|
return Json(new { Success = true, Message = "保存成功!" });
|
}
|
|
//检查料箱码是否码盘
|
[HttpGet]
|
public IHttpActionResult CheckBarcodeIsExistBoxing(string uniCode)
|
{
|
//查询当前是否有该装箱码记录
|
var printBarCode = BLLCreator.Create<MONGO_PRINT_BARCODEBLL>().GetValueYS(uniCode, "Y");
|
if (printBarCode == null)
|
{
|
return Json(new { Success = false, Message = "当前唯一码未装箱!" });
|
}
|
else
|
{
|
return Json(new { Success = true, Message = "当前唯一码已经装箱!" });
|
}
|
}
|
//检查料箱码是否码盘
|
[HttpGet]
|
public OperateResult CheckBarcodeIsExistBoxingBack(string uniCode)
|
{
|
//查询当前是否有该装箱码记录
|
try
|
{
|
var printBarCode = BLLCreator.Create<MONGO_PRINT_BARCODEBLL>().GetValue(uniCode);
|
return OperateResult.Succeed("", printBarCode);
|
}
|
catch(Exception ex)
|
{
|
return OperateResult.Error(ex.Message);
|
}
|
|
|
}
|
|
#endregion
|
|
#region 码盘相关接口
|
/// <summary>
|
/// 检查码盘托盘是否可用
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckTrayYS(string trayCode)
|
{
|
|
try
|
{
|
bool result = DALCreator.Create<TN_WM_B_TRAY_LOCATIONDAL>().CheckTrayBindLoc(trayCode);
|
|
//后期需要增加判断托盘是否在任务执行中
|
if (result)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("该托盘已绑定货位"));
|
}
|
else
|
{
|
DataTable dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetailYS(trayCode);
|
if (dt.Rows.Count == 0)
|
{
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayInfoYS(trayCode);
|
}
|
if (dt.Rows.Count == 0)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("该托盘号在系统中不存在"));
|
}
|
else
|
{
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", dt));
|
}
|
}
|
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckTrayYS异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
/// <summary>
|
/// 检查唯一码是否已经码盘
|
/// </summary>
|
/// <param name="uniCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckUniCodeYS(string uniCode)
|
{
|
try
|
{
|
List<TN_WM_B_TRAY_ITEM_DTLEntity> lstDTLEntity = BLLCreator.Create<DapperBLL<TN_WM_B_TRAY_ITEM_DTLEntity>>().GetList(new { CN_S_UNIQUE_CODE = uniCode });
|
if (lstDTLEntity.Any())
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("该料箱码已码盘,请勿重复码盘"));
|
}
|
else
|
{
|
return JsonConvert.SerializeObject(OperateResult.Succeed());
|
}
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckUniCodeYS异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
/// <summary>
|
/// 检查码盘货位是否可用
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckLocationYS(string locationCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().CheckLocationYS(locationCode);
|
|
return JsonConvert.SerializeObject(result);
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckLocationYS异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
/// <summary>
|
/// 检查线边叫料货位是否可用
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckCallLocationYS(string locationCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().CheckCallLocationYS(locationCode);
|
|
return JsonConvert.SerializeObject(result);
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckLocationYS异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
/// <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 SaveUniPalletItemRelationYS(JObject jsonData)
|
{
|
|
try
|
{
|
ItemOnTrayEntity entity = JsonConvert.DeserializeObject<ItemOnTrayEntity>(jsonData.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
Log.Info("SaveUniPalletItemRelationYS-SaveUniPalletItemRelationYS", "开始调用");
|
OperateResult oresult = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>(t).SaveUniPalletItemRelationYS(entity, t);
|
Log.Info("SaveUniPalletItemRelationYS-SaveUniPalletItemRelationYS", "结束调用");
|
if (oresult.Success)
|
{
|
if (entity.BIND_TRAY_LOCATION)
|
{
|
Log.Info("SaveUniPalletItemRelationYS-AddTrayLocationRelationYS", "开始调用");
|
oresult = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>(t).AddTrayLocationRelationYS(entity.CN_S_TRAY_CODE, entity.CN_S_LOCATION_CODE, entity.IN_STOCK_TYPE, t, entity.PROJECT_CODE);
|
Log.Info("SaveUniPalletItemRelationYS-AddTrayLocationRelationYS", "结束调用");
|
if (oresult.Success)
|
{
|
if (entity.CODE_IN_TASK == "Y")
|
{
|
TrayOnShelfEntity trayOnShelf = new TrayOnShelfEntity();
|
trayOnShelf.CN_S_DEVICE_NO = entity.CN_S_LOCATION_CODE;
|
trayOnShelf.CN_S_END_AREA_CODE = entity.CN_S_END_AREA_CODE;
|
trayOnShelf.CN_S_LOCATION_CODE = "";
|
trayOnShelf.CN_S_TASK_TYPE = entity.CN_S_TASK_TYPE;
|
trayOnShelf.CN_S_TRAY_CODE = entity.CN_S_TRAY_CODE;
|
trayOnShelf.projectCode = entity.PROJECT_CODE;
|
trayOnShelf.IN_STOCK_TYPE = entity.IN_STOCK_TYPE;
|
Log.Info("SaveUniPalletItemRelationYS-SimZTShelfAutoYS", "开始调用");
|
oresult = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().SimZTShelfAutoYS(trayOnShelf, t);
|
Log.Info("SaveUniPalletItemRelationYS-SimZTShelfAutoYS", "结束调用");
|
if (!oresult.Success)
|
{
|
oresult.Msg = "码盘成功但入库失败:" + oresult.Msg;
|
}
|
}
|
}
|
else
|
{
|
oresult.Msg = "码盘成功但绑定货位失败:" + oresult.Msg;
|
}
|
}
|
}
|
else
|
{
|
oresult.Msg = "码盘失败:" + oresult.Msg;
|
}
|
return JsonConvert.SerializeObject(oresult);
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("SaveUniPalletItemRelationYS异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message.ToString()));
|
}
|
}
|
/// <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 SaveBackPalletItemRelationYS(JObject jsonData)
|
{
|
try
|
{
|
ItemOnTrayEntity entity = JsonConvert.DeserializeObject<ItemOnTrayEntity>(jsonData.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
OperateResult oresult = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>(t).SaveUniPalletItemRelationYS(entity, t);
|
return JsonConvert.SerializeObject(oresult);
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("SaveUniPalletItemRelationYS异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message.ToString()));
|
}
|
}
|
|
#endregion
|
|
#region (PDA接口)托盘货位绑定
|
/// <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<TN_WM_B_TRAY_LOCATIONBLL>(t).AddTrayLocationRelationYS(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()));
|
}
|
}
|
#endregion
|
|
#region (PDA接口)托盘货位解绑
|
/// <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<TN_WM_B_TRAY_LOCATIONBLL>(t).DeleteTrayLocationRelationYS(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 CheckInStockLocation(string locationCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().CheckInStockLocation(locationCode);
|
|
return JsonConvert.SerializeObject(result);
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckInStockLocation异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
/// <summary>
|
/// 检查托盘是否可用
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckInStockTray(string trayCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().CheckInStockTray(trayCode);
|
|
return JsonConvert.SerializeObject(result);
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckInStockTray异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
#endregion
|
|
#region 根据料箱码获取装箱信息
|
/// <summary>
|
/// 根据料箱码获取装箱信息
|
/// </summary>
|
/// <param name="barCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string AnalysisCodeYS(string barCode)
|
{
|
try
|
{
|
ScanCodeClass ScanCodeClass = BLLCreator.Create<MONGO_KEYTYPE_MAPBLL>().AnalysisCodeYS(barCode, "Y");
|
if (ScanCodeClass == null) return JsonConvert.SerializeObject(OperateResult.Error("找不到该料箱码!请确认是否已装箱称重"));
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", ScanCodeClass));
|
}
|
catch (Exception ex)
|
{
|
Log.Error("AnalysisCodeYS异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error("AnalysisCodeYS方法 Exception!" + ex.ToString()));
|
}
|
|
}
|
/// <summary>
|
/// 根据料箱码获取装箱信息
|
/// </summary>
|
/// <param name="barCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string AnalysisCodeBackYS(string barCode)
|
{
|
try
|
{
|
ScanCodeClass ScanCodeClass = BLLCreator.Create<MONGO_KEYTYPE_MAPBLL>().AnalysisCodeYS(barCode, "N");
|
if (ScanCodeClass == null) return JsonConvert.SerializeObject(OperateResult.Error("已上料数据中不存在该料箱码!请确认是否已上料"));
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", ScanCodeClass));
|
}
|
catch (Exception ex)
|
{
|
Log.Error("AnalysisCodeBackYS异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error("AnalysisCodeBackYS方法 Exception!" + ex.ToString()));
|
}
|
|
}
|
#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));
|
}
|
}
|
#endregion
|
|
#region 查询托盘中物料信息
|
/// <summary>
|
/// 获取托盘中的物料信息
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string QueryTrayDetail(string trayCode, string locationCode, string boxCode)
|
{
|
try
|
{
|
OperateResult result = new OperateResult();
|
string returnJson = string.Empty;
|
DataTable dt = new DataTable();
|
if (!string.IsNullOrEmpty(trayCode))
|
{
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetail(trayCode);
|
returnJson = JsonConvert.SerializeObject(OperateResult.Succeed("", 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.Error("该货位没有绑定托盘!"));
|
}
|
else
|
{
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetail(lstEntity[0].CN_S_TRAY_CODE);
|
returnJson = JsonConvert.SerializeObject(OperateResult.Succeed("", dt));
|
}
|
}
|
if (!string.IsNullOrEmpty(boxCode))
|
{
|
ScanCodeClass ScanCodeClass = BLLCreator.Create<MONGO_KEYTYPE_MAPBLL>().AnalysisCodeYS(boxCode, "Y");
|
if (ScanCodeClass == null)
|
{
|
returnJson = JsonConvert.SerializeObject(OperateResult.Error("找不到该料箱码!请确认是否已装箱称重"));
|
}
|
else
|
{
|
dt.Columns.Add("CN_S_ITEM_NAME", Type.GetType("System.String"));
|
dt.Columns.Add("CN_S_ITEM_CODE", Type.GetType("System.String"));
|
dt.Columns.Add("CN_S_LOT_NO", Type.GetType("System.String"));
|
dt.Columns.Add("CN_S_UNIQUE_CODE", Type.GetType("System.String"));
|
dt.Columns.Add("CN_S_SERIAL_NO", Type.GetType("System.String"));
|
dt.Columns.Add("CN_F_QUANTITY", Type.GetType("System.String"));
|
dt.Columns.Add("CN_S_MODEL", Type.GetType("System.String"));
|
DataRow newRow;
|
newRow = dt.NewRow();
|
newRow["CN_S_ITEM_NAME"] = ScanCodeClass.PrintBarCode.CN_S_ITEM_NAME;
|
newRow["CN_S_ITEM_CODE"] = ScanCodeClass.PrintBarCode.CN_S_ITEM_CODE;
|
newRow["CN_S_LOT_NO"] = ScanCodeClass.PrintBarCode.CN_S_LOT_NO;
|
newRow["CN_S_UNIQUE_CODE"] = boxCode;
|
newRow["CN_S_SERIAL_NO"] = ScanCodeClass.PrintBarCode.CN_S_SERIAL_NO;
|
newRow["CN_F_QUANTITY"] = "1";
|
newRow["CN_S_MODEL"] = ScanCodeClass.PrintBarCode.CN_S_MODEL;
|
dt.Rows.Add(newRow);
|
returnJson = JsonConvert.SerializeObject(OperateResult.Succeed("", dt));
|
}
|
}
|
return returnJson;
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetBindTrayDetail异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
#endregion
|
|
#region 查询库存
|
[HttpGet]
|
public OperateResult GetAreaQty(string itemCode, string lotNo, string areaCode)
|
{
|
try
|
{
|
return BLLCreator.Create<YuShouApiBLL>().GetAreaQty(itemCode, lotNo, areaCode);
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetManualHandDetail异常:====>", 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 lotNo, 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 = "ys001",
|
lstAreaPrior = lstArea,
|
stockCode = stockCode,
|
itemCode = itemCode,
|
lotNo = lotNo,
|
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="areaCode"></param>
|
/// <param name="trayCode"></param>
|
/// <param name="itemCode"></param>
|
/// <param name="locationQty"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetZtEmptyCommandLocation(string areaCode, string trayCode, string itemCode, int locationQty)
|
{
|
try
|
{
|
if (!string.IsNullOrEmpty(itemCode))
|
{
|
//检查物料编码是否正确
|
var item = BLLCreator.Create<TN_WMS_ITEMBLL>().GetItem(itemCode);
|
if (item == null)
|
{
|
return OperateResult.Error("当前物料编码未在AutoBom中找到!");
|
}
|
}
|
//调用入库算法,获取空货位
|
List<areaPriorClass> lstTmpArea = new List<areaPriorClass>();
|
lstTmpArea.Add(new areaPriorClass { areaCode = areaCode, Prior = 1 });
|
|
InAssignEntity iAe = new InAssignEntity()
|
{
|
lstAreaPrior = lstTmpArea,
|
logicAreaCode = "",
|
objectCode = trayCode,
|
projectCode = "ys001",
|
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 宇寿叫料
|
/// <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 outStockType, 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
|
{
|
//TN_WM_LOCATION_EXTEntity startlocation = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetExtModel(" where CN_S_LOCATION_CODE='" + locationCode + "'");
|
|
//if (startlocation.CN_S_LOCATION_STATE == Constants.Location_State_Normal)
|
//{
|
// //锁定起点货位
|
// BLLCreator.Create<DapperBLL<TN_WM_LOCATION_EXTEntity>>().Update(new { CN_S_LOCATION_STATE = "预出库锁定" }, new { CN_S_LOCATION_CODE = locationCode });
|
//}
|
//转运货位-移动起点外层的货位
|
var moveResult = BLLCreator.Create<YuShouApiBLL>().MoveLocation(locationCode, logPara);
|
Log.Detail(logPara, "转运货位结果:" + moveResult.Success + ",信息:" + moveResult.Msg);
|
if (!moveResult.Success)
|
{
|
BLLCreator.Create<YuShouApiBLL>().RollBackLocation(moveResult, locationCode, logPara);
|
return OperateResult.Error(moveResult.Msg);
|
}
|
|
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; //任务类型
|
entity.IN_STOCK_TYPE = outStockType;
|
var result = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().SimZTDownShelfCallMaterialYS(entity, t);
|
if (!result.Success)
|
{
|
BLLCreator.Create<YuShouApiBLL>().RollBackLocation(moveResult, locationCode, logPara);
|
}
|
else
|
{
|
//增加库区量表
|
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);
|
}
|
Log.Detail(logPara, "调用叫料结果:" + JsonConvert.SerializeObject(result));
|
return result;
|
}
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetCallMaterialAction异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
#endregion
|
|
#region 宇寿组盘检查托盘是否可用
|
/// <summary>
|
/// 检查码盘托盘是否可用
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckTrayYSZP(string trayCode)
|
{
|
try
|
{
|
bool result = DALCreator.Create<TN_WM_B_TRAY_LOCATIONDAL>().CheckTrayBindLoc(trayCode);
|
|
//后期需要增加判断托盘是否在任务执行中
|
if (result)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("该托盘已绑定货位,组盘请解绑货位再组盘"));
|
}
|
else
|
{
|
DataTable dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetailYS(trayCode);
|
if (dt.Rows.Count == 0)
|
{
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayInfoYS(trayCode);
|
}
|
if (dt.Rows.Count == 0)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("该托盘号在系统中不存在"));
|
}
|
else
|
{
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", dt));
|
}
|
}
|
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckTrayYS异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
#endregion
|
|
#region 宇寿组盘
|
/// <summary>
|
/// 组盘保存事件
|
/// </summary>
|
/// <param name="jsonData"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public string SaveGroupPlate(JObject jsonData)
|
{
|
try
|
{
|
Log.Info("===>宇寿组盘传进来的参数:", jsonData.ToString());
|
ItemOnTrayEntity entity = JsonConvert.DeserializeObject<ItemOnTrayEntity>(jsonData.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
OperateResult oresult = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>(t).SaveGroupPlateYS(entity, t);
|
return JsonConvert.SerializeObject(oresult);
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("SaveGroupPlate异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message.ToString()));
|
}
|
}
|
#endregion
|
|
#region 宇寿呼叫空托
|
/// <summary>
|
/// 宇寿呼叫空托
|
/// </summary>
|
/// <param name="json">数据Json</param>
|
/// <returns></returns>
|
/// <History>[HANHE(LY)] CREATED BY 2018-12-12</History>
|
[HttpPost]
|
public OperateResult SimZTDownShelfAuto(JObject json)
|
{
|
try
|
{
|
Log.Info("整托上架开始", "");
|
TrayOnShelfEntity entity = JsonConvert.DeserializeObject<TrayOnShelfEntity>(json.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
if (t == null)
|
{
|
return OperateResult.Error("登陆人员信息获取失败!");
|
}
|
|
return BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().SimZTDownShelfAutoYS(entity, t);
|
});
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region 宇寿空托回库
|
/// <summary>
|
///宇寿空托回库
|
/// </summary>
|
/// <param name="json">数据Json</param>
|
/// <returns></returns>
|
/// <History>[HANHE(LY)] CREATED BY 2018-12-12</History>
|
[HttpPost]
|
public OperateResult SimZTShelfAuto(JObject json)
|
{
|
try
|
{
|
Log.Info("空托回库开始", "");
|
TrayOnShelfEntity entity = JsonConvert.DeserializeObject<TrayOnShelfEntity>(json.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
if (t == null)
|
{
|
return OperateResult.Error("登陆人员信息获取失败!");
|
}
|
|
return BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().SimZTShelfAuto(entity, t);
|
});
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region 空托回库检测货位码和托盘码
|
/// <summary>
|
/// 空托回库检测货位码和托盘码
|
/// </summary>
|
/// <param name="locationCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckInStockLocationEmpty(string locationCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().CheckInStockLocationEmpty(locationCode);
|
|
return JsonConvert.SerializeObject(result);
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckInStockLocation异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
#endregion
|
|
#region 空托回库检测托盘码
|
/// <summary>
|
/// 空托回库检测托盘码
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckInTrayCode(string trayCode)
|
{
|
try
|
{
|
OperateResult result = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().CheckInTrayCode(trayCode);
|
|
return JsonConvert.SerializeObject(result);
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckInStockTray异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
#endregion
|
|
#region 获取托盘类型列表
|
/// <summary>
|
/// 获取托盘类型列表
|
/// </summary>
|
/// <param name="loctiontype">托盘类型</param>
|
/// <returns></returns>
|
[HttpGet]
|
public string GetLocationType(string loctiontype)
|
{
|
try
|
{
|
return ValidateToken(x =>
|
{
|
List<AutoBomStockAreaEntity> LoctionList = new List<AutoBomStockAreaEntity>();
|
AutoBomStockAreaEntity LoctionModel = null;
|
LoctionModel = new AutoBomStockAreaEntity();
|
LoctionModel.CN_S_AREA_CODE = "120*100";
|
LoctionList.Add(LoctionModel);
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", LoctionList));
|
});
|
}
|
catch (Exception ex)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
#endregion
|
|
#region 组盘时校验料箱码是否已经码盘
|
/// <summary>
|
/// 组盘时校验料箱码是否已经码盘
|
/// </summary>
|
/// <param name="uniCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string CheckUniCodeYSZp(string uniCode)
|
{
|
try
|
{
|
List<TN_WM_B_TRAY_ITEM_DTLEntity> lstDTLEntity = BLLCreator.Create<DapperBLL<TN_WM_B_TRAY_ITEM_DTLEntity>>().GetList(new { CN_S_UNIQUE_CODE = uniCode });
|
if (lstDTLEntity.Any())
|
{
|
bool result = DALCreator.Create<TN_WM_B_TRAY_LOCATIONDAL>().CheckTrayBindLocGroup(lstDTLEntity[0].CN_PARENT_GUID);
|
if (result)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("该料箱码所在的托盘未解绑货位,请先解绑再组盘!"));
|
}
|
else
|
{
|
return JsonConvert.SerializeObject(OperateResult.Succeed());
|
}
|
|
}
|
else
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("该料箱码未码盘,不在托盘中!"));
|
}
|
}
|
catch (Exception ex)
|
{
|
Log.Error("CheckUniCodeYSZp异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
#endregion
|
|
#region 验证料箱码是否属于当前托盘
|
|
/// <summary>
|
/// 验证料箱码是否属于当前托盘
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <param name="uniqueCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IHttpActionResult CheckUniqueIsCurTray(string trayCode, string uniqueCode)
|
{
|
var result = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().CheckUniqueIsCurTray(trayCode, uniqueCode);
|
return Json(new { Success = true, Result = result });
|
}
|
|
#endregion
|
|
#region 上料确认(整托、部分)
|
/// <summary>
|
/// 上架确认
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <param name="type">上架类型 all 整托 part 部分</param>
|
/// <param name="uniqueCodes"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IHttpActionResult UpMaterialSure(string trayCode, string type, string uniqueCodes)
|
{
|
var logPara = LogType.LogPara("上料确认(" + (type == "all" ? "整托" : "部分") + ")");
|
Log.Detail(logPara, "接收参数:trayCode:" + trayCode + ",type:" + type + ",uniqueCodes:" + uniqueCodes);
|
var result = BLLCreator.Create<YuShouApiBLL>().UpMaterialSure(trayCode, type, uniqueCodes, logPara);
|
return Json(new { Success = result.Success, Message = result.Msg });
|
}
|
|
#endregion
|
|
#region 检查托盘(上料)
|
|
[HttpGet]
|
public IHttpActionResult CheckTrayByUpMaterial(string trayCode)
|
{
|
var logPara = LogType.LogPara("检查托盘(上料)");
|
Log.Detail(logPara, "接收参数托盘号:" + trayCode);
|
var result = BLLCreator.Create<YuShouApiBLL>().CheckTrayByUpMaterial(trayCode);
|
Log.Detail(logPara, LogDescribe.Content(result));
|
return Json(new { Success = result.Success, Message = result.Msg });
|
}
|
|
#endregion
|
|
#region 移库
|
|
/// <summary>
|
/// 移库保存
|
/// </summary>
|
/// <param name="saveMoveStockDto"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IHttpActionResult SaveMoveStock(SaveMoveStockDto saveMoveStockDto)
|
{
|
var logPara = LogType.LogPara("移库保存");
|
try
|
{
|
string tokenId = saveMoveStockDto.tokenId;
|
var user = GetTokenInfo(tokenId).GetData<RedisUserEntity>();
|
//计算起点货位
|
Log.Detail(logPara, "接收参数:" + JsonConvert.SerializeObject(saveMoveStockDto));
|
var result = BLLCreator.Create<YuShouApiBLL>().SaveMoveStock(saveMoveStockDto, logPara, user);
|
Log.Detail(logPara, "返回结果:" + JsonConvert.SerializeObject(result));
|
logPara.logPara.Add();
|
return Json(new { Success = result.Success, Message = result.Msg });
|
}
|
catch (Exception ex)
|
{
|
logPara.logPara.PushAndAdd(ex);
|
return Json(new { Success = false, Message = ex.Message });
|
}
|
}
|
|
/// <summary>
|
/// 实时移库
|
/// </summary>
|
/// <param name="saveMoveStockDto"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IHttpActionResult SaveCurrentMoveStock(SaveMoveStockDto saveMoveStockDto)
|
{
|
var logPara = LogType.LogPara("实时移库保存");
|
try
|
{
|
string tokenId = saveMoveStockDto.tokenId;
|
var user = GetTokenInfo(tokenId).GetData<RedisUserEntity>();
|
//计算起点货位
|
Log.Detail(logPara, "接收参数:" + JsonConvert.SerializeObject(saveMoveStockDto));
|
var result = BLLCreator.Create<YuShouApiBLL>().SaveCurrentMoveStock(saveMoveStockDto, logPara, user);
|
Log.Detail(logPara, "返回结果:" + JsonConvert.SerializeObject(result));
|
logPara.logPara.Add();
|
return Json(new { Success = result.Success, Message = result.Msg });
|
}
|
catch (Exception ex)
|
{
|
logPara.logPara.PushAndAdd(ex);
|
return Json(new { Success = false, Message = ex.Message });
|
}
|
}
|
|
/// <summary>
|
/// 移库检查最大可移动数
|
/// </summary>
|
/// <param name="startArea"></param>
|
/// <param name="itemCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IHttpActionResult CheckMoveStockAllocQty(string startArea, string itemCode)
|
{
|
var areaQtyList = BLLCreator.Create<DapperBLL<TN_WM_B_AREA_QTYEntity>>().GetList(new { CN_S_ITEM_CODE = itemCode, CN_S_STOCK_AREA = startArea });
|
decimal qty = 0;
|
try
|
{
|
var item = DALCreator.Create<TN_WMS_ITEMDAL>().GetItemEntity(itemCode);
|
if (item.CN_F_NW == 0)
|
{
|
return Json(new { Success = false, Msg ="当前物料没维护毛重"});
|
}
|
foreach (var areaQty in areaQtyList)
|
{
|
if (item.CN_F_NW > 0)
|
qty += (areaQty.CN_F_QUANTITY - areaQty.CN_F_ALLOC_QTY) / item.CN_F_NW;
|
}
|
}
|
catch (Exception ex)
|
{
|
Log.Detail("移库检查最大可移动数", "出错!" + ex.Message);
|
}
|
return Json(new { Success = true, Qty = Decimal.ToInt32(qty) });
|
}
|
|
#endregion
|
|
#region (PDA接口)整托上架自动
|
/// <summary>
|
/// 整托执行上架 宇寿
|
/// </summary>
|
/// <param name="json">数据Json</param>
|
/// <returns></returns>
|
/// <History>[HANHE(XDL)] CREATED BY 2018-12-12</History>
|
[HttpPost]
|
public OperateResult SimZTShelfAutoYS(JObject json)
|
{
|
try
|
{
|
Log.Info("整托上架开始", "");
|
TrayOnShelfEntity entity = JsonConvert.DeserializeObject<TrayOnShelfEntity>(json.ToString());
|
return ValidateToken(entity.TokenId, t =>
|
{
|
if (t == null)
|
{
|
return OperateResult.Error("登陆人员信息获取失败!");
|
}
|
|
return BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().SimZTShelfAutoYS(entity, t);
|
});
|
Log.Info("整托上架结束", "");
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region (PDA接口)整托上架自动
|
/// <summary>
|
/// 整托执行上架 宇寿
|
/// </summary>
|
/// <param name="json">数据Json</param>
|
/// <returns></returns>
|
/// <History>[HANHE(XDL)] CREATED BY 2018-12-12</History>
|
[HttpPost]
|
public OperateResult SimZTShelfAutoYSWithBind(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<TN_WM_B_TRAY_LOCATIONBLL>(t).AddTrayLocationRelationYS(entity.CN_S_TRAY_CODE, entity.CN_S_DEVICE_NO, entity.IN_STOCK_TYPE, t, entity.projectCode);
|
if (oresult.Success)
|
{
|
oresult = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().SimZTShelfAutoYS(entity, t);
|
}
|
}
|
else
|
{
|
oresult = BLLCreator.Create<TN_WM_B_TRAY_LOCATIONBLL>().SimZTShelfAutoYS(entity, t);
|
}
|
return oresult;
|
});
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region 打印
|
|
[HttpPost]
|
public OperateResult GetPrintData(SearchModel searchModel)
|
{
|
try
|
{
|
OperateResult result;
|
result = BLLCreator.Create<InventoryBll>().GetHistory(searchModel);
|
return result;
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
|
[HttpPost]
|
public IHttpActionResult SetPrintNo(dynamic data)
|
{
|
var result = BLLCreator.Create<InventoryBll>().SetPrintNo(data);
|
return Json(result);
|
}
|
|
[HttpGet]
|
public IHttpActionResult CancelPrintNo(string orderNo, string orderType)
|
{
|
var result = BLLCreator.Create<InventoryBll>().CancelPrintNo(orderNo, orderType);
|
return Json(result);
|
}
|
|
[HttpGet]
|
public string GetDictionary(string dictName)
|
{
|
string dictionary = WebApiManager.HttpAutoBom_Get("api/Dictionary/GetChildByName?DictName=" + dictName);
|
return dictionary;
|
}
|
|
[HttpGet]
|
public string GetBillNo(string ruleName)
|
{
|
var postData = "{\"appCode\":\"AutoWMS\",\"ruleName\":\"" + ruleName + "\",\"orgId\":\"0\",\"orgFlag\":\"\"}";
|
string orderNo = WebApiManager.HttpAutoBom_Post("api/BillRule/GenBillNo", postData);
|
return orderNo;
|
}
|
|
[HttpGet]
|
public decimal GetItemWeight(string itemCode)
|
{
|
var item = DALCreator.Create<TN_WMS_ITEMDAL>().GetItemEntity(itemCode);
|
if (item == null)
|
return 0;
|
return item.CN_F_NW;
|
}
|
|
[HttpPost]
|
public OperateResult GetTrayList(SearchModel searchModel)
|
{
|
string trayCode = Util.ToString(searchModel.SearchCondition.CN_S_TRAY_CODE);
|
string trayType = Util.ToString(searchModel.SearchCondition.CN_S_TRAY_TYPE);
|
string spec = Util.ToString(searchModel.SearchCondition.CN_S_SPEC);
|
return BLLCreator.Create<TN_WM_B_TRAY_INFOBLL>().GetForPrint(trayCode, trayType, spec, searchModel.PageIndex, searchModel.PageSize);
|
}
|
|
[HttpGet]
|
public OperateResult GetLocationList(int pageIndex, int pageSize, string areaCode, string tokenId, string roadWay, string row, string locationNo)
|
{
|
int total = 0;
|
var listLocation = BLLCreator.Create<TN_WMS_STOCKBLL>().GetLocationInfo(pageIndex, pageSize, areaCode, roadWay, row, locationNo, "新建", out total).Select(b => new
|
{
|
CN_S_LOCATION_CODE = b.CN_S_LOCATION_CODE,
|
CN_S_AREA_CODE = b.CN_S_AREA_CODE,
|
CN_S_ROADWAY = b.CN_S_ROADWAY,
|
CN_S_ROW = b.CN_S_ROW,
|
CN_S_COL = b.CN_S_COL,
|
CN_S_FLOOR = b.CN_S_FLOOR
|
});
|
return OperateResult.Succeed("", new { rows = listLocation, total = total });
|
}
|
|
[HttpGet]
|
public OperateResult GetBoxingList(int pageIndex, int pageSize)
|
{
|
int total = 0;
|
var data = BLLCreator.Create<MONGO_PRINT_BARCODEBLL>().GetPageList(pageIndex, pageSize, out total);
|
return OperateResult.Succeed("", new { rows = data, total = total });
|
}
|
|
#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 OperateResult SaveCheckResultYS(JObject jsonData)
|
{
|
Log.Info("开始调用SaveCheckResultYS", JsonConvert.SerializeObject(jsonData));
|
TN_WM_CHECK_MAINEntity entity = JsonConvert.DeserializeObject<TN_WM_CHECK_MAINEntity>(jsonData.ToString());
|
try
|
{
|
return ValidateToken(entity.TokenId, t =>
|
{
|
OperateResult result = BLLCreator.Create<TN_WM_CHECK_LISTBLL>(t).SaveCheckPDA(entity, t);
|
return result;
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("SaveCheckResultYS异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
[HttpGet]
|
public OperateResult LockLocation(string locationCode, string tokenId)
|
{
|
|
OperateResult operateResult = new OperateResult();
|
|
|
try
|
{
|
List<TN_WM_LOCATION_EXTEntity> GetModel = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetModel("where CN_S_LOCATION_CODE='" + locationCode + "'");
|
if (GetModel.Count == 0)
|
{
|
return OperateResult.Error("在表TN_WM_LOCATION_EXT中未查询到该货位!");
|
}
|
List<TN_WM_TASKEntity> lstTask = DALCreator.Create<HH.WMS.DAL.SysMgr.TN_WM_TASKDAL>().GetTaskByAreaCode(GetModel[0].CN_S_AREA_CODE.Trim());
|
List<string> lstInTaskLocation = new List<string>();
|
if (lstTask.Count > 0)
|
{
|
lstInTaskLocation.AddRange(lstTask.Where(a => a.CN_S_TASK_TYPE == "叫料").Select(o => o.CN_S_START_BIT).ToList());
|
lstInTaskLocation.AddRange(lstTask.Where(a => a.CN_S_TASK_TYPE == "上架").Select(o => o.CN_S_END_BIT).ToList());
|
List<TN_WM_LOCATIONCODE_EXT_Entity> lstTrueLocations = DALCreator.Create<TN_WM_LOCATION_EXTDAL>().GetLocationCodeListByLocationCode(lstInTaskLocation);
|
foreach (TN_WM_LOCATIONCODE_EXT_Entity entity in lstTrueLocations)
|
{
|
if (entity.CN_S_ROW == GetModel[0].CN_S_ROW && entity.CN_S_ROW == GetModel[0].CN_S_ROW)
|
{
|
return OperateResult.Error("该货位所在列有正在执行的出入库任务,不允许盘点锁定!");
|
}
|
}
|
|
}
|
|
return ValidateToken(tokenId, t =>
|
{
|
operateResult = BLLCreator.Create<TN_WM_CHECK_LISTBLL>(t).LockLocation(locationCode, t);
|
return operateResult;
|
});
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("LockLocation异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
[HttpGet]
|
public OperateResult UnLockLocation(string locationCode, string tokenId)
|
{
|
|
OperateResult operateResult = new OperateResult();
|
try
|
{
|
return ValidateToken(tokenId, t =>
|
{
|
operateResult = BLLCreator.Create<TN_WM_CHECK_LISTBLL>(t).UnLockLocation(locationCode, t);
|
return operateResult;
|
});
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("LockLocation异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region 盘点-获取托盘中物料信息
|
/// <summary>
|
/// 获取托盘中的物料信息
|
/// </summary>
|
/// <param name="trayCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetCheckTrayDetail(string trayCode, string locationCode)
|
{
|
try
|
{
|
OperateResult result = new OperateResult();
|
DataTable dt = new DataTable();
|
if (!string.IsNullOrEmpty(trayCode))
|
{
|
List<TN_WM_B_TRAY_LOCATIONEntity> lstEntity = DALCreator.Create<TN_WM_B_TRAY_LOCATIONDAL>().GetListByTrayCode(trayCode);
|
|
if (lstEntity.Count == 0)
|
{
|
return OperateResult.Error("该托盘没有绑定货位,不允许盘点!");
|
}
|
else
|
{
|
List<TN_WM_LOCATION_EXTEntity> GetModel = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetModel("where CN_S_LOCATION_CODE='" + lstEntity[0].CN_S_LOCATION_CODE + "'");
|
if (GetModel.Count == 0)
|
{
|
return OperateResult.Error("在表TN_WM_LOCATION_EXT中未查询到该货位!");
|
}
|
AutoBomStockAreaEntity areaModel = DALCreator.Create<TN_AB_STOCK_LOCATIONDAL>().GetAreaModelByLocation(lstEntity[0].CN_S_LOCATION_CODE);
|
if (areaModel == null)
|
{
|
//非法的目的货位
|
return OperateResult.Error(string.Format("在mongo(TN_AB_B_STOCK_AREA或TN_AB_STOCK_LOCATION表)中未查询到该货位信息!", lstEntity[0].CN_S_LOCATION_CODE));
|
}
|
//货位状态:正常
|
if (GetModel[0].CN_S_LOCATION_STATE != Constants.Location_State_Normal)
|
{
|
return OperateResult.Error(string.Format("当前货位状态为{0},不允许盘点或先解锁后再盘点!", GetModel[0].CN_S_LOCATION_STATE));
|
}
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetailCheck(trayCode);
|
DataTable dt1 = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayInfoYS(trayCode);
|
if (dt1.Rows.Count == 0)
|
{
|
return OperateResult.Error("该托盘号在系统中不存在");
|
}
|
result = OperateResult.Succeed(lstEntity[0].CN_S_LOCATION_CODE + ";" + areaModel.CN_S_AREA_CLASS + ";" + dt1.Rows[0][0].ToString(), 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)
|
{
|
return OperateResult.Error("该货位没有绑定托盘,不允许盘点!");
|
}
|
else
|
{
|
List<TN_WM_LOCATION_EXTEntity> GetModel = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetModel("where CN_S_LOCATION_CODE='" + locationCode + "'");
|
if (GetModel.Count == 0)
|
{
|
return OperateResult.Error("在表TN_WM_LOCATION_EXT中未查询到该货位!");
|
}
|
AutoBomStockAreaEntity areaModel = DALCreator.Create<TN_AB_STOCK_LOCATIONDAL>().GetAreaModelByLocation(locationCode);
|
if (areaModel == null)
|
{
|
//非法的目的货位
|
return OperateResult.Error(string.Format("在mongo(TN_AB_B_STOCK_AREA或TN_AB_STOCK_LOCATION表)中未查询到该货位信息!", locationCode));
|
}
|
//货位状态:正常
|
if (GetModel[0].CN_S_LOCATION_STATE != Constants.Location_State_Normal)
|
{
|
return OperateResult.Error(string.Format("当前货位状态为{0},不允许盘点或先解锁后再盘点!", GetModel[0].CN_S_LOCATION_STATE));
|
}
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetailCheck(lstEntity[0].CN_S_TRAY_CODE);
|
DataTable dt1 = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayInfoYS(lstEntity[0].CN_S_TRAY_CODE);
|
if (dt1.Rows.Count == 0)
|
{
|
return OperateResult.Error("该托盘号在系统中不存在");
|
}
|
return OperateResult.Succeed(lstEntity[0].CN_S_TRAY_CODE + ";" + areaModel.CN_S_AREA_CLASS + ";" + dt1.Rows[0][0].ToString(), dt);
|
}
|
}
|
return result;
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetCheckTrayDetail异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
#endregion
|
|
#region 人工搬运
|
[HttpGet]
|
public OperateResult GetManualHandDetail(string itemCode, string lotNo, string areaCode)
|
{
|
try
|
{
|
OperateResult result = new OperateResult();
|
DataTable dt = DALCreator.Create<YsApiDAL>().GetManualHandDetail(itemCode, lotNo, areaCode);
|
return OperateResult.Succeed("", dt);
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetManualHandDetail异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
public OperateResult GetManualTrayDetail(string trayCode, string locationCode,string itemCode,string lotNo)
|
{
|
try
|
{
|
OperateResult result = new OperateResult();
|
DataTable dt = new DataTable();
|
if (!string.IsNullOrEmpty(trayCode))
|
{
|
List<TN_WM_B_TRAY_LOCATIONEntity> lstEntity = DALCreator.Create<TN_WM_B_TRAY_LOCATIONDAL>().GetListByTrayCode(trayCode);
|
|
if (lstEntity.Count == 0)
|
{
|
return OperateResult.Error("该托盘没有绑定货位,不允许搬运!");
|
}
|
else
|
{
|
List<TN_WM_LOCATION_EXTEntity> GetModel = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetModel("where CN_S_LOCATION_CODE='" + lstEntity[0].CN_S_LOCATION_CODE + "'");
|
if (GetModel.Count == 0)
|
{
|
return OperateResult.Error("在表TN_WM_LOCATION_EXT中未查询到该货位!");
|
}
|
AutoBomStockAreaEntity areaModel = DALCreator.Create<TN_AB_STOCK_LOCATIONDAL>().GetAreaModelByLocation(lstEntity[0].CN_S_LOCATION_CODE);
|
if (areaModel == null)
|
{
|
//非法的目的货位
|
return OperateResult.Error(string.Format("在mongo(TN_AB_B_STOCK_AREA或TN_AB_STOCK_LOCATION表)中未查询到该货位信息!", lstEntity[0].CN_S_LOCATION_CODE));
|
}
|
//货位状态:正常
|
if (GetModel[0].CN_S_LOCATION_STATE != Constants.Location_State_Normal)
|
{
|
return OperateResult.Error(string.Format("当前货位状态为{0},不允许搬运!", GetModel[0].CN_S_LOCATION_STATE));
|
}
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetailManual(trayCode,itemCode,lotNo);
|
|
result = 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)
|
{
|
return OperateResult.Error("该货位没有绑定托盘,不允许搬运!");
|
}
|
else
|
{
|
List<TN_WM_LOCATION_EXTEntity> GetModel = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetModel("where CN_S_LOCATION_CODE='" + locationCode + "'");
|
if (GetModel.Count == 0)
|
{
|
return OperateResult.Error("在表TN_WM_LOCATION_EXT中未查询到该货位!");
|
}
|
AutoBomStockAreaEntity areaModel = DALCreator.Create<TN_AB_STOCK_LOCATIONDAL>().GetAreaModelByLocation(locationCode);
|
if (areaModel == null)
|
{
|
//非法的目的货位
|
return OperateResult.Error(string.Format("在mongo(TN_AB_B_STOCK_AREA或TN_AB_STOCK_LOCATION表)中未查询到该货位信息!", locationCode));
|
}
|
//货位状态:正常
|
if (GetModel[0].CN_S_LOCATION_STATE != Constants.Location_State_Normal)
|
{
|
return OperateResult.Error(string.Format("当前货位状态为{0},不允许搬运!", GetModel[0].CN_S_LOCATION_STATE));
|
}
|
dt = BLLCreator.Create<TN_WM_B_TRAY_ITEM_RELBLL>().GetTrayDetailManual(lstEntity[0].CN_S_TRAY_CODE,itemCode,lotNo);
|
|
return OperateResult.Succeed(lstEntity[0].CN_S_TRAY_CODE, dt);
|
}
|
}
|
return result;
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetManualTrayDetail异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
[HttpGet]
|
public OperateResult LockLocationManual(string locationCode, string tokenId)
|
{
|
|
OperateResult operateResult = new OperateResult();
|
try
|
{
|
List<TN_WM_LOCATION_EXTEntity> GetModel = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetModel("where CN_S_LOCATION_CODE='" + locationCode + "'");
|
if (GetModel.Count == 0)
|
{
|
return OperateResult.Error("在表TN_WM_LOCATION_EXT中未查询到该货位!");
|
}
|
List<TN_WM_TASKEntity> lstTask = DALCreator.Create<HH.WMS.DAL.SysMgr.TN_WM_TASKDAL>().GetTaskByAreaCode(GetModel[0].CN_S_AREA_CODE.Trim());
|
List<string> lstInTaskLocation = new List<string>();
|
if (lstTask.Count > 0)
|
{
|
lstInTaskLocation.AddRange(lstTask.Where(a => a.CN_S_TASK_TYPE == "叫料").Select(o => o.CN_S_START_BIT).ToList());
|
lstInTaskLocation.AddRange(lstTask.Where(a => a.CN_S_TASK_TYPE == "上架").Select(o => o.CN_S_END_BIT).ToList());
|
List<TN_WM_LOCATIONCODE_EXT_Entity> lstTrueLocations = DALCreator.Create<TN_WM_LOCATION_EXTDAL>().GetLocationCodeListByLocationCode(lstInTaskLocation);
|
foreach (TN_WM_LOCATIONCODE_EXT_Entity entity in lstTrueLocations)
|
{
|
if (entity.CN_S_ROW == GetModel[0].CN_S_ROW && entity.CN_S_ROW == GetModel[0].CN_S_ROW)
|
{
|
return OperateResult.Error("该货位所在列有正在执行的出入库任务,不允许人工搬运锁定!");
|
}
|
}
|
|
}
|
|
|
return ValidateToken(tokenId, t =>
|
{
|
operateResult = BLLCreator.Create<TN_WM_CHECK_LISTBLL>(t).LockLocationManual(locationCode, t);
|
return operateResult;
|
});
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("LockLocation异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
[HttpGet]
|
public OperateResult UnLockLocationManual(string locationCode, string tokenId)
|
{
|
|
OperateResult operateResult = new OperateResult();
|
try
|
{
|
return ValidateToken(tokenId, t =>
|
{
|
operateResult = BLLCreator.Create<TN_WM_CHECK_LISTBLL>(t).UnLockLocationManual(locationCode, t);
|
return operateResult;
|
});
|
|
}
|
catch (Exception ex)
|
{
|
Log.Error("LockLocation异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
[HttpPost]
|
public OperateResult SaveManualCarryYS(JObject jsonData)
|
{
|
|
TN_WM_CHECK_MAINEntity entity = JsonConvert.DeserializeObject<TN_WM_CHECK_MAINEntity>(jsonData.ToString());
|
try
|
{
|
return ValidateToken(entity.TokenId, t =>
|
{
|
OperateResult result = BLLCreator.Create<YuShouApiBLL>(t).SaveCarryPDA(entity, t);
|
return result;
|
});
|
}
|
catch (Exception ex)
|
{
|
Log.Error("SaveCheckResultYS异常:====>", ex.Message + ex.StackTrace);
|
return OperateResult.Error(ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
#region 获取物料信息
|
/// <summary>
|
/// 获取扫描物料实体信息
|
/// </summary>
|
/// <param name="itemCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public string GetItemDetail(string itemCode, string areaCode)
|
{
|
try
|
{
|
AutoBomItemEntityYS entity = BLLCreator.Create<TN_WMS_ITEMBLL>().GetItemYS(itemCode);
|
if (entity == null)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("未找到该物料信息"));
|
}
|
else
|
{
|
//查询库区中该物料对应的指令批次,并按照从小到大排序
|
List<string> lstLotNo = DALCreator.Create<YsApiDAL>().GetLotList(itemCode, areaCode);
|
entity.lstLotNo = lstLotNo;
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", entity));
|
}
|
}
|
catch (Exception ex)
|
{
|
Log.Error("GetItemDetail异常:====>", ex.Message + ex.StackTrace);
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
|
[HttpGet]
|
public IHttpActionResult GetItem(string itemCode)
|
{
|
itemCode = itemCode.Replace("\r", "").Replace("\n", "");
|
var item = BLLCreator.Create<TN_WMS_ITEMBLL>().GetItem(itemCode);
|
if (item == null) return Json(new { Success = false });
|
return Json(new { Success = true, Data = item });
|
}
|
|
#endregion
|
}
|
}
|