个人博客 用于记载日常收集的一些技术文章 ...
K3 BOS : C# 数组:字典 K3 BOS : C# 数组:字典 C# 数组:字典

var a = new Dictionary<TKey,TValue>(); // 看见尖括号就知道它是c#2.0的泛型了,所以它可以容纳任何类型。

首先,字典有【键】<TKey> 和【值】<TValue> 其中【键】必须是唯一的,不能重复。【键】不能是空引用

可以用【键】 WriteLine(a[TKey]); 来索引,
可以用【索引值】WriteLine(a[0]); 来索引。

------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;

namespace HelloWorldApplication
{
class A
{
static void Main(string[] args)
{
var a = new Dictionary<int,int>();

a.Add(12,14); // 添加【键】和【值】
a.Add(0,1);

Console.WriteLine("删去前的 Count" + a.Count); // 获取:【字典】有多少对【键】和【值】

a.Remove(0); // 删除:【字典】第 1 行,【索引号】从 0 开始计数

Console.WriteLine(a.Count);
// ------------------------------------------------------------------------------------------------------------------------------------

Console.WriteLine(a[12]); // 获取:【字典 的 键】对应的【值】

Console.WriteLine(a.ContainsKey(12)); // 是否包含:【键】
Console.WriteLine(a.ContainsValue(14)); // 是否包含:【值】

Console.ReadKey(); //

a.Clean(); // 清空:【字典】所有【键】和【值】

}
}
}
郭少锋 创建 2024-01-12 17:17:59 K3 BOS
K3 BOS : C# 四舍五入 K3 BOS : C# 四舍五入 double number = 3.1459; // 要进行四舍五入的值
int decimalPlaces = 2; // 保留小数位数

double roundedNumber = Math.Round(number, decimalPlaces); // 调用Math.Round()函数进行四舍五入
Console.WriteLine("四舍五入后的结果:" + roundedNumber);
郭少锋 创建 2024-01-11 20:55:00 K3 BOS
K3 BOS : cloud 值更新 配置 K3 BOS : cloud 值更新 配置 条件:

关联生成 ISDRAW() = 1

FMaterialId.F_POYP_MJ11 = @null OR FMaterialId.F_POYP_MJ11 = 0
物料编码.模具信息 = null OR 物料编码.模具信息 = 0

F_POYP_ybQty = sum(F_POYP_ybQty2)
预补数 = sum(预补数)
郭少锋 编辑 2024-01-11 14:16:45 创建 2024-01-09 13:44:06 K3 BOS
SQL : 零除错误 SQL : 零除错误 select 0 / 100 -- 正常

select 100 / 0 -- 遇到以零作除数错误。
郭少锋 创建 2024-01-10 22:55:51 SQL
SQL : Sql 压缩备份数据库 SQL : Sql 压缩备份数据库 declare @dbName varchar(100) select @dbName = 'AIS20230320140850' -- 要备份的 数据库名称
declare @path varchar(100) select @path = 'C:\Kingdee\bak' -- 要存放的 文件位置

declare @fileDate varchar(100) select @fileDate = replace(replace(replace( convert(varchar(30),getdate(),120) ,'-','') ,':','') ,' ','_') -- 日期格式 20231014_084910

declare @fileName varchar(100) select @fileName = @dbName +'_'+ @fileDate -- 新的文件名 master_20231014_090443
declare @filePath varchar(100) select @filePath = @path +'\'+ @fileName +'.bak' -- 新的存放位置 C:\Data\bak\master_20231014_090443.bak

declare @sql varchar(2000)
select @sql = '
BACKUP DATABASE '+ @dbName +'
TO DISK = N'''+ @filePath +''' WITH RETAINDAYS = 30, NOFORMAT, NOINIT
,NAME = N'''+ @fileName +'''
,SKIP
,REWIND
,NOUNLOAD
,COMPRESSION -- 压缩
,STATS = 10
'
print @sql
exec( @sql )

/*
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 备份+压缩:数据库


BACKUP DATABASE AIS20230320140850
TO DISK = N'C:\Kingdee\bak\AIS20230320140850_20231222_230202.bak' WITH RETAINDAYS = 30, NOFORMAT, NOINIT
,NAME = N'AIS20230320140850_20231222_230202'
,SKIP
,REWIND
,NOUNLOAD
,COMPRESSION -- 压缩
,STATS = 10

已处理百分之 10。
已处理百分之 20。
已处理百分之 30。
已处理百分之 40。
已处理百分之 50。
已处理百分之 60。
已处理百分之 70。
已处理百分之 80。
已处理百分之 90。
已处理百分之 100。
已为数据库 'AIS20230320140850',文件 'SqlServer_BC_20120727194252_Data' (位于文件 1 上)处理了 828984 页。
已为数据库 'AIS20230320140850',文件 'SqlServer_BC_20120727194252_Log' (位于文件 1 上)处理了 1 页。
BACKUP DATABASE 成功处理了 828985 页,花费 71.567 秒(90.494 MB/秒)。

完成时间: 2023-12-22T23:03:14.7146322+08:00

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*/
郭少锋 编辑 2024-01-09 10:32:01 创建 2023-10-14 09:06:46 SQL
SQL : SQL 临时表名 SQL : SQL 临时表名 declare @Date varchar(100); select @Date = replace(replace(replace( convert(varchar(30),getdate(),120) ,'-','') ,':','') ,' ','_') -- 日期格式 20231014_084910

declare @TableName varchar(100); select @TableName = 'Tmp_FID_'+ @UserId +'_'+ @Date -- 临时表名
郭少锋 编辑 2024-01-09 10:31:39 创建 2024-01-09 10:31:10 SQL
服务 : 利国拉链 服务 : 利国拉链 客户端安装

添加凭据 192.168.10.188

用户名 Kingdee
密码 Kingdee@20230320***

访问 \\192.168.10.188 安装【资源盘】【安装包】【补丁包】【插件】,远程组件配置

新增用户后,添加 clouduser 即可。
郭少锋 编辑 2024-01-08 19:22:16 创建 2023-09-05 17:11:26 服务
windows : win10 设置自动登录 windows : win10 设置自动登录 netplwiz = control userpasswords2 设置自动登录

win10 默认隐藏了 自动登录选项,需要将下面数值 改成 0

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device]
"DevicePasswordLessBuildVersion"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]

"AutoAdminLogon"="1"
"DefaultUserName"="gsf"


------------------------------------------------------------------------------------------------------------------------------------
control userpasswords 更改用户帐户信息

ms-settings:signinoptions 设置:帐户-登录选项


本文以Windows 11 家庭版为例,介绍如何 设置开机自动登录。(Windows 10/Windows 11企业版直接跳到第三步开始)

第一步,按“WIN+R”键打开“运行”输入 ms-settings:signinoptions 按确定打开“登录选项”,找到“为了改善安全性,仅在此装置上允许Microsoft 帐户的Windows Hello 登入”选项,把它设为关闭。

第二步,按“WIN+R”键打开“运行”输入 “regedit”按 确定,打开注册表,找到「HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device\DevicePasswordLessBuildVersion」,把右方的「DevicePasswordLessBuildVersion」值从2 改成0,如下图。注意:修改保存后需重启电脑才生效。
郭少锋 编辑 2024-01-07 16:43:47 创建 2023-09-13 09:55:23 windows
K3 BOS : 云星空:套打字段 K3 BOS : 云星空:套打字段 字段合并:自定义 公式如下 F_PAEZ_CMHZ 表标识 F_PAEZ_TSGY.FName 字段标识

特殊工艺:GetDataSourceValue("F_PAEZ_CMHZ","F_PAEZ_TSGY.FName"),GetDataSourceValue("F_PAEZ_CMHZ","F_PAEZ_BZ")

GetValue("F18"),GetValue("F18")
郭少锋 编辑 2024-01-04 09:22:49 创建 2023-11-21 17:03:05 K3 BOS
SQL : 云星空 收缩数据库 SQL : 云星空 收缩数据库
-- 执行语句:会占用服务器资源,影响性能,请业务空闲时操作



------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 删除:临时表

select 'drop table '+ name +' ;' from sysobjects where xtype = 'U' and ( name like'TMP%' ) order by name ;
------------------------------------------------------------------------------------------------------------------------------------
declare @Sql nvarchar(max) = '' ;

select @Sql = @Sql +'drop table '+ name +' ;'+ char(10) from sysobjects where xtype = 'U' and ( name like'TMP%' ) order by name ;

print @Sql
exec (@Sql)
go




------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 重建:索引

select 'select * from '+ name +' ;' from sysobjects where xtype = 'U' and ( name like'T_%' ) and ( name not like'TMP%' ) order by name ;
-------------------------------------------------------------------------------------------------------------------------------------------------------------
declare @Sql nvarchar(max) = '' ;

select @Sql = @Sql +'alter index all on '+ name +' rebuild ;'+ char(10) from sysobjects where xtype = 'U' and ( name like'T_%' ) and ( name not like'TMP%' ) order by name ;

print @Sql
exec (@Sql)
go

/*
alter index all on T_ECC_AFTERSALEORDERENTRY_C rebuild;
alter index all on T_FA_COUNTINGRPTENTRY rebuild;
alter index all on T_CB_BYPRODUCTCOST rebuild;
*/




------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 更新:统计信息

declare @Sql nvarchar(max) = '' ;

select @Sql = @Sql +'update statistics '+ name +' ;'+ char(10) from sysobjects where xtype = 'U' and ( name like'T_%' ) and ( name not like'TMP%' ) order by name ;

print @Sql
exec (@Sql)
go

/*
update statistics T_ECC_AFTERSALEORDERENTRY_C ;
update statistics T_FA_COUNTINGRPTENTRY ;
update statistics T_CB_BYPRODUCTCOST ;
*/




------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 收缩:数据表

declare @Sql nvarchar(max) = '';

select @Sql = @Sql + 'alter table '+ name +' rebuild with (data_compression = row) ;'+ char(10) from sysobjects where xtype = 'U' and ( name like'T_%' ) and ( name not like'TMP%' ) order by name ;

print @Sql
exec (@Sql)
go

/*
alter table T_ECC_AFTERSALEORDERENTRY_C rebuild with (data_compression = row) ;
alter table T_FA_COUNTINGRPTENTRY rebuild with (data_compression = row) ;
alter table T_CB_BYPRODUCTCOST rebuild with (data_compression = row) ;
*/




------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 收缩:数据库

dbcc shrinkDataBase(N'AIS20230320140850');
go

/*
AIS20230320140850_Data.mdf 11.3G - 6.52G
AIS20230320140850_log.ldf 555M - 1M
*/
郭少锋 编辑 2023-12-22 23:05:58 创建 2023-11-22 00:01:20 SQL