Beispiel #1
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);
            }
        }
Beispiel #2
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);
            }
        }
Beispiel #3
0
        private void InsertQuaReport(object source)
        {
            MSYS.DAL.DbOperator opt   = new MSYS.DAL.DbOperator();
            DataSet             times = opt.CreateDataSetOra("select date_begin  as time from ht_prod_schedule where substr(date_begin,1,10) = '" + System.DateTime.Now.ToString("yyyy-MM-dd") + "' union select date_end  as time  from ht_prod_schedule where substr(date_end,1,10) = '" + System.DateTime.Now.ToString("yyyy-MM-dd") + "'");

            if (times != null && times.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow time in times.Tables[0].Rows)
                {
                    if (System.DateTime.Now - Convert.ToDateTime(time["time"].ToString()) > new TimeSpan(0, 20, 0) && System.DateTime.Now - Convert.ToDateTime(time["time"].ToString()) < new TimeSpan(0, 50, 0))
                    {
                        //对每一班组的生产过程数据进行统计分析计算
                        try
                        {
                            QltRecoder.insertQuaReport(System.DateTime.Now.AddHours(-8));
                        }
                        catch (Exception)
                        {
                            if (QualityTimer != null)
                            {
                                QualityTimer.Dispose();
                                QualityTimer = null;
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
        public void Qua_show_Click(object sender, EventArgs e)
        {
            string endtime   = Convert.ToDateTime(QuaTime.Text).AddDays(1).ToString("yyyy-MM-dd") + " 00:00:00";
            string starttime = Convert.ToDateTime(QuaTime.Text).ToString("yyyy-MM-dd") + " 00:00:00";
            string query     = "select * from HT_QLT_DATA_RECORD where B_TIME >= '" + starttime + "' and  E_TIME <= '" + endtime + "'";

            MSYS.DAL.DbOperator opt  = new MSYS.DAL.DbOperator();
            DataSet             data = opt.CreateDataSetOra(query);

            if (data != null)
            {
                dataGridView1.DataSource = data.Tables[0];
            }
        }
Beispiel #5
0
        public static void ProdRecord(DateTime datetime)
        {
            MSYS.DAL.DbOperator opt   = new MSYS.DAL.DbOperator();
            DataSet             times = opt.CreateDataSetOra("select date_begin  as time ,team_code from ht_prod_schedule where substr(date_begin,1,10) = '" + datetime.ToString("yyyy-MM-dd") + "' union select date_end as time,team_code  from ht_prod_schedule where substr(date_end,1,10) ='" + datetime.ToString("yyyy-MM-dd") + "' union select starttime  as time ,''  from ht_prod_report where substr(starttime,1,10) = '" + datetime.ToString("yyyy-MM-dd") + "' union select endtime  as time,''  from ht_prod_report where substr(endtime,1,10) = '" + datetime.ToString("yyyy-MM-dd") + "'");

            if (times != null && times.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow time in times.Tables[0].Rows)
                {
                    if (datetime - Convert.ToDateTime(time["time"].ToString()) >= new TimeSpan(0, -2, -20) && datetime - Convert.ToDateTime(time["time"].ToString()) <= new TimeSpan(0, 2, 20))
                    {
                        ProdRecord(time["time"].ToString(), time["team_code"].ToString());
                    }
                }
            }
        }
Beispiel #6
0
        protected void InsertProdReportAsTime(string datetime)
        {
            MSYS.DAL.DbOperator opt   = new MSYS.DAL.DbOperator();
            DataSet             times = opt.CreateDataSetOra("select date_begin  as time ,team_code from ht_prod_schedule where substr(date_begin,1,10) = '" + datetime + "' union select date_end as time,team_code  from ht_prod_schedule where substr(date_end,1,10) ='" + datetime + "' union select starttime  as time ,''  from ht_prod_report where substr(starttime,1,10) = '" + datetime + "' union select endtime  as time,''  from ht_prod_report where substr(endtime,1,10) = '" + datetime + "'");

            if (times != null && times.Tables[0].Rows.Count > 0)
            {
                try
                {
                    foreach (DataRow time in times.Tables[0].Rows)
                    {
                        ProdRecoder.ProdRecord(time["time"].ToString(), time["team_code"].ToString());
                    }
                }
                catch
                {
                }
            }
        }
Beispiel #7
0
        protected static List <PointProperty> getParaList()
        {
            List <PointProperty> readlist = new List <PointProperty>();

            MSYS.DAL.DbOperator opt  = new MSYS.DAL.DbOperator();
            DataSet             data = opt.CreateDataSetOra("select r.para_code,r.VALUE_TAG from ht_pub_tech_para r  where r.para_type like '1___0%' and r.is_del = '0' order by r.para_code ");

            if (data != null && data.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in data.Tables[0].Rows)
                {
                    PointProperty p = new PointProperty();
                    p.para_code = row["para_code"].ToString();
                    p.tag       = row["VALUE_TAG"].ToString();
                    readlist.Add(p);
                }
            }
            return(readlist);
        }
Beispiel #8
0
        public string InOrOut(string PZ_code, string name, string nameno)//出入库单据号及当前操作人员
        {
            MSYS.Web.StoreService.StoreServiceInterfaceService service = new MSYS.Web.StoreService.StoreServiceInterfaceService();
            MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator();
            string  query           = "select t.*,r.name as creator,s.name as modifier,q.formula_code  from ht_strg_materia t left join ht_svr_user r on r.id = t.creator_id left join ht_svr_user s on s.id = t.modify_id left join ht_qa_mater_formula q on q.prod_code = substr(t.monthplanno,9,7) where t.ORDER_SN = '" + PZ_code + "'";
            DataSet data            = opt.CreateDataSetOra(query);

            if (data != null && data.Tables[0].Rows.Count > 0)
            {
                DataRow         row = data.Tables[0].Rows[0];
                materInAndOutVO r   = new materInAndOutVO();
                r.loginname = nameno;
                r.loginname = row["creator_id"].ToString();
                r.name      = row["creator"].ToString();
                r.planNo    = row["MONTHPLANNO"].ToString();
                r.prodCode  = row["MONTHPLANNO"].ToString().Substring(8, 7);
                try
                {
                    string  masql = "select xy_prod_code from ht_pub_prod_design where prod_code = '" + r.prodCode + "'";
                    DataSet mads  = opt.CreateDataSetOra(masql);
                    r.prodCode = mads.Tables[0].Rows[0][0].ToString();
                }
                catch
                {
                    System.Diagnostics.Debug.WriteLine("查询xyprodcode失败");
                }
                if (row["SHIFT_CODE"].ToString() != null && row["SHIFT_CODE"].ToString() != "")
                {
                    r.shiftCode = this.shift_dic[row["SHIFT_CODE"].ToString()];
                }
                if (row["TEAM_CODE"].ToString() != null && row["TEAM_CODE"].ToString() != "")
                {
                    r.teamCode = this.team_dic[row["TEAM_CODE"].ToString()];
                }
                // if(row["FDATE"].ToString() != null && row["FDATE"].ToString() != "")
                //   r.FDate =Convert.ToDateTime( row["FDATE"].ToString());
                r.createId = row["CREATOR_ID"].ToString();
                //string sqlid = "select loginname from ht_svr_user where id = '" + r.createId + "'";
                //r.createId = opt.CreateDataSetOra(sqlid).Tables[0].Rows[0][0].ToString();
                // r.loginname = r.createId;
                r.creator    = row["creator"].ToString();
                r.modifyId   = row["Modify_ID"].ToString();
                r.modifyMan  = row["modifier"].ToString();
                r.bomType    = "1";
                r.modifyTime = row["MODIFY_TIME"].ToString();
                if (row["STRG_TYPE"].ToString() == "0")
                {
                    r.vouNo = "YLLY" + row["ORDER_SN"].ToString().Substring(2);
                }
                if (row["STRG_TYPE"].ToString() == "1")
                {
                    r.vouNo = "YLLT" + row["ORDER_SN"].ToString().Substring(2);
                }


                if (row["BATCHNUM"].ToString() != null && row["BATCHNUM"].ToString() != "")
                {
                    r.batchNumber = Convert.ToDouble(row["BATCHNUM"].ToString());
                }
                if (row["CABOSUM"].ToString() != null && row["CABOSUM"].ToString() != "")
                {
                    r.caboSum = Convert.ToDouble(row["CABOSUM"].ToString());
                }

                //if (row["PEICESSUM"].ToString() != null && row["PEICESSUM"].ToString() != "")
                //r.piecesSum = Convert.ToDouble(row["PEICESSUM"].ToString());
                r.remark = row["REMARK"].ToString();
                if (row["PEICESSUM"].ToString() != null && row["PEICESSUM"].ToString() != "")
                {
                    r.piecesSum = Convert.ToDouble(row["PEICESSUM"].ToString());
                }
                if (row["STRG_TYPE"].ToString() != null && row["STRG_TYPE"].ToString() != "")
                {
                    r.inoutType = this.MIOT[row["STRG_TYPE"].ToString()];
                }
                r.cwarehouseid = row["WARE_HOUSE_ID"].ToString();
                if (row["FORMULA_CODE"].ToString() != null && row["FORMULA_CODE"].ToString() != "")
                {
                    r.formulaId = Convert.ToInt64(row["formula_code"].ToString());
                }
                List <tShopMaterInoutSubVO> s = new List <tShopMaterInoutSubVO>();
                //DataSet details = opt.CreateDataSetOra("select t.*,r.material_name from ht_strg_mater_sub t left join ht_pub_materiel r on r.material_code = t.mater_code  where t.main_code = '" + PZ_code + "' and t.is_del = '0'");
                DataSet details = opt.CreateDataSetOra("select t.*,r.material_name from ht_strg_mater_sub t left join ht_pub_materiel r on r.material_code = t.mater_code  where t.main_code = '" + PZ_code + "' and t.is_del = '0'");
                if (details != null && details.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow drow in details.Tables[0].Rows)
                    {
                        tWaOnhand info = queryMater(drow["MATER_CODE"].ToString());

                        // if(drow["MATER_FLAG"].ToString() == "SP" ||  drow["MATER_FLAG"].ToString() == "碎片")
                        //   continue;
                        tShopMaterInoutSubVO sub = new tShopMaterInoutSubVO();
                        if (info != null)
                        {
                            sub.materName = info.mName.ToString();//接口
                            if (info.cwarehouseid != null)
                            {
                                sub.warehouseCode = info.cwarehouseid.ToString();//从接口获得
                                r.cwarehouseid    = sub.warehouseCode;
                                sub.warehouseName = info.warehouseName.ToString();
                            }
                            if (info.locationName != null)
                            {
                                sub.materLocation = info.locationName.ToString();
                            }
                            //if (row["STRG_TYPE"].ToString() == "0" && (Convert.ToDouble(info.sumonhand) < Convert.ToDouble(drow["ORIGINAL_DEMAND"].ToString())))
                            //{
                            //  return "notenough" + info.materName.ToString();
                            //}
                        }
                        sub.mainId    = drow["MAIN_CODE"].ToString();
                        sub.materCode = drow["MATER_CODE"].ToString();
                        //sub.materName = drow["material_name"].ToString();//接口
                        sub.materType = drow["MATER_FLAG"].ToString();//
                        sub.unitCode  = drow["UNIT_CODE"].ToString();
                        // sub.unitName = drow["TEAM_CODE"].ToString();
                        sub.occurQty = drow["ORIGINAL_DEMAND"].ToString();
                        sub.remark   = drow["REMARK"].ToString();
                        //sub.warehouseCode = drow["WAREHOUSECODE"].ToString();//从接口获得
                        sub.packingNumbers = drow["PACKNUM"].ToString();
                        sub.substance      = drow["SUBSTANCE"].ToString();
                        sub.oddQty         = drow["ODDQTY"].ToString();
                        sub.materName      = drow["MATERIAL_NAME"].ToString();
                        s.Add(sub);
                    }
                }
                r.subList = s.ToArray();
                DateTime d    = new DateTime();
                string   date = date = DateTime.Now.ToString("yyyy-MM-dd");
                return(service.yuanliaoInAndOut4ws_03(r, date, r.batchNumber).status);
                // return "";
            }
            else
            {
                return("Falied");
            }
        }