protected void Page_Load(object sender, EventArgs e) { //身份校验 if (!InterfaceTool.IdentityVerify(Request)) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误!").DicInfo()); return; } //航次编码 string strShip_Id = Request.Params["Ship_Id"]; //进出口编码 string strCodeInOut = Request.Params["CodeInOut"]; //strShip_Id = "2014"; //strCodeInOut = "0"; try { if (strShip_Id == null || strCodeInOut == null) { Json = JsonConvert.SerializeObject(new DicPackage(true, null, "参数错误,获取个统计理货员数据失败!").DicInfo()); return; } //strShip_Id = string.IsNullOrWhiteSpace(strShip_Id) ? string.Empty : strShip_Id; //strCodeInOut = string.IsNullOrWhiteSpace(strCodeInOut) ? string.Empty : strCodeInOut; string strSql = string.Empty; string strTallySql = string.Empty; FullStatisticsE fullStatisticsE = new FullStatisticsE(); //进 if (strCodeInOut.Equals("0")) { strTallySql = string.Format(@"select distinct(c.name) from con_image i left join TALLY_CLERK c on c.work_no = i.work_no where i.SHIP_ID = '{0}' and i.CODE_UNLOAD_PORT LIKE '%LYG' AND MOVED = '0' AND c.NAME is not null", strShip_Id); strSql = string.Format(@"select SIZE_CON,FULLOREMPTY,c.name,count(case when unload_mark='1' then 1 end) tallyCon from con_image i left join TALLY_CLERK c on c.work_no=i.work_no where i.SHIP_ID='{0}' and i.CODE_UNLOAD_PORT LIKE '%LYG' AND MOVED='0' group by size_con,fullorempty,c.name", strShip_Id); } else { strTallySql = string.Format(@"select distinct(c.name) from con_image i left join TALLY_CLERK c on c.work_no = i.work_no where i.SHIP_ID = '{0}' and i.CODE_LOAD_PORT LIKE '%LYG' AND MOVED = '0' AND c.NAME is not null", strShip_Id); strSql = string.Format(@"select SIZE_CON,FULLOREMPTY,c.name,count(case when unload_mark='1' then 1 end) tallyCon from con_image i left join TALLY_CLERK c on c.work_no=i.work_no where i.SHIP_ID='{0}' and i.CODE_LOAD_PORT LIKE '%LYG' AND MOVED='0' group by size_con,fullorempty,c.name", strShip_Id); } var dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathTally).ExecuteTable(strTallySql); if (dt.Rows.Count <= 0) { Json = JsonConvert.SerializeObject(new DicPackage(true, null, "暂无数据!").DicInfo()); return; } List <SingleStatisticsE> singleStatisticsList = new List <SingleStatisticsE>(); for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { SingleStatisticsE singleStatisticsE = new SingleStatisticsE(); singleStatisticsE.Name = Convert.ToString(dt.Rows[iRow]["NAME"]); singleStatisticsList.Add(singleStatisticsE); } dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathTally).ExecuteTable(strSql); for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { string name = Convert.ToString(dt.Rows[iRow]["NAME"]); for (int j = 0; j < singleStatisticsList.Count; j++) { SingleStatisticsE s = singleStatisticsList[j]; if (s.Name.Equals(name)) { if (dt.Rows[iRow]["FULLOREMPTY"].Equals("E")) { if (dt.Rows[iRow]["SIZE_CON"].Equals("20")) { s.E_20 = Convert.ToInt16(dt.Rows[iRow]["TALLYCON"]); } else if (dt.Rows[iRow]["SIZE_CON"].Equals("40")) { s.E_40 = Convert.ToInt16(dt.Rows[iRow]["TALLYCON"]); } else { s.E_other = Convert.ToInt16(dt.Rows[iRow]["TALLYCON"]); } } if (dt.Rows[iRow]["FULLOREMPTY"].Equals("F")) { if (dt.Rows[iRow]["SIZE_CON"].Equals("20")) { s.F_20 = Convert.ToInt16(dt.Rows[iRow]["TALLYCON"]); } else if (dt.Rows[iRow]["SIZE_CON"].Equals("40")) { s.F_40 = Convert.ToInt16(dt.Rows[iRow]["TALLYCON"]); } else { s.F_other = Convert.ToInt16(dt.Rows[iRow]["TALLYCON"]); } } } } } Json = JsonConvert.SerializeObject(new DicPackage(true, singleStatisticsList, null).DicInfo()); } catch (Exception ex) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:获取个统计理货员数据发生异常。{1}", ex.Source, ex.Message)).DicInfo()); } }
protected void Page_Load(object sender, EventArgs e) { //身份校验 if (!InterfaceTool.IdentityVerify(Request)) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误!").DicInfo()); return; } //航次编码 string strShip_Id = Request.Params["Ship_Id"]; //strShip_Id = "2014"; try { if (strShip_Id == null) { Json = JsonConvert.SerializeObject(new DicPackage(true, null, "参数错误,获取个统计操作员数据数据失败!").DicInfo()); return; } //strShip_Id = string.IsNullOrWhiteSpace(strShip_Id) ? string.Empty : strShip_Id; string strSql = string.Empty; string strTallySql = string.Empty; FullStatisticsE fullStatisticsE = new FullStatisticsE(); strTallySql = string.Format(@"select distinct(OPER_NAME) FROM (SELECT I.SIZE_CON,I.FULLOREMPTY,I.UNLOAD_MARK,I.CONTAINER_NO,CASE WHEN T.NAME IS NOT NULL THEN T.NAME ELSE I.USER_NAME END as OPER_NAME from con_image I LEFT JOIN TALLY_CLERK T ON I.USER_NAME=T.WORK_NO where I.SHIP_ID='{0}' and MOVED='1' AND I.USER_NAME is not null) group by size_con,fullorempty,OPER_NAME", strShip_Id); strSql = string.Format(@"select SIZE_CON,FULLOREMPTY,OPER_NAME,count(case when unload_mark='1' then 1 end) operCon FROM (SELECT I.SIZE_CON,I.FULLOREMPTY,I.UNLOAD_MARK,I.CONTAINER_NO,CASE WHEN T.NAME IS NOT NULL THEN T.NAME ELSE I.USER_NAME END as OPER_NAME from con_image I LEFT JOIN TALLY_CLERK T ON I.USER_NAME=T.WORK_NO where I.SHIP_ID='{0}' and MOVED='1') group by size_con,fullorempty,OPER_NAME", strShip_Id); var dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathTally).ExecuteTable(strTallySql); if (dt.Rows.Count <= 0) { Json = JsonConvert.SerializeObject(new DicPackage(true, null, "暂无数据!").DicInfo()); return; } List <SingleStatisticsE> singleStatisticsList = new List <SingleStatisticsE>(); for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { SingleStatisticsE singleStatisticsE = new SingleStatisticsE(); singleStatisticsE.Name = Convert.ToString(dt.Rows[iRow]["OPER_NAME"]); singleStatisticsList.Add(singleStatisticsE); } dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathTally).ExecuteTable(strSql); for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { string name = Convert.ToString(dt.Rows[iRow]["OPER_NAME"]); for (int j = 0; j < singleStatisticsList.Count; j++) { SingleStatisticsE s = singleStatisticsList[j]; if (s.Name.Equals(name)) { if (dt.Rows[iRow]["FULLOREMPTY"].Equals("E")) { if (dt.Rows[iRow]["SIZE_CON"].Equals("20")) { s.E_20 = Convert.ToInt16(dt.Rows[iRow]["OPERCON"]); } else if (dt.Rows[iRow]["SIZE_CON"].Equals("40")) { s.E_40 = Convert.ToInt16(dt.Rows[iRow]["OPERCON"]); } else { s.E_other = Convert.ToInt16(dt.Rows[iRow]["OPERCON"]); } } if (dt.Rows[iRow]["FULLOREMPTY"].Equals("F")) { if (dt.Rows[iRow]["SIZE_CON"].Equals("20")) { s.F_20 = Convert.ToInt16(dt.Rows[iRow]["OPERCON"]); } else if (dt.Rows[iRow]["SIZE_CON"].Equals("40")) { s.F_40 = Convert.ToInt16(dt.Rows[iRow]["OPERCON"]); } else { s.F_other = Convert.ToInt16(dt.Rows[iRow]["OPERCON"]); } } } } } Json = JsonConvert.SerializeObject(new DicPackage(true, singleStatisticsList, null).DicInfo()); } catch (Exception ex) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:获取个统计操作员数据发生异常。{1}", ex.Source, ex.Message)).DicInfo()); } }