|
|
@ -7606,11 +7606,30 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (JsonData.taskCode.Contains("CK")) |
|
|
|
string chksql = @"select EATTRIBUTE1 from ICSAGVTaskLog
|
|
|
|
where ID='{0}'";
|
|
|
|
chksql = string.Format(chksql, JsonData.taskCode); |
|
|
|
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
if (chkdt.Rows.Count == 0) |
|
|
|
{ |
|
|
|
#region 更新AGV回调日志
|
|
|
|
logsql = @"update ICSAGVCallBackLog set Result='失败',Message='{1}'
|
|
|
|
where ReqCode='{0}'";
|
|
|
|
logsql = string.Format(logsql, JsonData.taskCode, "传入TaskCode不存在!"); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
#endregion
|
|
|
|
res.code = "1"; |
|
|
|
res.message = "传入TaskCode不存在!";// "接口调用失败!";
|
|
|
|
res.reqCode = JsonData.reqCode; |
|
|
|
return res; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (chkdt.Rows[0]["EATTRIBUTE1"].ToString()=="出库") |
|
|
|
{ |
|
|
|
logsql = @"update ICSAGVTaskLog set MTIME=GETDATE(),EATTRIBUTE2='已完成',EATTRIBUTE3='{1}'
|
|
|
|
WHERE TaskCode='{0}'";
|
|
|
|
logsql = string.Format(logsql, JsonData.taskCode, JsonData.taskCode); |
|
|
|
WHERE ID='{0}'";
|
|
|
|
logsql = string.Format(logsql, JsonData.taskCode, JsonData.currentPositionCode); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
} |
|
|
|
else |
|
|
@ -7618,6 +7637,7 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer |
|
|
|
ICSWareHouseLotInfoService.ActionAGVTaskEnd(JsonData.taskCode, JsonData.currentPositionCode, JsonData.taskCode, JsonData.action, JsonData.podCode, cmd, language); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
cmd.Transaction.Commit(); |
|
|
|
res.code = "0"; |
|
|
|
res.message = "成功";// "接口调用成功!";
|
|
|
@ -8846,6 +8866,123 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 调用AGV搬运任务失败后调用,用于删除入库时的库位占用
|
|
|
|
public static AGVResult AGVTaskEnd(AGVCallBackModel JsonData, string Jsonstr) |
|
|
|
{ |
|
|
|
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; |
|
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
|
cmd.Transaction = sqlTran; |
|
|
|
try |
|
|
|
{ |
|
|
|
#region 记录AGV回调日志
|
|
|
|
string logsql = @"INSERT INTO ICSAGVCallBackLog
|
|
|
|
(ID,ReqCode,InputJSON,Result,Message,EATTRIBUTE1) |
|
|
|
SELECT NEWID(),'{0}','{1}','','',GETDATE()";
|
|
|
|
logsql = string.Format(logsql, JsonData.taskCode, Jsonstr); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
#endregion
|
|
|
|
AGVResult res = new AGVResult(); |
|
|
|
if (string.IsNullOrEmpty(JsonData.taskCode)) |
|
|
|
{ |
|
|
|
msg = "传入AGV任务ID不能为空!"; |
|
|
|
} |
|
|
|
if (string.IsNullOrEmpty(JsonData.podCode)) |
|
|
|
{ |
|
|
|
msg = "传入料架不能为空!"; |
|
|
|
} |
|
|
|
if (string.IsNullOrEmpty(JsonData.currentPositionCode)) |
|
|
|
{ |
|
|
|
msg = "传入入库具体点位不能为空!"; |
|
|
|
} |
|
|
|
if (msg != "") |
|
|
|
{ |
|
|
|
#region 更新AGV回调日志
|
|
|
|
logsql = @"update ICSAGVCallBackLog set Result='失败',Message='{1}'
|
|
|
|
where ReqCode='{0}'";
|
|
|
|
logsql = string.Format(logsql, JsonData.taskCode, msg); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
#endregion
|
|
|
|
res.code = "1"; |
|
|
|
res.message = msg;// "接口调用失败!";
|
|
|
|
res.reqCode = JsonData.reqCode; |
|
|
|
return res; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
string chksql = @"select EATTRIBUTE1 from ICSAGVTaskLog
|
|
|
|
where ID='{0}'";
|
|
|
|
chksql = string.Format(chksql, JsonData.taskCode); |
|
|
|
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
if (chkdt.Rows.Count == 0) |
|
|
|
{ |
|
|
|
#region 更新AGV回调日志
|
|
|
|
logsql = @"update ICSAGVCallBackLog set Result='失败',Message='{1}'
|
|
|
|
where ReqCode='{0}'";
|
|
|
|
logsql = string.Format(logsql, JsonData.taskCode, "传入TaskCode不存在!"); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
#endregion
|
|
|
|
res.code = "1"; |
|
|
|
res.message = "传入TaskCode不存在!";// "接口调用失败!";
|
|
|
|
res.reqCode = JsonData.reqCode; |
|
|
|
return res; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (chkdt.Rows[0]["EATTRIBUTE1"].ToString() == "出库") |
|
|
|
{ |
|
|
|
logsql = @"update ICSAGVTaskLog set MTIME=GETDATE(),EATTRIBUTE2='已完成',EATTRIBUTE3='{1}'
|
|
|
|
WHERE ID='{0}'";
|
|
|
|
logsql = string.Format(logsql, JsonData.taskCode, JsonData.currentPositionCode); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ICSWareHouseLotInfoService.ActionAGVTaskEnd(JsonData.taskCode, JsonData.currentPositionCode, JsonData.taskCode, JsonData.action, JsonData.podCode, cmd, language); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
cmd.Transaction.Commit(); |
|
|
|
res.code = "0"; |
|
|
|
res.message = "成功";// "接口调用成功!";
|
|
|
|
res.reqCode = JsonData.reqCode; |
|
|
|
return res; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
#region 更新AGV回调日志
|
|
|
|
string logsql = @"update ICSAGVCallBackLog set Result='失败',Message='{1}'
|
|
|
|
where ReqCode='{0}'";
|
|
|
|
logsql = string.Format(logsql, JsonData.reqCode, ex.Message); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
#endregion
|
|
|
|
if (cmd.Transaction != null) |
|
|
|
cmd.Transaction.Rollback(); |
|
|
|
log.Error(ex.Message); |
|
|
|
AGVResult res = new AGVResult(); |
|
|
|
res.code = "1"; |
|
|
|
res.message = ex.Message;// "接口调用失败!";
|
|
|
|
res.reqCode = JsonData.reqCode; |
|
|
|
return res; |
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
if (conn.State == ConnectionState.Open) |
|
|
|
{ |
|
|
|
conn.Close(); |
|
|
|
} |
|
|
|
conn.Dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 临时接口(用于单独过账SAP接口 不经过WMS)
|
|
|
|
/// <summary>
|
|
|
|
/// 临时接口(用于单独过账SAP接口 不经过WMS)
|
|
|
|