2022.10.EEP開發筆記-1

发布于:2022-12-02 ⋅ 阅读:(563) ⋅ 点赞:(0)
做 IT 这么多年,一直都有工作笔记的习惯。可能是纸本,也可能是WORD档。因为 IT 真的要学很多很多东西。而且在不同公司的 IT 单位,使用不同的系统,不同的开发语言,不同的数据库。学习力太差,很难在这行混下去。

更何况,本人命运多舛,1998年工作以来,多次因为各种因素中断职涯。每次重返职场必然又是打掉重练的过程。

今年的新工作,使用了一家颇有历史的软体公司开发平台。至少在我印象中,在微软推出Visual Studio 2005时,这家公司就推出第一代物件导向的开发平台。又是一番下苦功学习的过程。

无论如何过去已不可追,那就从现在开始好好练功吧。

刚好我手上有一个做了五个月,分五阶段上线的项目结案了。今天趁着休假,把过去工作上的实作成果稍微整理一下。这里不介绍系统化的语法学习,网路上已经有很多免费的资源,而且还整理的很棒。

作笔记的第一步,就是拟出架构及大纲。我使用的文书软件是WPS。下图为今日已完成的筆記大綱,目前进度到第5点,后续依照进度随时更新大纲。

1b599f07422f49ac81afd1c475734c2b.png

以下依序介绍相关语法。如果有写的不对的,欢迎来信指教。

1.如何实现不同MENU点进去,在查询列表datagrid显示同资料表但不同业务别表单资料?

 

 

1-1.举例说明,在MENU设定中,加入SHOWCR=NXX11的参数值。语法如下:

FLOWFILENAME=FL\FLOWNAME&NAVMODE=Normal&FLNAVMODE=Submit&SHOWCR=NXX11
  • 1-2.在.aspx里面,取出MENU传入的SHOWCR。并将SHOWCR加入datagrid的wherestr过滤条件。语法:
function dgMaster_onbeforeload(param) {
          p_showcr = $.getEncryptParameter('SHOWCR');
          p_wherestr = param.whereStr;
          p_wherestr = p_wherestr + " (SHOWCR = '" + p_showcr + "') ";
}

1-3.新增资料的时候,须将SHOWCR存入表单实体栏位。之后才能以SHOWCR为索引值取出资料。

 

2.承上,处理各种取不到MENU参数的情况。

2-1.如果是FL点入,则要改抓datagrid的SHOWCR栏位值。然而因为没有MENU传入SHOWCR参数,所以SHOWCR如果无法判读为空值,要做undefined处理。

function dgMaster_onbeforeload(param) {
if (typeof p_showcr == 'undefined' 
    || typeof p_showcr == undefined 
    || p_showcr == "") 
  { p_showcr = ""; } 
}
function dgMaster_OnLoad() {
 if (p_showcr == '') { p_showcr = rows[i].SHOWCR; 
}

 

3.如何实现新增表单时,以客户编号自动复制最后结案单据的功能?

需求内容:如果该客户有已结案的表单,取最后结案表单资料带入新表单。如果该客户没有已结案表单,则带入客户统编建立空白新表单。

3-1.在datagrid之前,新增输入客户统编、交易对手文字方块的div。预设为不显示。

<div id="div_copy" style="display: none;">
        <p style="color: red; text-align: left">
            请输入完整统一编号:<input id="copy_gui" type="text" />
            请输入交易对手(可模糊比对):<input id="copy_trn_cust" type="text" />
        </p>
</div>

3-2.新增function copy_ok,取代datagrid新增按钮onclick事件insert_row。

规则内容:取出user在文字框输入的客户统编、交易对手。如果user没有指定客户统编就点击新增按钮,则执行insert_row 指令。

function copy_ok() {
        p_copy_gui_id = document.getElementById('copy_gui').value;
        p_copy_trn_cust = document.getElementById('copy_trn_cust').value;
        if (p_copy_gui_id == '' || p_copy_gui_id == null) {
                $('#dgMaster').datagrid("insert_row", 0);
                $('#dgMaster').datagrid("load");
            } else { 
            p_copy_load = 'Y'; $('#dgMaster').datagrid("load");         }
}

3-3.新增function copy_row2,取代datagrid复制按钮onclick事件copy_row。

function copy_row2() {
            copy_index = $('#dgMaster').datagrid('getSelectedIndex');
            if (copy_index == -1) {
                alert('请先点击要复制的资料,再点【复制】按钮');
            } else {
                var rows = $('#dgMaster').datagrid('getRows');
                p_copy_docid = '';
                p_copy_docid = rows[copy_index].DOC_ID;
                $('#dgMaster').datagrid("copy_row", copy_index);
                $('#dgMaster').datagrid("load");  } 
}

3-4.承上,在dgMaster_onbeforeload加上过滤条件。

规则内容:须加上判断是否按新增且有输入客户统编进来的。否则其他情况loaddata会有问题。

 function dgMaster_onbeforeload(param) {
        if (p_copy_load == 'Y') {
            if (p_copy_gui_id == "" || p_copy_gui_id == null) {    } 
                else {   p_wherestr = p_wherestr
                              + " and MA_GUI_ID = '" + p_copy_gui_id + "' " 
                              + " and DOC_ID = FN_PREF_LASTDOCID('" + p_copy_gui_id + "','" 
                               + p_showcr + "','" + p_copy_trn_cust + "','PREA') ";   }  
} 

3-5.承上,在数据库新增FN_LASTDOCID,带入客户统编、交易对手、单据类别),计算后传出最后结案单号。SQL语法如下。

CREATE OR REPLACE FUNCTION FN_PPPP(in_gui_id IN VPPACHPPA2,in_showcr IN VPPACHPPA2,in_trn_cust IN VPPACHPPA2,in_PP IN VPPACHPPA2 ) RETURN VPPACHPPA2 AS
  v_ret  VPPACHPPA2(100) := '';

BEGIN
  /*
    202209——michelle - PP_PPPP  - 依 DOC_ID + TRN_CUST 交易对手,取客户最后结案表单
    1.须注意交易对手的null判断处理
    2.PPF:
    3.PPA:
    4.其他表单(英文版)以此类推
*/
  case
    /*PPF*/
when in_PPF='PPF' then
SELECT max(t2.doc_id)
into v_ret
from PP_PPPP t2
where t2.MA_GUI_ID=in_gui_id
and t2.SHOWCR = in_showcr
and ((t2.MA_TRN_CUST like ('%'|| in_trn_cust ||'%')) or (t2.MA_TRN_CUST is null and in_trn_cust is null))
and t2.Ma_End_Date is not null
and t2.Ma_End_Date =
(select max(t3.Ma_End_Date)
from PP_PPPP t3
where t3.ma_gui_id = in_gui_id
and t3.showcr = in_showcr
and ((t3.MA_TRN_CUST like ('%'|| in_trn_cust ||'%')) or (t3.MA_TRN_CUST is null and in_trn_cust is null))
and t3.Ma_End_Date is not null
)
;

/PPA*/
when in_PPF='PPA' then
SELECT max(t2.doc_id)
into v_ret
from PP_PPPP_PPA t2
where t2.MA_GUI_ID=in_gui_id
and t2.SHOWCR = in_showcr
and ((t2.MA_TRN_CUST like ('%'|| in_trn_cust ||'%')) or (t2.MA_TRN_CUST is null and in_trn_cust is null))
and t2.Ma_End_Date is not null
and t2.Ma_End_Date =
(select max(t3.Ma_End_Date)
from PP_PPPP_PPA t3
where t3.ma_gui_id = in_gui_id
and t3.showcr = in_showcr
and ((t3.MA_TRN_CUST like ('%'|| in_trn_cust ||'%')) or (t3.MA_TRN_CUST is null and in_trn_cust is null))
and t3.Ma_End_Date is not null
)
;
end case;

   RETURN v_ret;

EXCEPTION
  WHEN NO_DATA_FOUND THEN
    RETURN v_ret;
  WHEN OTHERS THEN
   RETURN v_ret;
END;
/

4.如何实现datagrid的过滤功能,只显示跟自己及同群组的资料?

以PPPP为例,user可以查跟自己同部门、不分角色的所有资料。例如:A515、B515、C515为同部门不同角色。则以中间515数字为资料群组判断基础。

 function dgMaster_onbeforeload(param) {
        p_wherestr = p_wherestr 
            + " and ((substr(creator_roleid,2,3) in (select substr(groupid,2,3) from USERSANDGROUPS where userid='" 
            + p_userid + "')) " 
            + " or (creator = '" + p_userid + "' or creator ='" + p_username + "')) "; 
} 

 

5.如何实现datagrid的排序功能?

以PPPP为例,如果user没有设定排序,就会以单号由大到小排序。

 function dgMaster_onbeforeload(param) {
            if (param.sort == "" || param.sort == undefined || param.sort == "undefined") {
                param.sort = "DOC_ID";
                param.order = "DESC";                       
            } 
} 
  • (待续)

 

 


网站公告

今日签到

点亮在社区的每一天
去签到