|
问题:合同订单、服务合同等产品分录中如何给一个字段增加下拉选项?
解决办法:单据分录定制中新增文本类型的字段,然后到 ld_producttoolfield 表中根据模块tabid和
字段的名称fieldlabel,查询到字段的 columnname,最后修改脚本并执行脚本。
这里以自定义单据分录字段 sf837 为例;
操作步骤:
1、在Navicat数据库工具中录入sql语句;
SET @columnname='sf837';
2、修改字段类型为下拉框字段;
UPDATE ld_producttoolfield SET uitype=60 WHERE columnname=@columnname;
3、设置下拉框选项;
SET @listvalue1='AAAAAAAA';
SET @listvalue2='BBBBBBBB';
SET @listvalue3='CCCCCCCC';
4、插入下拉框字段到 ld_picklist_set 表;
INSERT INTO ld_picklist_set(listname,relatetable)
SELECT @columnname,'ld_producttoolfield' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM ld_picklist_set WHERE listname=@columnname AND relatetable='ld_producttoolfield');
SET @listid=(SELECT listid FROM ld_picklist_set WHERE relatetable='ld_producttoolfield' AND listname=@columnname LIMIT 1);
SET @i=IFNULL((SELECT MAX(sequence) FROM ld_picklist_values WHERE listid=@listid),0);
5、插入下拉选项到表 ld_picklist_values;
INSERT INTO ld_picklist_values(listid,listvalue,sequence)
SELECT @listid,@listvalue1,(@i:=@i+1) FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM ld_picklist_values WHERE listid=@listid AND listvalue=@listvalue1);
INSERT INTO ld_picklist_values(listid,listvalue,sequence)
SELECT @listid,@listvalue2,(@i:=@i+1) FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM ld_picklist_values WHERE listid=@listid AND listvalue=@listvalue2);
INSERT INTO ld_picklist_values(listid,listvalue,sequence)
SELECT @listid,@listvalue3,(@i:=@i+1) FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM ld_picklist_values WHERE listid=@listid AND listvalue=@listvalue3);
6、修改相应脚本并执行该脚本。
|
|