个人博客 用于记载日常收集的一些技术文章 ...
SQL : sql 不统计记录数 SQL : sql 不统计记录数 set noCount on -- 不统计记录数 郭少锋 创建 2024-08-12 14:16:10 SQL SQL : sql 全局唯一的标识符 GUID SQL : sql 全局唯一的标识符 GUID Select NewID() FTableID -- BBC19DA1-5CF8-493A-B8A0-2F8923C27C4D

在SQL Server中,‌NEWID() 函数用于生成一个全局唯一的标识符(‌GUID)‌。‌
这个GUID是一个128位的数字,‌通常以32个十六进制数字的形式表示,‌分为五组,‌由连字符分隔(‌例如:‌123E4567-E89B-12D3-A456-426614174000)‌。‌

当你执行 SELECT NEWID() 时,‌SQL Server会立即生成一个新的GUID值并返回它。‌
这个值在数据库中是唯一的,‌尽管在理论上存在极小的概率会生成重复的GUID(‌因为GUID的生成是基于算法而不是真正的随机性)‌,‌但在实际应用中,‌这种概率几乎可以忽略不计。‌

因此,‌如果你执行 SELECT NEWID(),‌你会得到一个类似于以下格式的GUID值:‌XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

其中 X 表示十六进制数字(‌0-9, A-F)‌。‌
每次执行这个查询时,‌你都会得到一个全新的、‌唯一的GUID值。‌
郭少锋 创建 2024-08-12 13:55:15 SQL
K3 BOS : K3-151 VMware 加速启动 K3 BOS : K3-151 VMware 加速启动 以下服务【启动类型】改为【自动(延迟启动)】
-------------------------------------------------------------
HrJobProcess

K3MMainSuspendService 【客户端组件 连接用】
K3MobileService 【K/3移动商务系统服务】
K3MobileServiceManage 【管理K3mobileservice服务】
KDBackgroundService 【Kingdee K/3 Background Task Service for .NET】

Kingdee.K3.AutoUpdatePatchService
Kingdee.K3.CRM.Mail.Service 【Kingdee.K3.CRM.Mail.Service】

Lonntec Suf 7.0 Application Service 【隆腾速飞 7.0 应用服务器】

Apache Tomcat 【Apache tomcat5 for KDRS.】 禁用

郭少锋 编辑 2024-08-12 09:59:14 创建 2023-03-25 22:04:56 K3 BOS
云星空 : Round 四舍五入 云星空 : Round 四舍五入 VB,VBScript,C#,J#,T-SQL 中
Round 函数都是采用 Banker's rounding(银行家舍入)算法,即 四舍六入五取偶。

四舍六入五留双 规则的具体方法是:

(一)当尾数小于或等于4时,直接将尾数舍去。
(二)当尾数大于或等于6时,将尾数舍去并向前一位进位。

(三)当尾数为5,而尾数后面的数字均为0时,应看尾数“5”的前一位:

若前一位数字此时为奇数,就应向前进一位;
若前一位数字此时为偶数,则应将尾数舍去。
数字“0”在此时应被视为偶数。

例如
12.64 50——12.64 尾数为5,前一位数字 4 为偶数,将尾数舍去
18.27 50——18.28 尾数为5,前一位数字 7 为奇数,向前进一位

(四)当尾数为5,而尾数后面的数字有不是0的,都应向前进一位。

例如
12.64 50001——12.65
18.27 503——18.28


Private Sub FPrice_Change()

FAmount.Value = Round(Val(FPrice.Text) * Val(FQty.Value) + 0.0000000001, 2) '四舍五入 + 0.0000000001
End Sub
郭少锋 编辑 2024-08-08 16:49:17 创建 2024-08-08 16:46:11 云星空
K3 功能 : VBA 文本转换为数字 K3 功能 : VBA 文本转换为数字 方法1:使用Val函数将单个文本转换为数字。

Dim text As String
Dim number As Double

text = "123.45"
number = Val(text)
MsgBox number

方法2:使用CDec函数将文本转换为十进制数。

Dim text As String
Dim number As Decimal

text = "123.45"
number = CDec(text)
MsgBox number

方法3:使用CDbl函数将文本转换为双精度浮点数。

Dim text As String
Dim number As Double

text = "123.45"
number = CDbl(text)
MsgBox number
郭少锋 创建 2024-08-08 16:26:15 K3 功能
SQL : sql 特殊符号 SQL : sql 特殊符号 sql 特殊符号

\r\n 换行符
\t 制表符

aSql = string.Format("/*dialect*/ \r\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n-- 1. 出货未对账\r\n\r\n select 1 FLevel ,1 FRow1 ,'出货未对账' FType\r\n \r\n ,a1.FBillTypeName,a1.FBillNo,a1.FSeq ,a1.FCustBelong,a1.FCustNo,a1.FCustName\r\n ,0 FDay3\t-- 天数|收款逾期\r\n\t\r\n \n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n ) a\r\n\r\n where 1=1 {1} \r\n \r\n order by FBillNo,FSeq\r\n;\r\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n", aTableName, aWhereFilter, arg);
DBUtils.Execute(aContext, aSql);


转换后的效果:

aSql = string.Format("/*dialect*/
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 1. 出货未对账

select 1 FLevel ,1 FRow1 ,'出货未对账' FType

,a1.FBillTypeName,a1.FBillNo,a1.FSeq ,a1.FCustBelong,a1.FCustNo,a1.FCustName
,0 FDay3 -- 天数|收款逾期

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
) a

where 1=1 {1}

order by FBillNo,FSeq
;
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
", aTableName, aWhereFilter, arg);
DBUtils.Execute(aContext, aSql);
郭少锋 编辑 2024-08-06 11:22:27 创建 2024-08-06 11:20:47 SQL
云星空 : c# 日期格式 云星空 : c# 日期格式 private int WeekOfYear() // 本年第几周
{
var dt = DateTime.Now;
int firstWeekend = Convert.ToInt32(DateTime.Parse(dt.Year + "-1-1").DayOfWeek);
int weekDay = firstWeekend == 0 ? 1 : (7 - firstWeekend + 1);
int currentDay = dt.DayOfYear;
int current_week = Convert.ToInt32(Math.Ceiling((currentDay - weekDay) / 7.0)) + 1;
return current_week;
}

private void FEDayInLastWeek() // 前几周的周一和周日
{
int N = 3; // 前几周参数
DateTime Today = DateTime.Now;
int daysInWeek = (int)Today.DayOfWeek == 0 ? 7 : (int)Today.DayOfWeek; // 当前周第几天,注释:周日为0

for (int i = N; i > 0; i--)
{
// 起始日期
DateTime firstDay = Today.AddDays(1 - (7 * i + daysInWeek));
DateTime lastDay = Today.AddDays(7 - (7 * i + daysInWeek));
}
}

private void FristDayToNowInThisWeek() // 本周一和当前日
{
int daysInWeek = (int)DateTime.Now.DayOfWeek == 0 ? 7 : (int)DateTime.Now.DayOfWeek; // 当前周第几天,注释:周日为0
// 起始日期
DateTime firstDay = DateTime.Now.AddDays(1 - daysInWeek);
DateTime lastDay = DateTime.Now;
}


// Bind("查询出的栏位", "{0:yyyy/MM/dd}") // C#中控件绑定时间栏位格式化
郭少锋 编辑 2024-08-06 09:51:34 创建 2024-08-06 09:49:09 云星空
云星空 : c# 日期格式 云星空 : c# 日期格式 string aa = DateTime.Now.ToShortDateString(); // "2019/9/23":"2024-08-06"
string bb = DateTime.Now.ToShortTimeString(); // "上午 10:21":"9:19"
string ff = DateTime.Now.ToLongDateString(); // 2019年9月23日:"2024-08-06"
string gg = DateTime.Now.ToLongTimeString(); // 上午 10:22:07:"09:19:58"

int monthDays = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); // 获取某月在某年中的天数:31

DateTime From = DateTime.ParseExact(/*tdFrom.Text*/"201909", "yyyyMM", DateTimeFormatInfo.InvariantInfo); // 输入的String转Datetime:{2019-09-01 00:00:00}
DateTime End = DateTime.ParseExact(/*tdEnd.Text*/"201909", "yyyyMM", DateTimeFormatInfo.InvariantInfo); // :{ 2019 - 09 - 01 00:00:00}

string nian = DateTime.Now.ToString("Y"); // 2019年9月:"2024年8月"
string nian1 = DateTime.Now.ToString("y"); // 2019年9月:"2024年8月"

string y1 = DateTime.Now.ToString("R"); // Mon, 23 Sep 2019 10:31:48 GMT:"Tue, 06 Aug 2024 09:21:31 GMT"
string y2 = DateTime.Now.ToString("r"); // Mon, 23 Sep 2019 10:32:10 GMT:"Tue, 06 Aug 2024 09:21:42 GMT"

string xingqiji = DateTime.Now.ToString("dddd"); // "星期一":"星期二"
string zhouji = DateTime.Now.ToString("ddd"); // "周一":"周二"
string ri = DateTime.Now.ToString("dd"); // 23:"06"
string ershisi = DateTime.Now.ToString("HH"); // 3:"09"
string shier = DateTime.Now.ToString("hh"); // 15:"09"

string chang = DateTime.Now.ToString("F"); // 2019年9月23日 上午 10:34:08:"2024-08-06 09:22:40"
string chang1 = DateTime.Now.ToString("f"); // 2019年9月23日 上午 10:34:"2024-08-06 9:22"
string cahng2 = DateTime.Now.ToString("G"); // 2019/9/23 上午 10:35:07:"2024-08-06 09:23:02"
string cahng3 = DateTime.Now.ToString("g"); // 2019/9/23 上午 10:35:"2024-08-06 9:23"
string cahng4 = DateTime.Now.ToString("D"); // 2019年9月23日:"2024-08-06"
string cahng5 = DateTime.Now.ToString("d"); // 2019/9/23:"2024-08-06"

string now = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); // 2019/09/23 10:14:54:"2024/08/06 09:23:38"
string a = DateTime.Now.AddYears(20).ToString("yyyy/MM/dd HH:mm:ss"); // 2039/09/23 10:14:54:"2044/08/06 09:23:51"
string b = DateTime.Now.AddMonths(-2).ToString("yyyy/MM/dd HH:mm:ss"); // "2019/07/23 10:14:54":"2024/06/06 09:23:59"
string c = DateTime.Now.AddDays(-8).ToString("yyyy/MM/dd HH:mm:ss"); // "2019/09/15 10:14:54":"2024/07/29 09:24:09"
string d = DateTime.Now.AddHours(24).ToString("yyyy/MM/dd HH:mm:ss"); // "2019/09/24 10:14:54":"2024/08/07 09:24:16"
string f = DateTime.Now.AddMinutes(1440).ToString("yyyy/MM/dd HH:mm:ss"); // 2019/09/24 10:14:54:"2024/08/07 09:24:25"
string g = DateTime.Now.AddSeconds(3600).ToString("yyyy/MM/dd HH:mm:ss"); // 2019/09/23 11:14:54":"2024/08/06 10:24:33"
string h = DateTime.Now.AddSeconds(3600).ToString("yyyy/MM/dd HH:mm:ss:ffff"); // 2019/09/23 11:14:54:7992:"2024/08/06 10:24:40:7478"
郭少锋 编辑 2024-08-06 09:51:10 创建 2024-08-06 09:48:28 云星空
云星空 : c# 日期计算 云星空 : c# 日期计算
DateTime today = DateTime.Today; // 获取 当前日期: {2024-08-06 00:00:00}

DateTime newDate = today.AddDays(10); // 当前日期 + 10天:{2024-08-16 00:00:00}

TimeSpan difference = newDate - today; // 计算 两个日期 之间的 日期差:{10.00:00:00}

int aDay = difference.Days; // 10

int weekOfYear = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(newDate, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); // 获取 日期 是 多少周:33

int daysInMonth = DateTime.DaysInMonth(newDate.Year, newDate.Month); // 获取 一个月中的 天数:31




DateTime dt = DateTime.Now; // {2024-08-06 09:15:26}
string MM1 = dt.AddMonths(-1).ToString("MMM", new System.Globalization.CultureInfo("en-us")); // 月英文缩写:"Jul"
string MM2 = dt.AddMonths(1).ToString("MMM", new System.Globalization.CultureInfo("en-us")); // 月英文缩写:"Sep"

DateTime ThisMonth_Frist = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date; // 当月第一天:{2024-08-01 00:00:00}
DateTime ThisMOnth_Last = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1); // 当月最后一天:{2024-08-31 23:59:59}

DateTime Today = DateTime.Today; // 当天时间:{2024-08-06 00:00:00}


DateTime ThisMonth = new DateTime(Today.Year, Today.Month, 1); // 当前月第一天时间:{2024-08-01 00:00:00}

DateTime LastMonth_First = ThisMonth.AddMonths(-1); // 上月第一天时间:{2024-07-01 00:00:00}
DateTime LastMonth_Last = ThisMonth.AddDays(-1); // 上月最后一天时间:{2024-07-31 00:00:00}


int daysInWeek1 = (int)DateTime.Now.DayOfWeek; // 注意:此处周日时返回0:2 周二
int daysInWeek2 = (int)DateTime.Now.DayOfWeek == 0 ? 7 : (int)DateTime.Now.DayOfWeek; // 当前周第几天,注释:周日为0:2 周二


bool isWeekend = newDate.DayOfWeek == DayOfWeek.Saturday || newDate.DayOfWeek == DayOfWeek.Sunday; // 获取 日期 是否 是周末:false



for (DateTime date = today; date <= newDate; date = date.AddDays(1)) // 获取 两个日期之间 的所有日期
{
Debug.Print(date.ToString("dd-MM-yyyy")); // Console.WriteLine(date.ToString("dd-MM-yyyy"));
}
/*
06-08-2024
07-08-2024
08-08-2024
09-08-2024
10-08-2024
11-08-2024
12-08-2024
13-08-2024
14-08-2024
15-08-2024
16-08-2024
*/
郭少锋 编辑 2024-08-06 09:50:43 创建 2024-08-06 09:47:54 云星空
云星空 : 套打:表尾字段 取得 数据表最后一行的 字段值 云星空 : 套打:表尾字段 取得 数据表最后一行的 字段值
firstRowData = "";

def OutputElement(e):

global pageNumber;
global firstRowData;

if e.ControlInfo.ControlID == "cell4":

firstRowData = e.ControlInfo.Text; # 每一行

elif e.ControlInfo.ControlID == "cell12":

e.ControlInfo.Text = firstRowData; # 每一行

elif e.ControlInfo.ControlID == "cell10":

e.ControlInfo.Text = "物料编码:" + firstRowData;
郭少锋 创建 2024-08-02 10:33:24 云星空