NiuBoYi
type: channel
link: https://disc.liu-yu.top/
description: Your description here.
items: 库存结余数量
items: 修正异步程序ID
items: U9查询值集值和枚举值sql
items: U9页面字段联动代码
items: 请款单生成请款确认单
items: U9获取组织公共参数sql
items: 创建供应商
items: 销售退货修改数量库位存储地点、采购退货修改数量库位存储地点
items: 🌟 Linux 内存交换空间（Swap）的完整教程
items: RustDesk 远程控制软件私有化部署指南

库存结余数量
type: item
date: 2026-04-16T18:03:00+08:00
description: select 1 as [FixOrder], A.[ItemInfo_ItemCode] as [ItemInfo_ItemCode], isnull( case when A1.[ItemFormAttribute] in (16, 22) then A.[ItemInfo_ItemName] else A1.[Name] end ,'') as [ItemID_Name], A3.[Code] as [Bin_Code], A3.[Segment1] as [Bin_Segment1], A4.[Code] as [Wh_Code], A.[DocDate] as [Main_DocDate], A7.[DocTypeName] as [Main_DocTypeName], A.[DocNo] as [Main_DocNo], A.[Doc_EntityID] as [Doc_EntityID], A.[Doc_EntityType] as [Doc_EntityType], A.[DocOrg] as [Main_DocOrg], A.[Direction] as [Main_Direction], A.[DocLineNo] as [Main_DocLineNo], convert(decimal(24,9),null) as [Temp_InQtyIU], A5.[Round_Precision] as [IURound_Precision], case when ((A.[DocType_EntityType] != 'UFIDA.U9.AP.APMatch.APMatchDocType') and (A.[BackLineType] = 0)) then (Power((-(1)),(A.[Direction] + A.[DisplayDirection])) * A2.[StoreUOMQty]) else convert(decimal(24,9),0) end as [Temp_OutQtyIU], convert(decimal(24,9),null) as [Temp_BalQtyIU], A8.[Name] as [Wh_Name], A9.[DescFlexField_CombineName] as [ItemDescFlex_CombineName], A10.[Name] as [Bin_Name], A.[TransUpdateTime] as [Main_TransUpdateTime], dbo.F_GetMD5key((((('' + '') + isnull(convert(nvarchar(2000),A.[ItemInfo_ItemCode]),'')) + '') + isnull(convert(nvarchar(2000),isnull( case when A1.[ItemFormAttribute] in (16, 22) then A.[ItemInfo_ItemName] else A1.[Name] end ,'')),''))) as [BizKey] from InvTrans_TransLine as A left join [CBO_ItemMaster] as A1 on (A.[ItemInfo_ItemID] = A1.[ID]) left join [InvTrans_TransLineBin] as A2 on (A.[ID] = A2.[TransLine]) left join [CBO_Bin] as A3 on (A2.[BinInfo_Bin] = A3.[ID]) left join [CBO_Wh] as A4 on (A.[Wh] = A4.[ID]) left join [Base_UOM] as A5 on (A.[StoreUOM] = A5.[ID]) left join [Base_Organization] as A6 on (A.[Org] = A6.[ID]) left join [InvTrans_TransLine_Trl] as A7 on (A7.SysMlFlag = 'zh-CN') and (A.[ID] = A7.[ID]) left join [CBO_Wh_Trl] as A8 on (A8.SysMlFlag = 'zh-CN') and (A4.[ID] = A8.[ID]) left join [CBO_ItemMaster_Trl] as A9 on (A9.SysMlFlag = 'zh-CN') and (A1.[ID] = A9.[ID]) left join [CBO_Bin_T…

修正异步程序ID
type: item
date: 2025-09-22T10:21:26+08:00
description: update UBF_Job_Request set BPName=(select Local_ID from UBF_MD_Class where Name='BP名') where ID=(select ID from UBF_Job_Request where code='请求管理编码')

U9查询值集值和枚举值sql
type: item
date: 2025-08-15T11:03:26+08:00
description: 值集值查询SELECT Base_DefineValue_Trl.Name FROM Base_DefineValue --值集值 LEFT JOIN Base_DefineValue_Trl ON Base_DefineValue.ID = Base_DefineValue_Trl.ID AND Base_DefineValue_Trl.SysMLFlag = 'zh-CN' --值集值Trl LEFT JOIN Base_ValueSetDef ON Base_ValueSetDef.ID = Base_DefineValue.ValueSetDef --值集 WHERE Base_ValueSetDef.Code = 'zfbz' AND Base_DefineValue.Code = 'N'枚举值查询SELECT UBF_Sys_ExtEnumValue.Code,* FROM UBF_Sys_ExtEnumType LEFT JOIN UBF_Sys_ExtEnumValue ON UBF_Sys_ExtEnumValue.ExtEnumType = UBF_Sys_ExtEnumType.ID LEFT JOIN UBF_Sys_ExtEnumValue_Trl ON UBF_Sys_ExtEnumValue_Trl.ID = UBF_Sys_ExtEnumValue.ID WHERE UBF_Sys_ExtEnumType.Code = 'QR.ZHXY.CGHTBE.MonthEnum'

U9页面字段联动代码
type: item
date: 2025-07-03T15:58:00+08:00
description: U9页面字段联动代码注意事项所有的代码都需要写在WebPart目录中*.Extend.cs注册CallBack方法 public void AfterOnLoad() { CallBack_UomTab_硬件成本不含税(); CallBack_UomTab_小计(); CallBack_UomTab_合同额And占比(); CallBack_UomTab_费用And毛利(); CallBack_UomTab_总收入And总成本(); CallBack_UomTab_合同计算(); }实现注册方法// private void CallBack_UomTab_硬件成本不含税() { // 所有控件集合，按顺序对应每个 AssociationControl IUFFldNumberControl[] sourceControls = new IUFFldNumberControl[] { PartsCostOutsource65, // 硬件成本外购（含税） PartsCostOwnProduction53, // 硬件成本自产（含税） InstallMaterialCost76, // 安装材料成本（含税） InstallArtificialCost100, // 安装人工成本（含税） }; IUFFldReference[] sourceControls1 = new IUFFldReference[] { PartsCostOutsourceTax43, // 硬件成本外购（含税）税率 PartsCostOwnProductionTax68, // 硬件成本自产（含税）税率 InstallMaterialCostTax40, // 安装材料成本（含税）税率 InstallArtificialCostTax82, // 安装人工成本（含税）税率 }; ClientCallBackFrm cF = new ClientCallBackFrm(); cF.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(CallBack_UomTab_硬件成本不含税); foreach (var ctrl in sourceControls) { // 注册控件到参数 cF.ParameterControls.Add(ctrl); // 创建并配置关联控制器 var assoc = new AssociationControl { SourceServerControl = ctrl, SourceControl = { EventName = "OnValueChanged" } }; cF.Add(assoc); } foreach (var ctrl in sourceControls1) { // 注册控件到参数 cF.ParameterControls.Add(ctrl); // 创建并配置关联控制器 var assoc = new AssociationControl { SourceServerControl = ctrl, SourceControl = { EventName = "OnValueChanged" } }; cF.Add(assoc); } } /// /// 回调函数：【含税金额+税率】，自动计算并设置【不含税金额】 /// object CallBack_UomTab_硬件成本不含税(CustomerActionEventArgs args) { // 硬件成本 - 外购部分 ComputeNoTaxValue(args, this.PartsCostOutsource65, this.PartsCostOutsourceTax43, this.PartsCostOutsourceNo55); // 硬件成本 - 自产部分 ComputeNoTaxValue(args, this.PartsCostOwnProduction53, this.PartsCostOwnProductionTax68, this.PartsCostOwnProductionNo85); // 安装材料成本 ComputeNoTaxValue(args, this.InstallMaterialCost76, this.InstallMaterialCostTax40, this.InstallMaterialCostNo37); // 安装人工成本 ComputeNoTaxValue(args, this.InstallArtificialCost100, this.InstallArtificialCostTax82, this.InstallArtificialC…

请款单生成请款确认单
type: item
date: 2025-05-21T16:30:00+08:00
description: {callout color="#ef4d4d"}由于无法指定组织只能采取登录组织方式{/callout}dll名：AutoGenerateConfirmBillBPProxydll位置：C:\yonyou\U9V60\Portal\ApplicationServer\Libs\UFIDA.U9.AP.APBP.Agent.dll AutoGenerateConfirmBillBPProxy proxy = new AutoGenerateConfirmBillBPProxy(); PayReqFundDocType payReqFundDocType = PayReqFundDocType.Finder.Find(string.Format("code = '{0}'","001")); PayReqFundDocType payReqFundDocType1 = PayReqFundDocType.Finder.Find(string.Format("code = '{0}'","002")); Entity.EntityList<PayReqFundHead> entityList = PayReqFundHead.Finder.FindAll( string.Format("DocStatus = 2 and DocumentType != '{1}' and DocumentType!= '{2}' and Org = {0}", Context.LoginOrg.ID,payReqFundDocType.ID,payReqFundDocType1.ID)); //string.Format("DocStatus = 1 and Org.Code = '10' and DocNo = '10-0012412200007'")); try { foreach (PayReqFundHead payReqFundHead in entityList) { proxy.PayReqHeadKey = payReqFundHead.ID; if (!string.IsNullOrEmpty(payReqFundHead.PayReqFundUses[0].OppAccBkAccount)) { BankAccount bankAccount = BankAccount.FindByCode(payReqFundHead.PayReqFundUses[0].OppAccBkAccount); if (bankAccount != null) { proxy.BankAccount = bankAccount.ID; } //proxy.SubBankAccount = bankAccount.PayBkSubAccount; } else { logger.LogInfo("创建请款确认单失败：付款银行账户为空 ： 单号：" + payReqFundHead.DocNo + "组织：" + payReqFundHead.Org.Code); continue; } // CashAccount cashAccount = // CashAccount.Finder.Find(string.Format("code = '{0}'", "01090699000120109050014")); // proxy.CashAccount = 0; proxy.IsUnApprove = true; proxy.IsCanInputInfo = false; proxy.PayDate = payReqFundHead.ExpectPayDate; AccountPeriod accountPeriod = AccountPeriod.Finder.Find(string.Format( "Year = '{0}' and Month = '{1}'", DateTime.Now.Year, DateTime.Now.Month)); // 会计记账期间 proxy.PostPeriod = accountPeriod.ID; proxy.PayCurrency = payReqFundHead.ReqFundAC.ID; proxy.ERType = payReqFundHead.ERType.Value; proxy.ExRate = payReqFundHead.PCToMCXR; if (payReqFundHead.PayReqFundUses != null && payReqFundHead.PayReqFundUses.Count > 0 && payReqFundHead.PayReqFundUses[0].Sttl…

U9获取组织公共参数sql
type: item
date: 2025-05-19T17:05:14+08:00
description: select a.ID,a.Code,b.* from Base_Profile a left join Base_Profile_Trl b on a.ID=b.ID where a.Code like 'OAtemplate%'

创建供应商
type: item
date: 2025-05-14T17:04:38+08:00
description: DLL：UFIDA.U9.ISV.Supplier.Agent.dllDLL位置: C:\yonyou\U9V60\Portal\ApplicationServer\Libs\UFIDA.U9.ISV.Supplier.Agent.dll List<ISV.Supplier.SupplierDTOData> supplierDTOList = new List<ISV.Supplier.SupplierDTOData>(); ISV.Supplier.SupplierDTOData supplierInfo = new ISV.Supplier.SupplierDTOData(); supplierInfo.Code = model.data.supplier_no; //供应商编号 supplierInfo.Name = model.data.enterprise_name; //供应商名称 supplierInfo.Org = new CommonArchiveDataDTOData(Context.LoginOrg.ID, Context.LoginOrg.Code, Context.LoginOrg.Name); //supplierInfo.ContactObject = new CBO.Pub.Controller.CommonArchiveDataDTOData(); //supplierInfo.ContactObject.Code = ""; supplierInfo.DescFlexField = new DescFlexSegmentsData(); supplierInfo.DescFlexField.PrivateDescSeg1 = model.data.contacts; //联系人 supplierInfo.DescFlexField.PrivateDescSeg3 = model.data.phone_number; //移动电话 supplierInfo.DescFlexField.PrivateDescSeg4 = model.data.enterprise_fax; //传真 supplierInfo.DescFlexField.PrivateDescSeg6 = model.data.email_address; //邮件地址 supplierInfo.DescFlexField.PrivateDescSeg7 = model.data.bank_name; //银行开户行 supplierInfo.DescFlexField.PrivateDescSeg8 = model.data.bank_account; //银行汇款账号 //状态是否生效 supplierInfo.Effective = new EffectiveData(); supplierInfo.Effective.IsEffective = true; supplierInfo.Effective.EffectiveDate = Convert.ToDateTime("2000-01-01"); supplierInfo.Effective.DisableDate = Convert.ToDateTime("9999-12-31"); supplierInfo.IsPriceListModify = true; //价目表可改 supplierInfo.IsReceiptRuleEditable = true; // 收货原则可改 supplierInfo.IsPaymentTermModify = true; // 付款条件可改 supplierInfo.IsAPConfirmTermEditable = true; //立账条件可改 // 收货原则 RcvBy receiptRule = RcvBy.FindByCode("G1"); if (receiptRule != null) { supplierInfo.ReceiptRule = new CommonArchiveDataDTOData(receiptRule.ID, receiptRule.Code, receiptRule.Name); } //供应商分类、税组合、立账条件、付款条件要效验编码 lirh 2025-02-17 if (!string.IsNullOrEmpty(model.data.supplier_classify_number)) { SupplierCategory suppcate = SupplierCategory.Finder.Find(string.Format( "Org.ID='{0}' and Code='{1…

销售退货修改数量库位存储地点、采购退货修改数量库位存储地点
type: item
date: 2025-04-27T13:05:00+08:00
description: 使用session修改销售退货修改数量private WMSResultDataDTOData ProcessReceivement(string docNo, RTNHeadData rtnHeadData) { var resultData = new WMSResultDataDTOData(); Receivement receivement = Receivement.Finder.Find(string.Format("DocNo = '{0}' and Org = {1}", docNo, Context.LoginOrg.ID)); if (receivement == null) throw new Exception("找不到销售退回收货单据，DocNo=" + docNo); foreach (RTNLineData rtnLineData in rtnHeadData.SoRcvLineList) { int docLineNo = int.Parse(rtnLineData.DocLineNo); decimal newQty = decimal.Parse(rtnLineData.Qty); using (Session session = Session.Open()) { for (var i = 0; i < receivement.RcvLines.Count; i++) { if (receivement.RcvLines[i].DocLineNo == docLineNo) { _logger.LogInfo(string.Format("[退货处理] - 更新到货数量：DocNo={0}, LineNo={1}, 原数量={2}, 新数量={3}", docNo, docLineNo, receivement.RcvLines[i].ArriveQtyTU, newQty)); //数量为0则删除该行 if (newQty == decimal.Zero) { receivement.RcvLines.RemoveAt(i); continue; } #region 我自己的 receivement.RcvLines[i].ArriveQtyTU = receivement.RcvLines[i].EyeballingQtyTU = receivement.RcvLines[i].RcvQtyTU = Math.Round(Convert.ToDecimal(newQty), 4); receivement.RcvLines[i].ArriveQtyPU = receivement.RcvLines[i].EyeballingQtyPU = receivement.RcvLines[i].RcvQtyPU = Math.Round(Convert.ToDecimal(newQty), 4); receivement.RcvLines[i].ArriveQtySU = receivement.RcvLines[i].EyeballingQtySU = receivement.RcvLines[i].RcvQtySU = Math.Round(Convert.ToDecimal(newQty), 4); receivement.RcvLines[i].ArriveQtyCU = receivement.RcvLines[i].EyeballingQtyCU = receivement.RcvLines[i].RcvQtyCU = Math.Round(Convert.ToDecimal(newQty), 4); receivement.RcvLines[i].ArriveQtyTBU = receivement.RcvLines[i].EyeballingQtyTBU = receivement.RcvLines[i].RcvQtyTBU = 0; //拒收数量 receivement.RcvLines[i].RejectQtyTU = Decimal.Zero; receivement.RcvLines[i].RejectQtyTBU = Decimal.Zero; receivement.RcvLines[i].RejectQtySU = Decimal.Zero; receivement.RcvLines[i].RejectQtyPU = Decimal.Zero; receivement.RcvLines[i].RejectQtyCU = Decimal.Zero; //可立账数量 receivement.RcvLines[i].CanAPConfirmQtyTU = Math.R…

🌟 Linux 内存交换空间（Swap）的完整教程
type: item
date: 2025-03-20T09:22:00+08:00
description: ✅ 1. 什么是 Swap？Swap（交换空间） 是 Linux 系统中用于辅助物理内存（RAM）的一种虚拟内存。它在物理内存不足时，将部分数据临时存储在磁盘上的专用空间中，从而缓解内存压力，防止系统崩溃。物理内存（RAM）： 系统主要运行数据的临时存储区域，速度快。交换空间（Swap）： 当物理内存不足时，Linux 将部分数据换出到 Swap 中，释放 RAM 以供其他进程使用。✅ 作用防止内存溢出：当内存不够时，使用 Swap 避免程序崩溃。支持休眠：休眠时，RAM 数据写入到 Swap 中。系统性能优化：适当的 Swap 可提高系统稳定性。✅ 缺点速度慢：磁盘 I/O 速度远低于 RAM，频繁使用 Swap 会显著降低性能。磁盘磨损：在 SSD 上使用 Swap 可能会影响寿命。🔥 2. 查看当前 Swap 信息在 Linux 中，常用以下命令查看 Swap 使用情况：# 查看 Swap 使用情况 free -h # 查看 Swap 分区信息 swapon --show # 查看 Swap 空间大小和使用率 cat /proc/swaps # 使用 htop 查看内存和 Swap 信息 htop✅ 示例输出$ free -h total used free shared buff/cache available Mem: 7.8Gi 2.5Gi 4.3Gi 237Mi 1.0Gi 4.8Gi Swap: 2.0Gi 512Mi 1.5Gitotal：总内存大小。used：已使用的 Swap 空间。free：可用 Swap 空间。⚙️ 3. 创建 Swap 空间如果你的系统没有 Swap 分区或想要扩展 Swap 空间，可以手动创建：🛠️ 3.1 创建 Swap 文件1️⃣ 创建一个新的 Swap 文件sudo fallocate -l 2G /swapfile # 创建 2G Swap 文件 # 如果 fallocate 不支持，可以使用 dd 命令 # sudo dd if=/dev/zero of=/swapfile bs=1M count=20482️⃣ 设置正确权限sudo mkswap /swapfile3️⃣ 格式化为 Swap 格式sudo mkswap /swapfile4️⃣ 启用 Swap 文件sudo swapon /swapfile5️⃣ 验证 Swap 状态swapon --show✅ 示例输出NAME TYPE SIZE USED PRIO /swapfile file 2G 0B -26️⃣ 永久生效 将 Swap 文件添加到 /etc/fstab：echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab🛠️ 4. 调整 Swap 大小如果你想扩展或缩小现有的 Swap 空间：1️⃣ 禁用当前 Swapsudo swapoff /swapfile2️⃣ 调整 Swap 大小sudo fallocate -l 4G /swapfile # 扩展为 4G sudo chmod 600 /swapfile sudo mkswap /swapfile3️⃣ 重新启用sudo swapon /swapfile⚙️ 5. 删除 Swap 空间如果不再需要 Swap 文件，可以删除：1️⃣ 禁用 Swapsudo swapoff /swapfile2️⃣ 移除配置 编辑 /etc/fstab 文件，删除相关行：/swapfile swap swap defaults 0 03️⃣ 删除 Swap 文件sudo rm /swapfile🔧 6. 调优 Swap 设置Linux 使用 swappiness 参数控制内核在内存不足时使用 Swap 的倾向：0：尽量避免使用 Swap，仅在 RAM 不足时使用。1-100：数值越大，越倾向于使用 Swap。一般服务器推荐值：10-30桌面系统推荐值：60✅ 查看当前 swappinesscat /proc/sys/vm/swappiness✅ 临时修改 swappinesssudo sysctl vm.swappiness=10✅ 永久修改 swappiness 编辑 /etc/sysctl.conf：sudo nano /etc/sysctl.conf添加：vm.swappiness=10保存后生效：sudo sysctl -p📊 7. Swap 与性能优化建议服务器环境Swap 文件大小：物理内存的 1~2 倍。swappiness：10~30，减少对磁盘的依赖。桌面环境Swap 文件大小：等于物理内存大小。swappiness：60~80，保证内存溢出时不崩溃。特殊情况如果使用 SSD…

RustDesk 远程控制软件私有化部署指南
type: item
date: 2025-03-11T17:08:00+08:00
description: 1. RustDesk 简介RustDesk 是一款开源的远程桌面软件，支持 Windows、Linux、macOS、Android 和 iOS 平台。与 TeamViewer、AnyDesk 等远程控制软件类似，RustDesk 允许用户远程访问和管理计算机，但不同之处在于它支持私有化部署，可以自建服务器以确保数据的安全性和隐私性。2. 为什么选择 RustDesk 私有化部署？数据安全：远程连接数据存储在自己的服务器上，避免泄露风险。低成本：无需购买商业远程控制软件的许可证。高可控性：可以自定义服务器配置，满足企业级需求。3. RustDesk 私有化部署组件RustDesk 私有化部署涉及两个核心组件：HBBS（RustDesk Server）：用于管理客户端连接。HBBR（RustDesk Relay）：用于转发远程桌面数据。4. 服务器环境准备4.1 服务器要求操作系统：Linux（推荐 Ubuntu 20.04+ 或 CentOS 7+）CPU：双核及以上内存：2GB 及以上磁盘：10GB 以上网络：拥有公网 IP（如果服务器在内网，则需要配置端口映射）4.2 开放端口端口作用21115用于客户端注册（TCP）21116用于 ID 服务器（TCP）21117用于中继服务器（TCP/UDP）5. RustDesk 私有服务器部署5.1 下载 RustDesk 服务器端mkdir -p /opt/rustdesk && cd /opt/rustdesk wget https://github.com/rustdesk/rustdesk-server/releases/latest/download/hbbs wget https://github.com/rustdesk/rustdesk-server/releases/latest/download/hbbr chmod +x hbbs hbbr5.2 启动服务器启动 hbbr（中继服务器）nohup ./hbbr &启动 hbbs（ID 服务器）nohup ./hbbs -r <服务器IP>:21117 &示例：如果服务器 IP 为 192.168.1.100，则命令如下：nohup ./hbbs -r 192.168.1.100:21117 &6. 配置客户端使用私有服务器在客户端（Windows、Linux、macOS）上，需要配置 RustDesk 以使用自建服务器。6.1 Windows 客户端打开 RustDesk。点击 设置（Settings）。在 ID/Relay Server 中，输入服务器地址（如 192.168.1.100:21115）。关闭 RustDesk 并重新打开，即可使用私有服务器。6.2 Linux/macOS 客户端echo "192.168.1.100:21115" > ~/.config/rustdesk/server7. RustDesk 服务器后台运行与开机自启7.1 创建 Systemd 服务创建 hbbr 服务cat <<EOF | sudo tee /etc/systemd/system/hbbr.service [Unit] Description=RustDesk Relay Server After=network.target [Service] ExecStart=/opt/rustdesk/hbbr Restart=always User=root [Install] WantedBy=multi-user.target EOF创建 hbbs 服务cat <<EOF | sudo tee /etc/systemd/system/hbbs.service [Unit] Description=RustDesk ID Server After=network.target [Service] ExecStart=/opt/rustdesk/hbbs -r 192.168.1.100:21117 Restart=always User=root [Install] WantedBy=multi-user.target EOF7.2 启动服务并设置开机自启sudo systemctl daemon-reload sudo systemctl enable hbbr hbbs sudo systemctl start hbbr hbbs8. 验证部署8.1 检查服务是否运行sudo systemctl status hbbr hbbs如果输出显示 active (running)，说明服务已成功运行。8.2 测试远程连接在客户端 RustDesk 中输入目标设备的 ID。尝试远程连接。如果能成功连接，说明私有化部署…