|
@@ -11,6 +11,7 @@ using System.Threading;
|
|
|
using parkMonitor.server.uiLogServer;
|
|
|
using parkMonitor.tools;
|
|
|
using parkMonitor.DataBase;
|
|
|
+using MySql.Data.MySqlClient;
|
|
|
|
|
|
namespace parkMonitor.server.CoreThread
|
|
|
{
|
|
@@ -205,6 +206,13 @@ namespace parkMonitor.server.CoreThread
|
|
|
/// </summary>
|
|
|
public class StopCmd : AbstractCmd
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// 停车数据库事务
|
|
|
+ /// </summary>
|
|
|
+ private void StopParkingSubmit()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 命令中号牌与对应号牌机中当前号牌比对,确认车辆
|
|
|
/// </summary>
|
|
@@ -581,12 +589,56 @@ namespace parkMonitor.server.CoreThread
|
|
|
{
|
|
|
connectionStr = "SqlConnectionStr";
|
|
|
//更新云端车位表车位状态
|
|
|
- oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 1);
|
|
|
+ //oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 1);
|
|
|
//更新车库表剩余车位数
|
|
|
int freeSpaceCount = oper.getGarageFreeSpace(connectionStr, garageID);
|
|
|
freeSpaceCount = freeSpaceCount - 1;
|
|
|
- oper.UpdateGarageFreeSpace(connectionStr, freeSpaceCount, garageID);
|
|
|
+ //oper.UpdateGarageFreeSpace(connectionStr, freeSpaceCount, garageID);
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.AppSettings["SqlConnectionStr"]))
|
|
|
+ {
|
|
|
+ while (conn.State != System.Data.ConnectionState.Open)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ conn.Open();
|
|
|
+ }
|
|
|
+ catch { }
|
|
|
+ }
|
|
|
+ MySqlTransaction transaction = conn.BeginTransaction();
|
|
|
+ MySqlCommand cmd = conn.CreateCommand();
|
|
|
+ cmd.Transaction = transaction;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ cmd.CommandText = "update parkingspace set parkingSpaceState = 1 where parkingSpaceID = '" + parkingSpaceID + "'";
|
|
|
+ cmd.ExecuteNonQuery();
|
|
|
+ cmd.CommandText = "update garage set garageFreeSpace = '" + freeSpaceCount + "' where garageID = '" + garageID + "'";
|
|
|
+ cmd.ExecuteNonQuery();
|
|
|
+ cmd.CommandText = "insert into parkingrecords(userID,numberPlate,parkingSpaceID,garageID,parkingRecordsState,realParkTime) values('" + userID + "','" + numberPlate + "','" + parkingSpaceID + "','" + garageID + "',3,'" + realParkTime + "')";
|
|
|
+ int parkingRecordsID = cmd.ExecuteNonQuery();
|
|
|
+ //cmd.CommandText = "update vehicle set vehiclepParkState = 1,scanEntryTime = '" + queueCmd.TimeRecord + "',parkingRecordsID = '" + parkingRecordsID + "',parkingSpaceID = '" + parkingSpaceID + "',vehicleTypeConfirm = 1,frontwheelbase = '" + frontWheelbase + "',rearwheelbase = '" + rearWheelbase + "' where numberPlate = '" + numberPlate + "'";
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ transaction.Rollback();
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ throw;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
else
|
|
|
{
|
|
|
connectionStr = "SqlConnectionLocation";
|
|
@@ -934,7 +986,7 @@ namespace parkMonitor.server.CoreThread
|
|
|
/// </summary>
|
|
|
public class SimpleCMDFactory
|
|
|
{
|
|
|
- DBOperation oper = new DBOperation();
|
|
|
+ //DBOperation oper = new DBOperation();
|
|
|
public AbstractCmd createCmd(Command queueCmd)
|
|
|
{
|
|
|
AbstractCmd abstractCmd = null;
|