|
|
@ -1096,6 +1096,91 @@ namespace ICSSoft.DataProject |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 获取推荐库位
|
|
|
|
/// <summary>
|
|
|
|
/// 料架验证
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="JsonData"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
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 条码信息
|
|
|
|
/// <summary>
|
|
|
|
/// 条码信息
|
|
|
@ -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; |
|
|
|
xxxxxxxxxx