Ejemplo n.º 1
0
        public static string ProductionOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                VProduceOrder   vpo = new VProduceOrder();
                B_SaleOrder     bso = bsob.Query(" and sid='" + sid + "'");
                CB_OrderFlow    cof = bwfb.QueryAttrExWorkFlow(sid, "sc");
                B_OrderFacotory bof = bofb.Query(" and sid='" + sid + "'");
                vpo.code     = bso.scode;
                vpo.ycode    = bso.oscode;
                vpo.customer = bso.customer;
                vpo.address  = bso.address;
                vpo.dname    = bso.dname;
                vpo.otype    = bso.otype;
                vpo.fname    = bof == null?"":bof.dname;
                vpo.scdate   = cof.edate;
                vpo.overdate = bof == null?"":CommonBll.GetBdate(bof.overdate);
                vpo.bz       = bso.remark;
                r            = js.Serialize(vpo);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 2
0
        public static string SalePayOperator(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_SaleOrder  bso = bsob.Query(" and sid='" + sid + "'");
                VPayOrder    vpo = new VPayOrder();
                VOrderMoney  vm  = bomb.DoorOrderMoney(sid, bso.sdiscount, bso.gdiscount, 1);
                CB_OrderFlow cof = bwfb.QueryAttrExWorkFlow(sid, "bj");
                vpo.code      = bso.scode;
                vpo.customer  = bso.customer;
                vpo.dname     = bso.dname;
                vpo.dcode     = bso.citycode;
                vpo.settlment = "";// bso.sname;
                vpo.bjr       = cof != null?cof.maker:"";
                vpo.yingshou  = vm.godhjmoney.ToString();
                vpo.yishou    = vm.pmoney.ToString();
                vpo.weishou   = (vm.godhjmoney - vm.pmoney).ToString();
                vpo.telephone = bso.telephone;
                r             = js.Serialize(vpo);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 3
0
        public static string BatchSetlment(string sid)
        {
            string r               = "";
            string bads            = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                string[] asid = sid.Split(';');
                for (int i = 0; i < asid.Length; i++)
                {
                    if (cbsb.UpState(asid[i], "isetlment", 2) > 0)
                    {
                        r = "S";
                    }
                    else
                    {
                        B_SaleOrder bso = bsob.Query(" and sid='" + asid[i] + "'");
                        bads = bads + bso.scode + ";";
                    }
                }
                if (bads != "")
                {
                    r = bads;
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 4
0
        public static string SetOrderCode(string sid, string otype)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r = "F";
                bool        iscode = false;
                B_SaleOrder bso    = bsob.Query(" and sid='" + sid + "'");
                if (bso != null)
                {
                    if (bso.scode == "")
                    {
                        iscode = true;
                    }
                    if (bocb.SetOrderCode(sid, otype, iv.u.dcode.Substring(0, 8), "", bso.citycode, iscode))
                    {
                        r = "S";
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 5
0
        public static string ProductionOutHouse(string sid, string psid, string remark)
        {
            string r    = "";
            string code = "";

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

            if (iv.f)
            {
                B_AfterSaleOrder ba  = basb.Query(" and sid='" + sid + "'");
                B_SaleOrder      bso = bsob.Query(" and sid='" + sid + "'");
                if (bso != null)
                {
                    code = bso.scode;
                }
                if (ba != null)
                {
                    code = ba.scode;
                }
                List <B_HouseProdcution> lbhp = bhpb.QueryList(" and sid='" + sid + "'");
                string[] arr  = psid.Split(';');
                string   osid = CommonBll.GetSid();
                if (bhpb.OutUpdate(arr, osid))
                {
                    bosb.UpState(sid, "istoredeliver", 1);
                    B_ApartSendOrder bo = new B_ApartSendOrder();
                    if (lbhp.Count == arr.Length)
                    {
                        bo.fhcode = code;
                        bo.snum   = 0;
                    }
                    else
                    {
                        bo.snum   = basob.QueryMaxNum(sid);
                        bo.fhcode = code + "-" + bo.snum.ToString();
                    }
                    bo.sid   = sid;
                    bo.osid  = osid;
                    bo.maker = iv.u.ename;
                    bo.cdate = DateTime.Now.ToString();
                    basob.Add(bo);
                    if (!bhpb.Exist(" and ostate=0 and sid='" + sid + "'"))
                    {
                        bosb.UpState(sid, "istoredeliver", 2);
                    }
                    r = "S";
                }
                else
                {
                    r = "F";
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 6
0
        public static string LoadSaleOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_YqSaleOrder bco = bsob.Query(" and sid='" + sid + "'");
                if (bco != null)
                {
                    B_CustormOrder bdj = bcob.Query(" and csid='" + bco.csid + "'");
                    r = js.Serialize(bco);
                }
                else
                {
                    Sys_Depment sd  = sdb.Query(" and dcode='" + iv.u.dcode + "'");
                    B_SaleOrder kco = new B_SaleOrder();
                    if (sd != null)
                    {
                        if (sd.dattr == "cs")
                        {
                            Sys_DepmentDpt sdd = sddb.Query(" and dcode='" + sd.dcode + "'");
                            kco.city       = sd.dpname;
                            kco.citycode   = sd.dpcode;
                            kco.dname      = sd.dname;
                            kco.dcode      = sd.dcode;
                            kco.stelephone = sdd != null ? sdd.dcontact : "";
                        }
                        else if (sd.dattr == "dm")
                        {
                            Sys_DepmentDpt sdd = sddb.Query(" and dcode='" + sd.dcode.Substring(0, sd.dcode.Length - 4) + "'");
                            kco.city       = sd.dpname;
                            kco.citycode   = sd.dpcode;
                            kco.dname      = sd.dname;
                            kco.dcode      = sd.dcode;
                            kco.stelephone = sdd != null ? sdd.dcontact : "";
                        }
                        else
                        {
                            kco.city     = "";
                            kco.citycode = "";
                            kco.dname    = "";
                            kco.dcode    = "";
                        }
                    }
                    kco.maker = iv.u.ename;
                    r         = js.Serialize(kco);
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 7
0
        public static string InitOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_MeasureOrder bco = new B_MeasureOrder();
                if (bmob.Exists(" and osid='" + sid + "'"))
                {
                    bco        = bmob.Query(" and osid='" + sid + "'");
                    bco.bplist = bmpb.QueryList(" and sid='" + bco.sid + "' order by id");
                }
                else
                {
                    B_SaleOrder bso = bsob.Query(" and sid='" + sid + "'");
                    if (bso != null)
                    {
                        bco.acity     = bso.acity;
                        bco.address   = bso.address;
                        bco.aprovince = bso.aprovince;
                        bco.customer  = bso.customer;
                        bco.gzname    = bso.gzname;
                        bco.telephone = bso.telephone;
                        bco.mremark   = "";
                        List <B_MeasureProduction>   lbp = new List <B_MeasureProduction>();
                        List <Sys_MeasureProduction> lsp = smpb.QueryList("");
                        if (lsp != null)
                        {
                            foreach (Sys_MeasureProduction smp in lsp)
                            {
                                B_MeasureProduction bp = new B_MeasureProduction();
                                bp.pcname = smp.mpname;
                                bp.pcnum  = 0;
                                lbp.Add(bp);
                            }
                        }
                        bco.bplist = lbp;
                    }
                }
                r = js.Serialize(bco);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 8
0
        public static string FixOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                VFixOrder       vfo = new VFixOrder();
                B_SaleOrder     bso = bsob.Query(" and osid='" + sid + "'");
                B_OrderFacotory bof = bofb.Query(" and sid='" + sid + "'");
                CB_OrderState   cos = cosb.Query(" and sid='" + sid + "'");
                string          zt  = "";
                if (cos != null)
                {
                    if (cos.ifixed == 0)
                    {
                        zt = "未安装";
                    }
                    if (cos.ifixed == 1)
                    {
                        zt = "部分安装";
                    }
                    if (cos.ifixed == 2)
                    {
                        zt = "已安装";
                    }
                }
                vfo.code        = bso.scode;
                vfo.ycode       = bso.oscode;
                vfo.wcode       = bso.wcode;
                vfo.otype       = bso.otype;
                vfo.customer    = bso.customer;
                vfo.telephone   = bso.telephone;
                vfo.address     = bso.address;
                vfo.dname       = bso.dname;
                vfo.city        = bso.city;
                vfo.gzname      = bso.gzname;
                vfo.gztelephone = bso.gztelephone;
                vfo.azzt        = zt;
                vfo.bz          = bso.remark;
                r = js.Serialize(vfo);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 9
0
        public static string QuerySaleOrder(string ycode)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_SaleOrder bso = bsob.Query(" and ccode='" + ycode + "'");
                r = js.Serialize(bso);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 10
0
        public static string QueryOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_SaleOrder bco = bsob.Query(" and sid='" + sid + "'");
                r = js.Serialize(bco);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 11
0
        public static string QueryOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_SaleChangeOrder bsco = new B_SaleChangeOrder();
                B_SaleChangeOrder bco  = bscob.Query(" and sid='" + sid + "'");
                if (bco != null)
                {
                    bsco = bco;
                    if (bgpcb.Exists(" and sid='" + sid + "'"))
                    {
                        bsco.hasproduction = "1";
                    }
                }
                else
                {
                    B_SaleOrder bso = bsob.Query(" and sid='" + sid + "'");
                    if (bso != null)
                    {
                        bsco.scode     = "";
                        bsco.oscode    = bso.scode;
                        bsco.e_city    = bso.city;
                        bsco.dname     = bso.dname;
                        bsco.customer  = bso.customer;
                        bsco.telephone = bso.telephone;
                        bsco.address   = bso.address;
                        bsco.otype     = "木门更改单";
                        bsco.mname     = bso.mname;
                        bsco.sname     = "";// bso.sname;
                        bsco.cdate     = DateTime.Now.ToString();
                        bsco.maker     = "";
                        bsco.creason   = "";
                        bsco.osid      = sid;
                        bsco.sid       = "";
                    }
                }
                r = js.Serialize(bsco);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 12
0
        public static string OutnHouseOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                VInHouseOrder   vpo  = new VInHouseOrder();
                B_SaleOrder     bso  = bsob.Query(" and sid='" + sid + "'");
                B_OrderFacotory bof  = bofb.Query(" and sid='" + sid + "'");
                CB_OrderState   cos  = cosb.Query(" and sid='" + sid + "'");
                int             bnum = bohrb.GetRecordCount(" sid='" + sid + "'");
                string          zt   = "";
                if (cos != null)
                {
                    if (cos.istoredeliver == 0)
                    {
                        zt = "未发库";
                    }
                    if (cos.istoredeliver == 1)
                    {
                        zt = "部分发库";
                    }
                    if (cos.istoredeliver == 2)
                    {
                        zt = "全部发库";
                    }
                }
                vpo.code      = bso.scode;
                vpo.ycode     = bso.oscode;
                vpo.customer  = bso.customer;
                vpo.address   = bso.address;
                vpo.dname     = bso.dname;
                vpo.fname     = bof == null ? "" : bof.dname;
                vpo.bz        = bso.remark;
                vpo.city      = bso.city;
                vpo.telephone = bso.telephone;
                vpo.bnum      = bnum.ToString();
                vpo.zt        = zt;
                r             = js.Serialize(vpo);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 13
0
        public static string InitOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_DrawProductionOrder ino = new B_DrawProductionOrder();
                B_DrawProductionOrder bco = bmppob.Query(" and sid='" + sid + "'");
                if (bco == null)
                {
                    B_SaleOrder bso = bsob.Query(" and sid='" + sid + "'");
                    if (bso != null)
                    {
                        ino.sid      = "";
                        ino.osid     = bso.sid;
                        ino.cityname = bso.city;
                        ino.citycode = bso.citycode;
                        ino.shopname = bso.dname;
                        ino.shopcode = bso.dcode;
                    }
                    else
                    {
                        ino.osid     = "";
                        ino.cityname = "";
                        ino.citycode = "";
                        ino.shopname = "";
                        ino.shopcode = "";
                    }
                }
                else
                {
                    ino = bco;
                }
                r = js.Serialize(ino);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 14
0
        public static string InitOrder(string sid, string zsid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_SaleOrder bco = new B_SaleOrder();
                if (sid != "")
                {
                    bco = bsob.Query(" and sid='" + sid + "'");
                    r   = js.Serialize(bco);
                }
                else
                {
                    if (zsid != "")
                    {
                        B_Orders       bo  = bob.Query(" and sid='" + zsid + "'");
                        Sys_DepmentDpt sdd = sddb.Query(" and dcode='" + bo.dcode + "'");
                        bco.city       = bo.city;
                        bco.citycode   = bo.citycode;
                        bco.dname      = bo.dname;
                        bco.dcode      = bo.dcode;
                        bco.zsid       = bo.sid;
                        bco.customer   = bo.customer;
                        bco.telephone  = bo.telephone;
                        bco.address    = bo.address;
                        bco.community  = bo.community;
                        bco.zcode      = bo.zcode;
                        bco.stelephone = sdd != null ? sdd.dcontact : "";
                        bco.maker      = iv.u.ename;
                    }
                    r = js.Serialize(bco);
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 15
0
        public static string SetDiscount(string sid, string dv)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r = "F";
                B_SaleOrder bso = bsob.Query(" and sid='" + sid + "'");
                if (bso != null)
                {
                    if (bsob.SetGDiscount(sid, Convert.ToDecimal(dv)))
                    {
                        r = "S";
                    }
                }
                B_YqSaleOrder ybso = ybsob.Query(" and sid='" + sid + "'");
                if (ybso != null)
                {
                    if (ybsob.SetGDiscount(sid, Convert.ToDecimal(dv)))
                    {
                        r = "S";
                    }
                }
                B_AfterSaleOrder baso = basob.Query(" and sid='" + sid + "'");
                if (bso != null)
                {
                    r = "S";
                    //if (basob.SetGDiscount(sid, Convert.ToDecimal(dv)))
                    //{

                    //}
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 16
0
        public static string QueryOrderMoney(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_SaleOrder bco = bsob.Query(" and sid='" + sid + "'");
                if (bco != null)
                {
                    B_CustormOrder bdj = bcob.Query(" and csid='" + bco.csid + "'");
                    // bco.omoney = bsdb.QueryOrderDiscountMoney(sid).ToString("#0.00");
                    //bco.dj = bdj != null ? bdj.cmoney.ToString() : "0";
                    r = js.Serialize(bco);
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 17
0
        public static string SaveFactory(string bcode, string fcode, string fline, string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                int              dn   = 0;
                Sys_Depment      sd   = sdb.Query(" and dcode='" + fcode + "'");
                B_OrderFacotory  bf   = new B_OrderFacotory();
                B_SaleOrder      bso  = bsob.Query(" and sid='" + sid + "'");
                B_AfterSaleOrder baso = basob.Query(" and sid='" + sid + "'");
                B_OrderFacotory  bof  = bofb.Query(" and sid='" + sid + "'");
                if (bso != null)
                {
                    string otype             = bso.otype == "补单" ? "补单" : "新单";
                    List <Sys_ProduceCyc> lc = spcb.QueryCheckList(" and emcode='0006' and dcode='" + fcode + "' and otype='" + otype + "'");
                    if (lc != null)
                    {
                        dn = lc[0].cnum;
                    }
                }
                if (baso != null)
                {
                    string otype             = baso.otype == "补单" ? "补单" : "新单";
                    List <Sys_ProduceCyc> lc = spcb.QueryCheckList(" and emcode='0035' and dcode='" + fcode + "' and otype='" + otype + "'");
                    if (lc != null)
                    {
                        dn = lc[0].cnum;
                    }
                }
                bf.dname    = sd != null?sd.dname:"";
                bf.dcode    = fcode;
                bf.maker    = iv.u.ename;
                bf.sid      = sid;
                bf.overdate = DateTime.Now.AddDays(dn).ToString();
                bf.otype    = bso == null ? "" : bso.otype;
                bf.cdate    = DateTime.Now.ToString();
                if (bof != null)
                {
                    if (bofb.Update(bf))
                    {
                        r = "S";
                        if (fline != "")
                        {
                            bppb.SetProduceProcess(sid, fline);
                        }
                        BaseSet.WorkFlowManage.EventBtnDo.FireEventBtn(sid, bcode, "1", "分单");
                        //bcpb.OrderCgComputePrice(sid);
                    }
                    else
                    {
                        r = "F";
                    }
                }
                else
                {
                    if (bofb.Add(bf) > 0)
                    {
                        r = "S";
                        if (fline != "")
                        {
                            bppb.SetProduceProcess(sid, fline);
                        }
                        BaseSet.WorkFlowManage.EventBtnDo.FireEventBtn(sid, bcode, "1", "分单");
                        //bcpb.OrderCgComputePrice(sid);
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 18
0
        public static string SaveOrder(string acity, string address, string aprovince, string bcode, string csid, string customer, string emcode, string gzname, string mdate, string mremark, ArrayList plist, string sid, string telephone)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_SaleOrder    bso = bsob.Query(" and sid='" + sid + "'");
                B_MeasureOrder bco = new B_MeasureOrder();
                bco.acity     = acity;
                bco.address   = address;
                bco.aprovince = aprovince;
                bco.customer  = customer;
                bco.gzname    = gzname;
                bco.maker     = iv.u.ename;
                bco.mdate     = mdate;
                bco.mremark   = mremark;
                bco.osid      = sid;
                bco.telephone = telephone;
                bco.city      = bso.city;
                bco.citycode  = bso.citycode;
                bco.dcode     = bso.dcode;
                bco.dname     = bso.dname;
                bco.mname     = bso.mname;
                bco.cdate     = DateTime.Now.ToString();
                bco.sdcode    = DateTime.Now.ToString("yyyymmddhhMMss");
                if (csid == "")
                {
                    bco.sid = CommonBll.GetSid();
                }
                else
                {
                    bco.sid = csid;
                }
                List <B_MeasureProduction> lbp = new List <B_MeasureProduction>();
                foreach (object[] o in plist)
                {
                    B_MeasureProduction bmp = new B_MeasureProduction();
                    var p = o;
                    bmp.cdate  = DateTime.Now.ToString();
                    bmp.maker  = iv.u.ename;
                    bmp.pcname = p[0].ToString();
                    bmp.pcnum  = Convert.ToInt32(p[1].ToString());
                    bmp.sid    = bco.sid;
                    lbp.Add(bmp);
                }
                bco.bplist = lbp;
                if (bmlb.CheckLimited(bco.dcode, bco.mdate))
                {
                    r = "MOB";
                }
                else
                {
                    if (csid == "")
                    {
                        CB_OrderState cos = new CB_OrderState();
                        bco.qtimg = qcb.CreateQtCode(System.Web.HttpContext.Current.Server.MapPath("/UpFile/OrderQt/"), CommonBll.GetHost() + "UIClient/SalesBusiness/DistributorOrder/SaleOrderDetail.htm?Sid=" + bco.sid);
                        if (bmob.Add(bco) > 0)
                        {
                            bwfb.CreateWorkFlow(bco.sid, emcode);
                            cos.sid = bco.sid;
                            cosb.Add(cos);
                            r = "S";
                        }
                        else
                        {
                            r = "F";
                        }
                        EventBtnDo.FireEventBtn(bco.sid, bcode, "1", " 保存测量单");
                    }
                    else
                    {
                        if (bmob.Update(bco))
                        {
                            r = "S";
                        }
                        else
                        {
                            r = "F";
                        }
                        EventBtnDo.FireEventBtn(bco.sid, bcode, "1", " 更改测量单");
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
0
        public static string SetOrderCode(string sid, string code)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r = "F";
                B_SaleOrder bso = bsob.Query(" and sid='" + sid + "'");
                if (bso != null)
                {
                    if (bsob.Exists(" and scode='" + code + "' and sid!='" + sid + "'"))
                    {
                        r = "T";
                    }
                    else
                    {
                        if (bsob.SetOrderCode(sid, code))
                        {
                            r = "S";
                        }
                        else
                        {
                            r = "F";
                        }
                    }
                }
                B_YqSaleOrder ybso = ybsob.Query(" and sid='" + sid + "'");
                if (ybso != null)
                {
                    if (ybsob.Exists(" and scode='" + code + "' and sid!='" + sid + "'"))
                    {
                        r = "T";
                    }
                    else
                    {
                        if (ybsob.SetOrderCode(sid, code))
                        {
                            r = "S";
                        }
                        else
                        {
                            r = "F";
                        }
                    }
                }
                B_AfterSaleOrder baso = basob.Query(" and sid='" + sid + "'");
                if (baso != null)
                {
                    if (basob.Exists(" and scode='" + code + "' and sid!='" + sid + "'"))
                    {
                        r = "T";
                    }
                    else
                    {
                        r = "S";
                        //if (basob.SetOrderCode(sid, code))
                        //{
                        //    r = "S";
                        //}
                        //else
                        //{
                        //    r = "F";
                        //}
                    }
                }
                B_MzSaleOrder bmso = bmsob.Query(" and sid='" + sid + "'");
                if (bmso != null)
                {
                    if (bmsob.Exists(" and scode='" + code + "' and sid!='" + sid + "'"))
                    {
                        r = "T";
                    }
                    else
                    {
                        if (bmsob.SetOrderCode(sid, code))
                        {
                            r = "S";
                        }
                        else
                        {
                            r = "F";
                        }
                    }
                }
                B_SaleMaterielOrder bswo = bswob.Query(" and sid='" + sid + "'");
                if (bswo != null)
                {
                    if (bswob.Exists(" and scode='" + code + "' and sid!='" + sid + "'"))
                    {
                        r = "T";
                    }
                    else
                    {
                        if (bswob.SetOrderCode(sid, code))
                        {
                            r = "S";
                        }
                        else
                        {
                            r = "F";
                        }
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 21
0
        public static string SaveQualityProduction(string sid, string qtype, string qremark, string rowid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                string             scode   = "";
                string             precode = "";
                B_PartQualityOrder bpqo    = new B_PartQualityOrder();
                B_SaleOrder        bso     = bsob.Query(" and sid='" + sid + "'");
                if (qtype == "s")
                {
                    bpqo.qstate = 1;
                }
                if (qtype == "f")
                {
                    bpqo.qstate = -1;
                    precode     = "F";
                }
                if (bso != null)
                {
                    scode = bso.scode;
                }
                bpqo.cdate  = DateTime.Now.ToString();
                bpqo.maker  = iv.u.ename;
                bpqo.qcode  = scode + "-" + precode + bpqob.QueryQorderNum(" and sid='" + sid + "' and qstate=" + bpqo.qstate + "").ToString();
                bpqo.qsid   = CommonBll.GetSid();
                bpqo.remark = qremark;
                bpqo.sid    = sid;

                List <B_PartQualityItems> lq = new List <B_PartQualityItems>();
                string[] arrow = rowid.ToString().Split(';');
                if (arrow.Length > 0)
                {
                    foreach (string id in arrow)
                    {
                        string             idv   = "";
                        string             etype = "";
                        B_PartQualityItems bpi   = new B_PartQualityItems();
                        if (id.IndexOf('-') > -1)
                        {
                            string [] ids = id.Split('-');
                            idv   = ids[0];
                            etype = ids[1];
                        }
                        else
                        {
                            idv = id;
                        }
                        B_GroupProduction bgp = bgpb.Query(" and id=" + idv + "");
                        if (bgp != null)
                        {
                            bpi.cdate = DateTime.Now.ToString();
                            //if (bgp.ptype == "ms")
                            //{
                            //    B_ProductionItem li = bpib.Query(" and psid='" + bgp.psid + "' and e_ptype='" + etype + "'");
                            //    bpi.deep = li.deep;
                            //    bpi.gnum = bgp.gnum;
                            //    bpi.height = li.height;
                            //    bpi.maker = iv.u.ename;
                            //    bpi.pcode = li.pcode;
                            //    bpi.pname = li.pname;
                            //    bpi.pnum = (int)li.pnum;
                            //    bpi.psid = li.psid;
                            //    bpi.qsid = bpqo.qsid;
                            //    bpi.sid = sid;
                            //    bpi.width = li.width;
                            //    lq.Add(bpi);
                            //}
                            //else
                            //{
                            bpi.deep   = bgp.deep;
                            bpi.gnum   = bgp.gnum;
                            bpi.height = bgp.height;
                            bpi.maker  = iv.u.ename;
                            bpi.pcode  = bgp.icode;
                            bpi.pname  = bgp.iname;
                            bpi.pnum   = (int)bgp.inum;
                            bpi.psid   = bgp.psid;
                            bpi.qsid   = bpqo.qsid;
                            bpi.sid    = sid;
                            bpi.width  = bgp.width;
                            lq.Add(bpi);
                            //}
                        }
                    }
                }
                if (bpqob.SaveQualityOrder(bpqo, lq))
                {
                    List <B_GroupProduction> lbpi = bgpb.QueryList(" and sid='" + sid + "' and substring(icode,9,3)<>'004' and psid not in (select psid from  B_PartQualityItems where qsid in(select qsid from B_PartQualityOrder where sid='" + sid + "' and qstate=1) ) order by gnum");
                    if (lbpi == null)
                    {
                        cosb.UpState(sid, "iquality", 2);
                        cosb.UpState(sid, "ifactorydeliver", 2);
                    }
                    r = "S";
                }
                else
                {
                    r = "F";
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 22
0
        public void ProcessRequest(HttpContext context)
        {
            ApiReturns     ar   = new ApiReturns();
            PackageMessage pm   = new PackageMessage();
            string         psid = "";
            string         agr  = "";
            int            pid  = 0;

            if (context.Request.QueryString["psid"] != null)
            {
                psid = context.Request.QueryString["psid"].ToString();
            }
            if (context.Request.QueryString["m"] != null)
            {
                agr = context.Request.QueryString["m"].ToString();
            }
            if (psid != "" && agr != "")
            {
                switch (agr)
                {
                case "get":
                    #region    //获取包装
                    pid = Convert.ToInt32(psid.Replace("P", ""));
                    DataRow bp = bpb.ViewQuery(" and bzid='" + pid + "'");
                    if (bp != null)
                    {
                        B_SaleOrder       o  = bsb.Query(" and osid='" + bp["sid"].ToString() + "'");
                        B_AfterSaleOrder  ao = basb.Query(" and sid='" + bp["sid"].ToString() + "'");
                        B_GroupProduction gp = bgpb.Query(" and psid='" + bp["bsid"].ToString() + "'");
                        if (o != null)
                        {
                            pm.city     = o.city;
                            pm.code     = o.scode;
                            pm.customer = o.customer;
                        }
                        if (ao != null)
                        {
                            pm.city     = ao.city;
                            pm.code     = ao.scode;
                            pm.customer = ao.customer;
                        }
                        pm.mname     = gp.mname;
                        pm.pname     = gp.iname;
                        pm.size      = gp.height.ToString() + "*" + gp.width.ToString() + "*" + gp.deep.ToString();
                        pm.direction = gp.direction;
                        pm.osort     = "";// bgpb.QueryPackageGnum(" and psid in (select bsid from View_B_Package where bzid='"+pid+"')");
                        pm.pdate     = bsb.QueryProductDate(bp["sid"].ToString());
                        if (bp != null)
                        {
                            pm.ptype      = bp["btype"].ToString();
                            pm.packnum    = bpb.PackageNum(bp["sid"].ToString()).ToString();
                            pm.curpacknum = bp["bnum"].ToString();
                            if (gp.icode.Substring(0, 2) == "02" || gp.icode.Substring(0, 2) == "06" || gp.icode.Substring(0, 2) == "07")
                            {
                                if (pm.ptype == "门套" || pm.ptype == "套板")
                                {
                                    B_ProductionItem mt     = bpib.Query(" and psid='" + gp.psid + "' and  e_ptype='mt'");
                                    string           mtszie = "";
                                    if (mt != null)
                                    {
                                        mtszie = mt.height.ToString() + "*" + mt.width.ToString() + "*" + mt.deep.ToString();
                                    }
                                    B_ProductionItem lb     = bpib.Query(" and psid='" + gp.psid + "' and  e_ptype='lb'");
                                    string           lbszie = "";
                                    if (lb != null)
                                    {
                                        lbszie = lb.height.ToString() + "*" + lb.width.ToString() + "*" + lb.deep.ToString();
                                    }
                                    if (gp.icode.Substring(0, 2) == "02")
                                    {
                                        if (mtszie != "" && lbszie != "")
                                        {
                                            pm.size2 = mtszie + ";" + lbszie;
                                        }
                                        else
                                        {
                                            pm.size2 = mtszie + lbszie;
                                        }
                                    }
                                }
                                else
                                {
                                    pm.size2 = bp["height"].ToString() + "*" + bp["width"].ToString() + "*" + bp["deep"].ToString();;
                                }
                            }
                            else
                            {
                                if (gp.icode.Substring(0, 2) == "01")
                                {
                                    pm.size2 = bp["height"].ToString() + "*" + bp["width"].ToString() + "*" + bp["deep"].ToString();
                                }
                                else
                                {
                                    pm.size2 = "";
                                }
                            }
                            pm.pcode = "B" + bp["bzid"].ToString();
                            ar.msg   = "S";
                            bpb.UpPackageState(bp["sid"].ToString(), Convert.ToInt32(bp["bnum"].ToString()), "bz", "1");
                            bpdb.UpPackageState(bp["sid"].ToString(), bp["bzid"].ToString(), "bdate");
                            cbsb.UpState(bp["sid"].ToString(), "ipackage", 1);
                            ar.o = pm;
                        }
                        else
                        {
                            ar.msg = "订单不错在";
                        }
                    }
                    else
                    {
                        ar.msg = "产品不错在";
                    }
                    #endregion
                    break;

                case "instore":
                    #region    //包装入库
                    pid = Convert.ToInt32(psid.Replace("B", ""));
                    DataRow zbrk = bpb.ViewQuery(" and bzid=" + pid + "");
                    if (zbrk != null)
                    {
                        if (bpb.UpPackageState(zbrk["sid"].ToString(), Convert.ToInt32(zbrk["bnum"].ToString()), "zbrk", "1"))
                        {
                            #region    //包装入库插入待SAP导入表
                            CB_InSapRecord cisr = new CB_InSapRecord();
                            cisr.sid    = pid.ToString();
                            cisr.stype  = "bzrk";
                            cisr.istate = 0;
                            cisr.cdate  = DateTime.Now.ToString();
                            cisrb.Add(cisr);
                            #endregion
                            bpdb.UpPackageState(zbrk["sid"].ToString(), zbrk["bzid"].ToString(), "insdate");
                            if (bpb.Exists(" and sid='" + zbrk["sid"].ToString() + "' and zbrk=0"))
                            {
                            }
                            else
                            {
                                cbsb.UpState(zbrk["sid"].ToString(), "istoreget", 2);
                                //订单入库销售订单 和销售返修单
                                BaseSet.WorkFlowManage.EventBtnDo.UnUserFireEventBtn(zbrk["sid"].ToString(), "0062", "1", "入库");
                                BaseSet.WorkFlowManage.EventBtnDo.UnUserFireEventBtn(zbrk["sid"].ToString(), "0118", "1", "入库");
                                #region    //订单入库插入待SAP导入表
                                CB_InSapRecord cor = new CB_InSapRecord();
                                cor.sid    = zbrk["sid"].ToString();
                                cor.stype  = "ork";
                                cor.istate = 0;
                                cor.cdate  = DateTime.Now.ToString();
                                cisrb.Add(cor);
                                #endregion
                            }
                            ar.msg = "S";
                        }
                        else
                        {
                            ar.msg = "入库失败";
                        }
                    }
                    else
                    {
                        ar.msg = "包装不错在";
                    }
                    #endregion
                    break;

                case "outstore":
                    #region    //包装出库
                    //pid = Convert.ToInt32(psid.Replace("B", ""));
                    // DataRow zbck = bpb.ViewQuery(" and bzid=" + pid + "");
                    //if (zbck != null)
                    //{
                    //    if (bpb.UpPackageState(zbck["sid"].ToString(), Convert.ToInt32(zbck["bnum"].ToString()), "zbck", "1"))
                    //    {
                    //        bpdb.UpPackageState(zbck["sid"].ToString(), zbck["bzid"].ToString(), "outsdate");
                    //        ar.msg = "S";
                    //    }
                    //    else
                    //    {
                    //        ar.msg = "出库失败";
                    //    }
                    //}
                    //else
                    //{
                    //    ar.msg = "包装不错在";
                    //}
                    #endregion
                    #region    //订单出库
                    B_SaleOrder bso = bsb.Query(" and scode='" + psid + "'");
                    if (bso != null)
                    {
                        bpb.UpPackageState(bso.sid, "zbck", "1");
                        bpdb.UpPackageState(bso.sid, "outsdate");
                        ar.msg = "S";
                        CB_InSapRecord cisr = new CB_InSapRecord();
                        cisr.sid    = bso.sid;
                        cisr.stype  = "ock";
                        cisr.istate = 0;
                        cisr.cdate  = DateTime.Now.ToString();
                        cisrb.Add(cisr);
                    }
                    B_AfterSaleOrder abso = basb.Query(" and scode='" + psid + "'");
                    if (abso != null)
                    {
                        bpb.UpPackageState(abso.sid, "zbck", "1");
                        bpdb.UpPackageState(abso.sid, "outsdate");
                        ar.msg = "S";
                        CB_InSapRecord cisr = new CB_InSapRecord();
                        cisr.sid    = abso.sid;
                        cisr.stype  = "ock";
                        cisr.istate = 0;
                        cisr.cdate  = DateTime.Now.ToString();
                        cisrb.Add(cisr);
                    }


                    #endregion
                    break;

                case "incity":
                    pid = Convert.ToInt32(psid.Replace("B", ""));
                    DataRow csrk = bpb.ViewQuery(" and bzid=" + pid + "");
                    if (csrk != null)
                    {
                        if (bpb.UpPackageState(csrk["sid"].ToString(), Convert.ToInt32(csrk["bnum"].ToString()), "csrk", "1"))
                        {
                            bpdb.UpPackageState(csrk["sid"].ToString(), csrk["bzid"].ToString(), "incdate");
                            ar.msg = "S";
                        }
                        else
                        {
                            ar.msg = "入库失败";
                        }
                    }
                    else
                    {
                        ar.msg = "包装不错在";
                    }
                    break;

                case "outcity":
                    pid = Convert.ToInt32(psid.Replace("B", ""));
                    DataRow csck = bpb.ViewQuery(" and bzid=" + pid + "");
                    if (csck != null)
                    {
                        if (bpb.UpPackageState(csck["sid"].ToString(), Convert.ToInt32(csck["bnum"].ToString()), "csck", "1"))
                        {
                            bpdb.UpPackageState(csck["sid"].ToString(), csck["bzid"].ToString(), "outcdate");
                            ar.msg = "S";
                        }
                        else
                        {
                            ar.msg = "出库失败";
                        }
                    }
                    else
                    {
                        ar.msg = "包装不错在";
                    }
                    break;
                }
            }
            else
            {
                ar.msg = "参数错误";
                ar.o   = null;
            }
            context.Response.Write(js.Serialize(ar));
        }
Ejemplo n.º 23
0
        public static string SaveOrder(string acity, string address, string aprovince, string azperson, string bcode, string city, string citycode, string clperson, string ctype, string customer, string dcode, string discode, string dname, string emcode, string iscl, string maker, string mname, string otype, string pbdcode, string qytype, string remark, string saletelephone, string sdtype, string sid, string source, string stype, string telephone, string untype, string zcode, string zsid)
        {
            string r     = "";
            string saddr = "";

            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_Orders           bo   = bob.Query(" and sid='" + zsid + "'");
                Sys_CityGetAddress scga = scgab.QueryFrist(" and dcode='" + citycode + "'");
                Sys_Brands         sbs  = sbb.Query(" and pbcode='" + pbdcode + "'");
                B_SaleOrder        bco  = new B_SaleOrder();
                if (scga != null)
                {
                    saddr = scga.address;
                }
                bco.csid        = bo != null ? bo.csid : "";
                bco.zsid        = zsid;
                bco.zcode       = bo != null?bo.zcode:"";
                bco.wcode       = "";
                bco.oscode      = "";
                bco.customer    = customer;
                bco.telephone   = telephone;
                bco.community   = "";
                bco.address     = address.Replace(",", ",");
                bco.dname       = dname;
                bco.dcode       = dcode;
                bco.city        = city;
                bco.citycode    = citycode;
                bco.gzname      = "";
                bco.gztelephone = "";
                bco.stelephone  = saletelephone;
                bco.otype       = otype;
                bco.sendtype    = stype;
                bco.sdtype      = sdtype;
                bco.mname       = mname;
                bco.source      = source;
                bco.remark      = remark.Replace(",", ",");
                bco.maker       = maker;
                bco.cdate       = DateTime.Now.ToString();
                bco.istax       = false;
                bco.isdf        = false;
                bco.iscl        = iscl == "0" ? false : true;
                bco.colorpane   = "";
                bco.floor       = "";
                bco.disactcode  = discode;
                bco.bdcode      = iv.u.dcode.Substring(0, 8);
                bco.clperson    = clperson;
                bco.azperson    = azperson;
                bco.pbdcode     = pbdcode;
                bco.pbdname     = sbs != null ? sbs.pbname : "";
                bco.saddress    = aprovince == "" ? saddr : aprovince + acity + address;
                bco.qytype      = qytype;
                bco.ctype       = ctype;
                bco.untype      = untype;
                if (bco.citycode.Substring(0, 12) != "000100010008")
                {
                    bco.package = "外地包装";
                }
                else
                {
                    bco.package = "本地包装";
                }
                bco.sdcode = "S" + DateTime.Now.ToString("yyMM") + bsob.QueryOrderNum();
                if (sid == "")
                {
                    CB_OrderState cos = new CB_OrderState();
                    bco.sid   = CommonBll.GetSid();
                    bco.qtimg = qcb.CreateQtCode(System.Web.HttpContext.Current.Server.MapPath("/UpFile/OrderQt/"), CommonBll.GetHost() + "/UIClient/QtScan/OrderDetail.htm?Sid=" + bco.sid);
                    if (bsob.Add(bco) > 0)
                    {
                        bwfb.CreateWorkFlow(bco.sid, emcode);
                        cos.sid = bco.sid;
                        cosb.Add(cos);
                        r = bco.sid;
                    }
                    else
                    {
                        r = "F";
                    }
                    EventBtnDo.FireEventBtn(bco.sid, bcode, "1", " 保存订单");
                }
                else
                {
                    bco.sid = sid;
                    if (bsob.Update(bco))
                    {
                        if (bmob.Exists(" and osid='" + sid + "'"))
                        {
                            if (!bco.iscl)
                            {
                                bmob.Delete(" and osid='" + sid + "'");
                            }
                        }
                        r = bco.sid;
                    }
                    else
                    {
                        r = "F";
                    }
                    EventBtnDo.FireEventBtn(bco.sid, bcode, "1", " 更改订单");
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 24
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);
        }
Ejemplo n.º 25
0
        public static string SaveOrder(string address, string azperson, string citycode, string cityname,
                                       string clperson, string colorpane, string community, string customer, string emcode,
                                       string floor, string maker, string mname, string mtype, string otype,
                                       string qbcode, string remark, string saddress, string saletelephone, string shopcode,
                                       string shopname, string sid, string source,
                                       string telephone, string untype, string ycode, string ydate)
        {
            string              r     = "";
            string              saddr = "";
            BusiWorkFlowBll     bwfb  = new BusiWorkFlowBll();
            SessionUserValidate iv    = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_Depment        sd   = sdb.Query(" and dcode='" + citycode + "'");
                Sys_Depment        cd   = sdb.Query(" and dcode='" + iv.u.dcode.Substring(0, 8) + "'");
                Sys_Area           sa   = sab.Query(" and acode=(select acode from Sys_RDepmentArea where dcode='" + citycode + "')");
                Sys_CityGetAddress scga = scgab.QueryFrist(" and dcode='" + citycode + "'");
                B_SaleOrder        bco  = new B_SaleOrder();
                if (scga != null)
                {
                    saddr = scga.address;
                }
                //bco.ccode =cd.dabc + DateTime.Now.ToString("yyyyMMddHHmmss");
                //bco.ycode =ycode;
                bco.wcode     = "";
                bco.customer  = customer;
                bco.telephone = telephone;
                bco.community = "";
                bco.address   = address.Replace(",", ",");
                if (sa != null)
                {
                    //bco.aname = sa.aname;
                    //bco.acode = sa.acode;
                }
                bco.dname = shopname;
                bco.dcode = shopcode;
                bco.city  = sd != null ? sd.dname : "";
                //bco.citytype = "";
                bco.citycode    = citycode;
                bco.gzname      = "";
                bco.gztelephone = "";
                // bco.saletelephone = saletelephone;
                bco.otype = otype;
                // bco.state = false;
                bco.mname  = mname;
                bco.source = source;
                //bco.ps = remark.Replace(",", ",");
                bco.maker = maker;
                // bco.wlcompany = "";
                bco.cdate = DateTime.Now.ToString();
                bco.istax = false;
                bco.isdf  = false;
                //bco.lxtype = "";
                bco.colorpane = colorpane;
                // bco.sname = sd.khcode;
                bco.floor  = floor;
                bco.bdcode = iv.u.dcode.Substring(0, 8);
                // bco.qbcode = qbcode;
                bco.clperson = clperson;
                bco.azperson = azperson;
                bco.saddress = saddress == "" ? saddr : saddress;
                bco.ydate    = ydate == null?"":ydate;
                if (sid == "")
                {
                    CB_OrderState cos = new CB_OrderState();
                    bco.sid   = CommonBll.GetSid();
                    bco.qtimg = qcb.CreateQtCode(System.Web.HttpContext.Current.Server.MapPath("/UpFile/OrderQt/"), CommonBll.GetHost() + "UIClient/SalesBusiness/DistributorOrder/SaleOrderDetail.htm?Sid=" + bco.sid);
                    if (bsob.Add(bco) > 0)
                    {
                        bwfb.CreateWorkFlow(bco.sid, emcode);
                        cos.sid = bco.sid;
                        cosb.Add(cos);
                        if (!bcb.Exists(" and customer='" + bco.customer + "' and bdcode='" + iv.u.dcode.Substring(0, 8) + "'"))
                        {
                            B_Customer bc = new B_Customer();
                            bc.dname     = bco.dname;
                            bc.dcode     = bco.dcode;
                            bc.customer  = bco.customer;
                            bc.telephone = bco.telephone;
                            bc.community = bco.community;
                            bc.address   = bco.address;
                            bc.cdate     = DateTime.Now.ToString();
                            bc.maker     = bco.maker;
                            bc.bdcode    = iv.u.dcode.Substring(0, 8);
                            bcb.Add(bc);
                        }
                        r = bco.sid;
                    }
                    else
                    {
                        r = "F";
                    }
                }
                else
                {
                    bco.sid = sid;
                    if (bsob.Update(bco))
                    {
                        r = bco.sid;
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }