修正数据库存储过程,解决缓存上传失败问题
This commit is contained in:
@@ -1434,10 +1434,13 @@ Public Class Service1
|
||||
Private Function CheckLicense() As Boolean
|
||||
Try
|
||||
Dim licensePath As String = UtsRegistry.LicenseFilePath
|
||||
UTS_Core.DebugLog.ApplicationLog.WriteInfoLog($"License Path:{licensePath}.")
|
||||
|
||||
_license = New License(licensePath)
|
||||
_license.CheckLicense()
|
||||
|
||||
UTS_Core.DebugLog.ApplicationLog.WriteInfoLog($"License Info:{JsonConvert.SerializeObject(_license, Formatting.Indented)}.")
|
||||
|
||||
UTS_Core.DebugLog.ApplicationLog.WriteInfoLog($"CheckLicense Success.")
|
||||
Catch ex As Exception
|
||||
UTS_Core.DebugLog.ApplicationLog.WriteErrorLog($"CheckLicense Error:{ex.Message}.")
|
||||
|
||||
@@ -61,6 +61,8 @@ Public Class DbSynchronizer
|
||||
''' 同步数据库,开始同步
|
||||
''' </summary>
|
||||
Public Sub SyncDatabase()
|
||||
ServiceLog.WriteDebugLog($"RemoteConnString:{Parameters.RemoteConnString} LocalConnString:{Parameters.LocalConnString}")
|
||||
|
||||
Using remoteDb As New DbExecutor(Parameters.RemoteType, Parameters.RemoteConnString)
|
||||
remoteDb.Open()
|
||||
|
||||
@@ -155,7 +157,9 @@ Public Class DbSynchronizer
|
||||
|
||||
Catch ex As MySqlException
|
||||
'记录失败
|
||||
ServiceLog.WriteErrorLog($"UploadData Error:{ex.Message},ErrorNumber:{ex.Number}")
|
||||
Dim id As String = row(LocalPrivate.CacheTable.ColNamesEnum.ID.ToString()).ToString()
|
||||
|
||||
ServiceLog.WriteErrorLog($"UploadData Error:{ex.Message},ErrorNumber:{ex.Number},ID:{id}")
|
||||
|
||||
Select Case ex.Number
|
||||
Case MySqlErrorCode.DuplicateFieldName '重复字段
|
||||
|
||||
@@ -123,5 +123,11 @@
|
||||
</None>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\UTS_Core\UTS_Core.vbproj">
|
||||
<Project>{33c6456c-f00d-41ac-a6fb-db0601495c6a}</Project>
|
||||
<Name>UTS_Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -168,7 +168,7 @@ Public Class FrmMain
|
||||
sqlCmd.Append("DECLARE l_int int default 0;" & vbCrLf)
|
||||
sqlCmd.Append("DECLARE l_len int default 0;" & vbCrLf)
|
||||
sqlCmd.Append("DECLARE l_type varchar(16) default '';" & vbCrLf)
|
||||
sqlCmd.Append("select count(*),`DATA_TYPE`,`CHARACTER_MAXIMUM_LENGTH` into l_int,l_type,l_len from `information_schema`.`COLUMNS` WHERE TABLE_SCHEMA = dbName and TABLE_NAME = tbName and COLUMN_NAME = filed;" & vbCrLf)
|
||||
sqlCmd.Append("select count(*),`DATA_TYPE`,`CHARACTER_MAXIMUM_LENGTH` into l_int,l_type,l_len from `information_schema`.`COLUMNS` WHERE TABLE_SCHEMA = dbName and TABLE_NAME = tbName and COLUMN_NAME = filed COLLATE utf8_general_ci;" & vbCrLf)
|
||||
sqlCmd.Append("if l_int = 0 then" & vbCrLf)
|
||||
sqlCmd.Append("set @cmd = CONCAT('alter table ',dbName,'.',tbName,' add column ',filed,' varchar(',len,')');" & vbCrLf)
|
||||
sqlCmd.Append("PREPARE pre FROM @cmd;" & vbCrLf)
|
||||
@@ -193,7 +193,7 @@ Public Class FrmMain
|
||||
sqlCmd.Append($"Create Procedure `{dbName}`.`AlterSnListBarcode`(in orderid int,in orderinternalid int,in pid int,in code varchar(32),in sntype int)" & vbCrLf)
|
||||
sqlCmd.Append("begin " & vbCrLf)
|
||||
sqlCmd.Append("DECLARE l_int int default 0; " & vbCrLf)
|
||||
sqlCmd.Append("select count(*) into l_int from `TBL_SnList` WHERE `BarCode` = code; " & vbCrLf)
|
||||
sqlCmd.Append("select count(*) into l_int from `TBL_SnList` WHERE `BarCode` = code COLLATE utf8_general_ci; " & vbCrLf)
|
||||
sqlCmd.Append("if l_int = 0 then " & vbCrLf)
|
||||
sqlCmd.Append("set @cmd = CONCAT('Insert into TBL_SnList(OrderID,OrderInternalID,ProductID,BarCode,SnType) values(',orderid,',',orderinternalid,',',pid,',''',code,''',',sntype,')'); " & vbCrLf)
|
||||
sqlCmd.Append("PREPARE pre FROM @cmd; " & vbCrLf)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user