|
@ -3192,6 +3192,32 @@ namespace ICSSoft.DataProject |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
|
|
|
#region 验证料架是否已经占用库位
|
|
|
|
|
|
string chksql = @"select LocationCode from ICSLocation
|
|
|
|
|
|
where Isoccupy='{0}' and WorkPoint='{1}'";
|
|
|
|
|
|
chksql = string.Format(chksql, ContainerCode, WorkPoint); |
|
|
|
|
|
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
|
|
if (chkdt.Rows.Count != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
chksql = @"select ID from ICSAGVTaskLog
|
|
|
|
|
|
where ContainerCode='{0}' and ISNULL(EATTRIBUTE2,'')='' AND WorkPoint='{1}'";
|
|
|
|
|
|
chksql = string.Format(chksql, ContainerCode, WorkPoint); |
|
|
|
|
|
chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
|
|
{ |
|
|
|
|
|
if (chkdt.Rows.Count != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception("货架:" + ContainerCode + ",已经绑定AGV搬运任务,请等待任务完成后再下发任务!"); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
string updatesql = @"Update ICSLocation set Isoccupy=''
|
|
|
|
|
|
where Isoccupy='{0}' AND WorkPoint='{1}'";
|
|
|
|
|
|
updatesql = string.Format(updatesql, ContainerCode, WorkPoint); |
|
|
|
|
|
DBHelper.ExecuteNonQuery(updatesql, cmd); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
string sql = @" select TOP 1 B.LotNo from ICSContainer A
|
|
|
string sql = @" select TOP 1 B.LotNo from ICSContainer A
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ID AND B.WorkPoint=A.WorkPoint |
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ID AND B.WorkPoint=A.WorkPoint |
|
|
Where A.ContainerCode='{0}' AND A.WorkPoint='{1}' |
|
|
Where A.ContainerCode='{0}' AND A.WorkPoint='{1}' |
|
@ -3240,6 +3266,7 @@ namespace ICSSoft.DataProject |
|
|
LEFT JOIN ICSWareHouseLotInfo B ON B.LocationCode=A.LocationCode AND B.WorkPoint=A.WorkPoint AND ISNULL(B.Quantity,0)>0 |
|
|
LEFT JOIN ICSWareHouseLotInfo B ON B.LocationCode=A.LocationCode AND B.WorkPoint=A.WorkPoint AND ISNULL(B.Quantity,0)>0 |
|
|
where B.LocationCode IS NULL AND A.LocationCode like ('{0}'+'-'+'{1}%') AND ISNULL(A.EATTRIBUTE1,'')='' |
|
|
where B.LocationCode IS NULL AND A.LocationCode like ('{0}'+'-'+'{1}%') AND ISNULL(A.EATTRIBUTE1,'')='' |
|
|
AND A.LocationCode NOT IN ({2}) AND ISNULL(A.Isoccupy,'')='' |
|
|
AND A.LocationCode NOT IN ({2}) AND ISNULL(A.Isoccupy,'')='' |
|
|
|
|
|
AND ISNULL(A.StockInArea,'')!='' |
|
|
ORDER BY A.LocationCode";
|
|
|
ORDER BY A.LocationCode";
|
|
|
if (LocationIsTaken == "") |
|
|
if (LocationIsTaken == "") |
|
|
{ |
|
|
{ |
|
@ -3421,11 +3448,8 @@ namespace ICSSoft.DataProject |
|
|
InspectJosn += "\"SourceBin\": \"" + currentPositionCode + "\",";//起始点位
|
|
|
InspectJosn += "\"SourceBin\": \"" + currentPositionCode + "\",";//起始点位
|
|
|
InspectJosn += "\"DestBin\": \"" + InLocationCode + "\"";//目标点位
|
|
|
InspectJosn += "\"DestBin\": \"" + InLocationCode + "\"";//目标点位
|
|
|
InspectJosn += "}"; |
|
|
InspectJosn += "}"; |
|
|
RestHelper rest = new RestHelper(ForkLiftUrl, HttpVerb.POST); |
|
|
|
|
|
rest.PostData = InspectJosn; |
|
|
|
|
|
string strResult = rest.MakeRequest(); |
|
|
|
|
|
//string resultstr = HTTPHelper.Post(ERPUrl.AGVBineURL, InspectJosn);
|
|
|
|
|
|
ForkLiftResult result = JsonConvert.DeserializeObject<ForkLiftResult>(strResult); |
|
|
|
|
|
|
|
|
string resultstr = HTTPHelper.Post(ERPUrl.AGVBineURL, InspectJosn); |
|
|
|
|
|
ForkLiftResult result = JsonConvert.DeserializeObject<ForkLiftResult>(resultstr); |
|
|
if (result.Ret == 1) |
|
|
if (result.Ret == 1) |
|
|
{ |
|
|
{ |
|
|
#region 记录叉车的任务编号及相关信息
|
|
|
#region 记录叉车的任务编号及相关信息
|
|
@ -3434,7 +3458,9 @@ namespace ICSSoft.DataProject |
|
|
select NEWID(),'{0}','{1}','PTWY','{2}','{3}',GETDATE(),'1701' |
|
|
select NEWID(),'{0}','{1}','PTWY','{2}','{3}',GETDATE(),'1701' |
|
|
|
|
|
|
|
|
Update ICSAGVCallBackLog set Result='成功',Message='' |
|
|
Update ICSAGVCallBackLog set Result='成功',Message='' |
|
|
where ReqCode='{4}'";
|
|
|
|
|
|
|
|
|
where ReqCode='{4}' |
|
|
|
|
|
update ICSAGVTaskLog set MTIME=GETDATE(),EATTRIBUTE2='已完成',EATTRIBUTE3='{2}' |
|
|
|
|
|
WHERE ID='{4}'";
|
|
|
sql = string.Format(sql, TaskCode, ContainerCode, currentPositionCode, dt.Rows[0]["LocationCode"].ToString(), reqCode); |
|
|
sql = string.Format(sql, TaskCode, ContainerCode, currentPositionCode, dt.Rows[0]["LocationCode"].ToString(), reqCode); |
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
{ |
|
|
{ |
|
@ -3553,7 +3579,7 @@ namespace ICSSoft.DataProject |
|
|
string occupysql = @"Update ICSLocation set Isoccupy=''
|
|
|
string occupysql = @"Update ICSLocation set Isoccupy=''
|
|
|
where LocationCode='{0}'";
|
|
|
where LocationCode='{0}'";
|
|
|
occupysql = string.Format(occupysql, EndLocation); |
|
|
occupysql = string.Format(occupysql, EndLocation); |
|
|
DBHelper.ExecuteNonQuery(sql, cmd); |
|
|
|
|
|
|
|
|
DBHelper.ExecuteNonQuery(occupysql, cmd); |
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
#region 判断单据是否全部完成入库,并过账SAP
|
|
|
#region 判断单据是否全部完成入库,并过账SAP
|
|
@ -3688,7 +3714,7 @@ namespace ICSSoft.DataProject |
|
|
string logsql = @"insert into ICSWMSCallSAPErrorLog
|
|
|
string logsql = @"insert into ICSWMSCallSAPErrorLog
|
|
|
(ID,DocType,DocNO,WorkPoint,MTIME,WorkType,EATTRIBUTE1) |
|
|
(ID,DocType,DocNO,WorkPoint,MTIME,WorkType,EATTRIBUTE1) |
|
|
Select NEWID(),'{0}','{1}','{2}',GETDATE(),'叉车入库','{3}'";
|
|
|
Select NEWID(),'{0}','{1}','{2}',GETDATE(),'叉车入库','{3}'";
|
|
|
logsql = string.Format(logsql, "生产退料", dr["TransNO"].ToString(), dr["WorkPoint"].ToString() |
|
|
|
|
|
|
|
|
logsql = string.Format(logsql, "检验合格单入库", dr["TransNO"].ToString(), dr["WorkPoint"].ToString() |
|
|
, ErrorMessage); |
|
|
, ErrorMessage); |
|
|
DBHelper.ExecuteNonQuery(logsql, cmd); |
|
|
DBHelper.ExecuteNonQuery(logsql, cmd); |
|
|
} |
|
|
} |
|
@ -3714,19 +3740,24 @@ namespace ICSSoft.DataProject |
|
|
ServiceCallAgvTask.CallAgvTaskpositionCodePath AGVLineInfo = new ServiceCallAgvTask.CallAgvTaskpositionCodePath(); |
|
|
ServiceCallAgvTask.CallAgvTaskpositionCodePath AGVLineInfo = new ServiceCallAgvTask.CallAgvTaskpositionCodePath(); |
|
|
AGVInfo.reqCode = Year + Month + Day + Hour + Minute + Second; |
|
|
AGVInfo.reqCode = Year + Month + Day + Hour + Minute + Second; |
|
|
AGVInfo.podCode = ContainerCode; |
|
|
AGVInfo.podCode = ContainerCode; |
|
|
AGVInfo.taskTyp = "F02"; |
|
|
|
|
|
|
|
|
AGVInfo.taskTyp = "A01"; |
|
|
AGVLineInfo.positionCode = StartLocation; |
|
|
AGVLineInfo.positionCode = StartLocation; |
|
|
AGVLineInfo.type = "00"; |
|
|
AGVLineInfo.type = "00"; |
|
|
AGVLineList.Add(AGVLineInfo); |
|
|
AGVLineList.Add(AGVLineInfo); |
|
|
|
|
|
|
|
|
AGVLineInfo = new ServiceCallAgvTask.CallAgvTaskpositionCodePath(); |
|
|
AGVLineInfo = new ServiceCallAgvTask.CallAgvTaskpositionCodePath(); |
|
|
AGVLineInfo.positionCode = areadt.Rows[0]["F_Define1"].ToString();//空料架区位置编码待提供
|
|
|
AGVLineInfo.positionCode = areadt.Rows[0]["F_Define1"].ToString();//空料架区位置编码待提供
|
|
|
AGVLineInfo.type = "04"; |
|
|
|
|
|
|
|
|
AGVLineInfo.type = "02"; |
|
|
AGVLineList.Add(AGVLineInfo); |
|
|
AGVLineList.Add(AGVLineInfo); |
|
|
AGVInfo.positionCodePath = AGVLineList.ToArray(); |
|
|
AGVInfo.positionCodePath = AGVLineList.ToArray(); |
|
|
ServiceCallAgvTask.CallAgvTaskOperationResult agvresult = new ServiceCallAgvTask.CallAgvTaskOperationResult(); |
|
|
ServiceCallAgvTask.CallAgvTaskOperationResult agvresult = new ServiceCallAgvTask.CallAgvTaskOperationResult(); |
|
|
ServiceCallAgvTask.StartAgvTaskClient client = new ServiceCallAgvTask.StartAgvTaskClient(); |
|
|
ServiceCallAgvTask.StartAgvTaskClient client = new ServiceCallAgvTask.StartAgvTaskClient(); |
|
|
agvresult = client.StartCallAgvTask(AGVInfo); |
|
|
agvresult = client.StartCallAgvTask(AGVInfo); |
|
|
|
|
|
string delsql = @"delete from ICSContainerLot
|
|
|
|
|
|
where ContainerID=(SELECT ID FROM ICSContainer |
|
|
|
|
|
WHERE ContainerCode='{0}')";
|
|
|
|
|
|
delsql = string.Format(delsql, ContainerCode); |
|
|
|
|
|
DBHelper.ExecuteNonQuery(delsql, cmd); |
|
|
if (agvresult.code != 0) |
|
|
if (agvresult.code != 0) |
|
|
{ |
|
|
{ |
|
|
throw new Exception(agvresult.message); |
|
|
throw new Exception(agvresult.message); |
|
@ -3884,11 +3915,8 @@ namespace ICSSoft.DataProject |
|
|
InspectJosn += "\"SourceBin\": \"" + OutPosition + "\",";//起始点位
|
|
|
InspectJosn += "\"SourceBin\": \"" + OutPosition + "\",";//起始点位
|
|
|
InspectJosn += "\"DestBin\": \"" + dt.Rows[0]["StartLocation"].ToString() + "\"";//目标点位
|
|
|
InspectJosn += "\"DestBin\": \"" + dt.Rows[0]["StartLocation"].ToString() + "\"";//目标点位
|
|
|
InspectJosn += "}"; |
|
|
InspectJosn += "}"; |
|
|
RestHelper rest = new RestHelper(ForkLiftUrl, HttpVerb.POST); |
|
|
|
|
|
rest.PostData = InspectJosn; |
|
|
|
|
|
string strResult = rest.MakeRequest(); |
|
|
|
|
|
string resultstr = HTTPHelper.Post(ERPUrl.ForkLiftTaskStart, InspectJosn); |
|
|
string resultstr = HTTPHelper.Post(ERPUrl.ForkLiftTaskStart, InspectJosn); |
|
|
ForkLiftResult result = JsonConvert.DeserializeObject<ForkLiftResult>(strResult); |
|
|
|
|
|
|
|
|
ForkLiftResult result = JsonConvert.DeserializeObject<ForkLiftResult>(resultstr); |
|
|
if (result.Ret == 1) |
|
|
if (result.Ret == 1) |
|
|
{ |
|
|
{ |
|
|
#region 记录叉车的任务编号及相关信息
|
|
|
#region 记录叉车的任务编号及相关信息
|
|
|