Exemple #1
0
    private void Bind()
    {
        if (KeyID != 0)
        {
            string sql = "SELECT * FROM [dbo].[CompCollection_view] where  CompID=" + this.CompID + " and ID=" + KeyID;

            DataTable ds = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0];

            if (ds != null && ds.Rows.Count > 0)
            {
                int orderid = Convert.ToInt32(ds.Rows[0]["orderID"]);
                Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(orderid);

                this.lblReceiptNo.InnerText  = orderModel.ReceiptNo.ToString();
                this.lblOState.InnerText     = OrderInfoType.OState(orderid);
                this.lblPayState.InnerText   = OrderInfoType.PayState(orderModel.PayState);
                this.lblTotalPrice.InnerText = orderModel.AuditAmount.ToString("N");
                this.lblPayedPrice.InnerText = ds.Rows[0]["Price"].ToString().ToDecimal(0).ToString("N");
                this.lblPayAuomet.InnerText  = orderModel.PayedAmount.ToString("N");
                if (ds.Rows[0]["Date"] != null && ds.Rows[0]["Date"].ToString() != "")
                {
                    this.lblArriveDate.InnerText = Convert.ToDateTime(ds.Rows[0]["Date"]).ToString("yyyy-MM-dd");
                }
                this.lblDisUser.InnerText    = Common.GetUserName(orderModel.DisUserID);
                this.lblCreateDate.InnerText = Convert.ToDateTime(orderModel.CreateDate).ToString("yyyy-MM-dd");

                this.lblPaySource.InnerText = ds.Rows[0]["Source"].ToString();
            }
        }
    }
Exemple #2
0
    private void Bind()
    {
        Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(orderid);

        string sql = string.Empty;

        if (paymentid > 0)
        {
            sql = "SELECT * FROM [dbo].[CompCollection_view] where PreType=" + PreType + " and paymentid=" + paymentid;
        }

        DataTable ds = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0];

        if (ds != null && ds.Rows.Count > 0 && orderModel != null)
        {
            this.lblReceiptNo.InnerText = orderModel.ReceiptNo.ToString();


            this.lblOState.InnerText   = OrderInfoType.OState(orderModel.ID);
            this.lblPayState.InnerText = OrderInfoType.PayState(orderModel.PayState);



            this.lblTotalPrice.InnerText = orderModel.AuditAmount.ToString("N");
            this.lblPayedPrice.InnerText = ds.Rows[0]["Price"].ToString().ToDecimal(0).ToString("N");
            this.lblPayAuomet.InnerText  = orderModel.PayedAmount.ToString("N");
            this.lblArriveDate.InnerText = Convert.ToDateTime(ds.Rows[0]["Date"]).ToString("yyyy-MM-dd");
            this.lblDisUser.InnerText    = Common.GetUserName(orderModel.DisUserID);
            this.lblCreateDate.InnerText = Convert.ToDateTime(orderModel.CreateDate).ToString("yyyy-MM-dd");

            this.lblPaySource.InnerText = ds.Rows[0]["Source"].ToString();

            ViewState["paymentID"] = ds.Rows[0]["paymentID"].ToString().ToInt(0);
        }
    }
Exemple #3
0
    /// <summary>
    /// 绑定数据
    /// </summary>
    public void Bind()
    {
        if (KeyID != 0)
        {
            //判断改该条数据代理商是否有操作权限
            if (!Common.PageDisOperable("Order", KeyID, this.DisID))
            {
                Response.Redirect("../NoOperable.aspx");
                return;
            }

            Hi.Model.DIS_Order OrderModel = OrderBll.GetModel(KeyID);

            if (OrderModel != null)
            {
                // this.lblOtype.InnerText = OrderInfoType.OType(OrderModel.Otype);
                this.lblReceiptNo.InnerText = OrderModel.ReceiptNo;
                this.lblRemark.InnerText    = OrderModel.Remark;

                //this.hidAddrId.Value = OrderModel.AddrID.ToString();
                //this.lblAddr.InnerText = Common.GetAddr(OrderModel.AddrID);
                //this.lblAddr.InnerText = OrderModel.Address;

                this.lblCreateDate.InnerText = OrderModel.CreateDate == DateTime.MinValue ? "" : OrderModel.CreateDate.ToString("yyyy-MM-dd");
                this.lblOState.InnerText     = OrderInfoType.OState(OrderModel.ID);
                if (OrderInfoType.PayState(OrderModel.PayState) == "已支付")
                {
                    this.lblPayState.InnerHtml = "<span style='color:green'>" + OrderInfoType.PayState(OrderModel.PayState) + "</span>";
                }
                else if (OrderInfoType.PayState(OrderModel.PayState) == "未支付")
                {
                    this.lblPayState.InnerHtml = "<span style='color:red'>" + OrderInfoType.PayState(OrderModel.PayState) + "</span>";
                }
                else
                {
                    this.lblPayState.InnerHtml = "<span style='color:blue'>" + OrderInfoType.PayState(OrderModel.PayState) + "</span>";
                }
                // this.lblAddType.InnerText = OrderInfoType.AddType(OrderModel.AddType);

                //this.lblTotalPrice.InnerText = OrderModel.TotalAmount.ToString("N");
                this.lblTotalPrice.InnerText = OrderModel.AuditAmount.ToString("N");
                //this.lblOtherAmount.InnerText = OrderModel.OtherAmount.ToString("N");
                //this.lblAuditAmount.InnerText = OrderModel.AuditAmount.ToString("N");
                this.lblPayedPrice.InnerText = OrderModel.PayedAmount.ToString("N");

                this.lblDisUser.InnerText    = Common.GetUserName(OrderModel.DisUserID);
                this.lblArriveDate.InnerText = OrderModel.ArriveDate == DateTime.MinValue ? "" : OrderModel.ArriveDate.ToString("yyyy-MM-dd");
                this.lblfymc.InnerText       = OrderModel.vdef2;
                //this.lblAuditUser.InnerText = Common.GetUserName(OrderModel.AuditUserID);
                //this.lblAuditDate.InnerText = OrderModel.AuditDate == DateTime.MinValue ? "" : OrderModel.AuditDate.ToString("yyyy-MM-dd");
                //this.lblAuditRemark.InnerText = OrderModel.AuditRemark;



                //订单操作
                OrderState(OrderModel);

                #region 页面操作
                if (Request["type1"] == "RepOrderList")
                {
                    payIcon.Visible    = false;
                    prnIcon.Visible    = false;
                    offIcon.Visible    = false;
                    copyIcon.Visible   = false;
                    SingIcon.Visible   = false;
                    removeIcon.Visible = false;
                    DelIcon.Visible    = false;
                    editIcon.Visible   = false;
                    Exp.Visible        = false;
                    Log.Visible        = false;
                    returnIcon.Visible = true;
                }
                if (Request["type1"] == "RepDetailsList")
                {
                    payIcon.Visible    = false;
                    prnIcon.Visible    = false;
                    offIcon.Visible    = false;
                    copyIcon.Visible   = false;
                    SingIcon.Visible   = false;
                    removeIcon.Visible = false;
                    DelIcon.Visible    = false;
                    editIcon.Visible   = false;
                    Exp.Visible        = false;
                    Log.Visible        = false;
                    returnIcon.Visible = true;
                }
                if (Request["type1"] == "RepZdzfDetailsList")
                {
                    payIcon.Visible    = false;
                    prnIcon.Visible    = false;
                    offIcon.Visible    = false;
                    copyIcon.Visible   = false;
                    SingIcon.Visible   = false;
                    removeIcon.Visible = false;
                    DelIcon.Visible    = false;
                    editIcon.Visible   = false;
                    Exp.Visible        = false;
                    Log.Visible        = false;
                    returnIcon.Visible = true;
                }
                //支付
                if (Request["type1"] == "orderpaylist")
                {
                    payIcon.Visible    = true;
                    prnIcon.Visible    = false;
                    offIcon.Visible    = false;
                    copyIcon.Visible   = false;
                    SingIcon.Visible   = false;
                    removeIcon.Visible = false;
                    DelIcon.Visible    = false;
                    editIcon.Visible   = false;
                    Exp.Visible        = false;
                    Log.Visible        = false;
                    returnIcon.Visible = true;
                }
                if (Request["type1"] == "UserList")
                {
                    payIcon.Visible    = false;
                    prnIcon.Visible    = false;
                    offIcon.Visible    = false;
                    copyIcon.Visible   = false;
                    SingIcon.Visible   = false;
                    removeIcon.Visible = false;
                    DelIcon.Visible    = false;
                    editIcon.Visible   = false;
                    Exp.Visible        = false;
                    Log.Visible        = true;
                    returnIcon.Visible = true;
                }
                if (Request["type1"] == "ReceivingList")
                {
                    payIcon.Visible    = false;
                    prnIcon.Visible    = false;
                    offIcon.Visible    = false;
                    copyIcon.Visible   = false;
                    SingIcon.Visible   = true;
                    removeIcon.Visible = false;
                    DelIcon.Visible    = false;
                    editIcon.Visible   = false;
                    Exp.Visible        = true;
                    //this.Exp.Attributes.Add("style", "display:inline-block;");
                    Log.Visible        = true;
                    returnIcon.Visible = true;
                }
                if (Request["type1"] == "ReceivingList1")
                {
                    payIcon.Visible    = false;
                    prnIcon.Visible    = false;
                    offIcon.Visible    = false;
                    copyIcon.Visible   = false;
                    SingIcon.Visible   = false;
                    removeIcon.Visible = false;
                    DelIcon.Visible    = false;
                    editIcon.Visible   = false;
                    Exp.Visible        = true;
                    //this.Exp.Attributes.Add("style", "display:inline-block;");
                    Log.Visible        = true;
                    returnIcon.Visible = true;
                }
                if (Request["type1"] == "ReturnOrderList1")
                {
                    payIcon.Visible    = false;
                    prnIcon.Visible    = false;
                    offIcon.Visible    = false;
                    copyIcon.Visible   = false;
                    SingIcon.Visible   = false;
                    removeIcon.Visible = true;
                    DelIcon.Visible    = false;
                    editIcon.Visible   = false;
                    Exp.Visible        = false;
                    Log.Visible        = true;
                    returnIcon.Visible = true;
                }
                #endregion
            }
        }
        else
        {
            Response.Redirect("../NoOperable.aspx");
            return;
        }
    }
Exemple #4
0
    /// <summary>
    /// 绑定数据
    /// </summary>
    public void Bind()
    {
        string type = Request.QueryString["type"] + "";

        if (KeyID != 0)
        {
            if (!Common.PageCompOperable("ReturnOrder", KeyID, CompID))
            {
                Response.Redirect("../../NoOperable.aspx");
                return;
            }

            Hi.Model.DIS_OrderReturn OrderReturnModel = OrderReturnBll.GetModel(KeyID);

            if (OrderReturnModel != null)
            {
                this.lblDisName.InnerText = Common.GetDis(OrderReturnModel.DisID, "DisName");
                this.hidDisId.Value       = OrderReturnModel.DisID.ToString();
                DisId   = OrderReturnModel.DisID;
                OrderId = OrderReturnModel.OrderID;

                Hi.Model.DIS_Order OrderModel = new Hi.BLL.DIS_Order().GetModel(OrderId);

                this.lblReceiptNo.InnerText = OrderReturnModel.ReceiptNo;

                this.lblReturnDate.InnerText = OrderReturnModel.ReturnDate == DateTime.MinValue ? "" : OrderReturnModel.ReturnDate.ToString("yyyy-MM-dd");

                this.lblReturnUserID.InnerText = Common.GetUserName(OrderReturnModel.ReturnUserID.ToString().ToInt(0));
                this.lblReturnState.InnerText  = OrderInfoType.ReturnState(OrderReturnModel.ReturnState);
                //this.lblExpress.InnerText = OrderReturnModel.Express;
                //this.lblExpressNo.InnerText = OrderReturnModel.ExpressNo;
                this.lblReturnContent.InnerText = OrderReturnModel.ReturnContent;

                ProID    = OrderInfoType.getOrderExt(OrderReturnModel.OrderID, "ProID");
                ProPrice = OrderInfoType.getOrderExt(OrderReturnModel.OrderID, "ProAmount");
                ProIDD   = OrderInfoType.getOrderExt(OrderReturnModel.OrderID, "ProDID");
                ProType  = OrderInfoType.getOrderExt(OrderReturnModel.OrderID, "Protype");

                //订单信息
                this.lblOState.InnerText   = OrderInfoType.OState(OrderModel.ID);
                this.lblPayState.InnerHtml = OrderInfoType.PayState(OrderModel.PayState);
                if (OrderModel.PayState == (int)Enums.PayState.未支付)
                {
                    this.lblPayState.Attributes.Add("style", "Color:Red");
                }
                else
                {
                    this.lblPayState.Attributes.Add("style", "Color:green");
                }

                this.lblAddType.InnerText = OrderInfoType.AddType(OrderModel.AddType);
                this.lblOtype.InnerText   = OrderInfoType.OType(OrderModel.Otype);
                //订单总价
                this.lblTotalPrice.InnerText = OrderInfoType.getOrder(OrderReturnModel.OrderID, "AuditAmount");


                if (OrderReturnModel.AuditUserID == 0)
                {
                    this.trAuditUser.Attributes.Add("style", "display:none;");
                    this.trAuditRemark.Attributes.Add("style", "display:none;");
                }
                else
                {
                    this.trAuditUser.Attributes.Add("style", "");
                    this.trAuditRemark.Attributes.Add("style", "");
                }
                this.lblAuditUser.InnerText   = Common.GetUserName(OrderReturnModel.AuditUserID);
                this.lblAuditDate.InnerText   = OrderReturnModel.AuditDate == DateTime.MinValue ? "" : OrderReturnModel.AuditDate.ToString("yyyy-MM-dd");
                this.lblAuditRemark.InnerText = OrderReturnModel.AuditRemark;

                if (this.Erptype != 0)
                {
                    //U8、U9等用户  不能对订单进行操作
                    this.Audit.Visible       = false;
                    this.ReturnMoney.Visible = false;
                }
                else
                {
                    //非U8、U9等用户  可以对订单进行操作
                    #region
                    if (OrderReturnModel.ReturnState < (int)Enums.AuditState.提交)
                    {
                        //this.Audit.Attributes.Add("style", "display:none;");
                        //this.ReturnMoney.Attributes.Add("style", "display:none;");

                        this.Audit.Visible       = false;
                        this.ReturnMoney.Visible = false;
                    }
                    else if (OrderReturnModel.ReturnState == (int)Enums.AuditState.提交)
                    {
                        this.Audit.Visible       = true;
                        this.ReturnMoney.Visible = false;

                        //this.Audit.Attributes.Add("style", "display:inline-block;");
                        //this.ReturnMoney.Attributes.Add("style", "display:none;");
                    }
                    else if (OrderReturnModel.ReturnState == (int)Enums.AuditState.已审)
                    {
                        this.Audit.Visible = false;
                        //this.Audit.Attributes.Add("style", "display:none;");
                        if (OrderModel != null)
                        {
                            if (OrderModel.Otype != (int)Enums.OType.赊销订单)
                            {
                                if (type == "")
                                {
                                    this.ReturnMoney.Visible = false;
                                    //this.ReturnMoney.Attributes.Add("style", "display:none;");
                                }
                                else
                                {
                                    this.ReturnMoney.Visible = true;
                                    //this.ReturnMoney.Attributes.Add("style", "display:inline-block;");
                                }
                            }
                            else
                            {
                                if (OrderModel.PayState == (int)Enums.PayState.已支付)
                                {
                                    if (type == "")
                                    {
                                        this.ReturnMoney.Visible = false;
                                        //this.ReturnMoney.Attributes.Add("style", "display:none;");
                                    }
                                    else
                                    {
                                        this.ReturnMoney.Visible = true;
                                        //this.ReturnMoney.Attributes.Add("style", "display:inline-block;");
                                    }
                                }
                                else
                                {
                                    this.ReturnMoney.Visible = false;
                                    //this.ReturnMoney.Attributes.Add("style", "display:none;");
                                }
                            }
                        }
                    }
                    else if (OrderReturnModel.ReturnState == (int)Enums.AuditState.已完结)
                    {
                        this.Audit.Visible       = false;
                        this.ReturnMoney.Visible = false;
                        //this.Audit.Attributes.Add("style", "display:none;");
                        //this.ReturnMoney.Attributes.Add("style", "display:none;");
                    }
                    #endregion
                }
                BindOrderDetail(OrderReturnModel.OrderID, OrderReturnModel.DisID);
            }
        }
        else
        {
            Response.Write("数据错误!");
            Response.End();
        }
    }
Exemple #5
0
    public void Bind()
    {
        //取消按钮显示
        //this.btnRemove.Attributes.Add("style", "display:none;");
        //this.btnRemove.Style["display"] = "none";

        Hi.Model.DIS_Order OrderInfoModel = OrderInfoBll.GetModel(KeyID);

        if (OrderInfoModel != null)
        {
            this.lblDisName.InnerText = Common.GetDis(OrderInfoModel.DisID, "DisName");
            this.hidDisId.Value       = OrderInfoModel.DisID.ToString();
            DisId = OrderInfoModel.DisID;

            this.lblOtype.InnerText     = OrderInfoType.OType(OrderInfoModel.Otype);
            this.lblReceiptNo.InnerText = OrderInfoModel.ReceiptNo;
            this.lblRemark.InnerText    = OrderInfoModel.Remark;

            this.hidAddrId.Value   = OrderInfoModel.AddrID.ToString();
            this.lblAddr.InnerText = OrderInfoModel.Address;

            this.lblCreateDate.InnerText = OrderInfoModel.CreateDate.ToString("yyyy-MM-dd");
            this.lblOState.InnerText     = OrderInfoType.OState(OrderInfoModel.ID);
            this.lblPayState.InnerText   = OrderInfoType.PayState(OrderInfoModel.PayState);

            this.lblTotalPrice.InnerText = OrderInfoModel.TotalAmount.ToString("0.00");
            //this.lblOtherAmount.InnerText = OrderInfoModel.OtherAmount.ToString("0.00");
            this.lblPayedPrice.InnerText = OrderInfoModel.PayedAmount.ToString("0.00");

            this.lblDisUser.InnerText    = Common.GetUserName(OrderInfoModel.DisUserID);
            this.lblArriveDate.InnerText = OrderInfoModel.ArriveDate == DateTime.MinValue ? "" : OrderInfoModel.ArriveDate.ToString("yyyy-MM-dd");

            BindOrderDetail(OrderInfoModel.DisID);

            if (OrderInfoModel.OState == (int)Enums.OrderState.退回)
            {
                //this.Remove.Attributes.Add("style", "display:none;"); //取消订单
                //this.Return.Attributes.Add("style", "display:none;"); //退回
                //this.Edit.Attributes.Add("style", "display:inline-block;");   //编辑
                //this.Del.Attributes.Add("style", "display:none;");  //删除
                this.Shipping.Attributes.Add("style", "display:none;"); //发货
                //this.Clearing.Attributes.Add("style", "display:none;");  //去结算
                //this.PrePayMonery.Attributes.Add("style", "display:none;"); //预收款申请
                //this.Submit.Attributes.Add("style", "display:inline-block;");  //提交
                this.Audit.Attributes.Add("style", "display:none;");  //审核
            }
            if (OrderInfoModel.OState == (int)Enums.OrderState.未提交)
            {
                //this.Remove.Attributes.Add("style", "display:none;");
                //this.Return.Attributes.Add("style", "display:none;");
            }
            if (OrderInfoModel.OState == (int)Enums.OrderState.待审核)
            {
                //this.Edit.Attributes.Add("style", "display:none;");
                //this.Del.Attributes.Add("style", "display:none;");
                this.Shipping.Attributes.Add("style", "display:none;");
                //this.Clearing.Attributes.Add("style", "display:none;");
                //this.PrePayMonery.Attributes.Add("style", "display:none;");
                //this.Submit.Attributes.Add("style", "display:none;");

                //this.Return.Attributes.Add("style", "display:inline-block;");
                this.Audit.Attributes.Add("style", "display:inline-block;");
                //this.Remove.Attributes.Add("style", "display:inline-block;");
            }
            if (OrderInfoModel.OState < (int)Enums.OrderState.待审核 || OrderInfoModel.OState > (int)Enums.OrderState.已审)
            {
                //this.Return.Attributes.Add("style", "display:none;");
                this.Audit.Attributes.Add("style", "display:none;");
                this.Shipping.Attributes.Add("style", "display:none;");
                //this.Clearing.Attributes.Add("style", "display:none;");
                //this.PrePayMonery.Attributes.Add("style", "display:none;");
            }
            if (OrderInfoModel.OState == (int)Enums.OrderState.已审)
            {
                //this.Return.Attributes.Add("style", "display:none;");
                this.Audit.Attributes.Add("style", "display:none;");
                //this.Edit.Attributes.Add("style", "display:none;");
                //this.Del.Attributes.Add("style", "display:none;");
                //this.Submit.Attributes.Add("style", "display:none;");

                //this.Remove.Attributes.Add("style", "display:inline-block;");

                if (OrderInfoModel.Otype == (int)Enums.OType.赊销订单)
                {
                    //this.Clearing.Attributes.Add("style", "display:none;");
                    //this.PrePayMonery.Attributes.Add("style", "display:none;");
                    this.Shipping.Attributes.Add("style", "display:inline-block;");
                }
                else
                {
                    if (OrderInfoModel.PayState > (int)Enums.PayState.未支付)
                    {
                        //this.Clearing.Attributes.Add("style", "display:none;");
                        //this.PrePayMonery.Attributes.Add("style", "display:none;");

                        this.Shipping.Attributes.Add("style", "display:inline-block;");
                    }
                    else
                    {
                        //this.Clearing.Attributes.Add("style", "display:none;");
                        //this.PrePayMonery.Attributes.Add("style", "display:none;");

                        this.Shipping.Attributes.Add("style", "display:none;");
                    }
                }
            }
            if (OrderInfoModel.OState == (int)Enums.OrderState.已作废)
            {
                //this.Return.Attributes.Add("style", "display:none;");
                //this.Remove.Attributes.Add("style", "display:none;");
                this.Shipping.Attributes.Add("style", "display:none;");
                //this.Submit.Attributes.Add("style", "display:none;");

                //if (OrderInfoModel.PayState > (int)Enums.PayState.未支付)
                //{
                //    this.Clearing.Attributes.Add("style", "display:none;");
                //    this.PrePayMonery.Attributes.Add("style", "display:none;");
                //}
            }
        }
    }
Exemple #6
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);
    }
Exemple #7
0
    public void Bind()
    {
        //取消按钮显示

        if (KeyID > 0)
        {
            Hi.Model.DIS_Order OrderInfoModel = OrderInfoBll.GetModel(KeyID);
            //if (Request["showtype"] == "PayZdblList")
            //{
            //    zd.InnerText = "账单查询详细";
            //}
            //if (Request["showtype"] == "PaymentZdblcxList")
            //{
            //    //zd.InnerText = "账单补录详细";
            //}
            string PostType = string.Empty;
            if (Request["PostType"] != null)
            {
                PostType = Request["PostType"].ToString();
            }

            if (OrderInfoModel != null)
            {
                this.lblDisName.InnerText = Common.GetDis(OrderInfoModel.DisID, "DisName");
                this.hidDisId.Value       = OrderInfoModel.DisID.ToString();
                DisId = OrderInfoModel.DisID;

                this.lblReceiptNo.InnerText = OrderInfoModel.ReceiptNo;
                this.lblRemark.InnerText    = OrderInfoModel.Remark;
                this.lblAddr.InnerText      = OrderInfoModel.vdef2;

                this.lblCreateDate.InnerText = OrderInfoModel.CreateDate == DateTime.MinValue ? "" : OrderInfoModel.CreateDate.ToString("yyyy-MM-dd");
                this.lblOState.InnerText     = OrderInfoType.OState(OrderInfoModel.ID);
                this.lblPayState.InnerText   = OrderInfoType.PayState(OrderInfoModel.PayState);
                if (OrderInfoModel.PayState == (int)Enums.PayState.未支付)
                {
                    this.lblPayState.Attributes.Add("style", "Color:Red");
                }
                else
                {
                    this.lblPayState.Attributes.Add("style", "Color:green");
                }


                this.lblTotalPrice.InnerText = OrderInfoModel.AuditAmount.ToString("N");
                this.lblPayedPrice.InnerText = OrderInfoModel.PayedAmount.ToString("N");

                this.lblDisUser.InnerText    = Common.GetUserName(OrderInfoModel.DisUserID);
                this.lblArriveDate.InnerText = OrderInfoModel.ArriveDate == DateTime.MinValue ? "" : OrderInfoModel.ArriveDate.ToString("yyyy-MM-dd");

                if (!PostType.Equals("1"))
                {
                    if (OrderInfoModel.OState == (int)Enums.OrderState.退回)
                    {
                        this.Remove.Visible = false;
                        this.Edit.Visible   = true;
                    }
                    if (OrderInfoModel.OState == (int)Enums.OrderState.未提交)
                    {
                        this.Remove.Visible = false;
                    }
                    if (OrderInfoModel.OState == (int)Enums.OrderState.待审核)
                    {
                        if (OrderInfoModel.AddType != (int)Enums.AddType.企业补单)
                        {
                            this.Edit.Visible = false;
                        }
                        this.Remove.Visible = true;
                    }
                    if (OrderInfoModel.OState == (int)Enums.OrderState.已审)
                    {
                        this.Edit.Visible = false;
                        if (OrderInfoModel.PayState == (int)Enums.PayState.未支付)
                        {
                            this.Remove.Visible = true;
                        }
                        else
                        {
                            this.Remove.Visible = false;
                        }
                    }
                    if (OrderInfoModel.OState == (int)Enums.OrderState.已作废)
                    {
                        this.Remove.Visible    = false;
                        this.CopyOrder.Visible = false;
                        this.Edit.Visible      = false;
                    }
                    if (OrderInfoModel.OState > (int)Enums.OrderState.退货处理 && OrderInfoModel.OState < (int)Enums.OrderState.已到货)
                    {
                        this.Remove.Visible    = false;
                        this.CopyOrder.Visible = false;
                        this.Edit.Visible      = false;
                    }
                    if ((OrderInfoModel.OState >= (int)Enums.OrderState.退货处理 && OrderInfoModel.ReturnState != (int)Enums.ReturnState.未退货) && OrderInfoModel.OState <= (int)Enums.OrderState.已退货)
                    {
                        this.Remove.Visible    = false;
                        this.CopyOrder.Visible = false;
                        this.Edit.Visible      = false;
                    }
                }
                else
                {
                    this.Remove.Visible    = false;
                    this.CopyOrder.Visible = false;
                    this.Edit.Visible      = false;
                }
                if (PostType.Equals("3"))
                {
                    btn.Visible = false;
                    this.btnright.Attributes.Add("style", "margin-top:0px; margin-left:0px; width:auto;");
                    //btntitle.Visible = false;
                    this.lblpaytime.InnerText = Request["Date"] == null ? "" : Request["Date"].ToString();
                    this.paytime1.Visible     = true;
                    this.paytime2.Visible     = true;
                }
                else
                {
                    this.state.Attributes.Add("colspan", "5");
                }
            }
        }
        else
        {
            Response.Write("数据错误!");
            Response.End();
        }
    }