diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
index 3d2eb5e..c22905d 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
@@ -1096,6 +1096,91 @@ namespace ICSSoft.DataProject
}
#endregion
+ #region 获取推荐库位
+ ///
+ /// 料架验证
+ ///
+ ///
+ ///
+ public static Result LocationRecommend(ICSLocationRecommend JsonData)
+ {
+ var language = LanguageHelper.GetName("WMSAPIInfo");
+ DataTable table = new DataTable();
+ string msg = "";
+ using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString))
+ {
+ conn.Open();
+ SqlCommand cmd = new SqlCommand();
+ cmd.Connection = conn;
+ try
+ {
+ string ContainerID = "";
+ Result res = new Result();
+ if (String.IsNullOrEmpty(JsonData.WorkPoint))
+ {
+ msg = string.Format(language.GetNameByCode("WMSAPIInfo004"));//"站点不能为空!"
+ }
+ string chksql = "";
+ DataTable chkdt = new DataTable();
+ if (JsonData.NeedMerge==false)
+ {
+ chksql = @" select TOP 1 LocationCode from ICSLocation
+ where ISNULL(EATTRIBUTE2,'')!='' AND ISNULL(EATTRIBUTE1,'')=''
+ AND WorkPoint='{0}'
+ Order by EATTRIBUTE2";
+ chksql = string.Format(chksql, JsonData.WorkPoint);
+ chkdt = DBHelper.SQlReturnData(chksql, cmd);
+ if (chkdt.Rows.Count == 0)
+ {
+ res.Success = false;
+ res.Message = string.Format(language.GetNameByCode("WMSAPIInfo202"));//"库位已被全部占用,暂无可以入库的库位!"
+ }
+ else
+ {
+ res.Success = true;
+ res.Message = chkdt.Rows[0]["LocationCode"].ToString();
+ }
+ }
+ else
+ {
+ chksql = @" select TOP 1 MergeLocationCode AS LocationCode from ICSLocationMerge A
+ INNER JOIN ICSLocation B ON B.LocationCode=A.LocationCode AND B.WorkPoint=A.WorkPoint
+ where ISNULL(B.EATTRIBUTE2,'')!='' AND ISNULL(B.EATTRIBUTE1,'')=''
+ AND ISNULL(A.IsOccupied,'0')='0' AND ISNULL(A.OccupiedPallet,'')=''
+ AND A.WorkPoint='{0}'
+ Order by B.EATTRIBUTE2";
+ chksql = string.Format(chksql, ContainerID, JsonData.WorkPoint);
+ chkdt = DBHelper.SQlReturnData(chksql, cmd);
+ if (chkdt.Rows.Count == 0)
+ {
+ res.Success = false;
+ res.Message = string.Format(language.GetNameByCode("WMSAPIInfo202"));//"库位已被全部占用,暂无可以入库的库位!"
+ }
+ else
+ {
+ res.Success = true;
+ res.Message = chkdt.Rows[0]["LocationCode"].ToString();
+ }
+ }
+ return res;
+ }
+ catch (Exception ex)
+ {
+ log.Error(ex.Message);
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ if (conn.State == ConnectionState.Open)
+ {
+ conn.Close();
+ }
+ conn.Dispose();
+ }
+ }
+ }
+ #endregion
+
#region 条码信息
///
/// 条码信息
@@ -6350,7 +6435,8 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
cmd.Connection = conn;
try
{
- foreach (ICSContainerBind item in JsonData)
+ Result res = new Result();
+ foreach (ICSContainerBind item in JsonData)
{
string TransType = item.TransType;
if (JsonData.Count <= 0)
@@ -6373,18 +6459,30 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo199"));//"操作类型错误!"
}
- if (TransType == TransTypeEnum.ContainerBind.GetDescription())
+ if (item.ContainerType == "窄巷道叉车(木托盘)" && item.LocationCode == "")
+ {
+ msg = string.Format(language.GetNameByCode("WMSAPIInfo203"));//"推荐库位不能为空!"
+ }
+ if (msg != "")
{
- //料架条码绑定
- ICSWareHouseLotInfoService.ContainerBind(item.LotNo, item.ContainerCode, item.ContainerType, item.User, item.WorkPoint, cmd, language);
+ res.Success = false;
+ res.Message = msg;// "接口调用失败!";
+ return res;
}
else
{
- //料架条码解绑
- ICSWareHouseLotInfoService.ContainerUnBind(item.ContainerCode, item.WorkPoint, cmd, language);
+ if (TransType == TransTypeEnum.ContainerBind.GetDescription())
+ {
+ //料架条码绑定
+ ICSWareHouseLotInfoService.ContainerBind(item.LotNo, item.ContainerCode, item.ContainerType, item.User, item.WorkPoint, cmd, language);
+ }
+ else
+ {
+ //料架条码解绑
+ ICSWareHouseLotInfoService.ContainerUnBind(item.ContainerCode, item.WorkPoint, cmd, language);
+ }
}
}
- Result res = new Result();
res.Success = true;
res.Message = msg;// "接口调用成功!";
return res;
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSContainerBind.cs b/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSContainerBind.cs
new file mode 100644
index 0000000..f0aae9e
--- /dev/null
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSContainerBind.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace ICSSoft.Entity
+{
+ public class ICSContainerBind
+ {
+ ///
+ ///容器编码
+ ///
+ public string ContainerCode { get; set; }
+
+ ///
+ /// 条码
+ ///
+ public string LotNo { get; set; }
+ ///
+ /// 操作人
+ ///
+ public string User { get; set; }
+ ///
+ /// 操作时间
+ ///
+ public string MTime { get; set; }
+ ///
+ /// 站点
+ ///
+ public string WorkPoint { get; set; }
+ ///
+ /// 操作类型(绑定/解绑)
+ ///
+ public string TransType { get; set; }
+ ///
+ /// 绑定类型(货柜/窄巷道叉车(料架)/窄巷道叉车(木托盘))
+ ///
+ public string ContainerType { get; set; }
+ ///
+ /// 推荐库位(窄巷道叉车(木托盘))
+ ///
+ public string LocationCode { get; set; }
+ }
+}
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSContainerInfo.cs b/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSContainerInfo.cs
new file mode 100644
index 0000000..2eca33c
--- /dev/null
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSContainerInfo.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace ICSSoft.Entity
+{
+ public class ICSContainerInfo
+ {
+ ///
+ ///容器编码
+ ///
+ public string ContainerCode { get; set; }
+
+ ///
+ /// 站点
+ ///
+ public string WorkPoint { get; set; }
+ ///
+ /// 操作类型
+ ///
+ public string TransType { get; set; }
+ }
+}
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSLocationRecommend.cs b/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSLocationRecommend.cs
new file mode 100644
index 0000000..fadbcd5
--- /dev/null
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSLocationRecommend.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace ICSSoft.Entity
+{
+ public class ICSLocationRecommend
+ {
+ ///
+ /// 是否超托
+ ///
+ public bool NeedMerge { get; set; }
+ ///
+ /// 站点
+ ///
+ public string WorkPoint { get; set; }
+ }
+}
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSSoft.Entity.csproj b/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSSoft.Entity.csproj
index 2bf67cf..3410982 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSSoft.Entity.csproj
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.Entity/ICSSoft.Entity.csproj
@@ -60,6 +60,8 @@
+
+
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
index 5a05d92..d7a1451 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
@@ -296,6 +296,43 @@ namespace ICSSoft.WebAPI.Controllers
return result;
}
///
+ /// 获取推荐库位
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("api/LocationRecommend/Get")]
+ public HttpResponseMessage LocationRecommend([FromBody] object JsonData)
+ {
+ log.Info("获取条码信息传入值" + JsonData);
+ try
+ {
+ if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
+ {
+ ICSLocationRecommend model = new ICSLocationRecommend();
+ model = JsonConvert.DeserializeObject(JsonData.ToString());
+ //var resultStr = ICSSubmitService.BarCodeInformationGet(model);
+ //res.Success = true;
+ //res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
+ //res.Data = resultStr;
+ res = ICSSubmitService.LocationRecommend(model);
+ }
+ }
+ catch (Exception ex)
+ {
+ log.Error("转换失败:" + ex.ToString());
+ res.Success = false;
+ res.Message = ex.Message;
+ }
+ finally
+ {
+ str = JsonConvert.SerializeObject(res);
+ result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
+ }
+ log.Debug("获取条码信息返回值:" + str);
+ return result;
+ }
+ ///
/// 使用中
/// 获取条码信息
///