Ejemplo n.º 1
0
        public static ArrayList QueryMsRefBlCate(string mscode, string blcode)
        {
            ArrayList r = new ArrayList();
            Sys_InventoryDetailBll       sib  = new Sys_InventoryDetailBll();
            Sys_InventoryCategoryBll     sub  = new Sys_InventoryCategoryBll();
            List <Sys_InventoryCategory> plsr = new List <Sys_InventoryCategory>();
            List <Sys_InventoryCategory> lsr  = new List <Sys_InventoryCategory>();
            List <Sys_InventoryCategory> lr   = new List <Sys_InventoryCategory>();
            Sys_AssortBll       sab           = new Sys_AssortBll();
            SessionUserValidate iv            = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r.Add(iv.badstr);
                lsr  = sub.QueryList(" and iccode='" + blcode + "' order by isort");
                plsr = sub.QueryList(" and icpcode='" + blcode + "'  order by isort");
                if (plsr != null)
                {
                    lr = plsr;
                }
                else
                {
                    lr = lsr;
                }
                if (lr != null)
                {
                    foreach (Sys_InventoryCategory s in lr)
                    {
                        ArrayList al = new ArrayList();
                        al.Add(s.iccode);
                        al.Add(s.icname);
                        al.Add(s.icstate);
                        if (sib.Exists(" and icode like '" + s.iccode + "%'"))
                        {
                            if (sab.ExistMsBl(" and bcode like '" + s.iccode + "%' and mcode='" + mscode.Substring(0, mscode.Length - 3) + "'"))
                            {
                                r.Add(al);
                            }
                        }
                    }
                }
            }
            else
            {
                r.Add(iv.badstr);
            }
            return(r);
        }
Ejemplo n.º 2
0
        public static ArrayList CzQueryListInventoryCategory(string ipcode, string mname)
        {
            ArrayList r = new ArrayList();
            Sys_InventoryCategoryBll     sub  = new Sys_InventoryCategoryBll();
            List <Sys_InventoryCategory> plsr = new List <Sys_InventoryCategory>();
            List <Sys_InventoryCategory> lsr  = new List <Sys_InventoryCategory>();
            List <Sys_InventoryCategory> lr   = new List <Sys_InventoryCategory>();
            Sys_InventoryDetailBll       sidb = new Sys_InventoryDetailBll();
            SessionUserValidate          iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r.Add(iv.badstr);
                lsr  = sub.QueryList(" and iccode='" + ipcode + "' order by isort");
                plsr = sub.QueryList(" and icpcode='" + ipcode + "'  order by isort");
                if (plsr != null)
                {
                    lr = plsr;
                }
                else
                {
                    lr = lsr;
                }
                if (lr != null)
                {
                    foreach (Sys_InventoryCategory s in lr)
                    {
                        ArrayList al = new ArrayList();
                        al.Add(s.iccode);
                        al.Add(s.icname);
                        al.Add(s.icstate);
                        if (sidb.Exists(" and icode like '" + s.iccode + "%' and mname='" + mname + "'"))
                        {
                            r.Add(al);
                        }
                    }
                }
            }
            else
            {
                r.Add(iv.badstr);
            }
            return(r);
        }
Ejemplo n.º 3
0
        public static ArrayList BatchSaveInventory(string iccode, string plmname, string plsize, string pltype, string plunit)
        {
            ArrayList r = new ArrayList();
            Sys_InventoryDetailBll   sidb = new Sys_InventoryDetailBll();
            Sys_MaterialBll          sub  = new Sys_MaterialBll();
            List <Sys_Material>      lsr  = new List <Sys_Material>();
            Sys_InventoryCategoryBll sicb = new Sys_InventoryCategoryBll();
            SessionUserValidate      iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                List <Sys_InventoryCategory> als  = new List <Sys_InventoryCategory>();
                List <Sys_InventoryDetail>   lsid = new List <Sys_InventoryDetail>();
                string[] iarr = iccode.Split(';');
                if (iarr.Length > 0)
                {
                    foreach (string icv in iarr)
                    {
                        List <Sys_InventoryCategory> lic = sicb.QueryList(" and iccode like '" + icv + "%' and icstate='true'");
                        if (lic != null)
                        {
                            foreach (Sys_InventoryCategory sic in lic)
                            {
                                if (!als.Contains(sic))
                                {
                                    als.Add(sic);
                                }
                            }
                        }
                    }
                }
                if (als.Count > 0)
                {
                    r.Add("S");
                    foreach (Sys_InventoryCategory sic in als)
                    {
                        string[] arr   = plmname.Split(';');
                        int      pcnum = sidb.CreateCode(sic.iccode);
                        foreach (string cz in arr)
                        {
                            if (!sidb.Exists(" and iname='" + sic.icname + "' and mname='" + cz + "'"))
                            {
                                Sys_InventoryDetail sid = new Sys_InventoryDetail();
                                sid.icname         = sic.icname;
                                sid.iccode         = sic.iccode;
                                sid.iname          = sic.icname;
                                sid.icode          = sic.iccode + pcnum.ToString().PadLeft(3, '0');
                                sid.mname          = cz;
                                sid.iunit          = plunit;
                                sid.maker          = iv.u.ename;
                                sid.isaleprice     = 0;
                                sid.isupplyprice   = 0;
                                sid.ipurchaseprice = 0;
                                sid.iimage         = "";
                                sid.istate         = true;
                                sid.mcode          = "";
                                sid.idef1          = "";
                                sid.idef2          = true;
                                sid.idef3          = 0;
                                sid.psize          = plsize;
                                sid.cdate          = DateTime.Now.ToString();
                                sid.tcprice        = 0;
                                sid.ptype          = pltype;
                                if (sidb.Add(sid) < 0)
                                {
                                    lsid.Add(sid);
                                }
                                pcnum++;
                            }
                            else
                            {
                                Sys_InventoryDetail fsid = new Sys_InventoryDetail();
                                fsid.mname = cz;
                                fsid.iname = sic.icname;
                                lsid.Add(fsid);
                            }
                        }
                    }
                    if (lsid.Count > 0)
                    {
                        foreach (Sys_InventoryDetail sd in lsid)
                        {
                            ArrayList al = new ArrayList();
                            al.Add(sd.iname);
                            al.Add(sd.mname);
                            r.Add(al);
                        }
                    }
                }
                else
                {
                    r.Add("F");
                }
            }
            else
            {
                r.Add(iv.badstr);
            }
            return(r);
        }
Ejemplo n.º 4
0
        public static string SaveInventory(string pbz, string pcprice, string pcode, string pcz, string pcztype, string pgprice, string pid, string plcode, string plname, string pname, string psize, string psprice, string pstate, string ptcprice, string ptype, string punit)
        {
            string r     = "";
            string dcode = "00010001";
            Sys_InventoryDetailBll sidb = new Sys_InventoryDetailBll();
            Sys_InventoryDetail    sid  = new Sys_InventoryDetail();
            Sys_MaterialBll        sub  = new Sys_MaterialBll();
            List <Sys_Material>    lsr  = new List <Sys_Material>();
            SessionUserValidate    iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                sid.icname         = plname;
                sid.iccode         = plcode;
                sid.iname          = pname;
                sid.icode          = pcode;
                sid.mname          = pcz;
                sid.iunit          = punit;
                sid.maker          = iv.u.ename;
                sid.isaleprice     = Convert.ToDecimal(psprice);
                sid.isupplyprice   = Convert.ToDecimal(pgprice);
                sid.ipurchaseprice = Convert.ToDecimal(pcprice);
                sid.iimage         = "";
                sid.istate         = pstate == "1" ? true : false;
                sid.mcode          = "";
                sid.idef1          = pbz;
                sid.idef2          = true;
                sid.idef3          = 0;
                sid.psize          = psize;
                sid.cdate          = DateTime.Now.ToString();
                sid.tcprice        = Convert.ToDecimal(ptcprice);
                sid.ptype          = ptype;
                if (pid == "0")
                {
                    if (pcztype == "a")
                    {
                        if (iv.u.dcode != "")
                        {
                            dcode = iv.u.dcode;
                        }
                        lsr = sub.QueryList(" and mstate='true' and mccode in (select mccode from Sys_MaterialCategory where dcode='" + dcode.Substring(0, 8) + "')");
                        if (lsr != null)
                        {
                            foreach (Sys_Material s in lsr)
                            {
                                sid.mname = s.mname;
                                sid.icode = plcode + sidb.CreateCode(plcode).ToString().PadLeft(3, '0');
                                if (!sidb.Exists(" and iname='" + pname + "' and mname='" + s.mname + "'"))
                                {
                                    if (sidb.Add(sid) > 0)
                                    {
                                        r = "S";
                                    }
                                    else
                                    {
                                        r = "F";
                                    }
                                }
                                else
                                {
                                    r = "T";
                                }
                            }
                        }
                    }
                    if (pcztype == "b")
                    {
                        string[] czarr = pcz.Split(';');
                        for (int i = 0; i < czarr.Length; i++)
                        {
                            sid.mname = czarr[i];
                            sid.icode = plcode + sidb.CreateCode(plcode).ToString().PadLeft(3, '0');
                            if (!sidb.Exists(" and iname='" + pname + "' and mname='" + czarr[i] + "'"))
                            {
                                if (sidb.Add(sid) > 0)
                                {
                                    r = "S";
                                }
                                else
                                {
                                    r = "F";
                                }
                            }
                            else
                            {
                                r = "T";
                            }
                        }
                    }
                }
                else
                {
                    if (!sidb.Exists(" and iname='" + pname + "' and mname='" + pcz + "' and icode<>'" + pcode + "'"))
                    {
                        if (sidb.Update(sid))
                        {
                            r = "S";
                        }
                        else
                        {
                            r = "F";
                        }
                    }
                    else
                    {
                        r = "T";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }