|
@ -3213,14 +3213,21 @@ namespace ICSSoft.DataProject |
|
|
/// <param name="WorkPoint"></param>
|
|
|
/// <param name="WorkPoint"></param>
|
|
|
/// <param name="cmd"></param>
|
|
|
/// <param name="cmd"></param>
|
|
|
/// <param name="language"></param>
|
|
|
/// <param name="language"></param>
|
|
|
public static void ActionSaveAGVTaskCode(string TaskCode, string ContainerCode, string Location,bool IsOverLoad, string User, string WorkPoint, SqlCommand cmd, Dictionary<string, string> language) |
|
|
|
|
|
|
|
|
public static void ActionSaveAGVTaskCode(string TaskCode, string ContainerCode, string Location, bool IsOverLoad, string User, string WorkPoint, SqlCommand cmd, Dictionary<string, string> language) |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
string sql = @"Insert into ICSAGVTaskLog
|
|
|
string sql = @"Insert into ICSAGVTaskLog
|
|
|
(ID,TaskCode,ContainerCode,LocationCode,IsOverLoad,UserCode,MTIME,WorkPoint) |
|
|
(ID,TaskCode,ContainerCode,LocationCode,IsOverLoad,UserCode,MTIME,WorkPoint) |
|
|
select NEWID(),'{0}','{1}','{2}','{3}','{4}',GETDATE(),'{5}'";
|
|
|
select NEWID(),'{0}','{1}','{2}','{3}','{4}',GETDATE(),'{5}'";
|
|
|
sql = string.Format(sql, TaskCode, ContainerCode, Location, IsOverLoad, User, WorkPoint); |
|
|
|
|
|
|
|
|
if (IsOverLoad == true) |
|
|
|
|
|
{ |
|
|
|
|
|
sql = string.Format(sql, TaskCode, ContainerCode, Location, "是", User, WorkPoint); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
sql = string.Format(sql, TaskCode, ContainerCode, Location, "否", User, WorkPoint); |
|
|
|
|
|
} |
|
|
DataTable dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
DataTable dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
if (dt.Rows.Count == 0) |
|
|
if (dt.Rows.Count == 0) |
|
|
{ |
|
|
{ |
|
@ -3245,8 +3252,112 @@ namespace ICSSoft.DataProject |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
#region 根据任务ID查询是否需要超托入库
|
|
|
#region 根据任务ID查询是否需要超托入库
|
|
|
string sql = @""; |
|
|
|
|
|
|
|
|
bool OverLoad = false; |
|
|
|
|
|
string ContainerCode = ""; |
|
|
|
|
|
string InWHCode = ""; |
|
|
|
|
|
string InLocationCode = ""; |
|
|
|
|
|
string sql = @"select ContainerCode,LocationCode,IsOverLoad from ICSAGVTaskLog
|
|
|
|
|
|
where TaskCode='{0}'";
|
|
|
|
|
|
sql = string.Format(sql, reqCode); |
|
|
DataTable dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
DataTable dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
|
|
if (dt.Rows.Count == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception("未查询到对应的任务ID:" + reqCode + "!"); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
if (dt.Rows[0]["IsOverLoad"].ToString() == "是") |
|
|
|
|
|
{ |
|
|
|
|
|
OverLoad = true; |
|
|
|
|
|
} |
|
|
|
|
|
ContainerCode = dt.Rows[0]["IsOverLoad"].ToString(); |
|
|
|
|
|
#region 查询料架中条码对应单据的仓库及条码对应物料的区域(绑定时已做卡控,一个料架只能绑定同仓库区域的条码,故只要通过其中一个条码来判断)
|
|
|
|
|
|
sql = @"SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A
|
|
|
|
|
|
INNER JOIN ICSDeliveryNotice B ON B.DNCode=A.TransCode AND B.Sequence=A.TransSequence AND B.WorkPoint=A.WorkPoint |
|
|
|
|
|
INNER JOIN ICSInventoryDetail C ON C.INVCode=B.InvCode AND C.WHCode=B.WHCode AND C.WorkPoint=B.WorkPoint |
|
|
|
|
|
WHERE A.LotNo=(select top 1 LotNo from ICSContainerLot A |
|
|
|
|
|
INNER JOIN ICSContainer B ON B.ID=A.ContainerID |
|
|
|
|
|
WHERE B.ContainerCode='{0}') |
|
|
|
|
|
UNION ALL |
|
|
|
|
|
SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A |
|
|
|
|
|
INNER JOIN ICSMOApplyNegDetail B ON B.ApplyNegCode=A.TransCode AND B.Sequence=A.TransSequence AND B.WorkPoint=A.WorkPoint |
|
|
|
|
|
INNER JOIN ICSInventoryDetail C ON C.INVCode=B.InvCode AND C.WHCode=B.WHCode AND C.WorkPoint=B.WorkPoint |
|
|
|
|
|
WHERE A.LotNo=(select top 1 LotNo from ICSContainerLot A |
|
|
|
|
|
INNER JOIN ICSContainer B ON B.ID=A.ContainerID |
|
|
|
|
|
WHERE B.ContainerCode='{0}')";
|
|
|
|
|
|
sql = string.Format(sql, ContainerCode); |
|
|
|
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
|
|
if (dt.Rows.Count == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception("未查询到料架:" + ContainerCode + ",对应的入库区域和仓库!"); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
InWHCode = dt.Rows[0]["WHCode"].ToString(); |
|
|
|
|
|
InLocationCode = dt.Rows[0]["LocationCode"].ToString(); |
|
|
|
|
|
#region 根据入库仓库和区域获取按库位编码排序后可以入库的下一个库位
|
|
|
|
|
|
if (OverLoad == false) |
|
|
|
|
|
{ |
|
|
|
|
|
#region 正常入库
|
|
|
|
|
|
sql = @"select TOP 1 A.LocationCode from ICSLocation A
|
|
|
|
|
|
LEFT JOIN ICSWareHouseLotInfo B ON B.LocationCode=A.LocationCode AND B.WorkPoint=A.WorkPoint AND B.Quantity>0 |
|
|
|
|
|
where B.LocationCode IS NULL AND A.LocationCode like ('{0}'+'-'+'{1}%') |
|
|
|
|
|
ORDER BY A.LocationCode";
|
|
|
|
|
|
sql = string.Format(sql, InWHCode, InLocationCode); |
|
|
|
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
|
|
if (dt.Rows.Count == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception("仓库:" + InWHCode + ",区域:" + InLocationCode + "无可用库位,无法入库!"); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadForkLift"])) |
|
|
|
|
|
{ |
|
|
|
|
|
string ForkLiftUrl = System.Configuration.ConfigurationManager.AppSettings["ForkLiftUrl"]; |
|
|
|
|
|
string Year = DateTime.Now.Year.ToString(); |
|
|
|
|
|
string Month = DateTime.Now.Month.ToString().PadLeft(2, '0'); |
|
|
|
|
|
string Day = DateTime.Now.Day.ToString().PadLeft(2, '0'); |
|
|
|
|
|
string Pre = "CC" + Year + Month + Day; |
|
|
|
|
|
string serialsql = "EXEC Addins_GetSerialCode '{0}','{1}','{2}','{3}',{4}"; |
|
|
|
|
|
serialsql = string.Format(serialsql, "1701", "ICSForkLiftTaskLog", "TaskCode", Pre, 4); |
|
|
|
|
|
string TaskCode = DBHelper.SQlReturnData(serialsql, cmd).Rows[0][0].ToString(); |
|
|
|
|
|
string SerialNum = DateTime.Now.Hour.ToString().PadLeft(2, '0'); |
|
|
|
|
|
string InspectJosn = "{"; |
|
|
|
|
|
InspectJosn += "\"ID\":\"" + TaskCode + "\",";//任务编号
|
|
|
|
|
|
InspectJosn += "\"PalletID\": \"" + ContainerCode + "\",";//料架号
|
|
|
|
|
|
//InspectJosn += "\"LaneCode\": \"\",";
|
|
|
|
|
|
InspectJosn += "\"TaskType\": \"PTWY\",";//任务类型
|
|
|
|
|
|
InspectJosn += "\"SourceBin\": \""+ currentPositionCode + "\",";//起始点位
|
|
|
|
|
|
InspectJosn += "\"DestBin\": \"" + dt.Rows[0]["LocationCode"].ToString() + "\"";//目标点位
|
|
|
|
|
|
InspectJosn += "}"; |
|
|
|
|
|
RestHelper rest = new RestHelper(ForkLiftUrl, HttpVerb.POST); |
|
|
|
|
|
rest.PostData = InspectJosn; |
|
|
|
|
|
string strResult = rest.MakeRequest(); |
|
|
|
|
|
//string resultstr = HTTPHelper.Post(ERPUrl.AGVBineURL, InspectJosn);
|
|
|
|
|
|
ForkLiftStartTaskResultModel result = JsonConvert.DeserializeObject<ForkLiftStartTaskResultModel>(strResult); |
|
|
|
|
|
if (result.Ret == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
#region 记录叉车的任务编号及相关信息
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
sql = @"update ICSContainer set LocationCode='{2}',EATTRIBUTE1='已搬运' where ContainerCode='{0}' AND WorkPoint='{1}'"; |
|
|
|
|
|
//sql = string.Format(sql, ContainerCode, WorkPoint, LocationCode);
|
|
|
|
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo207"));//料架状态更新失败
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception(result.RetMsg); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|