动态表单行转列快输入再列转行到单据
A单据
import clr clr.AddReference('System') clr.AddReference('System.Data') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.App') clr.AddReference('Kingdee.BOS.ServiceHelper') clr.AddReference('Newtonsoft.Json') from Kingdee.BOS import * from Kingdee.BOS.Util import * from Kingdee.BOS.Core import * from Kingdee.BOS.Core.Bill import * from Kingdee.BOS.Core.DynamicForm.PlugIn import * from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import * from System import * from System.Data import * from System.Net import * from System.Text import * from System.IO import * from Kingdee.BOS.Core.Bill.PlugIn import * from Kingdee.BOS.App.Data import * from System.Collections.Generic import List from Kingdee.BOS.ServiceHelper import * def ChildFromClosed(obj): newDic= obj.ReturnData; djzt=this.View.Model.GetValue("FDocumentStatus"); if djzt in ['B','C']:return; entity="FSaleOrderEntry"; #解析数据并写入单据体 objstr=JsonUtil.Serialize(newDic); #this.View.ShowMessage(objstr); #return ii=this.View.Model.GetEntryRowCount(entity); fms=newDic["pm"].Count-1; #this.View.Model.BatchCreateNewEntryRow(entity,fms); a=this.View.Model.GetEntryCurrentRowIndex(entity); b=int(newDic['hh']) c=0 wlid=newDic["mx"]["FMaterialId_Id"]; for c in range(fms): this.View.Model.CopyEntryRow(entity,b,b+1,False) #this.View.Model.SetValue("FMaterialId",wlid,b); #this.View.UpdateView("FMaterialId"); #this.View.Model.SetItemValueByNumber("FAuxPropId",wlid,ms); this.View.UpdateView(entity); for key, value in newDic["pm"].items(): if value != 0: this.View.Model.SetItemValueByNumber("$$FAuxPropId__FF100001", key, b) this.View.Model.SetValue("FQty", value,b) b=b+1 #this.View.ShowNotificationMessage(str(i)+"-"+str(fms)) return; def EntryBarItemClick(e): if e.BarItemKey.upper()=='XKS': djzt=this.View.Model.GetValue("FDocumentStatus"); if djzt in ['B','C']:return; entity="FSaleOrderEntry"; rowindex=this.View.Model.GetEntryCurrentRowIndex(entity); wlObj=this.View.Model.GetValue("FMaterialId",rowindex); if wlObj is None:return; if wlObj["Id"] is None:return; dic={}; wlid=wlObj["Id"]; cppm=wlObj["F_X_Assistant_pm"]; if cppm is None: return; dic['wlId']=wlid; dic['wlNumber']=wlObj["Number"]; dic['pmid']=cppm['Id']; dic['lbfh']=1; dic['dqhh']=str(rowindex); dic['xszz']=this.View.Model.GetValue("FSaleOrgId")["Id"]; #objstr=JsonUtil.Serialize(dic); #this.View.ShowMessage(str(rowindex)); dynamicFormShowParameter = DynamicFormShowParameter(); guid = str(Guid.NewGuid()); dynamicFormShowParameter.PageId=guid; dynamicFormShowParameter.FormId="X_so_fmks";#动态表单子页面FormID dynamicFormShowParameter.CustomComplexParams.Add("DIC", dic); this.View.ShowForm(dynamicFormShowParameter, Action[FormResult](ChildFromClosed));
B 动态表单
import clr clr.AddReference('System') clr.AddReference('System.Data') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.App') clr.AddReference('Kingdee.BOS.ServiceHelper') clr.AddReference('Newtonsoft.Json') from Kingdee.BOS import * from Kingdee.BOS.Core import * from Kingdee.BOS.Core.Bill import * from Kingdee.BOS.Util import * from Kingdee.BOS.Core.DynamicForm.PlugIn import * from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import * from System import * from System.Data import * from System.Net import * from System.Text import * from System.IO import * from Kingdee.BOS.Core.Bill.PlugIn import * from Kingdee.BOS.App.Data import * from System.Collections.Generic import List from Kingdee.BOS.ServiceHelper import * global colList; global cshh def clpm(e): global colList; pm=this.View.Model.GetValue("F_X_dlpm")["FNumber"]; sql="select replace(upper(a.FNUMBER),'"+str(pm)+"-','F_')as FNumber,b.FDATAVALUE,replace(a.FNUMBER,'"+str(pm)+"-','')as coltext from T_BAS_ASSISTANTDATAENTRY a ,T_BAS_ASSISTANTDATAENTRY_L b"; sql=sql+" where a.fid='65558e5812c45f' and a.FDOCUMENTSTATUS='C' and a.FENTRYID=b.FENTRYID and b.FLOCALEID=2052 and a.FNUMBER like '"+str(pm)+"-%'"; entryData = DBServiceHelper.ExecuteDataSet(this.Context, sql); if entryData is None: return pms=len(entryData.Tables[0].Rows); if pms== 0:return; colList=[row[0] for row in entryData.Tables[0].Rows]; i=0; for i in range(36): tCol ="F_A"+str(i); this.View.GetControl[EntryGrid]("FEntity").UpdateHeader(tCol,"a"+str(i)); this.View.GetControl(tCol).Visible = True; for i in range(36): tCol ="F_A"+str(i); if tCol not in colList: control = this.View.GetControl(tCol); if control is not None and tCol not in colList: control.Visible = False; for i in range(len(entryData.Tables[0].Rows)): dr = entryData.Tables[0].Rows[i] control = this.View.GetControl(dr["FNumber"]) if control is not None: this.View.GetControl[EntryGrid]("FEntity").UpdateHeader(dr["FNumber"], dr["FDATAVALUE"]); this.View.UpdateView("FEntity"); def AfterBindData(e): global cshh dic=this.View.OpenParameter.GetCustomParameter("DIC"); if dic is not None: pmid=dic["pmid"]; wlid=dic["wlId"]; cshh=dic["dqhh"]; xszz=dic["xszz"]; this.View.Model.SetValue("FSaleOrgId",xszz); this.View.UpdateView("FSaleOrgId"); this.View.InvokeFieldUpdateService("FSaleOrgId",0); this.View.Model.SetValue("F_X_dlpm",pmid); this.View.InvokeFieldUpdateService("F_X_dlpm",0); this.View.UpdateView("F_X_dlpm"); this.View.Model.SetValue("F_X_cshh",cshh); this.View.UpdateView("F_X_cshh"); this.View.Model.SetValue('F_X_cpbm',wlid,0); this.View.InvokeFieldUpdateService("F_XVKJ_cpbm",0); this.View.UpdateView("F_X_cpbm"); this.View.UpdateView("F_X_cpmc"); this.View.UpdateView("F_X_ywys"); this.View.UpdateView("F_X_ywms"); this.View.UpdateView("F_X_zwys"); this.View.UpdateView("F_X_cpkh"); this.View.Model.SetValue('FMaterialId',wlid,0); this.View.InvokeFieldUpdateService("FMaterialId",0); this.View.InvokeFieldUpdateService(" F_cmsl",0); this.View.UpdateView("FEntity"); clpm("FEntity"); def DataChanged(e): return; def BarItemClick(e): global colList; key=e.BarItemKey.ToUpper(); if(key=="tbReturn".ToUpper()): pm=this.View.Model.GetValue("F_X_dlpm")["FNumber"]; curRowData = this.View.Model.GetEntityDataObject(this.View.BusinessInfo.GetEntity('FEntity'), 0) processed_colList = [key[2:].lower() for key in colList] pmmx = {pm + "-" + key: getattr(curRowData, key, 0) for key in processed_colList if getattr(curRowData, key, 0) != 0} newDic={}; newDic['mx']=curRowData newDic['cm']=processed_colList newDic['hh']=cshh newDic['pm']=pmmx this.View.ReturnToParentWindow(newDic); this.View.Close();
谢谢CQ周玉立老师及黑大帅的指导
动态表单行转列快输入再列转行到单据
A单据import clrclr.AddReference('System')clr.AddReference('System.Data')clr.AddReference('Kingdee.BOS')clr.AddReference('Kingdee.B...
点击下载文档
本文2024-09-16 18:06:21发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-19978.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章