Пример #1
0
        //封装报工实体
        public job getJobDate(HttpClient httpClient)
        {
            job    job     = new job();
            String joburl  = "http://123.232.10.234:8083/servlet/com.sdjxd.pms.platform.serviceBreak.Invoke?p=6962531A-0F5E-43E9-84ED-185AE9A93CFE";
            var    sheetId = Guid.NewGuid().ToString();

            job.SheetId = sheetId;
            DateTime dt     = System.DateTime.Now;
            String   date   = dt.ToString("yyyy-MM-dd");
            String   datejq = dt.ToString("yyyy-MM-dd HH:mm:ss");

            job.Data   = date;
            job.Datajq = date;
            List <KeyValuePair <String, String> > paramList = new List <KeyValuePair <String, String> >();

            paramList.Add(new KeyValuePair <string, string>("_c", "bgxt.BgxtPc"));
            paramList.Add(new KeyValuePair <string, string>("_m", "getData"));
            HttpResponseMessage response = httpClient.PostAsync(new Uri(joburl), new FormUrlEncodedContent(paramList)).Result;
            String result = response.Content.ReadAsStringAsync().Result;

            String[] str1 = new Regex("JSClass.extend\\(\\[").Split(result);
            if (str1.Length < 2)
            {
                return(null);
            }
            String[] str2 = new Regex("],\"").Split(str1[1]);
            if (str2.Length < 2)
            {
                return(null);
            }
            String[] jobstr = new Regex(",").Split(str2[0]);
            if (jobstr.Length > 0)
            {
                job.Place     = jobstr[0].Replace("\"", "");
                job.Project   = jobstr[1].Replace("\"", "");
                job.Quarter   = jobstr[2].Replace("\"", "");
                job.Desc      = jobstr[3].Replace("\"", "");
                job.PlaceId   = jobstr[4].Replace("\"", "");
                job.ProjectId = jobstr[5].Replace("\"", "");
                job.QuarterId = jobstr[6].Replace("\"", "");
                job.Bgrq      = jobstr[7].Replace("\"", "");
                job.PcType    = jobstr[8].Replace("\"", "");
                job.WorkType  = jobstr[9].Replace("\"", "");
            }

            return(job);
        }
Пример #2
0
        //拼接注入SQL
        public String getJobSql(emp emp, job job)
        {
            StringBuilder jobSQL = new StringBuilder();

            jobSQL.Append("     IF NOT EXISTS (SELECT * FROM dbo.BGXT_BGLRB WHERE CREATEUSERID='" + emp.ObjectId + "' AND BGRQ = '" + job.Data + "') ");
            jobSQL.Append("     BEGIN ");
            jobSQL.Append("  	INSERT INTO dbo.BGXT_BGLRB (	  ");
            jobSQL.Append("  	BEIZHU,	  ");
            jobSQL.Append("  	BGRQ,	  ");
            jobSQL.Append("  	BGSTATUS,	  ");
            jobSQL.Append("  	CQQK,	  ");
            jobSQL.Append("  	CREATEDATE,	  ");
            jobSQL.Append("  	CREATEDEPT,	  ");
            jobSQL.Append("  	CREATEDEPTID,	  ");
            jobSQL.Append("  	CREATEORG,	  ");
            jobSQL.Append("  	CREATEORGID,	  ");
            jobSQL.Append("  	CREATEUSER,	  ");
            jobSQL.Append("  	CREATEUSERID,	  ");
            jobSQL.Append("  	DATASTATUSID,	  ");
            jobSQL.Append("  	DNSY,	  ");
            jobSQL.Append("  	EDITUSER,	  ");
            jobSQL.Append("  	EDITUSERID,	  ");
            jobSQL.Append("  	GZDID,	  ");
            jobSQL.Append("  	GZDMC,	  ");
            jobSQL.Append("  	GZL,	  ");
            jobSQL.Append("  	JBSJ,	  ");
            jobSQL.Append("  	LASTOPENTIME,	  ");
            jobSQL.Append("  	LOCATION,	  ");
            jobSQL.Append("  	OPENER,	  ");
            jobSQL.Append("  	OPENERID,	  ");
            jobSQL.Append("  	PATTERNID,	  ");
            jobSQL.Append("  	SBLX,	  ");
            jobSQL.Append("  	SHEETID,	  ");
            jobSQL.Append("  	SHEETNAME,	  ");
            jobSQL.Append("  	SHOWORDER,	  ");
            jobSQL.Append("  	SHZT,	  ");
            jobSQL.Append("  	XMZID,	  ");
            jobSQL.Append("  	XMZMC,	  ");
            jobSQL.Append("  	YXMZID,	  ");
            jobSQL.Append("  	YXMZMC,	  ");
            jobSQL.Append("  	YZSFWID,	  ");
            jobSQL.Append("  	YZSFWMC,	  ");
            jobSQL.Append("  	ZSFWID,	  ");
            jobSQL.Append("  	ZSFWMC	  ");
            jobSQL.Append("  	) SELECT	  ");
            jobSQL.Append("  	BEIZHU,	  ");
            jobSQL.Append("  	'"+ job.Data + "',	  ");
            jobSQL.Append("  	'2',	  ");
            jobSQL.Append("  	CQQK,	  ");
            jobSQL.Append("  	'"+ job.Datajq + "',	  ");
            jobSQL.Append("  	CREATEDEPT,	  ");
            jobSQL.Append("  	CREATEDEPTID,	  ");
            jobSQL.Append("  	CREATEORG,	  ");
            jobSQL.Append("  	CREATEORGID,	  ");
            jobSQL.Append("  	CREATEUSER,	  ");
            jobSQL.Append("  	CREATEUSERID,	  ");
            jobSQL.Append("  	DATASTATUSID,	  ");
            jobSQL.Append("  	DNSY,	  ");
            jobSQL.Append("  	EDITUSER,	  ");
            jobSQL.Append("  	EDITUSERID,	  ");
            jobSQL.Append("  	GZDID,	  ");
            jobSQL.Append("  	GZDMC,	  ");
            jobSQL.Append("  	GZL,	  ");
            jobSQL.Append("  	JBSJ,	  ");
            jobSQL.Append("  	'"+ job.Datajq + "',	  ");
            jobSQL.Append("  	LOCATION,	  ");
            jobSQL.Append("  	OPENER,	  ");
            jobSQL.Append("  	OPENERID,	  ");
            jobSQL.Append("  	PATTERNID,	  ");
            jobSQL.Append("  	SBLX,	  ");
            jobSQL.Append("  	'"+ job.SheetId + "',	  ");
            jobSQL.Append("  	SHEETNAME,	  ");
            jobSQL.Append("  	SHOWORDER,	  ");
            jobSQL.Append("  	SHZT,	  ");
            jobSQL.Append("  	XMZID,	  ");
            jobSQL.Append("  	XMZMC,	  ");
            jobSQL.Append("  	YXMZID,	  ");
            jobSQL.Append("  	YXMZMC,	  ");
            jobSQL.Append("  	YZSFWID,	  ");
            jobSQL.Append("  	YZSFWMC,	  ");
            jobSQL.Append("  	ZSFWID,	  ");
            jobSQL.Append("  	ZSFWMC	  ");
            jobSQL.Append("  	FROM	  ");
            jobSQL.Append("  	dbo.BGXT_BGLRB	  ");
            jobSQL.Append("  	WHERE	  ");
            jobSQL.Append("  	CREATEUSERID = '"+ emp.ObjectId + "'	  ");
            jobSQL.Append("  	AND BGRQ = '"+ job.Bgrq + "'	  ");
            jobSQL.Append("     END ");
            return(jobSQL.ToString());
        }