Example #1
0
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strwhere  = string.Empty;

        if (ViewState["strwhere"] != null)
        {
            strwhere += ViewState["strwhere"].ToString();
        }
        strwhere += " and disid=" + this.DisID + " and isnull(dr,0)=0 and IsSign=0";

        if (this.txtPager.Value.Trim().ToString() != "")
        {
            if (this.txtPager.Value.Trim().Length < 4)
            {
                Pager.PageSize = int.Parse(this.txtPager.Value.Trim());
            }
            else
            {
                this.txtPager.Value = "100";
                Pager.PageSize      = 100;
            }
        }

        List <Hi.Model.DIS_OrderOut> orders = new Hi.BLL.DIS_OrderOut().GetList(Pager.PageSize, Pager.CurrentPageIndex, "id", true, strwhere, out pageCount, out Counts);

        this.rptving.DataSource = orders;
        this.rptving.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
Example #2
0
    /// <summary>
    /// 签收
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSing_Click(object sender, EventArgs e)
    {
        Hi.Model.DIS_Order OrderModel = OrderBll.GetModel(KeyID);

        if (OrderModel.OState == (int)Enums.OrderState.已发货 && OrderModel.ReturnState == (int)Enums.ReturnState.未退货)
        {
            Hi.Model.DIS_OrderOut OutModel = new Hi.BLL.DIS_OrderOut().GetOutModel(KeyID);

            OutModel.SignDate   = DateTime.Now;
            OutModel.SignRemark = "";
            OutModel.SignUser   = Common.GetUserName(this.UserID);
            OutModel.SignUserId = this.UserID;
            OutModel.IsSign     = 1;
            OutModel.ts         = DateTime.Now;
            OutModel.modifyuser = this.UserID;

            if (OrderInfoType.SignOrder(OutModel, OrderModel) > 0)
            {
                Utils.AddSysBusinessLog(this.CompID, "Order", KeyID.ToString(), "订单签收", "");
                new Common().GetWxService("3", KeyID.ToString(), "1");
                if (!string.IsNullOrEmpty(Request["type1"]) && Request["type1"].ToString() == "ReceivingList")
                {
                    Response.Redirect("receivinglist.aspx");
                }
                Response.Redirect("neworder/orderdetail.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey));
                //Bind();
            }
        }
    }
Example #3
0
    /// <summary>
    /// 签收
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public void btnSing_Click(int KeyID)
    {
        Hi.BLL.DIS_Order   OrderBll   = new Hi.BLL.DIS_Order();
        Hi.Model.DIS_Order OrderModel = OrderBll.GetModel(KeyID);

        if (OrderModel.OState == (int)Enums.OrderState.已发货 && OrderModel.ReturnState == (int)Enums.ReturnState.未退货)
        {
            Hi.Model.DIS_OrderOut OutModel = new Hi.BLL.DIS_OrderOut().GetOutModel(KeyID);

            OutModel.SignDate   = DateTime.Now;
            OutModel.SignRemark = "";
            OutModel.SignUser   = this.UserName;
            OutModel.SignUserId = this.UserID;
            OutModel.IsSign     = 1;
            OutModel.ts         = DateTime.Now;
            OutModel.modifyuser = this.UserID;

            if (OrderInfoType.SignOrder(OutModel, OrderModel) > 0)
            {
                Utils.AddSysBusinessLog(this.CompID, "Order", KeyID.ToString(), "订单签收", "");
                new Common().GetWxService("3", KeyID.ToString(), "1");
                string str = "\"str\":true";
                str = "{" + str + "}";
                Response.Write(str);
                Response.End();
                //Bind();
            }
        }
    }
Example #4
0
    /// <summary>
    ///  发货、退单编号
    /// </summary>
    /// <param name="strName">单据</param>
    /// <param name="OrderId">订单ID</param>
    /// <returns></returns>
    public static string GetCode(string strName, string OrderId)
    {
        string returnstr = "";

        try
        {
            int sort = 0;
            returnstr += "-";
            if (strName == "发货单")
            {
                List <Hi.Model.DIS_OrderOut> outl = new Hi.BLL.DIS_OrderOut().GetList("", " OrderID=" + OrderId + " and dr=0", "");
                sort       = outl.Count;
                returnstr += "F";
            }
            else if (strName == "退单")
            {
                List <Hi.Model.DIS_OrderReturn> rl = new Hi.BLL.DIS_OrderReturn().GetList("", " OrderID=" + OrderId + " and dr=0", "");
                sort       = rl.Count;
                returnstr += "T";
            }

            sort++;
            if (sort < 10)
            {
                returnstr += "0" + sort;
            }
            else
            {
                returnstr += sort;
            }
        }
        catch (Exception)
        {}
        return(returnstr);
    }
Example #5
0
    /// <summary>
    /// 绑定销售订单信息列表
    /// </summary>
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string cid       = Request.QueryString["cid"];

        if (!string.IsNullOrWhiteSpace(cid))
        {
            string    strwhere = Where(cid);
            DataTable l        = new Hi.BLL.DIS_OrderOut().getDataTable(Pager.PageSize, Pager.CurrentPageIndex, strwhere, out pageCount, out Counts);
            this.rptOrder.DataSource = l;
            this.rptOrder.DataBind();
            Pager.RecordCount = Counts;
            page = Pager.CurrentPageIndex.ToString();
        }
    }
Example #6
0
 /// <summary>
 /// 确认到货
 /// </summary>
 public void affirm(string ReceiptNo)
 {
     Hi.Model.DIS_Order order = new Hi.BLL.DIS_Order().GetModel(ReceiptNo);
     if (order.OState == 1 || order.OState == 2 || order.OState == 4)
     {
         order.OState     = (int)Enums.OrderState.已到货;
         order.ts         = DateTime.Now;
         order.modifyuser = this.UserID;
         if (new Hi.BLL.DIS_Order().Update(order))
         {
             Hi.Model.DIS_OrderOut orderout = new Hi.BLL.DIS_OrderOut().GetOutModel(order.ID);
             if (orderout != null)
             {
                 orderout.SignDate   = DateTime.Now;
                 orderout.IsSign     = 1;
                 orderout.SignUserId = this.UserID;
                 orderout.SignUser   = this.UserName;
                 orderout.ts         = DateTime.Now;
                 orderout.modifyuser = this.UserID;
                 if (new Hi.BLL.DIS_OrderOut().Update(orderout))
                 {
                     Utils.AddSysBusinessLog(dis.CompID, "Order", order.ID.ToString(), "签收", "");
                     string str = "\"str\":true";
                     str = "{" + str + "}";
                     Response.Write(str);
                     Response.End();
                 }
             }
             else
             {
                 string str = "\"str\":fales";
                 str = "{" + str + "}";
                 Response.Write(str);
                 Response.End();
             }
         }
     }
     else
     {
         string str = "\"str\":fales";
         str = "{" + str + "}";
         Response.Write(str);
         Response.End();
     }
 }
Example #7
0
    /// <summary>
    /// 删除物流
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        List <Hi.Model.DIS_Logistics> l = new Hi.BLL.DIS_Logistics().GetList("", "isnull(dr,0)=0 and orderId=" + ViewState["OrderId"].ToString(), "");

        if (l.Count > 0)
        {
            Hi.Model.DIS_OrderOut model2 = new Hi.BLL.DIS_OrderOut().GetModel(Convert.ToInt32(KeyID));
            SqlTransaction        Tran   = DBUtility.SqlHelper.CreateStoreTranSaction();
            try
            {
                foreach (Hi.Model.DIS_Logistics item in l)
                {
                    Hi.Model.DIS_Logistics model = new Hi.BLL.DIS_Logistics().GetModel(item.Id);
                    model.dr         = 1;
                    model.ts         = DateTime.Now;
                    model.modifyuser = this.UserID;

                    //model2.ExpressNo = "";
                    model2.ts         = DateTime.Now;
                    model2.modifyuser = this.UserID;
                    //model2.Express = "";
                    bool bol = new Hi.BLL.DIS_Logistics().Update(model, Tran);
                    new Hi.BLL.DIS_OrderOut().Update(model2, Tran);
                }
                Tran.Commit();
                this.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script> location.replace(location.href);</script>");
                return;
            }
            catch (Exception ex)
            {
                if (Tran != null)
                {
                    if (Tran.Connection != null)
                    {
                        Tran.Rollback();
                    }
                }
                JScript.ShowParentRefresh(this.Page, "删除物流失败");
                JScript.AlertMsgParentRefresh(this.Page, "删除物流失败", JScript.IconOption.哭脸);
            }
        }
    }
Example #8
0
    /// <summary>
    /// 订单信息
    /// </summary>
    public void databind()
    {
        if (KeyID != 0)
        {
            //判断改该条数据代理商是否有操作权限
            if (!Common.PageDisOperable("Order", KeyID, DisID))
            {
                Response.Redirect("../NoOperable.aspx");
                return;
            }
            hidOrderID.Value = Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey);

            string where = "and isnull(o.dr,0)=0 and o.otype<>9 and o.DisID=" + DisID + " and o.ID= " + KeyID;

            DataTable dt = new Hi.BLL.DIS_Order().GetList("", where);

            if (dt != null && dt.Rows.Count > 0)
            {
                //再次购买
                buyagain.Visible = false;
                //订单修改
                modifyorder.Visible = false;
                //订单作废
                ordervoid.Visible = false;
                //申请退货
                //orderReturn.Visible = false;

                Digits = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", dt.Rows[0]["CompID"].ToString().ToInt(0));

                IsShow = OrderInfoType.rdoOrderAudit("订单明细是否显示店铺商品", 0).ToInt(0);
                IsInve = OrderInfoType.rdoOrderAudit("商品是否启用库存", dt.Rows[0]["CompID"].ToString().ToInt(0)).ToInt(0);

                hidDigits.Value = Digits;

                isbate = OrderInfoType.rdoOrderAudit("订单支付返利是否启用", dt.Rows[0]["CompID"].ToString().ToInt(0)).ToInt(0);
                if (isbate == 0)
                {
                    if (dt.Rows[0]["bateAmount"].ToString() == "" || dt.Rows[0]["bateAmount"].ToString() == "0.00")
                    {
                        this.trbate.Visible = false;
                        this.rebate.Visible = false;
                    }
                }

                // 订单编号
                lblReceiptNo.InnerText  = dt.Rows[0]["ReceiptNo"].ToString();
                lblCreateDate.InnerText = dt.Rows[0]["CreateDate"].ToString().ToDateTime().ToString("yyyy-MM-dd");
                lblOstate.InnerText     = OrderType.GetOState(dt.Rows[0]["OState"].ToString(), dt.Rows[0]["IsOutState"].ToString());
                hidOstate.Value         = dt.Rows[0]["OState"].ToString();

                lblCompID.InnerText = Common.Getcom(dt.Rows[0]["CompID"].ToString().ToInt(0), "CompName");
                orderCompId         = Convert.ToString(dt.Rows[0]["CompID"]);

                hidIsOutstate.Value = dt.Rows[0]["IsOutState"].ToString();

                OState       = dt.Rows[0]["OState"].ToString().ToInt(0);
                IsOutState   = dt.Rows[0]["IsOutState"].ToString().ToInt(0);
                payState     = dt.Rows[0]["PayState"].ToString().ToInt(0);
                ReturnState  = dt.Rows[0]["ReturnState"].ToString().ToInt(0);
                hidDts.Value = dt.Rows[0]["ts"].ToString();

                //订单流程
                lblTotalAmount.InnerText = dt.Rows[0]["TotalAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["TotalAmount"].ToString().ToDecimal().ToString("N");
                lblProAmount.InnerText   = dt.Rows[0]["ProAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["ProAmount"].ToString().ToDecimal().ToString("N");

                lblbateAmount.InnerText = dt.Rows[0]["bateAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["bateAmount"].ToString().ToDecimal().ToString("N");
                lblbate.InnerText       = dt.Rows[0]["bateAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["bateAmount"].ToString().ToDecimal().ToString("N");

                lblPostFee.InnerText     = dt.Rows[0]["PostFee"].ToString() == "" ? "0.00" : dt.Rows[0]["PostFee"].ToString().ToDecimal().ToString("0.00");
                lblAuditAmount.InnerText = dt.Rows[0]["AuditAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["AuditAmount"].ToString().ToDecimal().ToString("N");

                //下单信息
                lblArriveDate.InnerText = dt.Rows[0]["ArriveDate"].ToString() == "" ? "" : dt.Rows[0]["ArriveDate"].ToString().ToDateTime().ToString("yyyy-MM-dd");
                lblGiveMode.InnerText   = dt.Rows[0]["GiveMode"].ToString();
                iRemark.InnerText       = dt.Rows[0]["Remark"].ToString();

                //收货地址
                lblPrincipal.InnerText = dt.Rows[0]["Principal"].ToString();
                lblPhone.InnerText     = dt.Rows[0]["Phone"].ToString();
                lblAddress.InnerText   = dt.Rows[0]["Address"].ToString();
                hidAddrID.Value        = dt.Rows[0]["AddrID"].ToString();

                //开票信息
                if (dt.Rows[0]["IsOBill"].ToString().ToInt(0) > 0)
                {
                    hidDisAccID.Value = dt.Rows[0]["DisAccID"].ToString();
                    hidval.Value      = dt.Rows[0]["IsOBill"].ToString();
                    string Billing = string.Empty;
                    Billing += "发票抬头:<label id=\"lblRise\" runat=\"server\">" + dt.Rows[0]["Rise"].ToString() + "</label>";
                    Billing += ",发票内容:<label id=\"lblContent\" runat=\"server\">" + dt.Rows[0]["Content"].ToString() + "</label>";
                    if (dt.Rows[0]["IsOBill"].ToString().ToInt(0) == 2)
                    {
                        Billing += ",开户银行:<label id=\"lblOBank\" runat=\"server\">" + dt.Rows[0]["OBank"].ToString() + "</label>";
                        Billing += ",开户账户:<label id=\"lblOAccount\" runat=\"server\">" + dt.Rows[0]["OAccount"].ToString() + "</label>";
                        Billing += ",纳税人登记号:<label id=\"lblTRNumber\" runat=\"server\">" + dt.Rows[0]["TRNumber"].ToString() + "</label>";
                    }
                    else
                    {
                        Billing += ",纳税人登记号:<label id=\"lblTRNumber\" runat=\"server\">" + dt.Rows[0]["TRNumber"].ToString() + "</label>";
                    }
                    iInvoice.InnerHtml = Billing;

                    //lblRise.InnerText = dt.Rows[0]["Rise"].ToString();
                    //lblContent.InnerText = dt.Rows[0]["Content"].ToString();
                    //lblOBank.InnerText = dt.Rows[0]["OBank"].ToString();
                    //lblOAccount.InnerText = dt.Rows[0]["OAccount"].ToString();
                    //lblTRNumber.InnerText = dt.Rows[0]["TRNumber"].ToString();
                }
                else
                {
                    this.iInvoice.InnerHtml = "不开发票";
                }

                //发票信息
                lblBillNo.InnerText  = dt.Rows[0]["BillNo"].ToString();
                lblIsBill.InnerText  = dt.Rows[0]["IsBill"].ToString() == "1" ? "是" : "否";
                this.hidisBill.Value = dt.Rows[0]["IsBill"].ToString();


                string msg  = string.Empty;
                bool   flag = Common.FCan(dt.Rows[0]["DisID"].ToString(), "1", out msg);
                if (flag)
                {
                    this.lblmsg.InnerText = msg;
                }

                decimal nopayAmount = OrderInfoType.GetSumAmount(dt.Rows[0]["DisID"].ToString(), dt.Rows[0]["CompID"].ToString(), KeyID);
                if (nopayAmount > 0)
                {
                    string promptmsg = "订单待支付金额为¥" + nopayAmount.ToString("0.00") + ",请尽快支付";
                    this.lblPrompt.InnerText = promptmsg;
                }
                else
                {
                    this.lblPrompt.Visible = false;
                }


                #region  订单支付信息

                TotalAmount = Convert.ToDecimal(dt.Rows[0]["AuditAmount"]).ToString("0.00");
                PayedAmount = Convert.ToDecimal(dt.Rows[0]["PayedAmount"]).ToString("0.00");

                //订单已支付不显示支付按钮(未审核、未支付完成)
                if (Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.未提交 || Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.待审核 || Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.待审核 || Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.已退货 || Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.已作废 || (Convert.ToDecimal(dt.Rows[0]["AuditAmount"]) - Convert.ToDecimal(dt.Rows[0]["PayedAmount"]) == 0))
                {
                    btn_pay.Visible = false;
                }
                paymoney = (Convert.ToDecimal(dt.Rows[0]["AuditAmount"]) - Convert.ToDecimal(dt.Rows[0]["PayedAmount"])).ToString("0.00");

                //加密keyId
                desKeyID.Value = Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey);

                //绑定支付流水信息
                DataTable paytable = new Hi.BLL.PAY_PrePayment().GetPayedItem(KeyID);
                rptmessage.DataSource = paytable;
                rptmessage.DataBind();

                //初始值加载
                txtArriveDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
                DataTable dtpayment = new Hi.BLL.PAY_PrePayment().GetDate(" top 1   CreateDate, payName ,paycode ,paybank", "pay_payment", " DisID=" + DisID + " and vdef3=5 order by  CreateDate desc");
                foreach (DataRow dr in dtpayment.Rows)
                {
                    bankname.Value = Convert.ToString(dr["payName"]);
                    bankcode.Value = Convert.ToString(dr["paycode"]);
                    bank.Value     = Convert.ToString(dr["paybank"]);
                }


                //附件
                //if (dt.Rows[0]["Atta"].ToString() != "")
                //{
                //    StringBuilder li = new StringBuilder();
                //    string[] atta = dt.Rows[0]["Atta"].ToString().Split(new string[] { "$$&&" }, StringSplitOptions.RemoveEmptyEntries);
                //    if (atta.Length > 0)
                //    {
                //        foreach (var item in atta)
                //        {
                //            li.AppendFormat("<li> <a href=\"javascript:;\" class=\"name\">{0}</a><a href=\"javascript:;\"  class=\"bule del\" orderid=\"{1}\">删除</a><a href=\"javascript:;\" class=\"bule\">下载</a></li>", item, KeyID);

                //        }
                //    }
                // this.payulfile.InnerHtml = li.ToString();
                //}
                #endregion


                //附件
                if (dt.Rows[0]["Atta"].ToString() != "")
                {
                    StringBuilder li   = new StringBuilder();
                    string[]      atta = dt.Rows[0]["Atta"].ToString().Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
                    if (atta.Length > 0)
                    {
                        foreach (var item in atta)
                        {
                            string[] att = item.Split(new string[] { "^^" }, StringSplitOptions.RemoveEmptyEntries);

                            if (att.Length > 1)
                            {
                                li.AppendFormat("<li> <a href=\"{2}\" target=\"_blank\" class=\"name\">{0}(大小:{4}KB)</a><a href=\"javascript:;\"  class=\"bule del\" tip=\"{3}\" orderid=\"{1}\">删除</a><a href=\"{2}\" target=\"_blank\" class=\"bule\">下载</a></li>", att[0] + att[1].Substring(att[1].LastIndexOf(".")), KeyID, Common.GetWebConfigKey("ImgViewPath") + "OrderFJ/" + item, item, OrderType.GetSize(item));
                            }
                        }
                    }
                    ulAtta.InnerHtml     = li.ToString();
                    this.hrOrderFj.Value = dt.Rows[0]["Atta"].ToString();
                }

                #region 订单明细

                //订单所有商品明细
                DataTable l = new Hi.BLL.DIS_OrderDetail().GetOrderDe("", " IsNUll(o.dr,0)=0 and o.OrderId=" + KeyID);
                if (l != null && l.Rows.Count > 0)
                {
                    rptOrderD.DataSource = l;
                    rptOrderD.DataBind();

                    //待发货商品
                    DataTable lno = SelectGoodsInfo.SreeenDataTable(l, "isnull(IsOut,0)=0"); //l.Select(string.Format("IsOut={0}", 0));
                    if (lno != null && lno.Rows.Count > 0)
                    {
                        rptIsout.DataSource = lno;
                        rptIsout.DataBind();
                    }

                    //已发货商品
                    List <Hi.Model.DIS_OrderOutDetail> loud = new Hi.BLL.DIS_OrderOutDetail().GetList("", " isnull(dr,0)=0 and OrderID=" + KeyID, "");
                    //发货单 and o.IsAudit<>3
                    DataTable lo = new Hi.BLL.DIS_OrderOut().GetList("", " isnull(o.dr,0)=0 and o.OrderID=" + KeyID + " Order by o.IsAudit");

                    if (loud != null && loud.Count > 0)
                    {
                        //outbind(lo, l, loud);
                        outGoods.InnerHtml = SelectGoodsInfo.outbind(lo, l, loud, Digits, 0);
                    }

                    #region 流程时间控件

                    if (lo != null && lo.Rows.Count > 0)
                    {
                        if (((int)Enums.OrderState.已发货 <= OState || OState == (int)Enums.OrderState.退货处理) && (IsOutState == 3 || IsOutState == 4))
                        {
                            //订单发货时间
                            DataRow[] sendlo = lo.Select("IsAudit<>3");
                            DataRow[] dv     = sendlo.OrderByDescending(x => x["id"]).ToArray();
                            if (dv.Length > 0)
                            {
                                sendde = dv[0]["SendDate"].ToString() != "" ? dv[0]["SendDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";
                            }
                        }

                        if ((int)Enums.OrderState.已到货 <= OState || OState == (int)Enums.OrderState.退货处理)
                        {
                            //订单签收时间
                            DataRow[] signlo = lo.Select("IsAudit<>3 and IsSign=1");
                            DataRow[] dr     = signlo.OrderByDescending(x => x["id"]).ToArray();
                            if (dr.Length > 0)
                            {
                                signde = dr[0]["SignDate"].ToString() != "" ? dr[0]["SignDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";
                            }
                        }
                    }
                    #endregion
                }
                #endregion

                #region 流程时间控件
                //订单流程时间显示
                //订单提交时间
                CreateDate = dt.Rows[0]["CreateDate"].ToString() != "" ? dt.Rows[0]["CreateDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";

                //订单审核时间
                AuditDate = dt.Rows[0]["AuditDate"].ToString() != "" ? dt.Rows[0]["AuditDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";
                #endregion 流程时间控件

                #region 订单操作按钮

                switch (OState)
                {
                case (int)Enums.OrderState.待审核:
                    modifyorder.Visible = true;
                    buyagain.Visible    = true;
                    ordervoid.Visible   = true;
                    break;

                case (int)Enums.OrderState.已审:
                    //订单审核前,可以修改订单。
                    buyagain.Visible = true;
                    break;

                case (int)Enums.OrderState.退货处理:
                    //orderReturn.Visible = false;
                    buyagain.Visible = true;
                    btn_pay.Visible  = false;
                    fulfil           = signde;
                    break;

                case (int)Enums.OrderState.已发货:
                    modifyorder.Visible = false;
                    buyagain.Visible    = true;
                    break;

                case (int)Enums.OrderState.已到货:
                    modifyorder.Visible = false;
                    buyagain.Visible    = true;
                    if (dt.Rows[0]["CreateDate"].ToString().ToDateTime() > DateTime.Now.AddMonths(-3))
                    {
                        //三个月以内的订单可退货
                        //if (ReturnState < (int)Enums.ReturnState.申请退货)
                        //orderReturn.Visible = true;
                    }
                    if (ReturnState >= (int)Enums.ReturnState.申请退货)
                    {
                        btn_pay.Visible = false;
                    }
                    if (sendde == "" && signde == "" && AuditDate != "")
                    {
                        fulfil = AuditDate;
                    }
                    else if (AuditDate.ToString() == "")
                    {
                        fulfil = CreateDate;
                    }
                    else
                    {
                        fulfil = signde == "" ? sendde : signde;
                    }
                    break;

                case (int)Enums.OrderState.已作废:
                    modifyorder.Visible = false;
                    buyagain.Visible    = true;
                    fulfil = Convert.ToDateTime(dt.Rows[0]["ts"]).ToString("yyyy-MM-dd HH:mm");
                    break;

                case (int)Enums.OrderState.已退货:
                    buyagain.Visible = true;
                    btn_pay.Visible  = false;
                    fulfil           = signde;
                    break;

                default:
                    break;
                }

                #endregion

                //订单修改,再次购买
                if (!Common.HasRight(this.CompID, this.UserID, "1010", this.DisID))
                {
                    this.buyagain.Visible    = false;
                    this.modifyorder.Visible = false;
                }
                //订单作废
                if (!Common.HasRight(this.CompID, this.UserID, "2012", this.DisID))
                {
                    this.ordervoid.Visible = false;
                }
                //在线支付
                if (!Common.HasRight(this.CompID, this.UserID, "2014", this.DisID))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "btn_pay_xs", "<script> $('#btn_pay_xs').hide();</script>");
                }

                //线下支付
                if (!Common.HasRight(this.CompID, this.UserID, "2015", this.DisID))
                {
                    this.btn_pay_xx.Visible = false;
                }
                //申请退货
                //if (!Common.HasRight(this.CompID, this.UserID, "2311", this.DisID))
                //this.orderReturn.Visible = false;
                //确认收货
                if (!Common.HasRight(this.CompID, this.UserID, "2013", this.DisID))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "btnsign", "<script> $('.btnsign,.btnsigni').hide();</script>");
                }
            }
        }
        else
        {
            Response.Redirect("../NoOperable.aspx");
            return;
        }
    }
Example #9
0
    /// <summary>
    /// 获取推送类型
    /// </summary>
    /// <returns></returns>
    public static string GetWXType(string sendType, string userID, string orderID)
    {
        string  res       = string.Empty;
        decimal num       = 0;
        string  orderInfo = string.Empty;
        string  orderOut  = String.Empty;

        Hi.Model.DIS_OrderOut         outModel    = null;
        Hi.Model.DIS_OrderReturn      returnModel = null;
        List <Hi.Model.DIS_Logistics> list_log    = null;

        Hi.Model.DIS_Logistics log     = null;
        Hi.BLL.DIS_Logistics   bll_log = new Hi.BLL.DIS_Logistics();

        Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(int.Parse(userID));
        if (user == null || string.IsNullOrEmpty(user.OpenID))
        {
            return("");
        }
        Hi.Model.DIS_Order order = new Hi.BLL.DIS_Order().GetModel(int.Parse(orderID));
        if (order == null)
        {
            return("");
        }
        List <Hi.Model.DIS_OrderDetail> orderList = new Hi.BLL.DIS_OrderDetail().GetList("",
                                                                                         " orderID=" + int.Parse(orderID), "");

        if (orderList == null || orderList.Count == 0)
        {
            return("");
        }
        foreach (Hi.Model.DIS_OrderDetail detail in orderList)
        {
            Hi.Model.BD_GoodsInfo goodsInfo = new Hi.BLL.BD_GoodsInfo().GetModel(detail.GoodsinfoID);
            if (goodsInfo != null)
            {
                Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(goodsInfo.GoodsID);
                orderInfo += " " + goods.GoodsName + "*" + detail.GoodsNum;
            }
            num += detail.GoodsNum;
        }
        Hi.Model.BD_DisAddr addr = new Hi.BLL.BD_DisAddr().GetModel(order.AddrID);
        if (addr != null)
        {
            if (addr.Phone != "")
            {
                orderOut += addr.Principal + ":" + addr.Phone + " ";
            }
            else
            {
                orderOut += addr.Principal + ":" + addr.Tel + " ";
            }
        }
        List <Hi.Model.DIS_OrderOut> orderout = new Hi.BLL.DIS_OrderOut().GetList("",
                                                                                  " orderID=" + int.Parse(orderID), "");

        if (orderout != null && orderout.Count != 0)
        {
            foreach (Hi.Model.DIS_OrderOut detail in orderout)
            {
                list_log = bll_log.GetList("", "OrderOutID = " + detail.ID + " and isnull(dr,0) == 0", "");
                if (list_log != null && list_log.Count >= 0)
                {
                    log = list_log[0];
                    //orderOut += log.ExpressPerson + ":" + log.ExpressTel + " ";
                }

                outModel = detail;
            }
        }
        List <Hi.Model.DIS_OrderReturn> returnlist = new Hi.BLL.DIS_OrderReturn().GetList("",
                                                                                          " orderID=" + int.Parse(orderID), "");

        if (returnlist != null && returnlist.Count != 0)
        {
            foreach (Hi.Model.DIS_OrderReturn detail in returnlist)
            {
                returnModel = detail;
            }
        }
        //string sqlstr = string.Format("select * from dis_order where receiptno like ('%{0}%') and dr=0", ReceiptNo);

        switch (sendType)
        {
        case "1":     //下单通知
            StringBuilder strSql = new StringBuilder();
            strSql.Append("{\"type\":\"ORDERADD\",\"openid\":\"");
            strSql.Append(user.OpenID);
            strSql.Append("\",\"msg\":[{\"title\":\"尊敬的");
            strSql.Append(user.TrueName);
            strSql.Append(",您好\",\"orderno\":\"");
            strSql.Append(order.ReceiptNo);
            strSql.Append("\",\"orderamount\":\"");
            strSql.Append(order.TotalAmount.ToString("N"));
            strSql.Append("元\",\"extra1\":\"状态:待付款\",\"extra2\":\"数量:");
            strSql.Append(num.ToString("0.00"));
            strSql.Append("\",\"remark\":\"");
            strSql.Append(order.Remark);
            strSql.Append("\"}]}");
            res = strSql.ToString();
            break;

        case "2":     //订单支付通知
            StringBuilder str = new StringBuilder();
            str.Append("{\"type\":\"ORDERPAY\",\"openid\":\"");
            str.Append(user.OpenID);
            str.Append("\",\"msg\":[{\"title\":\"尊敬的");
            str.Append(user.TrueName);
            str.Append(",您好\",\"orderpay\":\"");
            str.Append(order.TotalAmount.ToString("N"));
            str.Append("元\",\"orderinfo\":\"");
            str.Append(orderInfo);
            str.Append("\",\"receiveinfo\":\"");
            str.Append(orderOut);
            str.Append("\",\"orderno\":\"");
            str.Append(order.ReceiptNo);
            str.Append("\",\"remark\":\"");
            str.Append("\"}]}");
            res = str.ToString();
            break;

        case "3":     //42、签收提醒
            StringBuilder SIGN = new StringBuilder();
            SIGN.Append("{\"type\":\"SIGN\",\"openid\":\"");
            SIGN.Append(user.OpenID);
            SIGN.Append("\",\"msg\":[{\"title\":\"您好,您的订单");
            SIGN.Append(order.ReceiptNo);
            SIGN.Append("已签收\",\"orderno\":\"");
            SIGN.Append(order.ReceiptNo);
            SIGN.Append("\",\"qianshouren\":\"");
            SIGN.Append(outModel.SignUser);
            SIGN.Append("\",\"qianshoushijian\":\"");
            SIGN.Append(outModel.SignDate);
            SIGN.Append("\",\"remark\":\"");
            SIGN.Append(order.Remark);
            SIGN.Append("\"}]}");
            res = SIGN.ToString();
            break;

        case "4":     //退货申请
            StringBuilder RETGOODS = new StringBuilder();
            RETGOODS.Append("{\"type\":\"RETGOODS\",\"openid\":\"");
            RETGOODS.Append(user.OpenID);
            RETGOODS.Append("\",\"msg\":[{\"title\":\"买家申请退货");
            RETGOODS.Append("\",\"orderno\":\"");
            RETGOODS.Append(order.ReceiptNo);
            RETGOODS.Append("\",\"shangpinxinxi\":\"");
            RETGOODS.Append(orderInfo);
            RETGOODS.Append("\",\"orderjine\":\"");
            RETGOODS.Append(order.TotalAmount.ToString("N"));
            RETGOODS.Append("元\",\"remark\":\"");
            RETGOODS.Append(order.Remark);
            RETGOODS.Append("\"}]}");
            res = RETGOODS.ToString();
            break;

        case "41":     //代人下单通知
            StringBuilder ORDERADD = new StringBuilder();
            ORDERADD.Append("{\"type\":\"ORDERADD\",\"openid\":\"");
            ORDERADD.Append(user.OpenID);
            ORDERADD.Append("\",\"msg\":[{\"title\":\"尊敬的");
            ORDERADD.Append(user.TrueName);
            ORDERADD.Append(",您好\",\"orderno\":\"");
            ORDERADD.Append(order.ReceiptNo);
            ORDERADD.Append("\",\"orderamount\":\"");
            ORDERADD.Append(order.TotalAmount.ToString("N"));
            ORDERADD.Append("元\",\"extra1\":\"状态:待付款\",\"extra2\":\"数量:");
            ORDERADD.Append(num.ToString());
            ORDERADD.Append("\",\"remark\":\"");
            ORDERADD.Append(order.Remark);
            ORDERADD.Append("\"}]}");
            res = ORDERADD.ToString();
            break;

        case "42":     //订单审批
            StringBuilder sql = new StringBuilder();
            sql.Append("{\"type\":\"ORDERSTATUS\",\"openid\":\"");
            sql.Append(user.OpenID);
            sql.Append("\",\"msg\":[{\"title\":\"尊敬的");
            sql.Append(user.TrueName);
            sql.Append(",您好\",\"orderno\":\"");
            sql.Append(order.ReceiptNo);
            if (order.OState.ToString() == "-1")
            {
                sql.Append("\",\"orderstatus\":\"订单退回\",\"remark\":\"");
            }
            else
            {
                sql.Append("\",\"orderstatus\":\"待发货、审批通过\",\"remark\":\"");
            }
            sql.Append(order.Remark);
            sql.Append("\"}]}");
            res = sql.ToString();
            break;

        case "43":     //订单发货
            StringBuilder sqlSend = new StringBuilder();
            sqlSend.Append("{\"type\":\"ORDERSEND\",\"openid\":\"");
            sqlSend.Append(user.OpenID);
            sqlSend.Append("\",\"msg\":[{\"title\":\"尊敬的");
            sqlSend.Append(user.TrueName);
            sqlSend.Append(",您好\",\"orderno\":\"");
            sqlSend.Append(order.ReceiptNo);
            sqlSend.Append("\",\"wuliuname\":\"");
            sqlSend.Append(log.ComPName);
            sqlSend.Append("\",\"wuliucode\":\"");
            sqlSend.Append(log.LogisticsNo);
            sqlSend.Append("\",\"remark\":\"");
            sqlSend.Append(outModel.Remark);
            sqlSend.Append("\"}]}");
            res = sqlSend.ToString();
            break;

        case "44":     //6、退货审核
            StringBuilder RETAUDIT = new StringBuilder();
            RETAUDIT.Append("{\"type\":\"RETAUDIT\",\"openid\":\"");
            RETAUDIT.Append(user.OpenID);
            RETAUDIT.Append("\",\"msg\":[{\"title\":\"您好,您的退货审核");
            if (returnModel.ReturnState == -1)
            {
                RETAUDIT.Append("已退回");
            }
            else
            {
                RETAUDIT.Append("已审核");
            }
            RETAUDIT.Append("\",\"shenhejieguo\":\"");
            if (returnModel.ReturnState == -1)
            {
                RETAUDIT.Append("已退回");
            }
            else
            {
                RETAUDIT.Append("已审核");
            }
            RETAUDIT.Append("\",\"shangpinxinxi\":\"");
            RETAUDIT.Append(orderInfo);
            RETAUDIT.Append("\",\"tuihuojine\":\"");
            RETAUDIT.Append(order.PayedAmount.ToString("N"));
            RETAUDIT.Append("元\",\"shenheshuoming\":\"");
            RETAUDIT.Append(returnModel.AuditRemark);
            RETAUDIT.Append("\",\"shenheshijian\":\"");
            RETAUDIT.Append(returnModel.AuditDate);
            RETAUDIT.Append("\",\"orderno\":\"");
            RETAUDIT.Append(order.ReceiptNo);
            RETAUDIT.Append("\",\"remark\":\"");
            RETAUDIT.Append("\"}]}");
            res = RETAUDIT.ToString();
            break;

        case "45":     //5、退款
            StringBuilder REFUND = new StringBuilder();
            REFUND.Append("{\"type\":\"REFUND\",\"openid\":\"");
            REFUND.Append(user.OpenID);
            REFUND.Append("\",\"msg\":[{\"title\":\"您好,您的订单");
            REFUND.Append(order.ReceiptNo);
            REFUND.Append(",已退款。\",\"reason\":\"");
            REFUND.Append(returnModel.ReturnContent);
            REFUND.Append("\",\"refund\":\"");
            REFUND.Append(order.PayedAmount.ToString("N"));
            REFUND.Append("元\",\"orderno\":\"");
            REFUND.Append(order.ReceiptNo);
            REFUND.Append("\",\"remark\":\"");
            REFUND.Append("\"}]}");
            res = REFUND.ToString();
            break;
        }
        return(res);
    }
Example #10
0
    /// <summary>
    /// 订单信息
    /// </summary>
    public void databind()
    {
        if (KeyID != 0)
        {
            hidOrderID.Value = Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey);
            string where     = "and isnull(o.dr,0)=0 and o.otype<>9  and o.ID= " + KeyID;
            DataTable dt = new Hi.BLL.DIS_Order().GetList("", where);

            if (dt != null && dt.Rows.Count > 0)
            {
                CompID         = dt.Rows[0]["CompID"].ToString().ToInt(0);
                DisID          = dt.Rows[0]["DisID"].ToString().ToInt(0);
                hidDisID.Value = DisID.ToString();

                //判断改该条数据代理商是否有操作权限
                if (!Common.PageDisOperable("Order", KeyID, DisID))
                {
                    Response.Redirect("../NoOperable.aspx");
                    return;
                }

                //////再次购买
                ////buyagain.Visible = false;
                //////订单修改
                ////modifyorder.Visible = false;
                //订单作废
                //ordervoid.Visible = false;
                //////订单审核
                ////orderaudit.Visible = false;

                Digits          = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", dt.Rows[0]["CompID"].ToString().ToInt(0));
                hidDigits.Value = Digits;

                isbate = OrderInfoType.rdoOrderAudit("订单支付返利是否启用", CompID).ToInt(0);
                if (isbate == 0)
                {
                    trbate.Visible = false;
                    rebate.Visible = false;
                }

                OState = dt.Rows[0]["OState"].ToString().ToInt(0);
                if (OState == (int)Enums.OrderState.已作废)
                {
                    orderDelete.Visible = true;
                }
                else
                {
                    orderDelete.Visible = false;
                }
                IsOutState          = dt.Rows[0]["IsOutState"].ToString().ToInt(0);
                payState            = dt.Rows[0]["PayState"].ToString().ToInt(0);
                hidIsOutstate.Value = dt.Rows[0]["IsOutState"].ToString();
                hidOstate.Value     = OState.ToString();
                hidpaystate.Value   = payState.ToString();

                #region 订单操作按钮

                //switch (OState)
                //{
                //    case (int)Enums.OrderState.未提交:
                //        //modifyorder.Visible = true;
                //        //buyagain.Visible = true;
                //        //orderaudit.Visible = true;
                //        //ordervoid.Visible = true;
                //        deliver.Attributes.Add("style", "display: none;");
                //        break;
                //    case (int)Enums.OrderState.待审核:
                //        //modifyorder.Visible = true;
                //        //buyagain.Visible = true;
                //        //orderaudit.Visible = true;
                //        //ordervoid.Visible = true;
                //        deliver.Attributes.Add("style", "display: none;");
                //        break;
                //    case (int)Enums.OrderState.已审:
                //        //订单审核前,可以修改订单。
                //        buyagain.Visible = true;
                //        if (payState == 0)
                //        {
                //            //订单支付前订单可以作废,支付后不能作废订单
                //            ordervoid.Visible = true;
                //        }
                //        break;
                //    case (int)Enums.OrderState.退货处理:
                //        buyagain.Visible = true;
                //        fulfil = signde;
                //        break;
                //    case (int)Enums.OrderState.已发货:
                //        modifyorder.Visible = false;
                //        buyagain.Visible = true;
                //        break;
                //    case (int)Enums.OrderState.已到货:
                //        modifyorder.Visible = false;
                //        buyagain.Visible = true;
                //        fulfil = signde;
                //        break;
                //    case (int)Enums.OrderState.已作废:
                //        modifyorder.Visible = false;
                //        buyagain.Visible = true;
                //        break;
                //    case (int)Enums.OrderState.已退货:
                //        buyagain.Visible = true;
                //        fulfil = signde;
                //        break;
                //    default:
                //        break;
                //}

                #endregion

                // 订单编号
                lblReceiptNo.InnerText  = dt.Rows[0]["ReceiptNo"].ToString();
                lblDisName.InnerText    = Common.GetDisValue(dt.Rows[0]["DisID"].ToString().ToInt(0), "DisName").ToString();
                lblCreateDate.InnerText = dt.Rows[0]["CreateDate"].ToString().ToDateTime().ToString("yyyy-MM-dd");
                lblOstate.InnerText     = OrderType.GetOState(dt.Rows[0]["OState"].ToString(), dt.Rows[0]["IsOutState"].ToString());

                //订单流程
                lblTotalAmount.InnerText = dt.Rows[0]["TotalAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["TotalAmount"].ToString().ToDecimal().ToString("N");
                lblProAmount.InnerText   = dt.Rows[0]["ProAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["ProAmount"].ToString().ToDecimal().ToString("N");

                lblbateAmount.InnerText = dt.Rows[0]["bateAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["bateAmount"].ToString().ToDecimal().ToString("N");
                lblbate.InnerText       = dt.Rows[0]["bateAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["bateAmount"].ToString().ToDecimal().ToString("0.00");

                lblPostFee.InnerText     = dt.Rows[0]["PostFee"].ToString() == "" ? "0.00" : dt.Rows[0]["PostFee"].ToString().ToDecimal().ToString("0.00");
                lblAuditAmount.InnerText = dt.Rows[0]["AuditAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["AuditAmount"].ToString().ToDecimal().ToString("N");

                //下单信息
                lblArriveDate.InnerText = dt.Rows[0]["ArriveDate"].ToString() == "" ? "" : dt.Rows[0]["ArriveDate"].ToString().ToDateTime().ToString("yyyy-MM-dd");
                lblGiveMode.InnerText   = dt.Rows[0]["GiveMode"].ToString();
                iRemark.InnerText       = dt.Rows[0]["Remark"].ToString();

                //收货地址
                lblPrincipal.InnerText = dt.Rows[0]["Principal"].ToString();
                lblPhone.InnerText     = dt.Rows[0]["Phone"].ToString();
                lblAddress.InnerText   = dt.Rows[0]["Address"].ToString();
                hidAddrID.Value        = dt.Rows[0]["AddrID"].ToString();

                //开票信息
                if (dt.Rows[0]["IsOBill"].ToString() == "1")
                {
                    hidDisAccID.Value = dt.Rows[0]["DisAccID"].ToString();
                    hidval.Value      = dt.Rows[0]["IsOBill"].ToString();
                    string Billing = string.Empty;
                    Billing += "发票抬头:<label id=\"lblRise\" runat=\"server\">" + dt.Rows[0]["Rise"].ToString() + "</label>";
                    Billing += ",发票内容:<label id=\"lblContent\" runat=\"server\">" + dt.Rows[0]["Content"].ToString() + "</label>";
                    if (!string.IsNullOrEmpty(dt.Rows[0]["OBank"].ToString()))
                    {
                        Billing += ",开户银行:<label id=\"lblOBank\" runat=\"server\">" + dt.Rows[0]["OBank"].ToString() + "</label>";
                        Billing += ",开户账户:<label id=\"lblOAccount\" runat=\"server\">" + dt.Rows[0]["OAccount"].ToString() + "</label>";
                        Billing += ",纳税人登记号:<label id=\"lblTRNumber\" runat=\"server\">" + dt.Rows[0]["TRNumber"].ToString() + "</label>";
                    }
                    iInvoice.InnerHtml = Billing;

                    //lblRise.InnerText = dt.Rows[0]["Rise"].ToString();
                    //lblContent.InnerText = dt.Rows[0]["Content"].ToString();
                    //lblOBank.InnerText = dt.Rows[0]["OBank"].ToString();
                    //lblOAccount.InnerText = dt.Rows[0]["OAccount"].ToString();
                    //lblTRNumber.InnerText = dt.Rows[0]["TRNumber"].ToString();
                }
                else
                {
                    this.iInvoice.InnerHtml = "不开发票";
                }

                //发票信息
                lblBillNo.InnerText = dt.Rows[0]["BillNo"].ToString();
                lblIsBill.InnerText = dt.Rows[0]["IsBill"].ToString() == "1" ? "是" : "否";
                lblIsBill.Attributes.Add("tip", dt.Rows[0]["IsBill"].ToString());
                this.hidisBill.Value = dt.Rows[0]["IsBill"].ToString();


                #region  订单支付信息

                TotalAmount = Convert.ToDecimal(dt.Rows[0]["AuditAmount"]).ToString("0.00");
                PayedAmount = Convert.ToDecimal(dt.Rows[0]["PayedAmount"]).ToString("0.00");

                //订单已支付不显示支付按钮(未审核、未支付完成)
                if (Convert.ToInt32(dt.Rows[0]["OState"]) == 1 || (Convert.ToDecimal(dt.Rows[0]["AuditAmount"]) - Convert.ToDecimal(dt.Rows[0]["PayedAmount"]) == 0))
                {
                    btn_pay.Visible = false;
                }
                paymoney = (Convert.ToDecimal(dt.Rows[0]["AuditAmount"]) - Convert.ToDecimal(dt.Rows[0]["PayedAmount"])).ToString("0.00");

                //加密keyId
                desKeyID.Value = Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey);


                //绑定支付流水信息
                DataTable paytable = new Hi.BLL.PAY_PrePayment().GetPayedItem(KeyID);
                rptmessage.DataSource = paytable;
                rptmessage.DataBind();


                //初始值加载
                txtArriveDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
                DataTable dtpayment = new Hi.BLL.PAY_PrePayment().GetDate(" top 1   CreateDate, payName ,paycode ,paybank", "pay_payment", " DisID=" + DisID + " and vdef3=5 order by  CreateDate desc");
                foreach (DataRow dr in dtpayment.Rows)
                {
                    bankname.Value = Convert.ToString(dr["payName"]);
                    bankcode.Value = Convert.ToString(dr["paycode"]);
                    bank.Value     = Convert.ToString(dr["paybank"]);
                }


                #endregion
                //附件
                if (dt.Rows[0]["Atta"].ToString() != "")
                {
                    StringBuilder li   = new StringBuilder();
                    string[]      atta = dt.Rows[0]["Atta"].ToString().Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
                    if (atta.Length > 0)
                    {
                        foreach (var item in atta)
                        {
                            string[] att = item.Split(new string[] { "^^" }, StringSplitOptions.RemoveEmptyEntries);
                            if (att.Length > 1)
                            {
                                li.AppendFormat("<li> <a href=\"{2}\" target=\"_blank\" class=\"name\">{0}(大小:{4}KB)</a><a href=\"javascript:;\"  class=\"bule del\" tip=\"{3}\" orderid=\"{1}\">删除</a><a href=\"{2}\" target=\"_blank\" class=\"bule\">下载</a></li>", att[0] + att[1].Substring(att[1].LastIndexOf(".")), KeyID, Common.GetWebConfigKey("ImgViewPath") + "OrderFJ/" + item, item, OrderType.GetSize(item));
                            }
                        }
                    }
                    ulAtta.InnerHtml     = li.ToString();
                    this.hrOrderFj.Value = dt.Rows[0]["Atta"].ToString();
                }

                #region 订单明细

                //订单所有商品明细
                DataTable l = new Hi.BLL.DIS_OrderDetail().GetOrderDe("", " IsNUll(o.dr,0)=0 and o.OrderId=" + KeyID);
                if (l != null && l.Rows.Count > 0)
                {
                    rptOrderD.DataSource = l;
                    rptOrderD.DataBind();

                    //待发货商品
                    DataTable lno = SelectGoodsInfo.SreeenDataTable(l, "isnull(IsOut,0)=0"); //l.Select(string.Format("IsOut={0}", 0));
                    if (lno != null && lno.Rows.Count > 0)
                    {
                        txtDate.Value       = DateTime.Now.ToString("yyyy-MM-dd");
                        rptIsout.DataSource = lno;
                        rptIsout.DataBind();
                    }
                    else
                    {
                        deliver.Attributes.Add("style", "display: none;");
                    }

                    //已发货商品
                    List <Hi.Model.DIS_OrderOutDetail> loud = new Hi.BLL.DIS_OrderOutDetail().GetList("", " isnull(dr,0)=0 and OrderID=" + KeyID, "");
                    //发货单 作废-- and o.IsAudit<>3
                    DataTable lo = new Hi.BLL.DIS_OrderOut().GetList("", " isnull(o.dr,0)=0 and o.OrderID=" + KeyID + " Order by o.IsAudit");

                    if (loud != null && loud.Count > 0)
                    {
                        //outbind(lo, l, loud);

                        outGoods.InnerHtml = SelectGoodsInfo.outbind(lo, l, loud, Digits, 1);
                    }

                    #region 流程时间控件

                    //订单流程时间显示
                    //订单提交时间
                    CreateDate = dt.Rows[0]["CreateDate"].ToString() != "" ? dt.Rows[0]["CreateDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";

                    //订单审核时间
                    AuditDate = dt.Rows[0]["AuditDate"].ToString() != "" ? dt.Rows[0]["AuditDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";

                    if (lo != null && lo.Rows.Count > 0)
                    {
                        if (((int)Enums.OrderState.已发货 <= OState || OState == (int)Enums.OrderState.退货处理) && (IsOutState == 3 || IsOutState == 4))
                        {
                            //订单发货时间
                            DataRow[] sendlo = lo.Select("IsAudit<>3");
                            DataRow[] dv     = sendlo.OrderByDescending(x => x["id"]).ToArray();
                            if (dv.Length > 0)
                            {
                                sendde = dv[0]["SendDate"].ToString() != "" ? dv[0]["SendDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";
                            }
                        }
                        if ((int)Enums.OrderState.已到货 <= OState || OState == (int)Enums.OrderState.退货处理)
                        {
                            //订单签收时间
                            DataRow[] signlo = lo.Select("IsAudit<>3 and IsSign=1");
                            DataRow[] dr     = signlo.OrderByDescending(x => x["id"]).ToArray();
                            if (dr.Length > 0)
                            {
                                signde = dr[0]["SignDate"].ToString() != "" ? dr[0]["SignDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";
                            }
                        }
                    }
                    #endregion
                }
                #endregion
            }
            else
            {
                Response.Redirect("../NoOperable.aspx");
                return;
            }
        }
    }
Example #11
0
    public void databind()
    {
        if (!string.IsNullOrEmpty(Request["KeyID"]))
        {
            KeyID = Common.DesDecrypt((Request["KeyID"] + ""), Common.EncryptKey).ToInt(0);
        }

        if (!string.IsNullOrEmpty(Request["DisID"]))
        {
            DisID = (Request["DisID"] + "").ToInt(0);
        }

        if (!string.IsNullOrEmpty(Request["CompID"]))
        {
            CompID = (Request["CompID"] + "").ToInt(0);
        }

        //发货单
        DataTable lo = new Hi.BLL.DIS_OrderOut().GetList("", " isnull(o.dr,0)=0 and o.IsAudit<>3 and o.ID=" + KeyID);

        //已发货商品
        DataTable loud = new Hi.BLL.DIS_OrderOutDetail().GetOrderOutDe("", " isnull(od.dr,0)=0 and od.OrderOutID=" + KeyID);

        if (lo != null && lo.Rows.Count > 0)
        {
            int OrderID = lo.Rows[0]["OrderID"].ToString().ToInt(0);

            Hi.Model.DIS_Order omodel = new Hi.BLL.DIS_Order().GetModel(OrderID);
            if (omodel != null)
            {
                orderno = omodel.ReceiptNo;
            }

            if (Common.TypeID() == 1 || Common.TypeID() == 5)
            {
                //代理商 厂商
                name.InnerText    = "供应商:";
                lblName.InnerText = Common.Getcom(lo.Rows[0]["CompID"].ToString().ToInt(), "CompName");
            }
            else
            {
                name.InnerText    = "代理商:";
                lblName.InnerText = Common.GetDis(lo.Rows[0]["DisID"].ToString().ToInt(0), "DisName");
            }
            //司机姓名:张三 , 司机手机:1391391386 , 车牌号:苏A1234
            //this.Literal1.Text = barcode.get39(lo.Rows[0]["ReceiptNo"].ToString(), 1, 40);
            lblReceiptNo.InnerText = lo.Rows[0]["ReceiptNo"].ToString();
            codeno = lo.Rows[0]["ReceiptNo"].ToString();

            this.Image1.ImageUrl = "~/Distributor/newOrder/Code39.aspx?KeyID=" + codeno;

            lblArrDate.InnerText = lo.Rows[0]["SendDate"].ToString() != "" ? lo.Rows[0]["SendDate"].ToString().ToDateTime().ToString("yyyy-MM-dd") : "";
            if (lo.Rows[0]["CarUser"].ToString() != "")
            {
                lblLogistics.InnerText = "司机姓名:" + lo.Rows[0]["CarUser"] + " , 司机手机:" + lo.Rows[0]["CarNo"] + " , 车牌号:" + lo.Rows[0]["Car"];
            }

            if (loud != null && loud.Rows.Count > 0)
            {
                rptOrderD.DataSource = loud;
                rptOrderD.DataBind();
            }
        }
    }
Example #12
0
    public ResultOrderList GetBriefingList(string JSon)
    {
        try
        {
            string UserID          = string.Empty;
            string CompID          = string.Empty;
            string criticalOrderID = string.Empty; //当前列表最临界点产品ID:初始-1
            string getType         = string.Empty; //方向
            string rows            = string.Empty;
            string sortType        = string.Empty;
            string sort            = string.Empty;
            string datetype        = string.Empty;
            string ordertype       = string.Empty;
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["CompID"].ToString() != "" &&
                JInfo["CriticalOrderID"].ToString() != "" && JInfo["GetType"].ToString() != "" &&
                JInfo["Rows"].ToString() != "" && JInfo["SortType"].ToString() != "" &&
                JInfo["Sort"].ToString() != "" && JInfo["DateType"].ToString() != "" && JInfo["OrderType"].ToString() != "")
            {
                UserID          = JInfo["UserID"].ToString();
                CompID          = JInfo["CompID"].ToString();
                criticalOrderID = JInfo["CriticalOrderID"].ToString();
                getType         = JInfo["GetType"].ToString();
                rows            = JInfo["Rows"].ToString();
                sortType        = JInfo["SortType"].ToString();
                sort            = JInfo["Sort"].ToString();
                datetype        = JInfo["DateType"].ToString();
                ordertype       = JInfo["OrderType"].ToString();
            }
            else
            {
                return(new ResultOrderList()
                {
                    Result = "F", Description = "参数异常"
                });
            }
            #endregion
            //判断登录信息是否异常
            Hi.Model.SYS_Users one = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out one, int.Parse(CompID == "" ? "0" : CompID)))
            {
                return new ResultOrderList()
                       {
                           Result = "F", Description = "登录信息异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Convert.ToInt32(CompID));
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultOrderList()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;

            DateTime date       = DateTime.Now;
            DateTime date_start = new DateTime();
            DateTime date_end   = date.AddDays(1);
            //string strdate_start = string.Empty;
            // string strdate_end = date_end.ToString("yyyy-MM-dd");

            string strwhere = "";
            switch (datetype)
            {
            case "0":
                date_start = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);

                //strdate_start = date_start.ToString("yyyy-MM-dd");
                break;

            case "1":
                DateTime startWeek = date.AddDays(1 - Convert.ToInt32(date.DayOfWeek.ToString("d")));
                date_start = new DateTime(startWeek.Year, startWeek.Month, startWeek.Day, 0, 0, 0);
                //strdate_start = date_start.ToString("yyyy-MM-dd");
                break;

            case "2":
                date_start = new DateTime(date.Year, date.Month, 1);
                //strdate_start = date_start.ToString("yyyy-MM-dd");
                break;

            default:
                return(new ResultOrderList()
                {
                    Result = "F", Description = "时间段类型异常"
                });

                break;
            }
            switch (ordertype)
            {
            case "0":
                strwhere = " and  isnull(dr,0)=0 and Otype!=9 and CompID=" + comp.ID + " and OState in (2,3,4,5,7) and CreateDate>='" + date_start + "' and CreateDate<='" + date_end + "'";
                break;

            case "1":
                strwhere = " and  isnull(dr,0)=0 and CompID=" + comp.ID + " and  CreateDate>='" + date_start + "' and CreateDate<='" + date_end + "' and ReturnState =3";
                break;

            case "2":
                string sql = "SELECT distinct orderID FROM [dbo].[CompCollection_view] where OrderID not in(select ID from Dis_Order where ISNULL(dr,0)=0 and (Otype=9 or OState not in(2,3,4,5,7)) and CompID=" + comp.ID + ")  and status!=3 and CompID=" + comp.ID +
                             " and Date>='" + date_start + "' and Date<'" + date_end + "'  AND vedf9=1 ";
                DataTable dt_pay = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0];
                string where = "";
                for (int i = 0; i < dt_pay.Rows.Count; i++)
                {
                    if (ClsSystem.gnvl(dt_pay.Rows[i]["orderID"], "") != "")
                    {
                        where += ",";
                        where += ClsSystem.gnvl(dt_pay.Rows[i]["orderID"], "");
                    }
                }
                where    = where.Substring(1, where.Length - 1);
                strwhere = " and id in (" + where + ")";
                break;

            default:
                return(new ResultOrderList()
                {
                    Result = "F", Description = "订单类型异常"
                });

                break;
            }

            if (sortType == "1") //价格排序
            {
                sortType = "CreateDate";
            }
            else if (sortType == "2") //价格排序
            {
                sortType = "TotalAmount";
            }
            else
            {
                sortType = "ID";
            }

            string strsql = new Common().PageSqlString(criticalOrderID, "ID", "DIS_Order", sortType,
                                                       sort, strwhere, getType, rows);


            if (strsql == "")
            {
                return new ResultOrderList()
                       {
                           Result = "F", Description = "基础数据异常"
                       }
            }
            ;


            #region 赋值


            List <Order> OrderList = new List <Order>();
            DataSet      ds        = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql);
            if (ds.Tables.Count == 0)
            {
                return new ResultOrderList()
                       {
                           Result = "T", Description = "没有更多数据"
                       }
            }
            ;
            DataTable orderList = ds.Tables[0];
            if (orderList != null)
            {
                if (orderList.Rows.Count == 0)
                {
                    return new ResultOrderList()
                           {
                               Result = "T", Description = "没有更多数据"
                           }
                }
                ;

                foreach (DataRow row in orderList.Rows)
                {
                    Order order = new Order();

                    Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(int.Parse(row["ID"].ToString()));
                    if (orderModel == null || orderModel.dr == 1)
                    {
                        return new ResultOrderList()
                               {
                                   Result = "F", Description = "订单异常"
                               }
                    }
                    ;
                    order.OrderID  = orderModel.ID.ToString();
                    order.CompID   = orderModel.CompID.ToString();
                    order.CompName = comp.CompName;

                    order.State = Common.GetCompOrderType(orderModel.OState, orderModel.PayState, orderModel.Otype,
                                                          orderModel.ReturnState);
                    string IsEnSend, IsEnPay, IsEnReceive, IsEnReturn, IsEnAudit;
                    Common.GetEspecialType(orderModel.OState.ToString(), orderModel.PayState.ToString(), orderModel.Otype.ToString(),
                                           orderModel.ReturnState.ToString(), out IsEnSend, out IsEnPay, out IsEnAudit, out IsEnReceive, out IsEnReturn);
                    order.IsEnSend    = IsEnSend;
                    order.IsEnPay     = IsEnPay;
                    order.IsEnAudit   = IsEnAudit;
                    order.IsEnReceive = IsEnReceive;
                    order.IsEnReturn  = IsEnReturn;

                    order.Otype       = orderModel.Otype.ToString();
                    order.AddType     = orderModel.AddType.ToString();
                    order.OState      = orderModel.OState.ToString();
                    order.PayState    = orderModel.PayState.ToString();
                    order.ReturnState = orderModel.ReturnState.ToString();
                    order.DisID       = orderModel.DisID.ToString();
                    Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(orderModel.DisID);
                    if (dis == null || dis.AuditState == 0 || dis.dr == 1)
                    {
                        return new ResultOrderList()
                               {
                                   Result = "F", Description = "经销信息商异常"
                               }
                    }
                    ;
                    order.DisName   = dis.DisName;
                    order.DisUserID = orderModel.DisUserID.ToString();
                    Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(int.Parse(order.DisUserID));
                    //if (user == null || user.IsEnabled == 0 || user.dr == 1)
                    //    return new ResultOrderList() { Result = "F", Description = "经销商用户信息异常" };
                    //order.DisUserName = orderModel.DisUserName;
                    if (user != null && user.IsEnabled == 1 && user.dr == 0)
                    {
                        order.DisUserName = user.TrueName;
                    }
                    else
                    {
                        order.DisUserName = "";
                    }
                    order.AddrID    = orderModel.AddrID.ToString();
                    order.ReceiptNo = orderModel.ReceiptNo;
                    if (ClsSystem.gnvl(orderModel.ArriveDate, "") != "0001/1/1 0:00:00" && ClsSystem.gnvl(orderModel.ArriveDate, "") != "")
                    {
                        order.ArriveDate = orderModel.ArriveDate.ToString("yyyy-MM-dd");
                    }
                    if (!string.IsNullOrEmpty(orderModel.AddrID.ToString()))
                    {
                        Hi.Model.BD_DisAddr addr = new Hi.BLL.BD_DisAddr().GetModel(orderModel.AddrID);
                        if (addr != null)
                        {
                            order.Zip = addr.Zip;
                        }
                    }
                    order.Address           = orderModel.Address;
                    order.Contact           = orderModel.Principal;
                    order.Phone             = orderModel.Phone;
                    order.TotalAmount       = orderModel.AuditAmount.ToString("0.00");
                    order.AuditTotalAmount  = orderModel.AuditAmount.ToString("0.00");
                    order.PayedAmount       = orderModel.PayedAmount.ToString("0.00");
                    order.CreateUserID      = orderModel.CreateUserID.ToString();
                    order.CreateDate        = orderModel.CreateDate.ToString("yyyy-MM-dd HH:mm");
                    order.ReturnMoneyDate   = orderModel.ReturnMoneyDate.ToString();
                    order.ReturnMoneyUser   = orderModel.ReturnMoneyUser;
                    order.ReturnMoneyUserId = orderModel.ReturnMoneyUserId.ToString();

                    List <Hi.Model.DIS_OrderOut> outList = new Hi.BLL.DIS_OrderOut().GetList("",
                                                                                             " OrderID='" + orderModel.ID + "' and CompID='" + orderModel.CompID + "' and DisID='" +
                                                                                             orderModel.DisID + "' and ISNULL(dr,0)=0", "");
                    if (outList.Count != 0)
                    {
                        Hi.Model.DIS_OrderOut orderOut = new Hi.Model.DIS_OrderOut();
                        foreach (Hi.Model.DIS_OrderOut Out in outList)
                        {
                            orderOut = Out;
                        }
                        order.SendID   = orderOut.ID.ToString();
                        order.SendDate = orderOut.SendDate.ToString();
                        ////order.Express = orderOut.Express;
                        ////order.ExpressNo = orderOut.ExpressNo;
                        ////order.ExpressPerson = orderOut.ExpressPerson;
                        ////order.ExpressTel = orderOut.ExpressTel;
                        ////order.ExpressBao = orderOut.ExpressBao;
                        ////order.PostFee = orderOut.PostFee.ToString("0.00");
                        order.ActionUser = orderOut.ActionUser;
                        List <Hi.Model.DIS_Logistics> exlist = Common.GetExpress(orderOut.ID.ToString());
                        if (exlist != null)
                        {
                            order.SendRemark = exlist[0].Context;
                        }
                        order.IsAudit     = orderOut.IsAudit.ToString();
                        order.AuditUserID = orderOut.AuditUserID.ToString();
                        order.AuditDate   = orderOut.AuditDate.ToString();
                        order.AuditRemark = orderOut.AuditRemark == null ? "" : orderOut.AuditRemark.ToString();
                        order.SignDate    = orderOut.SignDate.ToString();
                        order.IsSign      = orderOut.IsSign.ToString();
                        order.SignUserId  = orderOut.SignUserId.ToString();
                        order.SignUser    = orderOut.SignUser;
                        order.SignRemark  = orderOut.SignRemark;
                    }
                    //todo:不知道的排序
                    //order.SortIndex = orderModel.SortIndex.ToString();
                    order.IsDel = orderModel.dr.ToString();

                    //明细
                    List <OrderDetail> orderDetail             = new List <OrderDetail>();
                    List <Hi.Model.DIS_OrderDetail> detailList = new Hi.BLL.DIS_OrderDetail().GetList("",
                                                                                                      " OrderID='" + orderModel.ID + "' and DisID='" + orderModel.DisID + "' and ISNULL(dr,0)=0", "");
                    if (detailList == null) //|| detailList.Count==0
                    {
                        return new ResultOrderList()
                               {
                                   Result = "F", Description = "订单明细异常"
                               }
                    }
                    ;
                    List <Hi.Model.BD_GoodsAttrs> list_attrs = null;
                    foreach (Hi.Model.DIS_OrderDetail detail in detailList)
                    {
                        string SKUName = string.Empty;

                        OrderDetail ordetail = new OrderDetail();
                        ordetail.SKUID = detail.GoodsinfoID.ToString();
                        //通过GoodsInfoID找到GoodsID
                        Hi.Model.BD_GoodsInfo goodsInfo = new Hi.BLL.BD_GoodsInfo().GetModel(detail.GoodsinfoID);
                        if (goodsInfo == null)
                        {
                            //if (goodsInfo == null || goodsInfo.IsEnabled == false || goodsInfo.dr == 1)
                            return new ResultOrderList()
                                   {
                                       Result = "F", Description = "SKU信息异常"
                                   }
                        }
                        ;
                        ordetail.ProductID = goodsInfo.GoodsID.ToString();

                        //通过GoodsID找到GoodsName
                        Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(goodsInfo.GoodsID);
                        if (goods == null)
                        {
                            //if (goods == null || goods.IsEnabled == 0 | goods.dr == 1)
                            return new ResultOrderList()
                                   {
                                       Result = "F", Description = "商品异常"
                                   }
                        }
                        ;
                        ordetail.ProductName = goods.GoodsName;
                        SKUName += goods.GoodsName;

                        list_attrs = new Hi.BLL.BD_GoodsAttrs().GetList("AttrsName", "GoodsID = " + goodsInfo.GoodsID + " and CompID = " + comp.ID + " and ISNULL(dr,0) = 0", "");
                        if (list_attrs != null && list_attrs.Count != 0)
                        {
                            foreach (Hi.Model.BD_GoodsAttrs attr in list_attrs)
                            {
                                SKUName += attr.AttrsName;
                            }
                        }
                        ordetail.SKUName = SKUName;
                        //todo:描述是什么
                        ordetail.ValueInfo   = goodsInfo.ValueInfo;
                        ordetail.SalePrice   = detail.Price.ToString("0.00");
                        ordetail.TinkerPrice = detail.AuditAmount.ToString("0.00");
                        ordetail.Num         = detail.GoodsNum.ToString("0.00");
                        ordetail.Remark      = detail.Remark;
                        //ordetail.IsPro =  .Trim() == "0" || detail.vdef1.Trim() == "" ? "0" : "1"; //是否是促销商品
                        //是否是促销商品
                        ordetail.IsPro = ClsSystem.gnvl(detail.vdef1, "").Trim() == "0" || ClsSystem.gnvl(detail.vdef1, "").Trim() == "" ? "0" : "1";

                        if (ordetail.IsPro != "0")
                        {
                            ordetail.ProNum = detail.vdef5;

                            if (detail.vdef1 != "" && detail.vdef1.Length > 0)
                            {
                                Hi.Model.BD_Promotion pro =
                                    new Hi.BLL.BD_Promotion().GetModel(Convert.ToInt32(detail.vdef1));
                                if (pro != null)
                                {
                                    List <Hi.Model.BD_PromotionDetail> dList = new Hi.BLL.BD_PromotionDetail().GetList(
                                        "", " ProID=" + pro.ID + " and GoodInfoID ='" + ordetail.SKUID + "' and dr=0",
                                        "");
                                    string info = string.Empty;
                                    if (dList != null && dList.Count > 0)
                                    {
                                        if (pro.Type == 0 && pro.ProType == 1)
                                        {
                                            info = "赠品";
                                        }
                                        else if (pro.Type == 0 && pro.ProType == 2)
                                        {
                                            info = "商品优惠价" + dList[0].GoodsPrice.ToString("0.00");
                                        }
                                        else if (pro.Type == 1 && pro.ProType == 3)
                                        {
                                            info = "商品数量满" + pro.Discount.ToString("0.00") + "赠" + dList[0].GoodsPrice.ToString("0.00") + dList[0].GoodsUnit;
                                        }
                                        else if (pro.Type == 1 && pro.ProType == 4)
                                        {
                                            info = "商品打折" + pro.Discount.ToString("0.00") + "%";
                                        }
                                    }
                                    ordetail.proInfo = new PromotionInfo()
                                    {
                                        ProID        = detail.vdef1,
                                        ProTitle     = pro.ProTitle,
                                        ProInfos     = info,
                                        Type         = pro.Type.ToString(),
                                        ProTpye      = pro.ProType.ToString(),
                                        Discount     = pro.Discount.ToString("0.00"),
                                        ProStartTime = pro.ProStartTime.ToString("yy-MM-dd"),
                                        ProEndTime   = pro.ProEndTime.ToString("yy-MM-dd")
                                    };
                                }
                            }
                        }

                        List <Pic> Pic = new List <Pic>();
                        if (goods.Pic != "" && goods.Pic != "X")
                        {
                            Pic pic = new Pic();
                            pic.ProductID = goodsInfo.GoodsID.ToString();
                            pic.IsDeafult = "1";
                            pic.PicUrl    = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" +
                                            goods.Pic;
                            Pic.Add(pic);
                        }
                        ordetail.ProductPicUrlList = Pic;

                        orderDetail.Add(ordetail);
                    }
                    order.OrderDetailList = orderDetail;
                    OrderList.Add(order);
                }
            }
            else
            {
                return(new ResultOrderList()
                {
                    Result = "F", Description = "没有更多数据"
                });
            }

            #endregion

            return(new ResultOrderList()
            {
                Result = "T",
                Description = "获取成功",
                OrderList = OrderList
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetBriefingList:" + JSon);
            return(new ResultOrderList()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Example #13
0
    /// <summary>
    /// 应收应付账款订单列表
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public DIS_Order.ResultOrderList GetDisAccountInfo(string JSon)
    {
        try
        {
            string strWhere = " and Ostate in (2,4,5) and PayState in (0,1)";

            #region JSon取值

            string userID          = string.Empty;
            string disID           = string.Empty;
            string criticalOrderID = string.Empty; //当前列表最临界点产品ID:初始-1
            string getType         = string.Empty; //方向
            string rows            = string.Empty;
            string sortType        = string.Empty;
            string sort            = string.Empty;

            string orderType = string.Empty;//单据类型   1:订单 2:账单

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" &&
                JInfo["CriticalOrderID"].ToString() != "" && JInfo["GetType"].ToString() != "" &&
                JInfo["Rows"].ToString() != "" && JInfo["SortType"].ToString() != "" && JInfo["Sort"].ToString() != "" && JInfo["orderType"].ToString() != "")
            {
                userID          = JInfo["UserID"].ToString();
                disID           = JInfo["ResellerID"].ToString();
                strWhere       += " and DisID='" + disID + "' and ISNULL(dr,0)=0";
                criticalOrderID = JInfo["CriticalOrderID"].ToString();
                getType         = JInfo["GetType"].ToString();
                rows            = JInfo["Rows"].ToString();
                sortType        = JInfo["SortType"].ToString();
                sort            = JInfo["Sort"].ToString();
                orderType       = JInfo["orderType"].ToString();
            }
            else
            {
                return(new DIS_Order.ResultOrderList()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            if (orderType == "1")//订单
            {
                strWhere += " and ISNULL(dr,0)=0 and OState != 0 and Otype!=9";
            }
            else//账单
            {
                strWhere += " and ISNULL(dr,0)=0 and OState != 0 and Otype=9";
            }

            JsonData JMsg = JInfo["Search"];
            if (JMsg.Count > 0)
            {
                if (JMsg["OrderID"].ToString() != "")
                {
                    strWhere += " and ReceiptNo like '" + JMsg["OrderID"].ToString() + "%'";
                }
                if (JMsg["BeginDate"].ToString() != "")
                {
                    strWhere += " and CreateDate >= '" + Convert.ToDateTime(JMsg["BeginDate"].ToString()) + "'";
                }
                if (JMsg["EndDate"].ToString() != "")
                {
                    strWhere += " and CreateDate < " + Convert.ToDateTime(JInfo["EndDate"].ToString()).AddDays(1) + "'";
                }
                //根据出库单编号 锁定 订单ID
                if (JMsg["ExpressNo"].ToString() != "")
                {
                    //strWhere += " and ReceiptNo like '" + JMsg["ExpressNo"].ToString() + "%'";
                    List <Hi.Model.DIS_OrderOut> orderOut = new Hi.BLL.DIS_OrderOut().GetList("",
                                                                                              " ExpressNo like '%" + JMsg["ExpressNo"].ToString() + "%'", "");
                    if (orderOut.Count == 0)
                    {
                        return new DIS_Order.ResultOrderList()
                               {
                                   Result = "F", Description = "参数异常"
                               }
                    }
                    ;
                    strWhere += " and ID in ( 0";
                    strWhere  = orderOut.Aggregate(strWhere, (current, aout) => current + ("," + aout.OrderID));
                    strWhere += " )";
                }
            }

            #endregion

            #region 模拟分页

            string tabName = " [dbo].[DIS_Order]"; //表名
            string strsql  = string.Empty;         //搜索sql
            sortType = "ID";

            strsql = new Common().PageSqlString(criticalOrderID, "ID", tabName, sortType,
                                                sort, strWhere, getType, rows);
            if (strsql == "")
            {
                return new DIS_Order.ResultOrderList()
                       {
                           Result = "F", Description = "基础数据异常"
                       }
            }
            ;

            #endregion

            #region 赋值

            string SKUName = string.Empty;
            List <DIS_Order.Order> OrderList = new List <DIS_Order.Order>();
            DataSet ds = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql);
            if (ds.Tables.Count == 0)
            {
                return new DIS_Order.ResultOrderList()
                       {
                           Result = "F", Description = "没有更多数据"
                       }
            }
            ;
            DataTable orderList = ds.Tables[0];
            if (orderList != null)
            {
                if (orderList.Rows.Count == 0)
                {
                    return new DIS_Order.ResultOrderList()
                           {
                               Result = "F", Description = "没有更多数据"
                           }
                }
                ;

                foreach (DataRow row in orderList.Rows)
                {
                    DIS_Order.Order order = new DIS_Order.Order();

                    Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(int.Parse(row["ID"].ToString()));
                    order.OrderID = orderModel.ID.ToString();
                    order.CompID  = orderModel.CompID.ToString();
                    Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(orderModel.CompID);
                    if (comp == null || comp.IsEnabled == 0 || comp.dr == 1)
                    {
                        return new DIS_Order.ResultOrderList()
                               {
                                   Result = "F", Description = "企业异常"
                               }
                    }
                    ;
                    order.CompName = comp.CompName;
                    order.State    = Common.GetDisOrderType(orderModel.OState, orderModel.PayState, orderModel.Otype,
                                                            orderModel.ReturnState);
                    order.OState      = orderModel.OState.ToString();
                    order.AddType     = orderModel.AddType.ToString();
                    order.Otype       = orderModel.Otype.ToString();
                    order.PayState    = orderModel.PayState.ToString();
                    order.ReturnState = orderModel.ReturnState.ToString();
                    order.DisID       = orderModel.DisID.ToString();
                    Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(orderModel.DisID);
                    if (dis == null || dis.IsEnabled == 0 || dis.dr == 1)
                    {
                        return new DIS_Order.ResultOrderList()
                               {
                                   Result = "F", Description = "经销信息商异常"
                               }
                    }
                    ;
                    order.DisName   = dis.DisName;
                    order.DisUserID = orderModel.DisUserID.ToString();
                    Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(int.Parse(userID));
                    if (user == null || user.IsEnabled == 0 || user.dr == 1)
                    {
                        return new DIS_Order.ResultOrderList()
                               {
                                   Result = "F", Description = "经销商用户信息异常"
                               }
                    }
                    ;
                    order.DisUserName = user.TrueName;
                    order.AddrID      = orderModel.AddrID.ToString();
                    order.ReceiptNo   = orderModel.ReceiptNo;
                    order.ArriveDate  = orderModel.ArriveDate.ToString();
                    if (!string.IsNullOrEmpty(orderModel.AddrID.ToString()))
                    {
                        Hi.Model.BD_DisAddr addr = new Hi.BLL.BD_DisAddr().GetModel(orderModel.AddrID);

                        if (addr != null)
                        {
                            order.Zip = addr.Zip;
                        }
                    }
                    order.Address           = orderModel.Address;
                    order.Contact           = orderModel.Principal;
                    order.Phone             = orderModel.Phone;
                    order.TotalAmount       = orderModel.TotalAmount.ToString("0.00");
                    order.AuditTotalAmount  = orderModel.AuditAmount.ToString("0.00");
                    order.PayedAmount       = orderModel.PayedAmount.ToString("0.00");
                    order.CreateUserID      = orderModel.CreateUserID.ToString();
                    order.CreateDate        = orderModel.CreateDate.ToString();
                    order.ReturnMoneyDate   = orderModel.ReturnMoneyDate.ToString();
                    order.ReturnMoneyUser   = orderModel.ReturnMoneyUser.ToString();
                    order.ReturnMoneyUserId = orderModel.ReturnMoneyUserId.ToString();

                    List <Hi.Model.DIS_OrderOut> outList = new Hi.BLL.DIS_OrderOut().GetList("",
                                                                                             " OrderID='" + orderModel.ID + "' and CompID='" + orderModel.CompID + "' and DisID='" +
                                                                                             orderModel.DisID + "' and ISNULL(dr,0)=0", "");
                    if (outList.Count != 0)
                    {
                        Hi.Model.DIS_OrderOut orderOut = new Hi.Model.DIS_OrderOut();
                        foreach (Hi.Model.DIS_OrderOut Out in outList)
                        {
                            orderOut = Out;
                        }
                        order.SendID   = orderOut.ID.ToString();
                        order.SendDate = orderOut.SendDate.ToString();
                        //根据发货单取对应的物流信息
                        List <Hi.Model.DIS_Logistics> list_log = new Hi.BLL.DIS_Logistics().GetList("", "OrderOutID = " + orderOut.ID + " and isnull(dr,0) = 0", "");
                        //一个发货单只有一条物流信息,所以list_log里也只有一条数据
                        Hi.Model.DIS_Logistics model_log = list_log[0];
                        order.Express   = Convert.ToString(model_log.ComPName);
                        order.ExpressNo = Convert.ToString(model_log.LogisticsNo);
                        //order.ExpressPerson = Convert.ToString(orderOut.ExpressPerson);
                        //order.ExpressTel = Convert.ToString(orderOut.ExpressTel);
                        //order.ExpressBao =Convert.ToString(orderOut.ExpressBao);
                        order.PostFee     = orderModel.PostFee.ToString("0.00");
                        order.ActionUser  = Convert.ToString(orderOut.ActionUser);
                        order.SendRemark  = Convert.ToString(orderOut.Remark);
                        order.IsAudit     = Convert.ToString(orderOut.IsAudit);
                        order.AuditUserID = Convert.ToString(orderOut.AuditUserID);
                        order.AuditDate   = Convert.ToString(orderOut.AuditDate);
                        order.AuditRemark = orderOut.AuditRemark == null ? "" : orderOut.AuditRemark.ToString();
                        order.SignDate    = Convert.ToString(orderOut.SignDate);
                        order.IsSign      = Convert.ToString(orderOut.IsSign);
                        order.SignUserId  = Convert.ToString(orderOut.SignUserId);
                        order.SignUser    = Convert.ToString(orderOut.SignUser);
                        order.SignRemark  = Convert.ToString(orderOut.SignRemark);
                    }
                    order.SendRemark = Convert.ToString(orderModel.Remark);
                    //todo:不知道的排序
                    //order.SortIndex = orderModel.SortIndex.ToString();
                    order.IsDel = Convert.ToString(orderModel.dr);

                    //明细
                    List <DIS_Order.OrderDetail>    orderDetail = new List <DIS_Order.OrderDetail>();
                    List <Hi.Model.DIS_OrderDetail> detailList  = new Hi.BLL.DIS_OrderDetail().GetList("",
                                                                                                       " OrderID='" + orderModel.ID + "' and DisID='" + orderModel.DisID + "' and ISNULL(dr,0)=0", "");
                    if (detailList == null) //|| detailList.Count==0 没有明细的单 PC可以新建
                    {
                        return new DIS_Order.ResultOrderList()
                               {
                                   Result = "F", Description = "订单明细异常"
                               }
                    }
                    ;
                    List <Hi.Model.BD_GoodsAttrs> list_attrs = null;
                    foreach (Hi.Model.DIS_OrderDetail detail in detailList)
                    {
                        DIS_Order.OrderDetail ordetail = new DIS_Order.OrderDetail();

                        ordetail.SKUID = detail.GoodsinfoID.ToString();
                        //通过GoodsInfoID找到GoodsID
                        Hi.Model.BD_GoodsInfo goodsInfo = new Hi.BLL.BD_GoodsInfo().GetModel(detail.GoodsinfoID);
                        if (goodsInfo == null)
                        {
                            //if (goodsInfo == null || goodsInfo.IsEnabled == false || goodsInfo.dr == 1)
                            return new DIS_Order.ResultOrderList()
                                   {
                                       Result = "F", Description = "SKU信息异常"
                                   }
                        }
                        ;
                        ordetail.ProductID = goodsInfo.GoodsID.ToString();

                        //通过GoodsID找到GoodsName
                        Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(goodsInfo.GoodsID);
                        if (goods == null)
                        {
                            //if (goods == null || goods.IsEnabled == 0 || goods.dr == 1)
                            return new DIS_Order.ResultOrderList()
                                   {
                                       Result = "F", Description = "商品异常"
                                   }
                        }
                        ;
                        ordetail.ProductName = goods.GoodsName;
                        SKUName += goods.GoodsName;

                        list_attrs = new Hi.BLL.BD_GoodsAttrs().GetList("AttrsName", "GoodsID = " + goodsInfo.GoodsID + " and CompID = " + comp.ID + " and ISNULL(dr,0) = 0", "");
                        if (list_attrs != null && list_attrs.Count != 0)
                        {
                            foreach (Hi.Model.BD_GoodsAttrs attr in list_attrs)
                            {
                                SKUName += attr.AttrsName;
                            }
                        }
                        ordetail.SKUName = SKUName;
                        //todo:描述是什么
                        ordetail.ValueInfo   = goodsInfo.ValueInfo;
                        ordetail.SalePrice   = detail.Price.ToString("0.00");
                        ordetail.TinkerPrice = detail.AuditAmount.ToString("0.00");
                        ordetail.Num         = detail.GoodsNum.ToString("0.00");
                        ordetail.Remark      = detail.Remark;

                        List <DIS_Order.Pic> Pic = new List <DIS_Order.Pic>();
                        if (goods.Pic.ToString() != "" && goods.Pic.ToString() != "X")
                        {
                            DIS_Order.Pic pic = new DIS_Order.Pic();

                            pic.ProductID = goodsInfo.GoodsID.ToString();
                            pic.IsDeafult = "1";
                            pic.PicUrl    = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" +
                                            goods.Pic;
                            Pic.Add(pic);
                        }
                        ordetail.ProductPicUrlList = Pic;

                        orderDetail.Add(ordetail);
                    }
                    order.OrderDetailList = orderDetail;
                    OrderList.Add(order);
                }
            }
            else
            {
                return(new DIS_Order.ResultOrderList()
                {
                    Result = "F", Description = "没有更多数据"
                });
            }

            #endregion

            return(new DIS_Order.ResultOrderList()
            {
                Result = "T",
                Description = "获取成功",
                OrderList = OrderList
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetDisAccountInfo:" + JSon);
            return(new DIS_Order.ResultOrderList()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Example #14
0
    /// <summary>
    /// 订单同步ERP方法
    /// </summary>
    private string GetNCOrder(string compID, string startDate = null, string endDate = null)
    {
        string bill = "<?xml version=\"1.0\" encoding=\"gb2312\"?>";

        try
        {
            int    OrderTB  = 0;
            string strWhere = " isnull(dr,0)=0 and Compid=" + compID + " and OState<>0 and OState<>1 and OType<>9";
            if (startDate != "")
            {
                strWhere += "and ts >='" + Convert.ToDateTime(startDate) + "'";
            }
            if (endDate != "")
            {
                strWhere += "and ts <='" + Convert.ToDateTime(endDate) + "'";
            }
            List <Hi.Model.DIS_Order> order = new Hi.BLL.DIS_Order().GetList("", strWhere, "");
            bill += "<ufinterface roottag=\"so_order\" billtype=\"30\"  replace=\"Y\" receiver=\"\" sender=\"30\" isexchange=\"Y\" filename=\"销售订单头.xml\" proc=\"add\" operation=\"req\">";
            if (Convert.ToDateTime(startDate) > Convert.ToDateTime(endDate))
            {
                bill += "同步日期异常</ufinterface>";
                return(bill);
            }
            foreach (Hi.Model.DIS_Order model in order)
            {
                try
                {
                    Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(model.CompID);
                    if (comp == null)
                    {
                        bill += "企业异常</ufinterface>";
                        return(bill);
                    }
                    Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(model.CompID);
                    if (dis == null)
                    {
                        bill += "代理商异常</ufinterface>";
                        return(bill);
                    }

                    List <Hi.Model.DIS_OrderDetail> orderDetail = new Hi.BLL.DIS_OrderDetail().GetList("", " isnull(dr,0)=0 and OrderID=" + model.ID + " ", "");
                    if (orderDetail.Count > 0)
                    {
                        OrderTB++;
                        bill += "<so_order id=\"" + model.ID + "\" subdoctype=\"\">";
                        bill += "<so_order_head>";

                        bill += "<pk_corp>" + comp.CompCode + "</pk_corp>";             //公司PK,不能为空,参照基础数据"公司目录".暂时写死
                        bill += "<vreceiptcode>" + model.ReceiptNo + "</vreceiptcode>"; //单据号,可空字段, 如果为空保存时系统自动获取
                        bill += "<creceipttype>30</creceipttype>";                      //单据类型,不能为空
                        bill += "<cbiztype>普通销售</cbiztype>";
                        bill += "<ccustomerid>" + dis.DisName + "</ccustomerid>";
                        bill += "<dbilldate>" + model.AuditDate.ToString("yyyy-MM-dd") + "</dbilldate>";       //单据日期,不能为空,YYYY-MM-DD
                        bill += "<vreceiptcode>" + model.DisID + "</vreceiptcode>";                            //客商管理档案ID,不能为空(需要参照客商管理档案ID)
                        bill += "<cdeptid>999</cdeptid>";                                                      //部门档案ID,不能为空(需要参照部门档案基础数据
                        bill += "<coperatorid>" + model.DisUserID + "</coperatorid>";                          //制单人:人员档案ID,不能为空(需要参照人员档案基础数据)。填写收货方
                        bill += "<csalecorpid>999</csalecorpid>";                                              //销售组织ID,不能为空(需要参照'销售组织'档案基础数据)
                        bill += "<ccalbodyid>999</ccalbodyid>";                                                //库存组织ID,不能为空(需要参照库存组织档案基础数据
                        bill += "<creceiptcustomerid>" + dis.DisName + "</creceiptcustomerid>";                //收货单位客商管理档案ID,不能为空(需要参照客商管理档案基础数据)
                        bill += "<vreceiveaddress>" + model.Address + "</vreceiveaddress>";                    //收货地址字符串,可以为空
                        bill += "<creceiptcorpid>" + dis.DisName + "</creceiptcorpid>";                        //开票单位客商管理档案ID,不能为空(需要参照客商管理档案基础数据)
                        bill += "<ndiscountrate>0</ndiscountrate>";                                            //<!--整单折扣,不能为空-->
                        bill += "<bfreecustflag>N</bfreecustflag>";                                            //<!--是否散户,默认为N-->
                        bill += "<ibalanceflag>0</ibalanceflag>";                                              //<!--结算标志,默认为N-->
                        bill += "<dmakedate>" + model.CreateDate.ToString("yyyy-MM-dd") + "</dmakedate>";      //<!--制单日期,不能为空,YYYY-MM-DD-->
                        bill += "<capproveid>" + model.AuditUserID + "</capproveid>";                          //<!--审批人:人员档案ID,为空(需要参照人员档案基础数据)-->
                        bill += "<dapprovedate>" + model.AuditDate.ToString("yyyy-MM-dd") + "</dapprovedate>"; //<!--审批日期,为空,YYYY-MM-DD-->

                        string type  = OrderInfoType.OState(model.ID);
                        string state = "0";
                        //<!--状态,不能为空:0无状态,1自由,2审批,3冻结,4关闭,5作废,6结束,7正在审批,8审批未通过-->
                        switch (type)
                        {
                        case "":
                            state = "";
                            break;

                        default:
                            state = "0";
                            break;
                        }
                        bill += "<fstatus>" + state + "</fstatus><bretinvflag>";
                        bill += type == "已退货" ? "Y" : "N" + "</bretinvflag><boutendflag>"; //<!--退货标记,默认为N-->
                        bill += type == "已发货" ? "Y" : "N" + "</boutendflag>";              //<!--出库结束标记,默认为N-->
                        bill += "<binvoicendflag>N</binvoicendflag>";                      //<!--开票结束标记,默认为N-->
                        bill += "<breceiptendflag>N</breceiptendflag>";                    //<!--发货结束标记,默认为N-->                        ;
                        bill += "<bpayendflag>N</bpayendflag>";                            //<!--付款结束标记,默认为N-->
                        bill += "</so_order_head>";
                        bill += "<so_order_body>";
                        string entry = string.Empty;
                        foreach (Hi.Model.DIS_OrderDetail MoDetail in orderDetail)
                        {
                            entry += "<entry>";
                            entry += "<pk_corp>" + comp.CompCode + "</pk_corp>"; //<!--公司主键,参照基础数据"公司目录"-->
                            entry += "<cinventoryid>999</cinventoryid>";         //<!--存货管理档案主键,不能为空,需要参照基础数据"存货档案"-->
                            List <Hi.Model.BD_GoodsInfo> goodsInfo = new Hi.BLL.BD_GoodsInfo().GetList("", " isnull(dr,0)=0 and ID=" + MoDetail.GoodsinfoID + "", "");
                            if (goodsInfo.Count > 0)
                            {
                                Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(goodsInfo[0].GoodsID);

                                if (goods != null)
                                {
                                    entry += "<cunitid>" + goods.Unit + "</cunitid>";//<!--主计量单位,不能为空,需要参照基础数据"计量档案"-->
                                }
                                else
                                {
                                    entry += "<cunitid>999</cunitid>";
                                }
                            }
                            entry += "<nnumber>" + MoDetail.GoodsNum + "</nnumber>";

                            DateTime dt = model.AuditDate;
                            if (type == "已发货")
                            {
                                List <Hi.Model.DIS_OrderOut> list = new Hi.BLL.DIS_OrderOut().GetList("", " isnull(dr,0)=0 and OrderID=" + model.ID + "", "");
                                if (list.Count > 0)
                                {
                                    dt = list[0].SendDate;
                                }
                            }
                            entry += "<dconsigndate>" + model.AuditDate + "</dconsigndate>";  //<!--发货日期,不能为空,YYYY-MM-DD-->
                            entry += "<ddeliverdate>" + dt.AddDays(15) + "</ddeliverdate>";   //<!--交货日期,不能为空,YYYY-MM-DD-->
                            entry += "<ccurrencytypeid>RMB</ccurrencytypeid>";                //<!--原币,不能为空,参考币种档案-->
                            entry += "<nitemdiscountrate>100</nitemdiscountrate>";            //<!--单品折扣率,不能为空, 默认100-->
                            entry += "<ndiscountrate>100</ndiscountrate>";                    //<!--整单折扣,不能为空, 默认100-->
                            entry += "<nexchangeotobrate>1.0</nexchangeotobrate>";            //<!--折本汇率,不能为空-->
                            entry += "<ntaxrate>17</ntaxrate>";                               // <!--税率,不能为空-->
                            entry += "<noriginalcurprice>10.27</noriginalcurprice>";          //<!--原币无税单价,不能为空-->
                            entry += "<noriginalcurtaxprice>12</noriginalcurtaxprice>";       //<!--原币含税单价,不能为空-->
                            entry += "<noriginalcurnetprice>10.26</noriginalcurnetprice>";    //<!--原币无税净价,不能为空-->
                            entry += "<noriginalcurtaxnetprice>12</noriginalcurtaxnetprice>"; //<!--原币含税净价,不能为空-->
                            entry += "<noriginalcurtaxmny>172.62</noriginalcurtaxmny>";       //<!--原币税额,不能为空-->
                            entry += "<noriginalcurmny>1015.38</noriginalcurmny>";            //<!--原币无税金额,不能为空-->
                            entry += "<noriginalcursummny>1188</noriginalcursummny>";         //<!--原币价税合计,不能为空-->
                            entry += "<noriginalcurdiscountmny>0</noriginalcurdiscountmny>";  //<!--原币折扣额,不能为空-->
                            entry += "<nprice>10.27</nprice>";                                //<!--本币无税单价,不能为空-->
                            entry += "<ntaxprice>12</ntaxprice>";                             //<!--本币含税单价,不能为空-->
                            entry += "<nnetprice>10.26</nnetprice>";                          //<!--本币无税净价,不能为空-->
                            entry += "<ntaxnetprice>12</ntaxnetprice>";                       //<!--本币含税净价,不能为空-->
                            entry += "<ntaxmny>172.62</ntaxmny>";                             // <!--本币税额,不能为空-->
                            entry += "<nmny>1015.38</nmny>";                                  //<!--本币无税金额,不能为空-->
                            entry += "<nsummny>1188</nsummny>";                               //<!--本币价税合计,不能为空-->
                            entry += "<ndiscountmny>1</ndiscountmny>";                        //<!--本币折扣额,不能为空-->
                            entry += "<coperatorid>" + model.DisUserID + "</coperatorid>";    //<!--制单人:人员档案ID,不能为空-->
                            entry += "<frowstatus>" + type + "</frowstatus>";                 //<!--行状态,不能为空:0无状态,1自由,2审批,3冻结,4关闭,5作废,6结束,7正在审批,8审批未通过-->
                            entry += "<cadvisecalbodyid>999</cadvisecalbodyid>";              //<!--建议发货库存组织,不能为空(参照库存组织档案)-->
                            entry += "<creceiptareaid>999</creceiptareaid>";                  //<!--收货地区,不能为空(参照子表的收货单位所属地区的档案基础数据)-->
                            entry += "<vreceiveaddress>999</vreceiveaddress>";                //<!--收货地址,不能为空(参照子表的收货单位的默认收货地址字符串-->
                            entry += "<creceiptcorpid>999</creceiptcorpid>";                  //<!--收货单位,不能为空(需要参照客商管理档案基础数据)-->
                            entry += "<crowno>" + OrderTB + "</crowno>";                      //<!--行号,不能为空,第一行为1,第二行为2,依此类推-->
                            entry += "</entry>";
                        }
                        bill += entry + "</so_order_body>";
                        bill += "</so_order>";
                    }
                    else
                    {
                        SetErrorTb("订单获取失败", "异常订单,无订单明细【订单ID:" + model.ID + ",订单编号:" + model.ReceiptNo + "】");
                        bill += "<error>订单:" + model.ReceiptNo + "异常。</error>";
                    }
                }
                catch (Exception ex)
                {
                    if (ex is XmlException)
                    {
                        CreateReturnXML("", false, "读取XML出现错误");
                        SetErrorTb("", "读取XML出现错误");
                    }
                    else if (ex is XPathException)
                    {
                        CreateReturnXML("", false, "格式错误");
                        SetErrorTb("", "XML格式错误");
                    }
                    else
                    {
                        CreateReturnXML("", false, ex.Message);
                        SetErrorTb("", "同步失败:" + ex.Message + "");
                    }
                    if (TranSaction != null)
                    {
                        if (TranSaction.Connection != null)
                        {
                            TranSaction.Rollback();
                        }
                    }
                    SetErrorTb("订单获取失败", "" + ex.Message + "【订单ID:" + model.ID + ",订单编号:" + model.ReceiptNo + "】");
                }
            }
            LogManager.WriteLog2(LogFile.Trace.ToString(), "共获取订单:" + OrderTB + " 单");
        }
        catch (Exception ex)
        {
            ErrTb.Rows.Clear();
            SetErrorTb("订单获取全部失败", "" + ex.Message + "");
            bill  = "<?xml version=\"1.0\" encoding=\"gb2312\"?>";
            bill += "<ufinterface roottag=\"so_order\" billtype=\"30\"  replace=\"Y\" receiver=\"\" sender=\"yj\" isexchange=\"Y\" filename=\"销售订单头.xml\" proc=\"add\" operation=\"req\">";
            bill += "error";
        }
        finally
        {
            bill += "</ufinterface>";
            TableWriteLog();
        }
        return(bill);
    }