示例#1
0
        public static string AfterSalePayOperator(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                VPayOrder        vpo      = new VPayOrder();
                B_AfterSaleOrder bso      = bsob.Query(" and sid='" + sid + "'");
                decimal          yingshou = bso.omoney;
                decimal          yishou   = bprb.GetSkMoney(sid);
                vpo.code      = bso.scode;
                vpo.customer  = bso.customer;
                vpo.dname     = bso.dname;
                vpo.settlment = "";
                vpo.yingshou  = yingshou.ToString();
                vpo.yishou    = yishou.ToString();
                vpo.weishou   = (yingshou - yishou).ToString();
                r             = js.Serialize(vpo);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
示例#2
0
        public static string AfterProductionOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                VProduceOrder    vpo = new VProduceOrder();
                B_AfterSaleOrder 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.pcode;
                vpo.customer = bso.customer;
                vpo.address  = bso.address;
                vpo.dname    = bso.dname;
                vpo.otype    = "反馈单";
                vpo.fname    = bof == null ? "" : bof.dname;
                vpo.scdate   = cof.edate;
                vpo.overdate = bof == null ? "" : bof.overdate;
                vpo.bz       = bso.remark;
                vpo.duty     = bso.aduty;
                vpo.reason   = bso.areason;
                vpo.city     = bso.city;
                r            = js.Serialize(vpo);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
示例#3
0
        public static string InitCompensate(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_AfterCompensate ba  = new B_AfterCompensate();
                B_AfterCompensate bac = bacb.Query(" and sid='" + sid + "'");
                if (bac != null)
                {
                    r = js.Serialize(bac);
                }
                else
                {
                    B_AfterSaleOrder aso = bsob.Query(" and sid='" + sid + "'");
                    if (aso != null)
                    {
                        ba.address   = aso.address;
                        ba.cljg      = "";
                        ba.customer  = aso.customer;
                        ba.pmoney    = 0;
                        ba.reason    = "";
                        ba.scode     = aso.pcode;
                        ba.telephone = aso.telephone;
                    }
                    r = js.Serialize(ba);
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
示例#4
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);
        }
示例#5
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_AfterSaleOrder      baso = bsob.Query(" and sid='" + sid + "'");
                B_OrderFacotory       bof  = bofb.Query(" and sid='" + sid + "'");
                List <Sys_ProduceCyc> lc   = spcb.QueryCheckList(" and emcode='0006' and dcode='" + fcode + "'");
                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("yyyy-MM-dd");
                bf.otype    = baso == null ? "" : baso.otype;
                bf.cdate    = DateTime.Now.ToString();
                if (bof != null)
                {
                    if (bofb.Update(bf))
                    {
                        r = "S";
                        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";
                        bppb.SetProduceProcess(sid, fline);
                        BaseSet.WorkFlowManage.EventBtnDo.FireEventBtn(sid, bcode, "1", "分单");
                        //bcpb.OrderCgComputePrice(sid);
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
示例#6
0
        public static string FixOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                VFixOrder        vfo = new VFixOrder();
                B_AfterSaleOrder bso = bsob.Query(" and sid='" + 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.fcode;
                vfo.ycode       = bso.scode;
                vfo.wcode       = "";
                vfo.otype       = "反馈单";
                vfo.customer    = bso.customer;
                vfo.telephone   = bso.telephone;
                vfo.address     = bso.address;
                vfo.dname       = bso.dname;
                vfo.city        = bso.city;
                vfo.gzname      = "";
                vfo.gztelephone = "";
                vfo.azzt        = zt;
                vfo.bz          = bso.remark;
                r = js.Serialize(vfo);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
示例#7
0
        public static string OutnHouseOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                VInHouseOrder    vpo = new VInHouseOrder();
                B_AfterSaleOrder 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.fcode;
                vpo.ycode     = bso.scode;
                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);
        }
示例#8
0
        public static string QueryAfterMoney(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                VAOrderPrice     vaop = new VAOrderPrice();
                StringBuilder    omh  = new StringBuilder();
                B_AfterSaleOrder bafo = abasob.Query("and sid='" + sid + "'");
                if (bafo != null)
                {
                    vaop.omoney = bafo.omoney.ToString("#0.00");
                    B_AfterPriceFile bapf = abpfb.Query("and sid='" + sid + "'");
                    if (bapf != null)
                    {
                        vaop.bshow = "1";
                        vaop.fname = bapf.fname;
                        vaop.pfid  = bapf.id.ToString();
                    }
                    List <B_PayImg> lobpi = bpib.QueryList(" and sid='" + sid + "' and ptype='o'");
                    if (lobpi != null)
                    {
                        omh.Append("<table style='width:100%;border:none'>");
                        foreach (B_PayImg bpi in lobpi)
                        {
                            omh.AppendFormat("<tr><td><img id='{0}' src='{1}' alt='' onclick='nck(this.id)'/></td></tr>", bpi.id, bpi.url);
                        }
                        omh.Append("<table>");
                    }
                    vaop.ohtm = omh.ToString();
                    r         = js.Serialize(vaop);
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
示例#9
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);
        }
示例#10
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));
        }
示例#11
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);
        }
示例#12
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);
        }