Пример #1
0
        /// <summary>
        /// 处理审批业务时进行的操作
        /// </summary>
        /// <param name="ID">审批流程ID号</param>
        /// <param name="keys">
        /// keys[0]:COMMENTS  意见内容
        /// keys[1]:STATUS  状态
        /// USERID  用户id,USERNAME  用户名 根据上下文自动填充
        /// </param>
        /// <returns></returns>
        public static bool authorize(string ID, string[] keys)
        {
            MSYS.DAL.DbOperator opt         = new MSYS.DAL.DbOperator();
            MSYS.Data.SysUser   user        = (MSYS.Data.SysUser)HttpContext.Current.Session["user"];
            List <String>       commandlist = new List <String>();

            //1.改变当前审批业务状态
            string[] seg   = { "USERID", "USERNAME", "OPINIONTIME", "COMMENTS", "STATUS" };
            string[] value = { user.id, user.text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), keys[0], keys[1] };
            commandlist.Add(opt.UpdateStr(seg, value, "HT_PUB_APRV_OPINION", " where id = '" + ID + "'"));

            //2.将当前审批业务的下一环节业务置为Enable,提交给相对应的角色
            string nextID = opt.GetSegValue("select id from ht_pub_aprv_opinion where (gongwen_id,pos) in ( select gongwen_id,to_char(to_number(pos)+1) from ht_pub_aprv_opinion where id= '" + ID + "')", "ID");

            if (nextID != "NoRecord")
            {
                commandlist.Add("update HT_PUB_APRV_OPINION set ISENABLE = '1' where id = '" + nextID + "'");
            }

            //3.从审批主表中匹配审批业务详情,将审批结果在被审批业务中进行反馈
            DataSet data     = opt.CreateDataSetOra("select s.id,t.aprv_table,t.aprv_tabseg,t.BUZ_ID,s.BUSIN_ID from ht_pub_aprv_opinion r left join ht_pub_aprv_flowinfo  s on s.id = r.gongwen_id left join ht_pub_aprv_type t on t.pz_type = s.modulename  where r.id = '" + ID + "'");
            string  flowid   = data.Tables[0].Rows[0][0].ToString();
            string  table    = data.Tables[0].Rows[0][1].ToString();
            string  tableseg = data.Tables[0].Rows[0][2].ToString();
            string  busid    = data.Tables[0].Rows[0][3].ToString();
            string  busvalue = data.Tables[0].Rows[0][4].ToString();

            //如果明细审批单步被拒绝,则整个审批单状态被置为己驳回,被审批业务不通过
            if (keys[1] == "1")
            {
                commandlist.Add("Update HT_PUB_APRV_FLOWINFO set STATE = '1' where id = '" + flowid + "'");
                //将业务主表的审批字段置为己驳回
                commandlist.Add("update " + table + " set " + tableseg + " = '1' where " + busid + " = '" + busvalue + "'");
            }
            //如果明细审批单所有流程均通过,则整个审批单状态被置为己通过
            if ("Success" == opt.TransactionCommand(commandlist))
            {
                data = opt.CreateDataSetOra("select status,GONGWEN_ID from ht_pub_aprv_opinion where pos = (select Max(pos) from ht_pub_aprv_opinion where gongwen_ID = (select gongwen_ID from ht_pub_aprv_opinion where id = '" + ID + "')) and id = '" + ID + "'");
                if (data != null && data.Tables[0].Rows.Count > 0 && data.Tables[0].Rows[0][0].ToString() == "2")
                {
                    commandlist.Clear();
                    commandlist.Add("Update HT_PUB_APRV_FLOWINFO set STATE = '2' where id = '" + flowid + "'");
                    //将业务主表的审批字段置为己通过
                    commandlist.Add("update " + table + " set " + tableseg + " = '2' where " + busid + " = '" + busvalue + "'");
                    opt.TransactionCommand(commandlist);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public override string InsertLocalFromMaster()
        {
            MSYS.Web.MateriaService.WsBaseDataInterfaceService service = new MSYS.Web.MateriaService.WsBaseDataInterfaceService();
            MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator();

            List <string> commandlist = new List <string>();

            tPubMateriel[] mat = service.getAllMaterialtList();
            commandlist.Clear();
            string[] matseg = { "ID",        "MATERIAL_CODE",  "MATERIAL_NAME",    "TYPE_CODE",   "SPEC_VAL",         "MODEL_VAL",   "IS_VALID",       "IS_DEL",
                                "TYPE_FLAG", "UNIT_CODE",      "DATA_ORIGIN_FLAG", "PK_MATERIAL", "FACTORY",          "MAT_YEAR",    "MAT_CATEGORY",   "MAT_TYPE",
                                "MAT_LEVEL", "MAT_VARIETY",    "MAT_PACK",         "MAT_PLACE",   "REMARK",           "MAT_TYPE2",   "MAT_PLACE_NAME", "MAT_PROVINCE",
                                "MAT_CITY",  "PK_MARBASCLASS", "LAST_UPDATE_TIME", "COSTPRICE",   "XY_MATERIAL_CODE", "PK_MATTAXES", "PIECE_WEIGHT" };

            foreach (tPubMateriel materia in mat)
            {
                string[] value = { materia.id.ToString(), materia.materialCode, materia.materialName, materia.typeCode, materia.specVal, materia.modelVal, materia.isValid, materia.isDel, materia.typeFlag, materia.unitCode, materia.dataOriginFlag, materia.pkMaterial, materia.factory, materia.matYear, materia.matCategory, materia.matType, materia.matLevel, materia.matVariety, materia.matPack, materia.matPlace, materia.remark, materia.matType2, materia.matPlaceName, materia.matProvince, materia.matCity, materia.pkMarbasclass, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), materia.costprice.ToString(), materia.xyMaterialCode, materia.pkMattaxes, materia.pieceWeight };
                string   temp  = opt.getMergeStr(matseg, value, 3, "HT_PUB_MATERIEL");
                commandlist.Add(temp);
                if (opt.UpDateOra(temp) != "Success")
                {
                    System.Diagnostics.Debug.Write(temp);
                }
            }
            return(opt.TransactionCommand(commandlist));
        }
Пример #3
0
        public override string InsertLocalFromMaster()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
            buffer.Append("<request>");
            buffer.Append("</request>");
            MisMasterDataServiceInterfaceService service = new MisMasterDataServiceInterfaceService();
            string Xmlstr = service.getUserInfo(buffer.ToString());

            XmlDocument xx = new XmlDocument();

            xx.LoadXml(Xmlstr);                                     //加载xml
            XmlNodeList xxList = xx.GetElementsByTagName(rootname); //取得节点名为DEPTINFO的XmlNode集合


            MSYS.DAL.DbOperator opt         = new MSYS.DAL.DbOperator();
            List <string>       commandlist = new List <string>();
            string temp;

            foreach (XmlNode xxNode in xxList)
            {
                XmlNodeList childList = xxNode.ChildNodes; //取得DEPTINFO下的子节点集合
                int         count     = childList.Count + 1;
                if (count == seg.Length)
                {
                    string[] segvalue = new string[count];
                    segvalue[0] = childList[2].InnerText;
                    segvalue[1] = childList[0].InnerText;
                    segvalue[2] = childList[1].InnerText;
                    segvalue[3] = childList[3].InnerText;
                    string dpno = opt.GetSegValue("select F_CODE  from Ht_Svr_Org_Group where F_KEY = '" + segvalue[3] + "'", "F_CODE");
                    if (dpno != "NoRecord")
                    {
                        segvalue[3] = dpno;
                    }
                    string psd = opt.GetSegValue("select Password from HT_SVR_USER where ID = '" + segvalue[0] + "'", "PassWord");
                    if (psd == "NoRecord" || psd == "")
                    {
                        segvalue[4] = "e10adc3949ba59abbe56e057f20f883e";
                    }
                    else
                    {
                        segvalue[4] = psd;
                    }
                    temp = opt.getMergeStr(seg, segvalue, 1, tablename);
                    commandlist.Add(temp);
                    if (opt.UpDateOra(temp) != "Success")
                    {
                        System.Diagnostics.Debug.Write(temp);
                    }
                }
                else
                {
                    return("字段与值个数不匹配");
                }
            }

            return(opt.TransactionCommand(commandlist));
        }
Пример #4
0
        public override string InsertLocalFromMaster()
        {
            MSYS.Web.MateriaService.WsBaseDataInterfaceService service = new MSYS.Web.MateriaService.WsBaseDataInterfaceService();
            MSYS.DAL.DbOperator opt         = new MSYS.DAL.DbOperator();
            List <string>       commandlist = new List <string>();

            productEntity[] prods = service.getAllProductList(new productEntity());

            string[] matseg   = { "PROD_CODE", "PROD_NAME", "PACK_NAME", "HAND_MODE", "TECH_STDD_CODE", "MATER_FORMULA_CODE", "AUX_FORMULA_CODE", "COAT_FORMULA_CODE", "REMARK", "CREATEOR_ID", "CREATE_TIME", "MODIFY_ID", "MODIFY_TIME", "STANDARD_VALUE", "XY_PROD_CODE", "IS_VALID", "IS_DEL" };
            int      SucCount = 0;

            foreach (productEntity prod in prods)
            {
                if (prod.prodCode.Substring(0, 3) == "703")
                {
                    commandlist.Clear();

                    string[] value = { prod.prodCode, prod.prodName, prod.packName, prod.handMode, prod.techStddId, prod.materFormulaId, prod.auxFormulaId, prod.coatFormulaId, prod.remark, prod.createorId, prod.createTime.ToString("yyyy-MM-dd HH:mm:ss"), prod.modifyId, prod.modifyTime.ToString("yyyy-MM-dd HH:mm:ss"), prod.standardValue, prod.prodCode, prod.isValid, prod.isDel };

                    string temp = opt.getMergeStr(matseg, value, 1, "HT_PUB_PROD_DESIGN");
                    commandlist.Add(temp);
                    if (opt.UpDateOra(temp) != "Success")
                    {
                        System.Diagnostics.Debug.Write(temp);
                    }
                    // getTechstdd_SQL(prod.techStddId, prod.prodCode); // java.math.BigInteger cannot be cast to java.lang.String
                    getMaterFormalu_SQL(prod.materFormulaId, prod.prodCode);
                    // getAuxFormalu_SQL(prod.auxFormulaId, prod.prodCode); //java.math.BigDecimal cannot be cast to java.lang.Double
                    getCoatFormalu_SQL(prod.coatFormulaId, prod.prodCode);
                    if (opt.TransactionCommand(commandlist) == "Success")
                    {
                        commandlist.Clear();
                        commandlist.Add("update ht_pub_prod_design t set tech_stdd_code = (select r.tech_code from ht_tech_stdd_code r where substr(t.tech_stdd_code,0,3)<>'TCH' and  r.id = to_number( t.tech_stdd_code)),mater_formula_code = (select s.formula_code from ht_qa_mater_formula s where  t.mater_formula_code is not null and  s.id = to_number( t.mater_formula_code)),aux_formula_code = (select  q.formula_code from ht_qa_aux_formula q where  t.aux_formula_code is not null and  q.id = to_number( t.aux_formula_code)),coat_formula_code = (select p.formula_code from ht_qa_coat_formula p where  t.coat_formula_code is not null and  p.id = to_number( t.coat_formula_code)) where t.prod_code = '" + prod.prodCode + "'");
                        commandlist.Add("update ht_qa_mater_formula_detail r set formula_code = (select t.formula_code from ht_qa_mater_formula t where t.id = r.formula_code) where r.formula_code = '" + prod.materFormulaId + "'");
                        commandlist.Add("update ht_qa_aux_formula_detail r set formula_code = (select t.formula_code from ht_qa_aux_formula t where t.id = r.formula_code) where r.formula_code = '" + prod.auxFormulaId + "'");
                        commandlist.Add("update ht_qa_coat_formula_detail r set formula_code = (select t.formula_code from ht_qa_coat_formula t where t.id = r.formula_code) where r.formula_code = '" + prod.coatFormulaId + "'");
                        commandlist.Add("update ht_qa_Fla_formula_detail r set formula_code = (select t.formula_code from ht_qa_Fla_formula t where t.id = r.formula_code) where r.formula_code = '" + prod.coatFormulaId + "'");
                        commandlist.Add("update ht_tech_stdd_code_detail r set tech_code = (select t.tech_code from ht_tech_stdd_code t where t.id = r.tech_code) where r.tech_code = '" + prod.techStddId + "'");
                        commandlist.Add("update ht_qa_mater_formula_detail t set t.mater_flag = (select r.mat_type from ht_pub_materiel r  where r.material_code = t.mater_code)");
                        opt.TransactionCommand(commandlist);
                        System.Diagnostics.Debug.Write("产品更新成功" + prod.prodCode + prod.prodName);
                        SucCount++;
                    }
                }
            }
            return(SucCount.ToString() + "项产品更新成功,总记录条数:" + prods.Length);
        }
Пример #5
0
        /// <summary>
        /// 传入一个需审批的业务,对业务安审批流程进行分解
        /// </summary>
        /// <param name="keys">
        /// keys[0]:TB_ZT标题
        /// keys[1]:MODULENAME审批类型编码
        /// keys[2]:BUSIN_ID业务数据id
        /// keys[3]:登录url
        /// 自动根据上下文状态确定 TBR_ID填报人id,TBR_NAME填报人name,TB_BM_ID填报部门id,TB_DATE申请时间创建日期,ID审批
        /// </param>
        /// <returns></returns>
        public static bool createApproval(string[] keys)
        {
            MSYS.DAL.DbOperator opt         = new MSYS.DAL.DbOperator();
            MSYS.Data.SysUser   user        = (MSYS.Data.SysUser)HttpContext.Current.Session["User"];
            List <String>       commandlist = new List <String>();

            //插入审批主业务
            string ID = opt.GetSegValue(" select zs18.aprvflow_id_seq.nextval from dual", "nextval");

            string[] seg   = { "TB_ZT", "MODULENAME", "BUSIN_ID", "URL", "TBR_ID", "TBR_NAME", "TB_BM_ID", "TB_DATE", "ID" };
            string[] value = { keys[0], keys[1], keys[2], keys[3], user.id, user.text, user.OwningBusinessUnitId, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ID };
            commandlist.Add(opt.InsertDatastr(seg, value, "HT_PUB_APRV_FLOWINFO"));

            //插入审批流程
            //1、插入审批流程第一步提交流程 顺序号为0
            string[] subseg0   = { "GONGWEN_ID", "ROLENAME", "POS", "WORKITEMID", "ISENABLE", "USERID", "USERNAME", "OPINIONTIME", "COMMENTS", "STATUS" };
            string[] subvalue0 = { ID, user.UserRole, "0", "操作员提交审批", "1", user.id, user.text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "提交", "2" };
            commandlist.Add(opt.InsertDatastr(subseg0, subvalue0, "HT_PUB_APRV_OPINION"));

            //2、根据审批模版中定义的顺序将审批业务分解为顺序流程
            string  query = "select * from HT_PUB_APRV_MODEL where PZ_TYPE = '" + value[1] + "' order by INDEX_NO";
            DataSet data  = opt.CreateDataSetOra(query);

            if (data != null && data.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in data.Tables[0].Rows)
                {
                    string enable = "0";
                    if ("1" == row["INDEX_NO"].ToString())
                    {
                        enable = "1";
                    }
                    string[] subseg   = { "GONGWEN_ID", "ROLENAME", "POS", "WORKITEMID", "ISENABLE" };
                    string[] subvalue = { ID, row["ROLE"].ToString(), row["INDEX_NO"].ToString(), row["FLOW_NAME"].ToString(), enable };
                    commandlist.Add(opt.InsertDatastr(subseg, subvalue, "HT_PUB_APRV_OPINION"));
                }
            }
            //3.从审批主表中匹配审批业务详情,将主业务置为办理中
            data = opt.CreateDataSetOra("select t.aprv_table,t.aprv_tabseg,t.BUZ_ID from   ht_pub_aprv_type t   where t.pz_type = '" + keys[1] + "'");
            string table    = data.Tables[0].Rows[0][0].ToString();
            string tableseg = data.Tables[0].Rows[0][1].ToString();
            string busid    = data.Tables[0].Rows[0][2].ToString();

            commandlist.Add("update " + table + " set " + tableseg + " = '0' where " + busid + " = '" + keys[2] + "'");

            //4、上述操作作为事务进行处理
            if ("Success" == opt.TransactionCommand(commandlist))
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }
Пример #6
0
        public override string InsertLocalFromMaster()
        {
            MSYS.Web.MateriaService.WsBaseDataInterfaceService service = new MSYS.Web.MateriaService.WsBaseDataInterfaceService();
            MSYS.DAL.DbOperator opt         = new MSYS.DAL.DbOperator();
            treeVO[]            mattree     = service.materialTree();
            List <string>       commandlist = new List <string>();

            string[] seg = { "ID", "MATTREE_CODE", "MATTREE_NAME", "IS_DEL", "PK_CLASS", "PK_PARENT_CLASS" };

            foreach (treeVO leaf in mattree)
            {
                string[] value = { leaf.id, leaf.classCode, leaf.name, "0", leaf.classCode, leaf.pId };
                string   temp  = opt.getMergeStr(seg, value, 1, "HT_PUB_MATTREE");
                commandlist.Add(temp);
                if (opt.UpDateOra(temp) != "Success")
                {
                    System.Diagnostics.Debug.Write(temp);
                }
            }
            commandlist.Add("update ht_pub_mattree t set t.parent_code = (select mattree_code from ht_pub_mattree r where r.id = t.pk_parent_class)");
            return(opt.TransactionCommand(commandlist));
        }
Пример #7
0
        public override string InsertLocalFromMaster()
        {
            MSYS.Web.MateriaService.WsBaseDataInterfaceService service = new MSYS.Web.MateriaService.WsBaseDataInterfaceService();
            MSYS.DAL.DbOperator opt         = new MSYS.DAL.DbOperator();
            tPubUnit[]          units       = service.getUnitList();
            List <string>       commandlist = new List <string>();

            string[] seg = { "id",            "unitCode",   "unitName", "originCode", "unitGroupCode", "unitGroupName",
                             "unitGroupType", "xyUnitCode", "isDel",    "isValid" };

            foreach (tPubUnit unit in units)
            {
                string[] value = { unit.id.ToString(), unit.unitCode, unit.unitName, unit.originCode, unit.unitGroupCode, unit.unitGroupName, unit.unitGroupType, unit.xyUnitCode, unit.isDel, unit.isValid };
                string   temp  = opt.getMergeStr(seg, value, 1, "HT_INNER_UNIT");
                commandlist.Add(temp);
                if (opt.UpDateOra(temp) != "Success")
                {
                    System.Diagnostics.Debug.Write(temp);
                }
            }
            return(opt.TransactionCommand(commandlist));
        }
Пример #8
0
        public override string InsertLocalFromMaster()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
            buffer.Append("<request>");
            buffer.Append("</request>");
            MisMasterDataServiceInterfaceService service = new MisMasterDataServiceInterfaceService();

            string      Xmlstr = service.getDeptInfo(buffer.ToString());
            XmlDocument xx     = new XmlDocument();

            xx.LoadXml(Xmlstr);                                     //加载xml
            XmlNodeList xxList = xx.GetElementsByTagName(rootname); //取得节点名为DEPTINFO的XmlNode集合

            MSYS.DAL.DbOperator opt         = new MSYS.DAL.DbOperator();
            List <string>       commandlist = new List <string>();

            foreach (XmlNode xxNode in xxList)
            {
                XmlNodeList childList = xxNode.ChildNodes; //取得DEPTINFO下的子节点集合
                int         count     = childList.Count + 1;
                if (count == seg.Length)
                {
                    string[] segvalue = new string[count];
                    for (int i = 0; i < count - 1; i++)
                    {
                        segvalue[i] = childList[i].InnerText;
                    }
                    segvalue[2] = "";
                    if (segvalue[1] == "江苏鑫源烟草薄片有限公司")
                    {
                        segvalue[count - 1] = "00700000";
                    }
                    else
                    {
                        segvalue[3] = opt.GetSegValue("select F_code from ht_svr_org_group where f_key = '" + segvalue[3] + "'", "F_CODE");
                        segvalue[4] = opt.GetSegValue("select F_code from ht_svr_org_group where f_key = '" + segvalue[0] + "'", "F_CODE");
                        if (segvalue[4] == "NoRecord")
                        {
                            string code;
                            if (segvalue[3] == "00700000")
                            {
                                code = "007" + opt.GetSegValue("select nvl(Max(substr(F_CODE,4,3))+1,1) as code from Ht_Svr_Org_Group where F_parentid = '00700000'", "CODE").PadLeft(3, '0') + "00";
                            }
                            else
                            {
                                code = segvalue[3].Substring(0, 6) + opt.GetSegValue("select nvl( Max(substr(F_CODE,7,2))+1,1) as code from Ht_Svr_Org_Group where F_parentid = '" + segvalue[3] + "'", "CODE").PadLeft(2, '0');
                            }
                            segvalue[4] = code;
                        }
                    }
                    string temp = opt.getMergeStr(seg, segvalue, 1, tablename);
                    commandlist.Add(temp);
                    if (opt.UpDateOra(temp) != "Success")
                    {
                        System.Diagnostics.Debug.Write(temp);
                    }
                }
            }
            return(opt.TransactionCommand(commandlist));
        }