コード例 #1
0
        public static DataTable GetExpZF(string jhh, string make, int cltype, string value)
        {
            string sql = "select count(*) JS,sum(MZ) MZ from ExportStorageAcceptOrder ";

            sql += "where JHH='" + jhh + "' and MAKE='" + make + "' and KW<>'' and (WCFlag is Null or WCFlag<>2) ";
            switch (cltype)
            {
            case 0:
                sql += "and ZFH='" + value + "' ";
                break;

            case 1:
                sql += "and LH='" + value + "' ";
                break;

            case 2:
                sql += "and HTH='" + value + "' ";
                break;

            case 3:
                sql += "and substring(CLH,1,6)='" + value + "' ";
                break;

            default:
                break;
            }

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #2
0
        public static void UpdateImpWcjs()
        {
            //string sql = "select A.JHH,A.ZFH,count(*) WCJS,sum(B.MZ) WCMZ,sum(B.JZ) WCJZ from ImportStorageOrder A,ImportStorageAcceptOrder B ";
            //sql += "where A.ZFH=B.ZFH and A.JHH=B.JHH and B.WCFlag=2 group by A.JHH,A.ZFH";

            //DataTable dt = SqlCe.ExecuteQuery(sql);

            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    SqlCe.ExecuteNonQuery("update ImportStorageOrder set WCJS=" + dt.Rows[i]["WCJS"].ToString() + ",WCMZ=" + dt.Rows[i]["WCMZ"].ToString() + ",WCJZ=" + dt.Rows[i]["WCJZ"].ToString() + " where ZFH='" + dt.Rows[i]["ZFH"].ToString() + "' and JHH='" + dt.Rows[i]["JHH"].ToString() + "'");
            //}

            string sql = "select A.JHH,A.MAKE,count(*) WCJS,sum(B.MZ) WCMZ,sum(B.JZ) WCJZ  from ImportStoragePlan A,ImportStorageAcceptOrder B ";

            sql += "where A.JHH=B.JHH and A.Make=B.Make and B.WCFlag=2 group by A.JHH,A.Make";


            DataTable dt = SqlCe.ExecuteQuery(sql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                SqlCe.ExecuteNonQuery("update ImportStoragePlan set WCJS=" + dt.Rows[i]["WCJS"].ToString() + ",WCMZ=" + dt.Rows[i]["WCMZ"].ToString() + ",WCJZ=" + dt.Rows[i]["WCJZ"].ToString() + " where JHH='" + dt.Rows[i]["JHH"].ToString() + "' and Make='" + dt.Rows[i]["Make"].ToString() + "'");
            }

            dt.Dispose();

            sql = "delete from ImportStorageAcceptOrder where exists(select * from ImportStoragePlan where JS=WCJS and JHH=ImportStorageAcceptOrder.JHH)";
            SqlCe.ExecuteNonQuery(sql);
            //sql = "delete from ImportStorageOrder where exists(select * from ImportStoragePlan where JS=WCJS and JHH=ImportStorageOrder.JHH)";
            //SqlCe.ExecuteNonQuery(sql);
            sql = "delete from ImportStoragePlan where JS=WCJS";
            SqlCe.ExecuteNonQuery(sql);
        }
コード例 #3
0
        public static DataTable GetExpZF(string jhh, string make, int cltype)
        {
            string sql = "sum(case WCFlag when 2 then 0 else 1 end) SYJS, sum(case WCFlag when 2 then 1 else 0 end) WCJS, count(*) JS, ";

            sql += "sum(case WCFlag when 2 then 0 else MZ end) SYMZ, sum(case WCFlag when 2 then MZ else 0 end) WCMZ, sum(MZ) MZ,";
            sql += "sum(case WCFlag when 2 then 0 else JZ end) SYJZ, sum(case WCFlag when 2 then JZ else 0 end) WCJZ, sum(JZ) JZ,";
            sql += "max(PM) PM,max(Height+'×'+Width+'×'+Long) GG ";
            sql += "from ExportStorageAcceptOrder ";
            sql += "where JHH='" + jhh + "' and MAKE='" + make + "' ";

            switch (cltype)
            {
            case 0:
                sql = "select ZFH," + sql + "group by ZFH ";
                break;

            case 1:
                sql = "select LH," + sql + "group by LH ";
                break;

            case 2:
                sql = "select HTH," + sql + "group by HTH ";
                break;

            case 3:
                sql = "select substring(CLH,1,6) ZPH," + sql + "group by substring(CLH,1,6) ";
                break;

            default:
                break;
            }

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #4
0
        public static DataTable GetExpPlanF(string kb, string jhh, string flag)
        {
            string sql = "select JHH,Make,JHDD,SHDW,";

            sql += "JS,WCJS,JS-(case isnull(WCJS) when 1 then 0 else WCJS end) SYJS, ";
            sql += "JZ,WCJZ,JZ-(case isnull(WCJZ) when 1 then 0 else WCJZ end) SYJZ, ";
            sql += "MZ,WCMZ,MZ-(case isnull(WCJZ) when 1 then 0 else WCMZ end) SYMZ ";
            sql += "from ExportStoragePlan where CKB='" + kb + "' ";
            if (flag == "zt")
            {
                sql += "and JHH like '1%' ";
            }
            else if (flag == "tl")
            {
                sql += "and JHH like '2%' ";
            }
            else if (flag == "zk")
            {
                sql += "and (JHH like '7%' or JHH like '8%' or JHH like '9%') ";
            }
            if (jhh != "")
            {
                sql += "and JHH='" + jhh + "'";
            }

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #5
0
        public static DataTable GetExpCL(string jhh, string make, int cltype, string value)
        {
            string sql = "select JHH,Make,ZFH,CLH,CLH2,MZ,JZ,";

            sql += "Height+'×'+Width+'×'+Long GG,QA, ";
            sql += "WCFlag,SCANTIME from ";
            sql += "ExportStorageAcceptOrder where (WCFlag is null or WCFlag<>2) ";
            sql += "and JHH='" + jhh + "' and Make='" + make + "' ";

            switch (cltype)
            {
            case 0:
                sql += "and ZFH='" + value + "'";
                break;

            case 1:
                sql += "and LH='" + value + "'";
                break;

            case 2:
                sql += "and HTH='" + value + "'";
                break;

            case 3:
                sql += "and substring(CLH,1,6)='" + value + "'";
                break;

            default:
                break;
            }

            sql += " order by CLH";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #6
0
        public static DataTable GetImpScanCL(string jhh, string make)
        {
            string sql = "select *  from ImportStorageAcceptOrder where WCFlag=1 ";

            if (jhh != "")
            {
                sql += "and JHH='" + jhh + "' and Make='" + make + "' ";
            }
            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #7
0
        public static DataTable GetImpCL(string kb, string jhh, string make, string zfh)
        {
            string sql = "select A.JHH,A.Make,A.ZFH,A.CLH,A.CLH2,A.MZ,A.JZ,A.Height+'×'+A.Width+'×'+A.Long GG,A.WCFlag,A.SCANTIME,A.QA, ";

            sql += "case when B.CLH is not null then '1' else '0' end ExFlag ";
            sql += "from ImportStorageAcceptOrder A left join ExportStorageAcceptOrder B on A.CLH=B.CLH and A.Make=B.Make and B.CKB='" + kb + "' ";
            sql += "where A.ZFH='" + zfh + "' and A.JHH='" + jhh + "' and A.Make='" + make + "'";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #8
0
        public static DataTable GetExpCL(string jhh, string make, string zfh)
        {
            string sql = "select ZFH,CLH,MZ,JZ,";

            sql += "Height+'×'+Width+'×'+Long GG,";
            sql += "WCFlag,SCANTIME from ";
            sql += "ExportStorageAcceptOrder where (WCFlag is null or WCFlag<>2) ";
            sql += "and ZFH='" + zfh + "' and JHH='" + jhh + "' and Make='" + make + "' ";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #9
0
        //public static void SaveCurrentKw(string jhh, string kw)
        //{
        //    string sql = "select * from ZF2KW where JHH='" + jhh + "'";
        //    DataTable dt = SqlCe.ExecuteQuery(sql);
        //    if (dt.Rows.Count > 0)
        //    {
        //        sql = "update ZF2KW set KW='"+ kw +"' where JHH='"+ jhh +"'";
        //    }
        //    else
        //    {
        //        sql = "insert into ZF2KW (JHH,KW) values ('" + jhh + "','" + kw + "')";
        //    }
        //    dt.Dispose();
        //    SqlCe.ExecuteNonQuery(sql);
        //}

        public static string GetRemainCls(string jhh, string make, string zfh)
        {
            string remain = "";

            string    sql = "select count(*) remain from ImportStorageAcceptOrder where ZFH='" + zfh + "' and JHH='" + jhh + "' and Make='" + make + "' and (WCFlag is null or WCFlag<>2) ";
            DataTable dt  = SqlCe.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                remain = dt.Rows[0]["remain"].ToString();
            }
            return(remain);
        }
コード例 #10
0
        public static string GetExportFlag(string clh)
        {
            string    sql = "select * from ExportStorageAcceptOrder where CLH='" + clh + "' and CKB='" + Global.sKb + "'";
            string    ret = "0";
            DataTable dt  = SqlCe.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                ret = "1";
            }
            dt.Dispose();
            return(ret);
        }
コード例 #11
0
        //public static int GetImpScanJs(string jhh, string make,string kjh)
        //{
        //    int js = 0;
        //    string sql = "select count(*) js from ImportStorageAcceptOrder where WCFlag=1 and RKB='" + Global.sKb + "' ";
        //    if (jhh != "")
        //    {
        //        sql += "and JHH='" + jhh + "' and Make='" + make + "' ";
        //    }
        //    if (kjh != "")
        //    {
        //        sql += "and CH='"+ kjh +"'";
        //    }

        //    DataTable dt = SqlCe.ExecuteQuery(sql);
        //    if (dt.Rows.Count > 0)
        //    {
        //        js = Convert.ToInt32(dt.Rows[0]["js"]);
        //    }

        //    return js;
        //}

        public static int GetExpScanJs(string jhh)
        {
            int       js  = 0;
            string    sql = "select count(*) js from ExportStorageAcceptOrder where WCFlag=1 and JHH='" + jhh + "' and CKB='" + Global.sKb + "' ";
            DataTable dt  = SqlCe.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                js = Convert.ToInt32(dt.Rows[0]["js"]);
            }

            return(js);
        }
コード例 #12
0
        public static DataTable GetCLDetail(string clh, bool inflag)
        {
            string sql = "";

            if (inflag)
            {
                sql = "select PM,Height+'×'+Width+'×'+Long GG from ImportStorageAcceptOrder where CLH='" + clh + "'";
            }
            else
            {
                sql = "select PM,Height+'×'+Width+'×'+Long GG from ExportStorageAcceptOrder where CLH='" + clh + "'";
            }
            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #13
0
        public static string GetCurrentKw(string zfh, string jhh, string make)
        {
            string kw = "";

            string    sql = "select KW from ZF2KW where ZFH='" + zfh + "' and JHH='" + jhh + "' and Make='" + make + "'";
            DataTable dt  = SqlCe.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                kw = dt.Rows[0]["KW"].ToString();
            }
            dt.Dispose();
            return(kw);
        }
コード例 #14
0
        public static DataTable GetImpPlan(string kb, string jhh)
        {
            string sql = "select JHH,Make,";

            sql += "JS,WCJS,JS-(case isnull(WCJS) when 1 then 0 else WCJS end) SYJS, ";
            sql += "JZ,WCJZ,JZ-(case isnull(WCJZ) when 1 then 0 else WCJZ end) SYJZ, ";
            sql += "MZ,WCMZ,MZ-(case isnull(WCJZ) when 1 then 0 else WCMZ end) SYMZ ";
            sql += "from ImportStoragePlan  where RKB='" + kb + "' ";
            if (jhh != "")
            {
                sql += "and JHH='" + jhh + "'";
            }

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #15
0
        //public static string GetCurrentKw(string jhh)
        //{
        //    string kw = "";

        //    string sql = "select KW from ZF2KW where JHH='" + jhh + "'";
        //    DataTable dt = SqlCe.ExecuteQuery(sql);
        //    if (dt.Rows.Count > 0)
        //    {
        //        kw = dt.Rows[0]["KW"].ToString();
        //    }
        //    dt.Dispose();
        //    return kw;

        //}

        public static void SaveCurrentKw(string zfh, string jhh, string make, string kw)
        {
            string    sql = "select * from ZF2KW where JHH='" + jhh + "' and Make='" + make + "' and ZFH='" + zfh + "'";
            DataTable dt  = SqlCe.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                sql = "update ZF2KW set KW='" + kw + "' where JHH='" + jhh + "' and Make='" + make + "' and ZFH='" + zfh + "'";
            }
            else
            {
                sql = "insert into ZF2KW (ZFH,JHH,Make,KW) values ('" + zfh + "','" + jhh + "','" + make + "','" + kw + "')";
            }
            dt.Dispose();
            SqlCe.ExecuteNonQuery(sql);
        }
コード例 #16
0
        public static DataTable GetExpPlanZC(string kb, string cph, string cm, string gdh)
        {
            string sql = "select JHH,Make,JHDD,SHDW,GDH,";

            sql += "JS,WCJS,JS-(case isnull(WCJS) when 1 then 0 else WCJS end) SYJS, ";
            sql += "JZ,WCJZ,JZ-(case isnull(WCJZ) when 1 then 0 else WCJZ end) SYJZ, ";
            sql += "MZ,WCMZ,MZ-(case isnull(WCJZ) when 1 then 0 else WCMZ end) SYMZ ";
            sql += "from ExportStoragePlan where CKB='" + kb + "' and JHH like '3%' ";
            sql += " and CM='" + cm + "' and CPH='" + cph + "' ";
            if (gdh != "")
            {
                sql += "and GDH='" + gdh + "'";
            }

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #17
0
        public static void SetWtdInScanStatus(string jhh, string clh, string kw, string js, string zl, string now, string lbl)
        {
            string    sql = "select * from wtddetail where wtdh='" + jhh + "' and clh='" + clh + "'";
            DataTable dt  = SqlCe.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                sql = "update wtddetail set js=" + js + ",zl=" + zl + ",kw='" + kw + "',scantime='" + now + "',wcflag=1,lbl='" + lbl + "' where wtdh='" + jhh + "' and clh='" + clh + "'";
                SqlCe.ExecuteNonQuery(sql);
            }
            else
            {
                sql = "insert into wtddetail (wtdh,clh,js,zl,kw,scantime,wcflag,lbl,flag) values('" + jhh + "','" + clh + "'," + js + "," + zl + ",'" + kw + "','" + now + "',1,'" + lbl + "','A')";
                SqlCe.ExecuteNonQuery(sql);
            }
            dt.Dispose();
        }
コード例 #18
0
        public static DataTable GetExpScanCL(string cph, string jhh, string make, string zfh)
        {
            string sql = "select A.* from ExportStorageAcceptOrder A,ExportStoragePlan B where A.JHH=B.JHH and A.Make=B.Make and  A.WCFlag=1 and A.CKB='" + Global.sKb + "' ";

            if (cph != "")
            {
                sql += "and B.CPH='" + cph + "' ";
            }
            if (jhh != "")
            {
                sql += "and A.JHH='" + jhh + "' and A.Make='" + make + "' ";
            }
            if (zfh != "")
            {
                sql += "and A.ZFH='" + zfh + "'";
            }
            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #19
0
        public static int GetImpScanJs(string jhh, string make)
        {
            int    js  = 0;
            string sql = "select count(*) js from ImportStorageAcceptOrder where WCFlag=1 and RKB='" + Global.sKb + "' ";

            if (jhh != "")
            {
                sql += "and JHH='" + jhh + "' and Make='" + make + "'";
            }

            DataTable dt = SqlCe.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                js = Convert.ToInt32(dt.Rows[0]["js"]);
            }

            return(js);
        }
コード例 #20
0
        public static int GetWtdScanJs(string jhh)
        {
            int    js  = 0;
            string sql = "select count(*) js from WtdDetail where WCFlag=1 ";

            if (jhh != "")
            {
                sql += "and Wtdh='" + jhh + "' ";
            }

            DataTable dt = SqlCe.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                js = Convert.ToInt32(dt.Rows[0]["js"]);
            }

            return(js);
        }
コード例 #21
0
        public static DataTable GetExpCLkb(string kb, string cph, string jhh, string make, int cltype, string value)
        {
            string sql = "select A.JHH,A.Make,A.ZFH,A.CLH,A.CLH2,A.MZ,A.JZ,substring(A.KW,4,8) KW,";

            sql += "A.Height+'×'+A.Width+'×'+A.Long GG,A.QA,";
            sql += "A.WCFlag,A.SCANTIME from ";
            sql += "ExportStorageAcceptOrder A, ExportStoragePlan B where A.JHH=B.JHH and A.Make=B.Make and (A.WCFlag is null or A.WCFlag<>2) and A.KW<>'' ";
            sql += "and A.CKB='" + kb + "' ";
            if (cph != "")
            {
                sql += "and B.CPH='" + cph + "' ";
            }
            if (jhh != "")
            {
                sql += "and A.JHH='" + jhh + "' and A.Make='" + make + "' ";
            }

            switch (cltype)
            {
            case 0:
                sql += "and A.ZFH='" + value + "'";
                break;

            case 1:
                sql += "and A.LH='" + value + "'";
                break;

            case 2:
                sql += "and A.HTH='" + value + "'";
                break;

            case 3:
                sql += "and substring(A.CLH,1,6)='" + value + "'";
                break;

            default:
                break;
            }

            sql += " order by KW,CLH ";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #22
0
ファイル: Message.cs プロジェクト: loveishere/A-B-
        private void SetDataModel(string MessageID)
        {
            string    sql = "select * from gram where mid='" + MessageID + "'";
            DataTable dt  = SqlCe.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                _mtablename = dt.Rows[0]["mainTbl"].ToString();
                _dtablename = dt.Rows[0]["detailTbl"].ToString();
                _isFeedback = Convert.ToBoolean(dt.Rows[0]["isFeedback"]);
                _name       = dt.Rows[0]["name"].ToString();
            }
            sql = "select * from gramfld where mid='" + MessageID + "' order by seq";
            dt  = SqlCe.ExecuteQuery(sql);

            string fldname = "";

            if (dt.Rows.Count > 0)
            {
                _fields = new FieldDesc[dt.Rows.Count];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    _fields[i] = new FieldDesc();
                    fldname    = dt.Rows[i]["name"].ToString();
                    if (fldname == "oper")
                    {
                        _oper = i;
                    }
                    else if (fldname == "loop")
                    {
                        _loopindex = i;
                    }
                    _fields[i].FieldName = fldname;
                    _fields[i].FieldType = dt.Rows[i]["type"].ToString();
                    _fields[i].IsPK      = Convert.ToInt32(dt.Rows[i]["isPK"]);
                    _fields[i].IsLoop    = Convert.ToBoolean(dt.Rows[i]["isLoop"]);
                    _fields[i].Value     = "";
                }
            }
            dt.Dispose();
        }
コード例 #23
0
        public static DataTable GetImpFrameCL(string kb, string kjh)
        {
            string sql = "select A.CLH,";

            sql += "case when B.CLH is not null then B.RKB else A.WZ end  WZ,";
            sql += "case when B.CLH is not null then case when len(B.KW)>3 then substring(B.KW,4,len(B.KW)-3) else '' end else case when len(A.KW)>3 then substring(A.KW,4,len(A.KW)-3) else '' end end KW,";
            sql += "case when B.CLH is not null then B.Height+'×'+B.Width+'×'+B.Long else A.Height+'×'+A.Width+'×'+A.Long end GG,";
            sql += "case when B.CLH is not null then B.MZ else A.MZ end MZ,";
            sql += "case when B.CLH is not null then B.WCFlag else -1 end WCFlag,";
            sql += "case when B.CLH is not null then B.SCANTIME else '' end SCANTIME,";
            sql += "case when B.CLH is not null then B.ZFH else A.ZFH end ZFH,";
            sql += "case when B.CLH is not null then B.JHH else A.TDH end TDH,";
            sql += "case when B.CLH is not null then B.Make else A.Make end Make,";
            sql += "case when B.CLH is not null then B.QA else A.QA end QA,";
            sql += "A.CH,";
            sql += "case when C.CLH is not null then '1' else '0' end ExFlag ";
            sql += "from FrameDetail A left join ImportStorageAcceptOrder B on A.CLH=B.CLH and A.Make=B.Make and (B.WCFlag is null or B.WCFlag<>2) and B.RKB='" + kb + "' ";
            sql += "left join ExportStorageAcceptOrder C on A.CLH=C.CLH and A.Make=C.Make and (C.WCFlag is null or C.WCFlag<>2) and C.CKB='" + kb + "' ";
            sql += "where A.KJH='" + kjh + "' order by A.CH desc,A.CLH asc ";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #24
0
        public static DataTable GetImpZF(string jhh, string make)
        {
            //string sql = "select A.ZFH,B.KW,sum(case B.WCFlag when 2 then 0 else 1 end) SYJS, sum(case B.WCFlag when 2 then 1 else 0 end) WCJS, count(*) JS, ";
            //sql += "sum(case B.WCFlag when 2 then 0 else B.MZ end) SYMZ, sum(case B.WCFlag when 2 then B.MZ else 0 end) WCMZ, sum(B.MZ) MZ,";
            //sql += "sum(case B.WCFlag when 2 then 0 else B.JZ end) SYJZ, sum(case B.WCFlag when 2 then B.JZ else 0 end) WCJZ, sum(B.JZ) JZ,";
            //sql += "max(A.HTH) HTH,max(A.PM) PM ";
            //sql += "from ImportStorageOrder A,ImportStorageAcceptOrder B ";
            //sql += "where A.ZFH=B.ZFH and A.JHH=B.JHH and A.Make=B.Make ";
            //sql += "and A.JHH='" + jhh + "' and A.make='"+ make +"'";
            //sql += "group by A.ZFH,B.KW ";


            string sql = "select ZFH,sum(case WCFlag when 2 then 0 else 1 end) SYJS, sum(case WCFlag when 2 then 1 else 0 end) WCJS, count(*) JS,";

            sql += "sum(case WCFlag when 2 then 0 else MZ end) SYMZ, sum(case WCFlag when 2 then MZ else 0 end) WCMZ, sum(MZ) MZ,";
            sql += "sum(case WCFlag when 2 then 0 else JZ end) SYJZ, sum(case WCFlag when 2 then JZ else 0 end) WCJZ, sum(JZ) JZ,";
            sql += "max(HTH) HTH,max(PM) PM ";
            sql += "from ImportStorageAcceptOrder ";
            sql += "where JHH='" + jhh + "' and Make='" + make + "'";
            sql += "group by ZFH ";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #25
0
        public static DataTable GetExpZF(string jhh, string make)
        {
            //string sql = "select A.ZFH,substring(B.KW,4,8) KW,sum(case B.WCFlag when 2 then 0 else 1 end) SYJS, sum(case B.WCFlag when 2 then 1 else 0 end) WCJS, count(*) JS, ";
            //sql += "sum(case B.WCFlag when 2 then 0 else B.MZ end) SYMZ, sum(case B.WCFlag when 2 then B.MZ else 0 end) WCMZ, sum(B.MZ) MZ,";
            //sql += "sum(case B.WCFlag when 2 then 0 else B.JZ end) SYJZ, sum(case B.WCFlag when 2 then B.JZ else 0 end) WCJZ, sum(B.JZ) JZ,";
            //sql += "max(A.PM) PM,max(B.Height+'×'+B.Width+'×'+B.Long) GG ";
            //sql += "from ExportStorageOrder A,ExportStorageAcceptOrder B ";
            //sql += "where A.ZFH=B.ZFH and A.JHH=B.JHH and A.MAKE=B.MAKE ";
            //sql += "and A.JHH='" + jhh + "' and A.MAKE='" + make + "' ";
            //sql += "group by A.ZFH,B.KW ";


            string sql = "select ZFH,sum(case WCFlag when 2 then 0 else 1 end) SYJS, sum(case WCFlag when 2 then 1 else 0 end) WCJS, count(*) JS,";

            sql += "sum(case WCFlag when 2 then 0 else MZ end) SYMZ, sum(case WCFlag when 2 then MZ else 0 end) WCMZ, sum(MZ) MZ,";
            sql += "sum(case WCFlag when 2 then 0 else JZ end) SYJZ, sum(case WCFlag when 2 then JZ else 0 end) WCJZ, sum(JZ) JZ,";
            sql += "max(PM) PM,max(Height+'×'+Width+'×'+Long) GG ";
            sql += "from ExportStorageAcceptOrder ";
            sql += "where JHH='" + jhh + "' and MAKE='" + make + "' ";
            sql += "group by ZFH ";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #26
0
        public static DataTable GetExpShip(string kb)
        {
            string sql = "select CPH,CM,sum(JS)-sum(WCJS) SYJS,sum(WCJS) WCJS from ExportStoragePlan where CKB='" + kb + "' and JHH like '3%' group by CPH,CM";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #27
0
        public static DataTable GetBasicQuality()
        {
            string sql = "select id,name from BasicQuality";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #28
0
ファイル: Message.cs プロジェクト: loveishere/A-B-
        private bool SaveDetailTbl()
        {
            string sql   = "";
            string nvsql = "";

            int looplength = _fields.Length - _loopindex - 1;

            string[] whsql = new string[_loopnum];

            sql = " where 1=1 ";
            for (int i = 0; i < _loopindex; i++)
            {
                if (_fields[i].IsPK == 1)
                {
                    nvsql = namevaluesql(_fields[i].FieldType, _fields[i].FieldName, _content[i]);
                    if (nvsql != "")
                    {
                        sql += "and " + nvsql + " ";
                    }
                }
            }

            for (int i = 0; i < _loopnum; i++)
            {
                whsql[i] = sql;

                for (int j = _loopindex + 1; j < _fields.Length; j++)
                {
                    if (_fields[j].IsPK == 1)
                    {
                        nvsql = namevaluesql(_fields[j].FieldType, _fields[j].FieldName, _content[j + i * looplength]);
                        if (nvsql != "")
                        {
                            whsql[i] += "and " + nvsql + " ";
                        }
                    }
                }
            }

            if (_operation == "D")
            {
                for (int i = 0; i < _loopnum; i++)
                {
                    sql = "delete from " + _dtablename + whsql[i];
                    try
                    {
                        SqlCe.ExecuteNonQuery(sql);
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message);
                        System.Diagnostics.Debug.WriteLine(sql);
                        SqlCe.ExecuteNonQuery("insert into error values('" + sql.Replace("'", "''") + "','" + ex.Message.Replace("'", "''") + "',getDate())");
                    }
                }
                return(true);
            }

            for (int i = 0; i < _loopnum; i++)
            {
                bool      bExist = false;
                DataTable dt     = SqlCe.ExecuteQuery("select * from " + _dtablename + whsql[i]);
                if (dt.Rows.Count > 0)
                {
                    bExist = true;
                }
                dt.Dispose();
                if (bExist == false)
                {
                    sql = "insert into " + _dtablename + "(";
                    for (int j = 0; j < _loopindex; j++)
                    {
                        if ((_fields[j].IsPK == 1 || _fields[j].IsPK == 2) && _fields[j].FieldType != "")
                        {
                            sql += _fields[j].FieldName + ",";
                        }
                    }

                    for (int j = _loopindex + 1; j < _fields.Length; j++)
                    {
                        if (_fields[j].FieldType != "")
                        {
                            sql += _fields[j].FieldName + ",";
                        }
                    }

                    sql  = sql.Substring(0, sql.Length - 1);
                    sql += ") values (";

                    for (int j = 0; j < _loopindex; j++)
                    {
                        if ((_fields[j].IsPK == 1 || _fields[j].IsPK == 2) && _fields[j].FieldType != "")
                        {
                            sql += valuesql(_fields[j].FieldType, _content[j]);
                        }
                    }

                    for (int j = _loopindex + 1; j < _fields.Length; j++)
                    {
                        if (_fields[j].FieldType != "")
                        {
                            sql += valuesql(_fields[j].FieldType, _content[j + i * looplength]);
                        }
                    }
                    sql  = sql.Substring(0, sql.Length - 1);
                    sql += ")";


                    try
                    {
                        SqlCe.ExecuteNonQuery(sql);
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message);
                        System.Diagnostics.Debug.WriteLine(sql);
                        SqlCe.ExecuteNonQuery("insert into error values('" + sql.Replace("'", "''") + "','" + ex.Message.Replace("'", "''") + "',getDate())");
                    }
                }
                else
                {
                    sql = "update " + _dtablename + " set ";
                    for (int j = 0; j < _loopindex; j++)
                    {
                        if (_fields[j].IsPK == 2 && _fields[j].FieldType != "")
                        {
                            nvsql = namevaluesql(_fields[j].FieldType, _fields[j].FieldName, _content[j]);
                            if (nvsql != "")
                            {
                                sql += nvsql + ",";
                            }
                        }
                    }
                    for (int j = _loopindex + 1; j < _fields.Length; j++)
                    {
                        if (_fields[j].IsPK == 0 && _fields[j].FieldType != "")
                        {
                            nvsql = namevaluesql(_fields[j].FieldType, _fields[j].FieldName, _content[j + i * looplength]);
                            if (nvsql != "")
                            {
                                sql += nvsql + ",";
                            }
                        }
                    }
                    sql  = sql.Substring(0, sql.Length - 1);
                    sql += whsql[i];

                    try
                    {
                        SqlCe.ExecuteNonQuery(sql);
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message);
                        System.Diagnostics.Debug.WriteLine(sql);
                        SqlCe.ExecuteNonQuery("insert into error values('" + sql.Replace("'", "''") + "','" + ex.Message.Replace("'", "''") + "',getDate())");
                    }
                }
            }

            return(true);
        }
コード例 #29
0
        public static DataTable GetWtd(string kb)
        {
            string sql = "select WTDH,HPMC,ZJS,ZZL,CRFLAG,SJFS,WCJS,WCZL from Wtd where KB='" + kb + "'";

            return(SqlCe.ExecuteQuery(sql));
        }
コード例 #30
0
        public static DataTable GetWtdCl(string jhh)
        {
            string sql = "select CLH,substring(KW,4,8) KW,JS,ZL,QA,SCANTIME,WCFLAG,LBL,FLAG from wtddetail where WTDH='" + jhh + "'";

            return(SqlCe.ExecuteQuery(sql));
        }