Example #1
0
        public static string ProductionInHouse(string sid, string psid, string remark)
        {
            string r  = "";
            int    zt = 0;

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

            if (iv.f)
            {
                string           scode = "";
                B_AfterSaleOrder ba    = basb.Query(" and sid='" + sid + "'");
                B_SaleOrder      bo    = bsob.Query(" and sid='" + sid + "'");
                if (bo != null)
                {
                    scode = bo.scode;
                }
                if (ba != null)
                {
                    scode = ba.scode;
                }
                B_InHouseOrder bio = new B_InHouseOrder();
                bio.isid  = CommonBll.GetSid();
                bio.sid   = sid;
                bio.maker = iv.u.ename;
                bio.ps    = remark;
                bio.state = 0;
                bio.cdate = DateTime.Now.ToString();
                string[] arr = psid.Split(';');
                if (bhpb.InUpdate(arr, bio.isid))
                {
                    bosb.UpState(sid, "istoreget", 1);
                    if (!bhpb.Exist(" and istate=0 and sid='" + sid + "'"))
                    {
                        zt = 1;
                        bosb.UpState(sid, "istoreget", 2);
                    }
                    if (!bihob.Exists(" and sid='" + sid + "'") && zt == 1)
                    {
                        bio.icode = scode;
                    }
                    else
                    {
                        List <B_InHouseOrder> bihl = bihob.QueryList(" and sid='" + sid + "'");
                        int n = bihl == null ? 1 : bihl.Count;
                        bio.icode = scode + "-" + n.ToString().PadLeft(2, '0');
                    }
                    bihob.Add(bio);
                    r = "S";
                }
                else
                {
                    r = "F";
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Example #2
0
        public static string SavePackage(string sid, string qremark, string rowid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                string         scode   = "";
                string         precode = "";
                B_InHouseOrder bpqo    = new B_InHouseOrder();
                B_SaleOrder    bso     = bsob.Query(" and sid='" + sid + "'");
                if (bso != null)
                {
                    scode = bso.scode;
                }
                bpqo.cdate = DateTime.Now.ToString();
                bpqo.maker = iv.u.ename;
                bpqo.icode = scode + "-" + precode + bihob.QueryIorderNum(" and sid='" + sid + "'").ToString();
                bpqo.isid  = CommonBll.GetSid();
                bpqo.ps    = qremark;
                bpqo.state = 1;
                bpqo.sid   = sid;

                List <B_InhousePackage> lq = new List <B_InhousePackage>();
                string[] arrow             = rowid.ToString().Split(';');
                if (arrow.Length > 0)
                {
                    foreach (string id in arrow)
                    {
                        B_PackageCode bgp = bpcb.Query(" and id=" + id + "");
                        if (bgp != null)
                        {
                            bpdb.UpPackageState(sid, bgp.id.ToString(), "insdate");
                            B_InhousePackage bpi = new B_InhousePackage();
                            bpi.cdate = DateTime.Now.ToString();
                            bpi.isid  = bpqo.isid;
                            bpi.pid   = bgp.id;
                            bpi.sid   = sid;
                            bpi.maker = iv.u.ename;
                            bpi.sid   = sid;
                            lq.Add(bpi);
                        }
                    }
                }
                if (bihob.SaveQualityOrder(bpqo, lq))
                {
                    List <B_PackageCode> lbp = bpcb.QueryList(" and sid='" + sid + "' and id not in (select pid  from B_InhousePackage where isid in (select isid from B_InHouseOrder where sid='" + sid + "'))");
                    if (lbp == null)
                    {
                        cosb.UpState(sid, "istoreget", 2);
                    }
                    r = "S";
                }
                else
                {
                    r = "F";
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }