Пример #1
0
        public static string SaveReason(string rcode, string rid, string rlcode, string rlname, string rname)
        {
            string              r  = "";
            Sys_RepairReason    sv = new Sys_RepairReason();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                string dcode = "";
                if (iv.u.rcode == "xtgl")
                {
                    dcode = "00010001";
                }
                else
                {
                    dcode = iv.u.dcode.Substring(0, 8);
                }
                sv.rcode   = rcode;
                sv.rdetail = rname;
                sv.rrcode  = rlcode;
                sv.rrname  = rlname;
                sv.rread   = true;
                sv.dcode   = dcode;
                sv.rtype   = "a";
                sv.cdate   = DateTime.Now.ToString();
                sv.maker   = iv.u.ename;
                if (rid == "0")
                {
                    if (srdb.Add(sv) > 0)
                    {
                        r = "S";
                    }
                    else
                    {
                        r = "F";
                    }
                }
                else
                {
                    if (srdb.Update(sv))
                    {
                        r = "S";
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Пример #2
0
        public static string InitReason(string rrcode, string rcode)
        {
            string                   r   = "";
            Sys_RepairReason         st  = new Sys_RepairReason();
            Sys_RepairReasonCategory srp = new Sys_RepairReasonCategory();
            SessionUserValidate      iv  = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                srp = srdcb.Query(" and rrcode='" + rrcode + "'");
                if (rcode == "")
                {
                    st.rcode   = srdb.CreateCode().ToString().PadLeft(4, '0');
                    st.rdetail = "";
                    if (srp != null)
                    {
                        st.rrcode = srp.rrcode;
                        st.rrname = srp.rrname;
                    }
                    else
                    {
                        st.rrcode = "";
                        st.rrname = "";
                    }
                    st.id = 0;
                }
                else
                {
                    st = srdb.Query(" and rcode='" + rcode + "'");
                }
                r = js.Serialize(st);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Пример #3
0
        public static string CustDelReason(string rcode)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_RepairReason srr = srdb.Query(" and rcode='" + rcode + "'");
                if (srr != null)
                {
                    if (srr.rread)
                    {
                        r = "R";
                    }
                    else
                    {
                        if (srdb.Delete(rcode))
                        {
                            r = "S";
                        }
                        else
                        {
                            r = "F";
                        }
                    }
                }
                else
                {
                    r = "F";
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Пример #4
0
        public static ArrayList QueryProdutionList(string bdate, string code, string curpage, string customer, string edate, string emcode, string fname, string pagesize, string city, string tabcode)
        {
            ArrayList r   = new ArrayList();
            DataTable lsr = new DataTable();

            StringBuilder where = new StringBuilder();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r.Add(iv.badstr);
                int rcount = 0;
                int pcount = 0;
                if (customer != "")
                {
                    where.AppendFormat(" and customer like '%{0}%'", customer);
                }
                if (code != "")
                {
                    where.AppendFormat(" and scode like '%{0}%'", code);
                }
                if (fname != "")
                {
                    where.AppendFormat(" and fname like '%{0}%'", fname);
                }
                if (city != "")
                {
                    where.AppendFormat(" and e_city like '%{0}%'", city);
                }
                if (bdate != "" && bdate != null)
                {
                    where.AppendFormat(" and edate >='{0}'", bdate);
                }
                if (edate != "" && edate != null)
                {
                    where.AppendFormat(" and edate <='{0}'", Convert.ToDateTime(edate).AddDays(1).ToString("yyyy-MM-dd"));
                }
                Sys_ViewTable svt = svtb.QuerySelCols(emcode, tabcode, iv.u.rcode);
                if (svt == null)
                {
                }
                else
                {
                    where.Append(CommonBll.SqlWhereReplace(iv.u, svt.sqlcondition));
                    string sfield = svt.sqlcols;
                    lsr = bsob.QueryList(Convert.ToInt32(curpage), Convert.ToInt32(pagesize), sfield, where.ToString(), "id desc", ref rcount, ref pcount);
                    if (lsr != null)
                    {
                        r.Add(pcount);
                        foreach (DataRow dr in lsr.Rows)
                        {
                            ArrayList al = new ArrayList();
                            al.Add(bebb.QueryBtnListItems(emcode, iv.u.rcode, "LX", dr[1].ToString()));
                            foreach (DataColumn column in lsr.Columns)
                            {
                                if (column.Caption == "rrcode")
                                {
                                    Sys_RepairReason srr = srrb.Query(" and rcode='" + dr[column].ToString() + "'");
                                    al.Add(srr != null?srr.rdetail:"");
                                }
                                else
                                {
                                    al.Add(dr[column].ToString());
                                }
                            }
                            r.Add(al);
                        }
                    }
                }
            }
            else
            {
                r.Add(iv.badstr);
            }
            return(r);
        }
Пример #5
0
        public static ArrayList QueryAfterSaleList(string bdate, string city, string code, string curpage, string customer, string edate, string emcode, string pagesize, string platform, string tabcode)
        {
            ArrayList r   = new ArrayList();
            DataTable lsr = new DataTable();

            StringBuilder where = new StringBuilder();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r.Add(iv.badstr);
                int rcount = 0;
                int pcount = 0;
                if (customer != "")
                {
                    where.AppendFormat(" and customer like '%{0}%'", customer);
                }
                if (code != "")
                {
                    where.AppendFormat(" and scode like '%{0}%'", code);
                }
                if (city != "")
                {
                    where.AppendFormat(" and e_city like '%{0}%'", city);
                }
                if (platform != "")
                {
                    where.AppendFormat(" and dname like '%{0}%'", platform);
                }
                if (bdate != "" && bdate != null)
                {
                    where.AppendFormat(" and cdate >='{0}'", bdate);
                }
                if (edate != "" && edate != null)
                {
                    where.AppendFormat(" and cdate <='{0}'", edate);
                }
                Sys_ViewTable svt = svtb.QuerySelCols(emcode, tabcode, iv.u.rcode);
                if (svt == null)
                {
                }
                else
                {
                    where.Append(CommonBll.SqlWhereReplace(iv.u, svt.sqlcondition));
                    string sfield = svt.sqlcols;
                    lsr = bsob.QueryList(Convert.ToInt32(curpage), Convert.ToInt32(pagesize), sfield, where.ToString(), "id desc", ref rcount, ref pcount);
                    if (lsr != null)
                    {
                        r.Add(pcount);
                        foreach (DataRow dr in lsr.Rows)
                        {
                            ArrayList al = new ArrayList();
                            al.Add(bebb.QueryBtnListItems(emcode, iv.u.rcode, "LX", dr[1].ToString()));
                            foreach (DataColumn column in lsr.Columns)
                            {
                                switch (column.Caption)
                                {
                                case "zt":
                                    al.Add("<span style='color:blue; font-weight:bolder'>" + cbeb.GetOrderState(dr[1].ToString()) + "</span>");
                                    break;

                                case "rrcode":
                                    Sys_RepairReason srr = srrb.Query(" and rcode='" + dr[column].ToString() + "'");
                                    al.Add(srr == null ? "" : srr.rdetail);
                                    break;

                                default:
                                    al.Add(dr[column].ToString());
                                    break;
                                }
                            }

                            r.Add(al);
                        }
                    }
                }
            }
            else
            {
                r.Add(iv.badstr);
            }
            return(r);
        }