|
|
@ -73,6 +73,14 @@ namespace ICSSoft.DataProject |
|
|
|
RAISERROR('源头单据:{3} 对应区域不是指定的可以无条码发料的区域!',16,1); |
|
|
|
RETURN |
|
|
|
END |
|
|
|
|
|
|
|
IF ((SELECT SUM(Quantity) AS Quantity from ICSMOApply where ApplyCode='{3}' and WorkPoint='{4}')> |
|
|
|
(select ISNULL(SUM(ISNULL(Quantity,0)),0) AS TransQty from ICSWareHouseLotInfoLog |
|
|
|
where TransCode='{3}' and WorkPoint='{4}' and TransType=15)) |
|
|
|
BEGIN |
|
|
|
RAISERROR('源头单据:{3} 未满足全部拣料条件,请确认拣料数据后再进行发料!',16,1); |
|
|
|
RETURN |
|
|
|
END |
|
|
|
--IF (select Count(A.InvCode) AS DocCount from ICSMOApply A |
|
|
|
-- INNER JOIN ICSInventoryDetail B ON B.INVCode=A.InvCode AND B.WHCode=A.WHCode AND B.WorkPoint=A.WorkPoint |
|
|
|
-- INNER JOIN Sys_SRM_ItemsDetail C ON C.F_Define1=B.LocationCode AND C.F_Define4='SAP_NOLOT' AND C.F_Define3=B.WorkPoint |
|
|
@ -7614,7 +7622,7 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 叉车搬运结束后回调(入库:PTWY上架 出库:PICK出库)
|
|
|
|
#region 叉车搬运结束后回调(入库:PTWY 出库:PICK)
|
|
|
|
public static ForkLiftResult ForkLiftTaskEndIn(ForkLiftCallBackModel JsonData, string Jsonstr) |
|
|
|
{ |
|
|
|
var language = LanguageHelper.GetName("WMSAPIInfo"); |
|
|
@ -8589,5 +8597,125 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 根据目标点位获取回库信息
|
|
|
|
public static DataTable MaterialBackInfoGet(ICSMaterialBackModel JsonData) |
|
|
|
{ |
|
|
|
var language = LanguageHelper.GetName("WMSAPIInfo"); |
|
|
|
using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString)) |
|
|
|
{ |
|
|
|
conn.Open(); |
|
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
|
cmd.Connection = conn; |
|
|
|
try |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(JsonData.OutPosition)) |
|
|
|
{ |
|
|
|
throw new Exception("传入出库点位不能为空"); |
|
|
|
} |
|
|
|
else if (string.IsNullOrEmpty(JsonData.WorkPoint)) |
|
|
|
{ |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo004"));//"站点不能为空!"
|
|
|
|
} |
|
|
|
string sql = @"select StartLocation from ICSForkLiftTaskLog
|
|
|
|
where EndLocation='{0}' AND WorkPoint='{1}' AND ISNULL(EATTRIBUTE1,'')=''";
|
|
|
|
sql = string.Format(sql, JsonData.OutPosition, JsonData.WorkPoint); |
|
|
|
DataTable table = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (table.Rows.Count == 0) |
|
|
|
{ |
|
|
|
throw new Exception("出库点位未查询到相关的未回库记录,无法回库!"); |
|
|
|
} |
|
|
|
return table; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
log.Error(ex.Message); |
|
|
|
throw new Exception(ex.Message); |
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
if (conn.State == ConnectionState.Open) |
|
|
|
{ |
|
|
|
conn.Close(); |
|
|
|
} |
|
|
|
conn.Dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 回库(提交)
|
|
|
|
public static ForkLiftResult ActionMaterialBack(ICSMaterialBackModel JsonData, string Jsonstr) |
|
|
|
{ |
|
|
|
var language = LanguageHelper.GetName("WMSAPIInfo"); |
|
|
|
DataTable table = new DataTable(); |
|
|
|
string GUID = Guid.NewGuid().ToString(); |
|
|
|
string msg = ""; |
|
|
|
using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString)) |
|
|
|
{ |
|
|
|
conn.Open(); |
|
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
|
cmd.Connection = conn; |
|
|
|
try |
|
|
|
{ |
|
|
|
#region 记录叉车回库日志
|
|
|
|
string logsql = @"INSERT INTO ICSForkLiftMaterialBackLog
|
|
|
|
(ID,OutPosition,InputJSON,Resutl,Message,MTIME) |
|
|
|
SELECT '{0}','{1}','{2}','',GETDATE()";
|
|
|
|
logsql = string.Format(logsql, GUID, JsonData.OutPosition, Jsonstr); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
#endregion
|
|
|
|
ForkLiftResult res = new ForkLiftResult(); |
|
|
|
if (string.IsNullOrEmpty(JsonData.OutPosition)) |
|
|
|
{ |
|
|
|
msg = "传入出库点位不能为空!"; |
|
|
|
} |
|
|
|
if (msg != "") |
|
|
|
{ |
|
|
|
#region 更新叉车回库日志
|
|
|
|
logsql = @"update ICSForkLiftMaterialBackLog set Result='失败',Message='{1}',MTIME=GETDATE()
|
|
|
|
where ID='{0}'";
|
|
|
|
logsql = string.Format(logsql, GUID); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
#endregion
|
|
|
|
res.Ret = 0; |
|
|
|
res.RetMsg = msg;// "接口调用失败!";
|
|
|
|
return res; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ICSWareHouseLotInfoService.ActionMaterialBack(GUID,JsonData.OutPosition, JsonData.WorkPoint, cmd, language); |
|
|
|
} |
|
|
|
res.Ret = 1; |
|
|
|
res.RetMsg = "success";// "接口调用成功!";
|
|
|
|
return res; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
#region 更新叉车回库日志
|
|
|
|
string logsql = @"update ICSForkLiftMaterialBackLog set Result='失败',Message='{1}',MTIME=GETDATE()
|
|
|
|
where ID='{0}'";
|
|
|
|
logsql = string.Format(logsql, GUID); |
|
|
|
DBHelper.ExecuteNonQuery(connString, CommandType.Text, logsql); |
|
|
|
#endregion
|
|
|
|
if (cmd.Transaction != null) |
|
|
|
cmd.Transaction.Rollback(); |
|
|
|
log.Error(ex.Message); |
|
|
|
ForkLiftResult res = new ForkLiftResult(); |
|
|
|
res.Ret = 0; |
|
|
|
res.RetMsg = ex.Message;// "接口调用失败!";
|
|
|
|
return res; |
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
if (conn.State == ConnectionState.Open) |
|
|
|
{ |
|
|
|
conn.Close(); |
|
|
|
} |
|
|
|
conn.Dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
} |