diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.Common/DBHelper.cs b/ICSSoft.WMS.WebAPI/ICSSoft.Common/DBHelper.cs
index 4f3a510..f6d7900 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.Common/DBHelper.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.Common/DBHelper.cs
@@ -3896,7 +3896,105 @@ VALUES (33, '{0}') END ";
string c = year + "-" + month + "-" + day;
return c;
}
+ }
+ public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText)
+ {
+ // Pass through the call providing null for the set of SqlParameters
+ return ExecuteNonQuery(connectionString, commandType, commandText, (SqlParameter[])null);
+ }
+
+ public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
+ {
+ if (connectionString == null || connectionString.Length == 0) throw new ArgumentNullException("connectionString");
+
+ // Create & open a SqlConnection, and dispose of it after we are done
+ using (SqlConnection connection = new SqlConnection(connectionString))
+ {
+ connection.Open();
+
+ // Call the overload that takes a connection in place of the connection string
+ return ExecuteNonQuery(connection, commandType, commandText, commandParameters);
+ }
+ }
+
+ public static int ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
+ {
+ if (connection == null) throw new ArgumentNullException("connection");
+
+ // Create a command and prepare it for execution
+ SqlCommand cmd = new SqlCommand();
+ bool mustCloseConnection = false;
+ PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters, out mustCloseConnection);
+
+ // Finally, execute the command
+ int retval = cmd.ExecuteNonQuery();
+
+ // Detach the SqlParameters from the command object, so they can be used again
+ cmd.Parameters.Clear();
+ if (mustCloseConnection)
+ connection.Close();
+ return retval;
+ }
+ private static void PrepareCommand(SqlCommand command, SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters, out bool mustCloseConnection)
+ {
+ if (command == null) throw new ArgumentNullException("command");
+ if (commandText == null || commandText.Length == 0) throw new ArgumentNullException("commandText");
+
+ // If the provided connection is not open, we will open it
+ if (connection.State != ConnectionState.Open)
+ {
+ mustCloseConnection = true;
+ connection.Open();
+ }
+ else
+ {
+ mustCloseConnection = false;
+ }
+
+ // Associate the connection with the command
+ command.Connection = connection;
+
+ // Set the command text (stored procedure name or SQL statement)
+ command.CommandText = commandText;
+ // If we were provided a transaction, assign it
+ if (transaction != null)
+ {
+ if (transaction.Connection == null) throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
+ command.Transaction = transaction;
+ }
+
+ // Set the command type
+ command.CommandType = commandType;
+
+ // Attach the command parameters if they are provided
+ if (commandParameters != null)
+ {
+ AttachParameters(command, commandParameters);
+ }
+ return;
+ }
+
+ private static void AttachParameters(SqlCommand command, SqlParameter[] commandParameters)
+ {
+ if (command == null) throw new ArgumentNullException("command");
+ if (commandParameters != null)
+ {
+ foreach (SqlParameter p in commandParameters)
+ {
+ if (p != null)
+ {
+ // Check for derived output value with no value assigned
+ if ((p.Direction == ParameterDirection.InputOutput ||
+ p.Direction == ParameterDirection.Input) &&
+ (p.Value == null))
+ {
+ p.Value = DBNull.Value;
+ }
+ command.Parameters.Add(p);
+ }
+ }
+ }
}
}
}
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSoft.DataProject.csproj b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSoft.DataProject.csproj
index 9e4533b..e237140 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSoft.DataProject.csproj
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSoft.DataProject.csproj
@@ -40,6 +40,9 @@
4
+
+ ..\ICSSoft.Common\bin\ICSSoft.Common.dll
+
..\packages\log4net.2.0.13\lib\net45\log4net.dll
@@ -98,10 +101,6 @@
-
- {ee45f7a5-17ee-4707-a617-8c00dd36fc01}
- ICSSoft.Common
-
{834E9A76-1D9E-4EBD-9321-0B362A06A367}
ICSSoft.Entity
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
index dfc4243..7454d1c 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
@@ -3323,7 +3323,7 @@ namespace ICSSoft.DataProject
///
///
///
- public static DataTable LOTStockDownHGCreate(LOTStockDownHGModel JsonData)
+ public static DataTable LOTStockDownHGCreate(LOTStockDownHGModel JsonData, object InputJson)
{
String PrintEnable = "";
var language = LanguageHelper.GetName("WMSAPIInfo");
@@ -3459,6 +3459,14 @@ namespace ICSSoft.DataProject
if (cmd.Transaction != null)
cmd.Transaction.Rollback();
log.Error(ex.Message);
+ #region 保存传入JSON及报错信息
+ string errorsql = @"Insert into ICSHG_WMSEorrorLog
+ Values
+ (NEWID(),'{0}','{1}','{2}','{3}',GETDATE(),'{4}','{4}','{5}','未完成','','')";
+ errorsql = string.Format(errorsql, JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, JsonData.DATA.EXP_ORDINI[0].ORD_DES, InputJson
+ , ex.Message, JsonData.DATA.EXP_ORDINI_RIGHE_STO[0].STO_EXE_OPERATORE, JsonData.DATA.EXP_ORDINI[0].ORD_CLIENTE);
+ DBHelper.ExecuteNonQuery(connString, CommandType.Text, errorsql);
+ #endregion
throw new Exception(ex.Message);
}
finally
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
index deff360..a92935c 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
@@ -1040,7 +1040,7 @@ namespace ICSSoft.WebAPI.Controllers
model = JsonConvert.DeserializeObject(JsonData.ToString());
//WMSBarCoreService action = new WMSBarCoreService();
//var resultStr = action.LOTStockDownCreate(model);
- var resultStr = ICSSubmitService.LOTStockDownHGCreate(model);
+ var resultStr = ICSSubmitService.LOTStockDownHGCreate(model, JsonData);
res.Success = true;
//res.PrintStr = DBHelper.ReadFileStream();
if (resultStr.Columns.Contains("OLDLotNo"))