NiuBoYi - U9
type: channel
link: https://disc.liu-yu.top/index.php/category/U9/
items: 库存结余数量
items: U9查询值集值和枚举值sql
items: U9页面字段联动代码
items: 请款单生成请款确认单
items: U9获取组织公共参数sql
items: 创建供应商
items: 销售退货修改数量库位存储地点、采购退货修改数量库位存储地点
items: 批量创建料品示例代码
items: 应付余额报表
items: 退货生成应收

库存结余数量
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…

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…

批量创建料品示例代码
type: item
date: 2025-03-04T10:49:00+08:00
description: BP名：BatchCreateItemByDTOSRVProxy命名空间：UFIDA.U9.ISV.Item.Proxydll：C:\yonyou\U9V60\Portal\ApplicationServer\Libs\UFIDA.U9.ISV.Item.Agent.dll示例代码using System; using System.Collections.Generic; using System.Data; using Cust.QR.ZJLHBP.Public; using UFIDA.U9.Base; using UFIDA.U9.Base.Organization; using UFIDA.U9.Base.PropertyTypes; using UFIDA.U9.CBO.Pub.Controller; using UFIDA.U9.CBO.Pub.Controller.Proxy; using UFIDA.U9.CBO.SCM.Item; using UFIDA.U9.CBO.SCM.TallyBy; using UFIDA.U9.ISV.Item.Proxy; using UFSoft.UBF.AopFrame; using UFSoft.UBF.Business; using UFSoft.UBF.PL.Engine; using ItemInspectionInfoDTOData = UFIDA.U9.ISV.Item.ItemInspectionInfoDTOData; using ItemInvInfoDTOData = UFIDA.U9.ISV.Item.ItemInvInfoDTOData; using ItemMasterDTOData = UFIDA.U9.ISV.Item.ItemMasterDTOData; using ItemMFGInfoDTOData = UFIDA.U9.ISV.Item.ItemMFGInfoDTOData; using ItemMRPInfoDTOData = UFIDA.U9.ISV.Item.ItemMRPInfoDTOData; using ItemPurchaseInfoDTOData = UFIDA.U9.ISV.Item.ItemPurchaseInfoDTOData; using ItemSaleInfoDTOData = UFIDA.U9.ISV.Item.ItemSaleInfoDTOData; internal partial class AutoCreateItemImpementStrategy : BaseStrategy { public AutoCreateItemImpementStrategy() { } public override object Do(object obj) { AutoCreateItem bpObj = (AutoCreateItem)obj; Logger logger = Logger.GetInstance(); //所有料品都有数据中心（00）创建然后下发 Organization org = Organization.Finder.Find("Code = '00'"); // 需要生成流水号的料品 ItemMaster.EntityList itemMasters = ItemMaster.Finder.FindAll( string.Format("Description = '需要建流水号' and Org = '{0}' and code = '0101000001' ", org.ID)); foreach (ItemMaster itemMaster in itemMasters) { if (itemMaster.Code.Contains(".")) { continue; } // 右匹配查看生成流水号的料品 string sql = string.Format( @"select id,code from CBO_ItemMaster where code like '{0}%' and DescFlexField_PrivateDescSeg15 != 'true' and org = '{1}' ORDER BY CreatedOn DESC; select id from CBO_ItemMaster where code like '{0}%' and org = '{1}'; ", itemMaster.Code + ".",org.ID); // 执行sql DataSet dataset = PubHelper.RunSQLOutDataSet(sql, null…

应付余额报表
type: item
date: 2025-02-07T15:13:00+08:00
description: create table #APDirectTmp (ID bigint, APStatementDirect int) -- 付款单据类型 insert into #APDirectTmp select A.[ID], A.[APStatementDirect] from AP_PayDocType as A create table #AccrueSupplierTmp (AccrueSupplierSite_ID bigint, Org_IsAuditOrg bit, Org_IsOperatingOrg bit, AccrueSupplier_ID bigint, AccrueSupplierSite_Territory_CombineName nvarchar(255), AccrueSupplier_CombineName nvarchar(255), AccrueSupplier_Territory_CombineName nvarchar(255), AccrueSupplier_Category_CombineName nvarchar(255), AccrueSupplier_Category_ID bigint, AccrueSupplier_Territory_ID bigint, AccrueSupplierSite_Territory_ID bigint) insert into #AccrueSupplierTmp select A.[ID] as [AccrueSupplierSite_ID], --供应商位置ID A2.[IsAuditOrg] as [Org_IsAuditOrg], --核算组织 A2.[IsOperatingOrg] as [Org_IsOperatingOrg], -- 营运组织 A1.[ID] as [AccrueSupplier_ID], -- 供应商ID A6.[CombineName] as [AccrueSupplierSite_Territory_CombineName],--地区名称 A7.[CombineName] as [AccrueSupplier_CombineName], --供应商名称 A8.[CombineName] as [AccrueSupplier_Territory_CombineName], --地区名称 A9.[CombineName] as [AccrueSupplier_Category_CombineName], --供应商分类名称 A3.[ID] as [AccrueSupplier_Category_ID], --供应商ID A4.[ID] as [AccrueSupplier_Territory_ID], --地区ID A5.[ID] as [AccrueSupplierSite_Territory_ID] --地区ID from CBO_SupplierSite as A -- 供应商位置 left join [CBO_Supplier] as A1 on (A.[Supplier] = A1.[ID]) -- 供应商 left join [Base_Organization] as A2 on (A1.[Org] = A2.[ID]) -- 组织 left join [CBO_SupplierCategory] as A3 on (A1.[Category] = A3.[ID]) -- 供应商分类 left join [Base_Territory] as A4 on (A1.[Territory] = A4.[ID]) -- 地区 left join [Base_Territory] as A5 on (A.[Territory] = A5.[ID]) -- 地区 left join [Base_Territory_Trl] as A6 on (A6.SysMlFlag = 'zh-CN') and (A5.[ID] = A6.[ID]) --地区TRl left join [CBO_Supplier_Trl] as A7 on (A7.SysMlFlag = 'zh-CN') and (A1.[ID] = A7.[ID]) -- 供应商TRL left join [Base_Territory_Trl] as A8 on (A8.SysMlFlag = 'zh-CN') and (A4.[ID] = A8.[ID]) --地区TRl left join [CBO_SupplierCategory_Trl] as A9 on (A9.SysMlFlag = 'zh-CN') and (A3.[ID] = A9.[…

退货生成应收
type: item
date: 2025-02-07T11:19:00+08:00
description: ⚠️ 注意事项 目前仅知道V60可用：BP名：RMAPushARBillBPProxy命名空间：UFIDA.U9.SM.RMA.Proxydll： C:\yonyou\U9V60\Portal\ApplicationServer\Libs\UFIDA.U9.SM.SMBP.Agent.dll示例代码RMA rma = RMA.Finder.Find( string.Format("DocNo = '{0}' and Org = {1}", "RMA1002932",Context.LoginOrg.ID)); if (rma.RMALines[0].DescFlexField == null || string.IsNullOrEmpty(rma.RMALines[0].DescFlexField.PrivateDescSeg2)) continue; RMAPushARBillBPProxy proxy = new RMAPushARBillBPProxy(); proxy.RMAKey = rma.Key.ID; proxy.BillingMode = rma.BillingMode.Value; proxy.RMALineKeys = new List<long>(); foreach (RMALine rmaRmaLine in rma.RMALines) { proxy.RMALineKeys.Add(rmaRmaLine.ID); } proxy.Do(); // 提交 ARBillSubmitBatchBPProxy arBillSubmitBatchBpProxy = new ARBillSubmitBatchBPProxy(); arBillSubmitBatchBpProxy.ARBillHeadDTOs = new List<IDSysVersionDTOData>(); // 查找来源退货单的应收单 ARBillHead arBillHead = ARBillHead.Finder.Find(string.Format("SrcBillID = '{0}'", rma.ID)); if (arBillHead != null) { IDSysVersionDTOData idSysVersionDtoData = new IDSysVersionDTOData(); idSysVersionDtoData.SysVer = arBillHead.SysVersion; idSysVersionDtoData.EntityID = arBillHead.ID; arBillSubmitBatchBpProxy.ARBillHeadDTOs.Add(idSysVersionDtoData); } arBillSubmitBatchBpProxy.Do(); // 审核 ARBillApproveBatchBPProxy arBillApproveBatchBpProxy = new ARBillApproveBatchBPProxy(); arBillApproveBatchBpProxy.ARBillHeadDTOs = new List<IDSysVersionDTOData>(); if (arBillHead != null) { IDSysVersionDTOData idSysVersionDtoData = new IDSysVersionDTOData(); idSysVersionDtoData.SysVer = arBillHead.SysVersion; idSysVersionDtoData.EntityID = arBillHead.ID; arBillApproveBatchBpProxy.ARBillHeadDTOs.Add(idSysVersionDtoData); } arBillApproveBatchBpProxy.Do();