fs-danaus
2024-03-16 a2ecbf17d6ba1c7b135fe10bb4cdfefa05b75add
src/com/yc/service/build/type/v2/BaseImpl.java
@@ -2,6 +2,8 @@
import com.yc.action.grid.GridUtils;
import com.yc.action.grid.TreeGridIfc;
import com.yc.api.bean.T9685Entity;
import com.yc.api.service.ApiServiceIfc;
import com.yc.service.BaseService;
import com.yc.service.build.BuildFuncIfc;
import com.yc.service.build.top.v2.BuildTopIfc;
@@ -36,12 +38,14 @@
    protected GformIfc gformIfc;
    @Autowired
    private BuildTopIfc buildTopIfc;
    @Autowired
    private ApiServiceIfc apiServiceIfc;
    @Autowired
    protected PanelServiceIfc pIfc;
    public static String BEAN_INFO = "beaninfo";
    private static String GFORM_SQL = " isTitle,formname,showdetail,isopenFuncshowpwdedit,isshowpwdedit,optype,HDTable,version,dataformid,formdatafilters,panellabellayout,CancelBtnProcName,CancelBtnExpression,CancelBtnEditStatus,CancelBtnName,RevokeBtnProcName,RevokeBtnExpression,RevokeBtnEditStatus,isShowOnlineMsg,isShowProcessTracking,autoOpen,predocstatus,procgroupaftersavedoc,dealafterdocsave,transgroupcode,dttable,isShowNewDocButton,isshowinserialbtn,inserialbtneditstatus,isshowoutserialbtn ,outserialbtneditstatus,isshowonlinepaymentbutton,isshowgridstyleforapp,popupWindowsHeightRate ";
    private static String GFORM_SQL = " isTitle,formname,showdetail,isopenFuncshowpwdedit,isshowpwdedit,optype,HDTable,version,dataformid,formdatafilters,panellabellayout,CancelBtnProcName,CancelBtnExpression,CancelBtnEditStatus,CancelBtnName,RevokeBtnProcName,RevokeBtnExpression,RevokeBtnEditStatus,isShowOnlineMsg,isShowProcessTracking,autoOpen,predocstatus,procgroupaftersavedoc,dealafterdocsave,transgroupcode,dttable,isShowNewDocButton,isshowinserialbtn,inserialbtneditstatus,isshowoutserialbtn ,outserialbtneditstatus,isshowonlinepaymentbutton,isshowgridstyleforapp,popupWindowsHeightRate,isShowCycleCountSerialBtn,cycleCountSerialBtnEditStatus,showOnlineMsgExpression,showProcessTrackingExpression";//
    protected Map<String, Object> getGformInfo(String formid) {
        return gformIfc.getGformInfo(GFORM_SQL, Integer.parseInt(formid));
    }
@@ -142,172 +146,12 @@
        // ----------------
        Map<String, String> map = pIfc.getPanelHtml(Integer.parseInt(baseBean.formID), baseBean.type, data, gformInfo);
        buildPageCode(map.get("panHTML"), fileName, baseBean);
        if (StringUtils.isNotBlank(map.get("customPanHTML"))) {//客户自定义控件布局文件 xin 2024-1-12 17:27:12
            buildPageCode(map.get("customPanHTML"), baseBean.getUsrCode() + fileName, baseBean);
        }
        buildPageCode(map.get("panelControl"), "panelControl" + baseBean.formID + ".jsp", baseBean);
        if(map!=null&&map.get("zhu")!=null){
            baseBean.zhu=map.get("zhu");
        }
    }
    /**
     * --生成功能号时,要检查单据表头必须的字段是否存在,如果不存在,则需要新增--(单据类型的执行) xin 2022-3-14 09:28:17
     */
    public void getDoesItExist(Integer formId) throws Exception {
        try {
            String sql="--生成功能号时,要检查单据表头必须的字段是否存在,如果不存在,则需要新增\n" +
                    " --Author : Johns Wang,2022-03-11 \n"+
                    " set nocount on \n" +
                    " declare @tableName varchar(50) ,@formid int =" +formId+" \n"+
                    " declare @sql nvarchar(max) = ' set nocount on; '\n" +
                    " declare @fieldid varchar(50),@fieldtype varchar(50)\n" +
                    " declare @objName varchar(50) ,@createOrAlter varchar(50)\n" +
                    " declare @uploadFieldId varchar(2000),@formType int\n" +
                    " if isnull(@formid,0) = 0 \n" +
                    " begin \n" +
                    " raiserror('请传递@formid参数',16,1) \n" +
                    " return \n" +
                    " end \n" +
                    " select @formType = formType from _sysmenu a where a.formid = @formid \n" +
                    " if @@ROWCOUNT = 0 \n" +
                    " begin \n" +
                    " raiserror('请在9810功能号中为此功能号%d设置菜单',16,1,@formid) \n" +
                    " return \n" +
                    " end \n" +
                    " if @formtype not in (5,9,8,15,16,17,496,497,498,499) \n" +
                    " begin \n" +
                    " raiserror('请在9810功能号中为此功能号%d设置【窗体类型】,肯该字段值只能是【5,9,8,15,16,17,496,497,498,499】',16,1,@formid) \n" +
                    " return \n" +
                    " end \n" +
                    " select @tableName = a.hdtable \n" +
                    " from gform a \n" +
                    " join INFORMATION_SCHEMA.TABLES c on a.hdtable = c.TABLE_NAME \n" +
                    " where a.formid = @formid \n" +
                    " and c.TABLE_TYPE = 'BASE TABLE' \n" +
                    " and isnull(a.hdtable,'') <> '' \n" +
                    " if @@ROWCOUNT = 0 or isnull(@tableName,'') = ''  return \n" +
                    " declare mycurFieldType cursor for \n" +
                    " select fieldid,fieldtype \n" +
                    " from _sys_DocTableExistsField where TableType = '单据主表' \n" +
                    " order by num asc \n" +
                    " open mycurFieldType \n" +
                    " fetch next from mycurFieldType into @fieldid,@fieldtype \n" +
                    " while @@FETCH_STATUS  = 0 \n" +
                    " begin \n" +
                    " if not exists(select 1 from INFORMATION_SCHEMA.COLUMNS a where a.TABLE_NAME = isnull(@tableName,'') and a.COLUMN_NAME = isnull(@fieldid,'')) \n" +
                    " begin \n" +
                    " set @sql = isnull(@sql,'') + ' alter table ' + isnull(@tableName,'') + ' add ' + isnull(@fieldid,'') + ' ' + isnull(@fieldtype,'') +'; ' \n" +
                    " end \n" +
                    " fetch next from mycurFieldType into @fieldid,@fieldtype\n" +
                    " end \n" +
                    " close mycurFieldType\n" +
                    " deallocate mycurFieldType \n" +
                    " if isnull(@sql,'') <> ''\n" +
                    " begin\n" +
                    " exec(@sql)\n" +
                    " end \n" +
                    " set @sql = ' set nocount on; declare @StatisID int ; ' +char(13)+\n" +
                    " ' if not exists(select 1 from INFORMATION_SCHEMA.COLUMNS a where a.TABLE_NAME = ''' + isnull(@tableName,'') + ''' and a.COLUMN_NAME = ''DocVersion'') '+char(13)+\n" +
                    " '   and exists(select 1 from INFORMATION_SCHEMA.COLUMNS a where a.TABLE_NAME = ''' + isnull(@tableName,'') + ''' and a.COLUMN_NAME = ''DocCode'') ' + char(13)+\n" +
                    " ' begin ' + char(13)+\n" +
                    " '   alter table ' + isnull(@tableName,'') + ' add DocVersion int ' + char(13)+\n" +
                    " ' end ' + char(13) +\n" +
                    " ' if exists(select 1 from INFORMATION_SCHEMA.COLUMNS a where a.TABLE_NAME = ''' + isnull(@tableName,'') + ''' and a.COLUMN_NAME = ''DocVersion'')'+char(13)+\n" +
                    " ' begin \n" +
                    "      if not exists(select 1 from gfield where formid = ' + cast(isnull(@formid,0) as varchar(20)) + ' and headflag = 0 and fieldid = ''DocVersion'')  \n" +
                    "   begin \n" +
                    "      select @StatisID = max(StatisID)  from gfield  where formid = ' + cast(isnull(@formid,0) as varchar(20)) + ' and headflag = 0 \n" +
                    "   insert into gfield(formid,headflag,fieldid,fieldname,statisId,DataLink,isLoad,MasterFieldShowLocation)\n" +
                    "   values('+cast(isnull(@formid,0) as varchar(20)) + ',0,''DocVersion'',''单据版本号'',cast(isnull(@StatisID,0) as varchar(20)) ,1,1,0 )\n" +
                    "  end \n" +
                    "  end '\n" +
                    " if isnull(@sql,'') <> ''\n" +
                    " begin\n" +
                    "  exec(@sql)\n" +
                    " end \n" +
                    " if exists(select 1 from INFORMATION_SCHEMA.COLUMNS a where a.TABLE_NAME =  isnull(@tableName,'')  and a.COLUMN_NAME = 'DocVersion')\n" +
                    " begin \n" +
                    "  set @objName = isnull(@tableName,'') + 'UpdateDocVersion'\n" +
                    "  if OBJECT_ID(isnull(@objName,'')) is  null \n" +
                    "  begin\n" +
                    "    set @createOrAlter = ' create '\n" +
                    "  end else \n" +
                    "  begin\n" +
                    "   set @createOrAlter = ' alter '\n" +
                    "  end \n" +
                    "   set @uploadFieldId = 'not UPDATE(DocVersion)'\n" +
                    " select @uploadFieldId = isnull(@uploadFieldId,'') + case when isnull(@uploadFieldId,'') <> '' then ' and ' else '' end \n" +
                    " + 'not UPDATE(' + isnull(fieldid,'') + ')' \n" +
                    " from gfield where formid = @formid and headflag = 0 and ControlType = 9 \n" +
                    "  select @uploadFieldId = isnull(@uploadFieldId,'') + case when isnull(@uploadFieldId,'') <> '' then ' and ' else '' end \n" +
                    "  + 'not UPDATE(' + isnull(fieldid,'') + ')' \n" +
                    " from gfield where formid = @formid and headflag = 0 and ControlType = 19\n" +
                    " set @sql = isnull(@createOrAlter,'') + ' trigger [dbo].['+ isnull(@objName,'') + '] on [dbo].['+ isnull(@tableName,'') + '] after update \n" +
                    " --目的:单据表头更新时,将版本号 DocVersion 字段值自动+1, 此触发器脚本为自动生成,请不要尝试修改它 \n" +
                    " --Author : Johns Wang,' + convert(varchar(19),getdate(),120) + '\n" +
                    "  as\n" +
                    "  begin \n" +
                    "  set nocount on\n" +
                    "  declare @DocVersionTable table(DocCode varchar(50) primary key,DocVersion int) ' + char(13)+\n" +
                    "  case when isnull(@uploadFieldId,'') <> '' then '    if ' + isnull(@uploadFieldId,'')  else '' end +char(13)+\n" +
                    "  --if not UPDATE(DocVersion)    --不能加此条件,因为加了之后,如果更新DocVersion字段时,同时更新其它字段,则会导致DocVersion不能自动+1\n" +
                    " '    begin\n" +
                    "   insert into @DocVersionTable (DocCode,DocVersion)\n" +
                    "   select DocCode,DocVersion from inserted \n" +
                    "   --int 从 -2^31 (-2,147,483,648) 到 2^31 - 1 (2,147,483,647) 的整型数据(所有数字)。\n" +
                    "   update a set DocVersion = 0 from @DocVersionTable a where DocVersion > 2147483000   --避免数字溢出\n" +
                    "   update a set DocVersion = isnull(b.DocVersion,0) + 1  from '+isnull(@tableName,'')+' a join @DocVersionTable b on a.DocCode = b.DocCode \n" +
                    "   end \n" +
                    " end '\n" +
                    "  if isnull(@sql,'') <> ''\n" +
                    "  begin\n" +
                    "   exec(@sql)\n" +
                    "  end \n" +
                    "  end \n";
            jdbcTemplate.update(sql);
        }catch (Exception e){
            throw new Exception(e.getCause()!=null?e.getCause().getMessage():e.getMessage());
        }
    }
    /**
     * 生成功能号时,要检查单据表头必须的字段是否存在,如果不存在,则需要新增--(指定类型窗体的执行) xin 2022-3-17 08:48:03
     */
    public void getOtherInspection(Integer formId) throws Exception {
        try {
            String sql="--生成功能号时,要检查功能号表必须的字段 DocVersion 是否存在,如果不存在,则需要新增\n" +
                       " --Author : Johns Wang,2022-03-11\n" +
                    " set nocount on \n" +
                    " declare @formid int = "+formId+" \n" +
                    " declare @hdtable varchar(50),@dttable varchar(50) ,@formType int\n" +
                    " if isnull(@formid,0) = 0 \n" +
                    " begin \n" +
                    " raiserror('请传递@formid参数',16,1)\n" +
                    " return\n" +
                    " end \n" +
                    " select @formType = formType from _sysmenu a where a.formid = @formid\n" +
                    " if @@ROWCOUNT = 0 \n" +
                    " begin\n" +
                    " raiserror('请在9810功能号中为此功能号%d设置菜单',16,1,@formid)\n" +
                    " return\n" +
                    " end \n" +
                    " if @formtype not in (1,2,3,7,10,20,30,  5,9,8,15,16,17,496,497,498,499)\n" +
                    " begin\n" +
                    " raiserror('请在9810功能号中为此功能号%d设置【窗体类型】,该字段值只能是【1,2,3,7,10,20,30,  5,9,8,15,16,17,496,497,498,499】',16,1,@formid)\n" +
                    " return\n" +
                    " end \n" +
                    " select @hdtable = a.hdtable,@dttable = a.dttable\n" +
                    " from gform a \n" +
                    " where a.formid = @formid \n" +
                    " if isnull(@hdtable,'') <> '' \n" +
                    " begin\n" +
                    " exec p9802v3 @tableName = @hdtable,@formid = @formid,@headflag = 0\n" +
                    " end \n" +
                    " if isnull(@dttable,'') <> '' \n" +
                    " begin\n" +
                    "  exec p9802v3 @tableName = @dttable,@formid = @formid,@headflag = 1\n" +
                    " end \n";
            jdbcTemplate.update(sql);
        }catch (Exception e){
            throw new Exception(e.getCause()!=null?e.getCause().getMessage():e.getMessage());
        }
    }
@@ -362,6 +206,25 @@
        //--------从gform表获取是否显示大标题字段值(isTitle)判断是否显示大标题,并替换标识符-2012-02-20-syz-----[end]-------------------------//
        //-------------文字颜色说明---------xin 2022-5-18 16:09:54-----------//
        StringBuilder colorText =new StringBuilder();//文字颜色说明
        if(StringUtils.isNotBlank(baseBean.formID)) {
            List<T9685Entity> colorList = apiServiceIfc.get9685List(Integer.parseInt(baseBean.formID));
            if (colorList != null && colorList.size() > 0) {
                colorText.append("<div class=\"colorDescriptionContainer\">");
                colorText.append("<div class=\"colorDescriptionTitle\">文字颜色说明</div>");
                colorText.append("<div class=\"colorDescription\">");
                for (T9685Entity t : colorList) {
                    colorText.append("<div><span title=\"" + t.getItemMemo() + "\" class=\"spanColor\" " +
                            "style=\"background-color: " + t.getHexColor() + "\"></span>" +
                            "<span class=\"spanText\" style=\"color: " + t.getHexColor() + "\">" +
                            t.getColorName() + "</span></div>");
                }
                colorText.append("</div></div>");
            }
        }
        //文字颜色说明 xin 2022-5-18 15:53:13
        data = data.replace("[?ColorDescription]",colorText);
        // ----------------
        data = data.replace("[?title]", gformInfo.get("formname") + "");
        data = data.replaceAll("@gridJsp@", baseBean.formID + "_grid.jsp");
@@ -389,6 +252,9 @@
     */
    public void buildGrid(BaseBean baseBean) throws Exception {
        treeGrid.createGrid(baseBean.type, Integer.parseInt(baseBean.formID), baseBean.URI, "app/" + baseBean.gPath + "/", new String[]{baseBean.formID + "_grid.jsp"}, getTemPath(baseBean), "/" + baseBean.formID + "/" + baseBean.type + "/", null, baseBean.dataBaseId);
        if(baseBean.isCustomLayout()){//自定义控件布局
            treeGrid.createGrid(baseBean.type, Integer.parseInt(baseBean.formID), baseBean.URI, "app/" + baseBean.gPath + "/", new String[]{baseBean.formID + "_"+baseBean.getUsrCode()+"grid.jsp"}, getTemPath(baseBean), "/" + baseBean.formID + "/" + baseBean.type + "/", null, baseBean.dataBaseId);
        }
    }
    /**
@@ -437,12 +303,6 @@
                "<script type=\"text/javascript\" src=\"/js/bootstrap/v5.1.3/js/bootstrap.bundle.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/bootstrap/v5.1.3/js/bootstrap.bundle.js\")%>\"></script>\n";
        if (num != 0) {//表示存在有上传控件
            js_css +=
//                    "<link rel=\"stylesheet\" type=\"text/css\" href=\"/js/bootstrap-upload/css/fileinput.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/bootstrap-upload/css/fileinput.css\")%>\">\n" +
//                    "<link rel=\"stylesheet\" type=\"text/css\" href=\"/js/bootstrap-upload/css/bootstrap.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/bootstrap-upload/css/bootstrap.css\")%>\">\n" +
//                    "<link rel=\"stylesheet\" type=\"text/css\" href=\"/js/bootstrap-upload/css/rotationscaling.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/bootstrap-upload/css/rotationscaling.css\")%>\">\n" +
//                    "<script type=\"text/javascript\" src=\"/js/bootstrap-upload/js/fileinput.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/bootstrap-upload/js/fileinput.js\")%>\"></script>\n" +
//                    "<script type=\"text/javascript\" src=\"/js/bootstrap-upload/js/locales/zh.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/bootstrap-upload/js/locales/zh.js\")%>\"></script>\n" +
//                    "<script type=\"text/javascript\" src=\"/shopping/view/javascript/bootstrap/js/bootstrap.min.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/shopping/view/javascript/bootstrap/js/bootstrap.min.js\")%>\"></script>\n";
                    "<link rel=\"stylesheet\" type=\"text/css\" href=\"/js/bootstrap/fileinput/css/fileinput.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/bootstrap/fileinput/css/fileinput.css\")%>\">\n" +
                            "<link rel=\"stylesheet\" type=\"text/css\" href=\"/general/Viewer/css/viewer.min.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/general/Viewer/css/viewer.min.css\")%>\">\n" +
                            "<script type=\"text/javascript\" src=\"/js/bootstrap/fileinput/js/fileinput.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/bootstrap/fileinput/js/fileinput.js\")%>\"></script>\n" +
@@ -488,24 +348,31 @@
        tmpJsp = tmpJsp.replace("[?formId]", baseBean.formID);
        tmpJsp = tmpJsp.replace("[?table]", toString(gformInfo.get("HDTable")));
        tmpJsp = tmpJsp.replace("[?formType]", baseBean.type + "");
        tmpJsp = tmpJsp.replace("[?canelProc]",toString(gformInfo.get("CancelBtnProcName")));//取消确认
        tmpJsp = tmpJsp.replace("[?revokeProc]",toString(gformInfo.get("RevokeBtnProcName")));//撤回
        tmpJsp= tmpJsp.replace("[?zhu]", baseBean.zhu);
        tmpJsp = tmpJsp.replace("[?formName]", gformInfo.get("formName") + "");
        tmpJsp = tmpJsp.replace("[?canelProc]", toString(gformInfo.get("CancelBtnProcName")));//取消确认
        tmpJsp = tmpJsp.replace("[?revokeProc]", toString(gformInfo.get("RevokeBtnProcName")));//撤回
        tmpJsp = tmpJsp.replace("[?zhu]", baseBean.zhu);
        tmpJsp = tmpJsp.replace("[?sousuo]", baseBean.sous);
        tmpJsp = tmpJsp.replace("@doc", baseBean.doc);
        tmpJsp = tmpJsp.replace("@id_info", baseBean.id_info);
        tmpJsp = tmpJsp.replace("[?predocstatus]", gformInfo.get("predocstatus") + "");
        tmpJsp = tmpJsp.replace("[?isShowOnlineMsg]", gformInfo.get("isShowOnlineMsg") + "");
        tmpJsp = tmpJsp.replace("[?isShowProcessTracking]", gformInfo.get("isShowProcessTracking") + "");
        tmpJsp = tmpJsp.replace("[?ShowOnlineMsgExpression]", gformInfo.get("showOnlineMsgExpression") == null ? "" : gformInfo.get("showOnlineMsgExpression") + "");
        tmpJsp = tmpJsp.replace("[?ShowProcessTrackingExpression]", gformInfo.get("showProcessTrackingExpression") == null ? "" : gformInfo.get("showProcessTrackingExpression") + "");
        tmpJsp = tmpJsp.replace("[?isOpenFuncShowPwdEdit]", toString(gformInfo.get("isopenFuncshowpwdedit")));
        tmpJsp = tmpJsp.replace("[?version]", ("".equalsIgnoreCase(toString(gformInfo.get("version"))) ? "0" : toString(gformInfo.get("version"))));
        // 序列号扫码 xin 2021-8-2 17:45:43
        //入库
        tmpJsp = tmpJsp.replace("[?isshowinserialbtn]", DBHelper.getValueInt(gformInfo,"isshowinserialbtn")+"");
        tmpJsp = tmpJsp.replace("[?inserialbtneditstatus]", DBHelper.getValue(gformInfo,"inserialbtneditstatus"));
        tmpJsp = tmpJsp.replace("[?isshowinserialbtn]", DBHelper.getValueInt(gformInfo, "isshowinserialbtn") + "");
        tmpJsp = tmpJsp.replace("[?inserialbtneditstatus]", DBHelper.getValue(gformInfo, "inserialbtneditstatus"));
        //出库
        tmpJsp = tmpJsp.replace("[?isshowoutserialbtn]", DBHelper.getValueInt(gformInfo,"isshowoutserialbtn")+"");
        tmpJsp = tmpJsp.replace("[?outserialbtneditstatus]", DBHelper.getValue(gformInfo,"outserialbtneditstatus"));
        tmpJsp = tmpJsp.replace("[?isshowoutserialbtn]", DBHelper.getValueInt(gformInfo, "isshowoutserialbtn") + "");
        tmpJsp = tmpJsp.replace("[?outserialbtneditstatus]", DBHelper.getValue(gformInfo, "outserialbtneditstatus"));
        //盘点
        tmpJsp = tmpJsp.replace("[?isShowCycleCountSerialBtn]", DBHelper.getValueInt(gformInfo,"isShowCycleCountSerialBtn")+"");
        tmpJsp = tmpJsp.replace("[?cycleCountSerialBtnEditStatus]", DBHelper.getValue(gformInfo,"cycleCountSerialBtnEditStatus"));
        //农行支付收付款控制 xin 2021-8-23 14:30:39
        //在线收
        tmpJsp = tmpJsp.replace("[?isshowonlinepaymentbutton]", DBHelper.getValueInt(gformInfo,"isshowonlinepaymentbutton")+"");