예제 #1
0
        /// <summary>
        /// 取打印时间
        /// </summary>
        /// <param name="OrderID"></param>
        /// <returns></returns>
        public string GetPrintTime(int OrderID)
        {
            string restr           = "<span style=\"color:#F00\" >未打印</span>";
            OrderWorkingLogInfo si = new OrderWorkingLogInfo();

            try
            {
                si = Orders.GetOrderWorkingLogInfoModelByOrderIDAndWorkType(OrderID, 6);
                if (si != null)
                {
                    restr = si.pAppendTime.ToString();;
                }
            }
            finally
            {
                si = null;
            }
            return(restr);
        }
        public int AddOrder(string passCode, int oType, int StoresSupplierID,
                            string oCustomersName, string oCustomersContact, string oCustomersTel, string oCustomersAddress, string oCustomersOrderID, string oCustomersNameB,
                            int oPrepay, string oReMake, string _OrderListDataJson)
        {
            int StaffID = 0;
            int UserID  = 0;
            int OrderID = 0;

            if (checkPassCode(passCode))
            {
                StaffInfo _sf = new StaffInfo();
                UserInfo  _ui = new UserInfo();

                GeneralConfigInfo _cf = new GeneralConfigInfo();
                _cf = GeneralConfigs.GetConfig();

                if (_cf.Server_Staff.Trim() != "")
                {
                    _sf = tbStaffInfo.GetStaffInfoModelByName(_cf.Server_Staff.Trim());
                    if (_sf != null)
                    {
                        StaffID = _sf.StaffID;
                    }
                }

                if (_cf.Server_User.Trim() != "")
                {
                    _ui = tbUserInfo.GetUserInfoModelByUserName(_cf.Server_User.Trim());
                    if (_ui != null)
                    {
                        UserID = _ui.UserID;
                    }
                }

                /*
                 * _OrderListDataJson = {"ProductsCode":"","StorageCode":"","Quantity":0,"Money":0}
                 */


                _OrderListDataJson = "";


                OrderInfo oi = new OrderInfo();
                oi.oOrderNum         = "----------";
                oi.oType             = oType;
                oi.StoresID          = StoresSupplierID;
                oi.oCustomersName    = oCustomersName;
                oi.oCustomersContact = oCustomersContact;
                oi.oCustomersTel     = oCustomersTel;
                oi.oCustomersAddress = oCustomersAddress;
                oi.oCustomersOrderID = oCustomersOrderID;
                oi.oCustomersNameB   = oCustomersNameB;
                oi.StaffID           = StaffID;
                oi.UserID            = UserID;
                oi.oAppendTime       = DateTime.Now;
                oi.oOrderDateTime    = DateTime.Now;
                oi.oState            = 0;
                oi.oSteps            = 1;
                oi.oPrepay           = oPrepay;
                oi.oReMake           = oReMake;
                oi.OrderListDataJson = (OrderListDataJson)JavaScriptConvert.DeserializeObject(_OrderListDataJson, typeof(OrderListDataJson));

                OrderID = Orders.AddOrderInfoAndList(oi);

                if (OrderID > 0)
                {
                    OrderWorkingLogInfo owl = new OrderWorkingLogInfo();

                    owl.OrderID     = OrderID;
                    owl.UserID      = 0;
                    owl.oType       = 0;
                    owl.oMsg        = "";
                    owl.pAppendTime = DateTime.Now;

                    Orders.AddOrderWorkingLogInfo(owl);
                }
            }
            return(OrderID);
        }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            int    orderid = HTTPRequest.GetInt("orderid", 0);
            string rc      = HTTPRequest.GetString("rc");

            if (orderid > 0)
            {
                //rc = Utils.UrlDecode(DES.Decode(rc, config.Passwordkey));
                rc = DES.Decode(Utils.UrlDecode(rc), config.Passwordkey);
                if (rc.Trim() != "")
                {
                    string[] rearray = Utils.SplitString(rc, "|");
                    if (rearray.Length > 0)
                    {
                        oi = Orders.GetOrderInfoModel(orderid);
                        if (oi != null)
                        {
                            if (rearray[1].Trim() == oi.oOrderNum.Trim())
                            {
                                printdatetime = rearray[0].Trim();
                                string tSteps   = ((oi.oSteps == 1) ? "  tbOrderListInfo.oWorkType=0 " : "  tbOrderListInfo.oWorkType<>0 ").ToString();
                                string tSteps_b = ((oi.oSteps == 1) ? " IsVerify=0 " : " IsVerify<>0 ").ToString();
                                //销售出货跟销售退货显示金额
                                if (oi.oType == 3 || oi.oType == 4)
                                {
                                    ShowMoney = true;
                                }

                                OrderList = Orders.GetOrderListInfoList(" OrderID=" + oi.OrderID + " and " + tSteps + " order by OrderListID asc").Tables[0];

                                foreach (DataRow dr in OrderList.Rows)
                                {
                                    summoney += Convert.ToDecimal(dr["oQuantity"]) * Convert.ToDecimal(dr["oPrice"]);
                                }
                                summoney_str = chang(summoney.ToString());

                                summoney = Math.Round(summoney, config.MoneyDecimal);

                                //库存调拨单,整理数据
                                if (oi.oType == 9)
                                {
                                    DataTable nOrderList = new DataTable();
                                    nOrderList = OrderList.Clone();

                                    foreach (DataRow dr in OrderList.Rows)
                                    {
                                        if (Convert.ToDecimal(dr["oQuantity"].ToString()) < 0)
                                        {
                                            dr["StorageName"] = "来源:" + dr["StorageName"].ToString();
                                            nOrderList.Rows.Add(dr.ItemArray);
                                        }
                                    }
                                    nOrderList.AcceptChanges();

                                    foreach (DataRow dr in OrderList.Rows)
                                    {
                                        foreach (DataRow ddr in nOrderList.Rows)
                                        {
                                            if (Convert.ToInt32(ddr["ProductsID"].ToString()) == Convert.ToInt32(dr["ProductsID"].ToString()))
                                            {
                                                if (Convert.ToDecimal(dr["oQuantity"].ToString()) > 0)
                                                {
                                                    ddr["oQuantity"]   = Convert.ToDecimal(dr["oQuantity"].ToString());
                                                    ddr["StorageName"] = ddr["StorageName"].ToString() + "<br>去向:" + dr["StorageName"].ToString() + "";
                                                }
                                            }
                                        }
                                        nOrderList.AcceptChanges();
                                    }

                                    OrderList.Clear();
                                    OrderList = nOrderList.Copy();
                                }
                                //制单人
                                print_ui = tbUserInfo.GetUserInfoModel(oi.UserID);
                                //审核人
                                OrderWorkingLogInfo owil = Orders.GetOrderWorkingUserID(oi.OrderID, 2);
                                if (owil != null)
                                {
                                    print_v_ui = tbUserInfo.GetUserInfoModel(owil.UserID);
                                }
                                else
                                {
                                    print_v_ui = null;
                                }

                                dList = Orders.GetOrderWorkingLogInfoList(" OrderID=" + orderid + " order by pAppendTime desc").Tables[0];
                            }
                            else
                            {
                                AddErrLine("掩码被修改!");
                            }
                        }
                        else
                        {
                            AddErrLine("参数错误,单据不存在!");
                        }
                    }
                    else
                    {
                        AddErrLine("掩码被修改!");
                    }
                }
                else
                {
                    AddErrLine("秘钥参数错误!");
                }
            }
            else
            {
                AddErrLine("单据编号参数错误!");
            }
        }
예제 #4
0
        public int Order_Print_Item         = 10;                           //打印分页,每页条数


        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-1-1-8") || CheckUserPopedoms("3-1-2-8") || CheckUserPopedoms("3-2-1-8") || CheckUserPopedoms("3-2-2-8") || CheckUserPopedoms("3-2-3-8") || CheckUserPopedoms("3-2-4-8") || CheckUserPopedoms("3-2-5-8") || CheckUserPopedoms("3-3-1-8") || CheckUserPopedoms("3-3-2-8") || CheckUserPopedoms("3-3-3-8"))
                {
                    act              = HTTPRequest.GetString("act");
                    orderid          = HTTPRequest.GetInt("orderid", 0);
                    ordertype        = HTTPRequest.GetInt("ordertype", 0);
                    ot               = HTTPRequest.GetString("ot");
                    Order_Print_Item = this.config.Order_Print_Item;

                    if (act == "pl")//批量打印
                    {
                        orderidstr   = HTTPRequest.GetString("orderid");
                        ordertypestr = HTTPRequest.GetString("ordertype");

                        string[] orderid_array      = Utils.SplitString(orderidstr, "x");
                        string[] ordertypestr_array = Utils.SplitString(ordertypestr, "x");
                    }


                    if (orderid > 0)
                    {
                        oi = Orders.GetOrderInfoModel(orderid);
                        if (oi != null)
                        {
                            string tSteps   = ((oi.oSteps == 1) ? "  tbOrderListInfo.oWorkType=0 " : "  tbOrderListInfo.oWorkType<>0 ").ToString();
                            string tSteps_b = ((oi.oSteps == 1) ? " IsVerify=0 " : " IsVerify<>0 ").ToString();

                            if (CheckUserPopedoms("X") || CheckUserPopedoms("3-1-1-9") || CheckUserPopedoms("3-1-2-9") || CheckUserPopedoms("3-2-1-9") || CheckUserPopedoms("3-2-2-9") || CheckUserPopedoms("3-2-3-9") || CheckUserPopedoms("3-2-4-9") || CheckUserPopedoms("3-2-5-9") || CheckUserPopedoms("3-3-1-9") || CheckUserPopedoms("3-3-2-9") || CheckUserPopedoms("3-3-3-9"))
                            {
                                ShowMoney = true;
                                ShowMoney = (HTTPRequest.GetString("ShowMoney").Trim() != "") ? false : true;
                            }
                            else
                            {
                                ShowMoney = false;
                            }
                            Print_Foot = Utils.ReplaceString(this.config.Print_Foot, "[", "<", false);
                            Print_Foot = Utils.ReplaceString(Print_Foot, "]", ">", false);
                            OrderList  = Orders.GetOrderListInfoList(" OrderID=" + oi.OrderID + " and " + tSteps + " order by OrderListID asc").Tables[0];

                            OrderFieldList = Orders.GetOrderFieldInfoList(" OrderType=" + ordertype + " and fState=0 and fPrint=0").Tables[0];
                            if (OrderFieldList != null)
                            {
                                OrderFieldValueList = Orders.GetOrderFieldValueInfoList(" OrderListID in(select tbOrderListInfo.OrderListID from tbOrderListInfo where tbOrderListInfo.OrderID=" + oi.OrderID + " and " + tSteps + ") and " + tSteps_b + "").Tables[0];
                            }
                            foreach (DataRow dr in OrderList.Rows)
                            {
                                summoney += Convert.ToDecimal(dr["oQuantity"]) * Convert.ToDecimal(dr["oPrice"]);
                            }
                            summoney_str = chang(summoney.ToString());

                            summoney = Math.Round(summoney, config.MoneyDecimal);

                            //库存调拨单,整理数据
                            if (oi.oType == 9)
                            {
                                DataTable nOrderList = new DataTable();
                                nOrderList = OrderList.Clone();

                                foreach (DataRow dr in OrderList.Rows)
                                {
                                    if (Convert.ToDecimal(dr["oQuantity"].ToString()) < 0)
                                    {
                                        dr["StorageName"] = "来源:" + dr["StorageName"].ToString();
                                        nOrderList.Rows.Add(dr.ItemArray);
                                    }
                                }
                                nOrderList.AcceptChanges();

                                foreach (DataRow dr in OrderList.Rows)
                                {
                                    foreach (DataRow ddr in nOrderList.Rows)
                                    {
                                        if (Convert.ToInt32(ddr["ProductsID"].ToString()) == Convert.ToInt32(dr["ProductsID"].ToString()))
                                        {
                                            if (Convert.ToDecimal(dr["oQuantity"].ToString()) > 0)
                                            {
                                                ddr["oQuantity"]   = Convert.ToDecimal(dr["oQuantity"].ToString());
                                                ddr["StorageName"] = ddr["StorageName"].ToString() + "<br>去向:" + dr["StorageName"].ToString() + "";
                                            }
                                        }

                                        /*
                                         * else
                                         * {
                                         *
                                         *  if (Convert.ToInt32(dr["oQuantity"].ToString()) > 0)
                                         *  {
                                         *      dr["StorageName"] = "去向:" + dr["StorageName"].ToString() + "<br>";
                                         *  }
                                         *  else
                                         *  {
                                         *      dr["oQuantity"] = -1 * Convert.ToInt32(dr["oQuantity"].ToString());
                                         *      dr["StorageName"] = "来源:" + dr["StorageName"].ToString() + "<br>";
                                         *  }
                                         *
                                         *  nOrderList.Rows.Add(dr);
                                         *
                                         * }*/
                                    }
                                    nOrderList.AcceptChanges();
                                }

                                OrderList.Clear();
                                OrderList = nOrderList.Copy();
                            }

                            //处理分页打印
                            if (OrderList.Rows.Count > 0)
                            {
                                print_page_sum = (int)Math.Ceiling((float)OrderList.Rows.Count / (float)Order_Print_Item);

                                for (int k = 0; k < print_page_sum; k++)
                                {
                                    DataTable _dt = new DataTable();
                                    _dt           = OrderList.Clone();
                                    _dt           = Public.PublicLib.GetPagedTable(OrderList, k + 1, Order_Print_Item);
                                    _dt.TableName = (k + 1).ToString();
                                    OrderListSet.Tables.Add(_dt);

                                    OrderListSet.AcceptChanges();
                                }
                            }

                            //制单人
                            print_ui = tbUserInfo.GetUserInfoModel(oi.UserID);
                            //审核人
                            OrderWorkingLogInfo owil = Orders.GetOrderWorkingUserID(oi.OrderID, 2);
                            if (owil != null)
                            {
                                print_v_ui = tbUserInfo.GetUserInfoModel(owil.UserID);
                            }
                            else
                            {
                                print_v_ui = null;
                            }

                            //是否为网购订单
                            _ms = M_Utils.GetM_SendGoodsInfoModelByOrderID(oi.OrderID);
                            if (_ms != null)
                            {
                                IsMOrder = true;
                                _mxsp    = M_Utils.GetM_ExpressTemplatesInfoModel(_ms.mExpName);
                                //转换交易单号
                                oi.oCustomersOrderID = "";
                                string   _m_TradeInfoID    = _ms.m_TradeInfoID;
                                string[] _m_TradeInfoIDArr = Utils.SplitString(_m_TradeInfoID, ",");
                                foreach (string _m_TradeInfoID_Str in _m_TradeInfoIDArr)
                                {
                                    if (_m_TradeInfoID_Str.Trim() != "")
                                    {
                                        M_TradeInfo _mt = new M_TradeInfo();
                                        try
                                        {
                                            try
                                            {
                                                _mt = M_Utils.GetM_TradeInfoModel(Convert.ToInt32(_m_TradeInfoID_Str.Trim()));
                                                if (_mt != null)
                                                {
                                                    BuyerName             = _mt.buyer_nick;
                                                    oi.oCustomersOrderID += _mt.tid.ToString() + " ";
                                                }
                                            }
                                            catch
                                            {
                                            }
                                        }
                                        finally
                                        {
                                            _mt = null;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                IsMOrder = false;
                                _mxsp    = null;
                            }

                            OrderWorkingLogInfo owl = new OrderWorkingLogInfo();
                            owl.OrderID     = oi.OrderID;
                            owl.UserID      = this.userid;
                            owl.oType       = 6;
                            owl.oMsg        = (ot.Trim() != "d")?"":"打印订单,备货";
                            owl.pAppendTime = DateTime.Now;

                            Orders.AddOrderWorkingLogInfo(owl);
                        }
                        else
                        {
                            AddErrLine("参数错误,单据不存在!");
                        }
                    }
                    else
                    {
                        AddErrLine("参数错误!");
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
예제 #5
0
        public string Order_QRCode_URL = "";                //外部查看连接

        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                ordertype = HTTPRequest.GetInt("ordertype", 0);
                orderid   = HTTPRequest.GetInt("orderid", 0);

                Act     = Utils.ChkSQL(HTTPRequest.GetString("Act")).Trim();
                format  = HTTPRequest.GetString("format");
                IsFirst = (HTTPRequest.GetString("IsFirst").Trim() != "") ? Convert.ToBoolean(HTTPRequest.GetString("IsFirst").Trim()) : false;;

                if (ordertype > 0 && Act != "")
                {
                    #region 权限判断
                    switch (ordertype)
                    {
                    case 1:                    //采购入库=1
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-1-1") || CheckUserPopedoms("3-3-4-1-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-1-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-1-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 采购入库单 列表!");
                        }
                        break;

                    case 2:                    //采购退货=2
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-2-1") || CheckUserPopedoms("3-3-4-2-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-2-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-2-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 采购退货单 列表!");
                        }
                        break;

                    case 3:                    //销售发货=3
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-3-1") || CheckUserPopedoms("3-3-4-3-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-3-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-3-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 销售发货单 列表!");
                        }
                        break;

                    case 4:                    //销售退货=4
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-4-1") || CheckUserPopedoms("3-3-4-4-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-4-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-4-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 销售退货单 列表!");
                        }
                        break;

                    case 5:                    //赠品=5
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-5-1") || CheckUserPopedoms("3-3-4-5-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-5-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-5-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 赠品单 列表!");
                        }
                        break;

                    case 6:                    //样品=6
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-6-1") || CheckUserPopedoms("3-3-4-6-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-6-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-6-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 样品单 列表!");
                        }
                        break;

                    case 7:                    //代购=7
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-7-1") || CheckUserPopedoms("3-3-4-7-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-7-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-7-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 代购单 列表!");
                        }
                        break;

                    case 8:                    //库存调整=8
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-1") || CheckUserPopedoms("3-3-4-8-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 库存调整单 列表!");
                        }
                        break;

                    case 9:                    //库存调拨=9
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-1") || CheckUserPopedoms("3-3-4-8-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 库存调拨单 列表!");
                        }
                        break;

                    case 10:                    //坏货=10
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-1") || CheckUserPopedoms("3-3-4-8-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 坏货单 列表!");
                        }
                        break;

                    case 11:                    //换货=11
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-1") || CheckUserPopedoms("3-3-4-8-2"))
                        {
                            switch (Act)
                            {
                            case "8":
                            case "v":
                                if (ispost)
                                {
                                    if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-2"))
                                    {
                                        oi = Orders.GetOrderInfoModel(this.orderid);

                                        if (oi != null)
                                        {
                                            if (oi.oSteps == 2 || oi.oSteps == 3)
                                            {
                                            }
                                            else
                                            {
                                                AddErrLine("无法 添加 记录,单据状态限制!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("参数错误!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("权限不足,无法 操作 列表!");
                                    }
                                }
                                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-3-4-8-1"))
                                {
                                    OrderWorkingType = 8;
                                }
                                else
                                {
                                    AddErrLine("权限不足,无法 查看 列表!");
                                }
                                break;
                            }
                        }
                        else
                        {
                            AddErrLine("权限不足,无法浏览 换货单 列表!");
                        }
                        break;

                    case 12:                    //修正数据
                        if (CheckUserPopedoms("X") || CheckUserPopedoms("7-2-1-5-7-1"))
                        {
                            IsEditData = true;
                        }
                        else
                        {
                            AddErrLine("权限不足,无法进行数据调整操作!");
                        }
                        break;
                    }

                    #endregion
                }
                else
                {
                    AddErrLine("参数错误,请返回!");
                }

                if (!IsErr())
                {
                    oOrderDateTime = (HTTPRequest.GetString("oOrderDateTime").Trim() != "") ? Convert.ToDateTime(Utils.ChkSQL(HTTPRequest.GetString("oOrderDateTime"))) : DateTime.Now;
                    string _OrderListDataJson = HTTPRequest.GetString("OrderListDataJson");
                    OrderWorkingLogMsg = Utils.ChkSQL(HTTPRequest.GetString("OrderWorkingLogMsg"));
                    string _splRemake = Utils.ChkSQL(HTTPRequest.GetString("splRemake"));
                    // oi = new OrderInfo();
                    switch (Act)
                    {
                        #region 查看,修改
                    case "v":
                    case "e":
                        oi = Orders.GetOrderInfoModel(orderid);
                        if (!ispost)
                        {
                            if (oi != null)
                            {
                                //CertificateList = Certificates.GetCertificateInfoList(" cObject=1 and cObjectID=" + oi.OrderID + " and cState=0 order by cDateTime desc").Tables[0];
                                PrepayMoney    = Certificates.GetPrepayMoneyByOrderID(oi.OrderID);
                                oOrderDateTime = oi.oOrderDateTime;

                                //是否为网购订单
                                _ms = M_Utils.GetM_SendGoodsInfoModelByOrderID(oi.OrderID);
                                if (_ms != null)
                                {
                                    IsMOrder = true;
                                }

                                //未审核,可修改
                                if (oi.oSteps == 1)
                                {
                                    this.ShowEdit = true;
                                    ShowTree      = true;
                                    IsVerify      = true;
                                }
                                else
                                {
                                    if (oi.oType != 11)                                    //非换货单可修改
                                    {
                                        if (oi.oPrepay == 1)
                                        {
                                            //是否已完成预付操作
                                            IsPrepayOK = Certificates.CheckCertificateByOrderID(oi.OrderID);
                                        }
                                        else
                                        {
                                            IsPrepayOK = true;
                                        }

                                        //已审核已发货
                                        if (oi.oSteps == 3)
                                        {
                                            this.ShowEdit = true;
                                        }
                                        else if (oi.oSteps >= 4)
                                        {
                                            //已经收货,已验收,已对账
                                            IsNOFull = Orders.CheckOrderIsFull(oi.OrderID);
                                        }
                                    }
                                    else
                                    {
                                        IsPrepayOK    = true;
                                        this.ShowEdit = false;
                                    }
                                }
                                OrderListDataJsonStr = "";                                //{"OrderListJson":[{"OrderListID":0,"OrderID":0,"StorageID":0,"ProductsID":0,"oQuantity":0,"oPrice":0,"oMoney":0,"StoresSupplierID":0,"IsPromotions":0,"oWorkType":0,"oAppendTime":"\/Date(1289206775426+0800)\/","OrderFieldValueInfo":[{"OrderFieldValueID":0,"OrderFieldID":0,"OrderListID":0,"oFieldValue":null,"IsVerify":0,"oAppendTime":"\/Date(1289206775426+0800)\/"}]}]}
                                string OrderFieldValueStr = "";
                                string tSteps             = "";
                                string tSteps_b           = "";

                                Order_QRCode_URL = "" + config.Sysurl + "/o-" + oi.OrderID + ".aspx?rc=" + Utils.UrlEncode(DES.Encode(oi.LastPrintDateTime.ToString() + "|" + oi.oOrderNum, config.Passwordkey)).Trim();


                                if (IsFirst)                                //输出原始单据
                                {
                                    tSteps   = " oWorkType=0";
                                    tSteps_b = " IsVerify=0";
                                }
                                else
                                {
                                    tSteps   = ((oi.oSteps == 1) ? " oWorkType=0" : " oWorkType<>0").ToString();
                                    tSteps_b = ((oi.oSteps == 1) ? " IsVerify=0" : " IsVerify<>0").ToString();
                                }

                                //取已收发列表
                                DataTable Storage_Order = tbStorageProductLogInfo.GetStorageProductLogListINOrderList(oi.OrderID).Tables[0];
                                if (Storage_Order != null)
                                {
                                    foreach (DataRow dr_Storage_Order in Storage_Order.Rows)
                                    {
                                        StorageOrderList += "{\"OrderListID\":" + dr_Storage_Order["OrderListID"].ToString() + "," +
                                                            "\"StorageID\":" + dr_Storage_Order["StorageID"].ToString() + "," +
                                                            "\"ProductsID\":" + dr_Storage_Order["ProductsID"].ToString() + "," +
                                                            "\"pQuantity\":" + dr_Storage_Order["pQuantity"].ToString() + "},";
                                    }
                                    if (StorageOrderList != "")
                                    {
                                        StorageOrderListJsonStr = "{\"StorageOrderList\":[" + Utils.ReSQLSetTxt(StorageOrderList) + "]}";
                                    }
                                }

                                //取单据列表
                                DataTable OrderListData = Orders.GetOrderListInfoList(" OrderID=" + oi.OrderID + " and " + tSteps + " order by OrderListID asc").Tables[0];
                                if (OrderListData != null)
                                {
                                    foreach (DataRow dr_OrderListData in OrderListData.Rows)
                                    {
                                        OrderFieldValueStr = "";
                                        DataTable OrderFieldValueData = Orders.GetOrderFieldValueInfoList(" OrderListID=" + dr_OrderListData["OrderListID"].ToString() + "and " + tSteps_b).Tables[0];
                                        foreach (DataRow dr_OrderFieldValueData in OrderFieldValueData.Rows)
                                        {
                                            OrderFieldValueStr += "{\"OrderFieldValueID\":" + dr_OrderFieldValueData["OrderFieldValueID"].ToString() + ",\"OrderFieldID\":" + dr_OrderFieldValueData["OrderFieldID"].ToString() + ",\"OrderListID\":" + dr_OrderFieldValueData["OrderListID"].ToString() + ",\"oFieldValue\":\"" + dr_OrderFieldValueData["oFieldValue"].ToString() + "\",\"IsVerify\":" + dr_OrderFieldValueData["IsVerify"].ToString() + ",\"oAppendTime\":\"" + dr_OrderFieldValueData["oAppendTime"].ToString() + "\"},";
                                        }
                                        if (OrderFieldValueStr != "")
                                        {
                                            OrderFieldValueStr = ",\"OrderFieldValueInfo\":[" + Utils.ReSQLSetTxt(OrderFieldValueStr) + "]";
                                        }
                                        OrderListDataJsonStr += "{\"OrderListID\":" + dr_OrderListData["OrderListID"].ToString() + "," +
                                                                "\"OrderID\":" + dr_OrderListData["OrderID"].ToString() + "," +
                                                                "\"StorageID\":" + dr_OrderListData["StorageID"].ToString() + "," +
                                                                "\"StorageName\":\"" + dr_OrderListData["StorageName"].ToString() + "\"," +
                                                                "\"ProductsID\":" + dr_OrderListData["ProductsID"].ToString() + "," +
                                                                "\"ProductsName\":\"" + Utils.ReplaceString(Utils.ReplaceString(dr_OrderListData["ProductsName"].ToString(), "'", "\\'", false), "\"", "\\\"", false) + "\"," +
                                                                "\"oQuantity\":" + dr_OrderListData["oQuantity"].ToString() + "," +
                                                                "\"oPrice\":" + dr_OrderListData["oPrice"].ToString() + "," +
                                                                "\"oMoney\":" + dr_OrderListData["oMoney"].ToString() + "," +
                                                                "\"StoresSupplierID\":" + dr_OrderListData["StoresSupplierID"].ToString() + "," +
                                                                "\"IsPromotions\":" + dr_OrderListData["IsPromotions"].ToString() + "," +
                                                                "\"oWorkType\":" + dr_OrderListData["oWorkType"].ToString() + "," +
                                                                "\"IsGifts\":" + dr_OrderListData["IsGifts"].ToString() + "," +
                                                                "\"oAppendTime\":\"" + dr_OrderListData["oAppendTime"].ToString() + "\"," +
                                                                "\"PriceClassID\":\"" + dr_OrderListData["PriceClassID"].ToString() + "\" " + OrderFieldValueStr + "},";
                                    }
                                    if (OrderListDataJsonStr.Trim() != "")
                                    {
                                        OrderListDataJsonStr = "{\"OrderListJson\":[" + Utils.ReSQLSetTxt(OrderListDataJsonStr) + "]}";
                                    }
                                }
                            }
                            else
                            {
                                AddErrLine("参数错误,单据列表不存在!");
                            }
                        }
                        break;
                        #endregion
                    }
                    if (ispost)
                    {
                        if (!IsEditData)
                        {
                            //非作废单据
                            if (oi.oState != 1)
                            {
                                if (oi.oSteps == 2 || oi.oSteps == 3)
                                {
                                }
                            }
                            else
                            {
                                AddErrLine("此单已作废,无法修改!");
                                AddScript("window.setTimeout('history.back(1);',2000);");
                            }
                        }
                        else
                        {
                            oi = new OrderInfo();
                        }

                        if (!IsErr())
                        {
                            //增加发货记录
                            spl.StorageID     = 0;                        //暂留无用
                            spl.StaffID       = this.userid;
                            spl.OrderID       = oi.OrderID;
                            spl.splRemake     = _splRemake;
                            spl.splAppendTime = DateTime.Now;


                            //Response.Write (_OrderListDataJson);
                            //	Response.End ();

                            spl.StorageOrderListDataJson = (StorageOrderListDataJson)JavaScriptConvert.DeserializeObject(_OrderListDataJson, typeof(StorageOrderListDataJson));

                            int StorageProductLogDataID = tbStorageProductLogInfo.AddStorageProductLogInfo(spl);

                            if (StorageProductLogDataID > 0)
                            {
                                AddMsgLine("保存成功!");

                                //更新当前在途库存情况
                                if (oi.oSteps == 2)
                                {
                                    oi.oSteps = 3;
                                    Orders.UpdateOrderInfo(oi);

                                    tbProductsInfo.UpdateProductsStorageByOrderID(orderid);

                                    OrderWorkingLogInfo owl = new OrderWorkingLogInfo();
                                    owl.OrderID     = oi.OrderID;
                                    owl.UserID      = this.userid;
                                    owl.oType       = 3;
                                    owl.oMsg        = OrderWorkingLogMsg;
                                    owl.pAppendTime = DateTime.Now;

                                    Orders.AddOrderWorkingLogInfo(owl);


                                    try
                                    {
                                        #region 发送邮件给收货人员
                                        //oi = Orders.GetOrderInfoModel(OrderID);
                                        switch (oi.oType)
                                        {
                                        case 1:                                        //采购入库
                                            UsersUtils.SendUserMailByPopedom("3-1-1-4", "采购入库单 等待收货处理,单号:" + oi.oOrderNum, "采购入库单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 2:                                        //采购退货
                                            UsersUtils.SendUserMailByPopedom("3-1-2-4", "采购退货单 等待收货处理,单号:" + oi.oOrderNum, "采购退货单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 3:                                        //销售发货
                                            UsersUtils.SendUserMailByPopedom("3-2-1-4", "销售发货单 等待收货处理,单号:" + oi.oOrderNum, "销售发货单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 4:                                        //销售退货
                                            UsersUtils.SendUserMailByPopedom("3-2-2-4", "销售退货单 等待收货处理,单号:" + oi.oOrderNum, "销售退货单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 5:                                        //赠品
                                            UsersUtils.SendUserMailByPopedom("3-2-3-4", "赠品单 等待收货处理,单号:" + oi.oOrderNum, "赠品单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 6:                                        //样品
                                            UsersUtils.SendUserMailByPopedom("3-2-4-4", "样品单 等待收货处理,单号:" + oi.oOrderNum, "样品单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 7:                                        //代购
                                            UsersUtils.SendUserMailByPopedom("3-2-5-4", "代购单 等待收货处理,单号:" + oi.oOrderNum, "代购单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 11:                                        //换货
                                            UsersUtils.SendUserMailByPopedom("3-2-6-4", "换货单 等待收货处理,单号:" + oi.oOrderNum, "换货单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 10:                                        //坏货
                                            UsersUtils.SendUserMailByPopedom("3-3-3-4", "坏货单 等待收货处理,单号:" + oi.oOrderNum, "坏货单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 8:                                        //库存调整
                                            UsersUtils.SendUserMailByPopedom("3-3-1-4", "库存调整单 等待收货处理,单号:" + oi.oOrderNum, "库存调整单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;

                                        case 9:                                        //库存调拨
                                            UsersUtils.SendUserMailByPopedom("3-3-2-4", "库存调拨单 等待收货处理,单号:" + oi.oOrderNum, "库存调拨单 等待收货处理,单号:" + oi.oOrderNum);
                                            break;
                                        }
                                        #endregion


                                        switch (oi.oType)
                                        {
                                        case 3:
                                        case 4:
                                        case 5:
                                        case 6:
                                            #region 发邮件给业务员
                                            if (oi.StaffID != 0)
                                            {
                                                tbStaffInfo.SendMailToStaff(oi.StaffID, tbStoresInfo.GetStoresInfoModel(oi.StoresSupplierID).sName + "," + GetOrderType(oi.oType.ToString()) + "单:" + oi.oOrderNum + "已发货.", "客户:" + tbStoresInfo.GetStoresInfoModel(oi.StoresSupplierID).sName + ",的" + GetOrderType(oi.oType.ToString()) + "单,单号:" + oi.oOrderNum + "已发货等待收货,请注意跟踪.<br>单据处理情况:" + config.Sysurl + "/o-" + oi.OrderID + ".aspx?rc=" + Utils.UrlEncode(DES.Encode(oi.LastPrintDateTime.ToString() + "|" + oi.oOrderNum, config.Passwordkey)).Trim());
                                            }
                                            #endregion

                                            #region 给客户发邮件
                                            tbStoresInfo.SendMailToStores(oi.StoresSupplierID, GetOrderType(oi.oType.ToString()) + "单 已发货,单号:" + oi.oOrderNum, GetOrderType(oi.oType.ToString()) + "单 已发货,单号:" + oi.oOrderNum);
                                            #endregion
                                            break;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        AddErrLine(ex.Message);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
            if (format == "json")
            {
                Response.ClearContent();
                Response.Buffer          = true;
                Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1);
                Response.Expires         = 0;

                Response.Charset         = "utf-8";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                Response.ContentType     = "application/json";
                string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"}" + MS_Json + "}";
                Response.Write(Json_Str);
                Response.End();
            }
        }
예제 #6
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-2"))
                {
                    string tSQL = "";
                    OrderID   = HTTPRequest.GetInt("orderid", 0);
                    ordertype = HTTPRequest.GetInt("ordertype", 0);
                    Act       = HTTPRequest.GetString("Act");

                    if (!ispost)
                    {
                        //对账时使用
                        if (Act == "s")
                        {
                            //int sObjectType = HTTPRequest.GetInt("sObjectType", -1);
                            //int sObjectID = HTTPRequest.GetInt("sObjectID", -1);
                            //if (sObjectType > -1 && sObjectID > -1)
                            //{

                            //    tSQL = "cObject=0 and toObject=" + sObjectType + " and toObjectID=" + sObjectID + " and cState=0";

                            //    cCode = Utils.ChkSQL(HTTPRequest.GetServerString("cCode"));
                            //    if (cCode.Trim() != "")
                            //    {
                            //        tSQL += " and cCode like '%" + cCode + "%'";
                            //    }
                            //    cType = HTTPRequest.GetInt("cType", -1);
                            //    if (cType > -1)
                            //    {
                            //        tSQL += " and cType=" + cType;
                            //    }

                            //    dList = Certificates.GetCertificateInfoList(tSQL+"  order by cDateTime desc").Tables[0];
                            //}
                            //else {
                            //    dList = Certificates.GetCertificateInfoList(" cObject=0 and cState=0 order by cDateTime desc").Tables[0];
                            //}
                            tSQL    = " cObject=0 and cState=0  ";
                            cNumber = HTTPRequest.GetString("cNumber");
                            if (Utils.StrToInt(cNumber, 0) > 0)
                            {
                                tSQL += " and cNumber = " + cNumber + "";
                            }
                            cType = HTTPRequest.GetInt("cType", -1);
                            if (cType > -1)
                            {
                                tSQL += " and cType=" + cType;
                            }
                            cDateTimeB = Utils.ChkSQL(HTTPRequest.GetString("cDateTimeB"));
                            if (cDateTimeB.Trim() != "" && Utils.IsDateString(cDateTimeB.Trim()))
                            {
                                tSQL += " and cDateTime>='" + cDateTimeB.Trim() + "  00:00:00 '";
                            }
                            cDateTimeE = Utils.ChkSQL(HTTPRequest.GetString("cDateTimeE"));
                            if (cDateTimeE.Trim() != "" && Utils.IsDateString(cDateTimeE.Trim()))
                            {
                                tSQL += " and cDateTime<='" + cDateTimeE.Trim() + "  23:59:59 '";
                            }
                            dList = Certificates.GetCertificateInfoList(tSQL + " order by cDateTime desc").Tables[0];
                        }
                        else
                        {
                            dList = Certificates.GetCertificateInfoList(" cObject=1 and cObjectID=" + OrderID + " and cState=0 order by cDateTime desc").Tables[0];
                        }
                    }
                    else
                    {
                        string CertificateIDStr = HTTPRequest.GetString("CertificateIDStr");//凭证系统编号集合,逗号分割
                        string tMsg             = "";
                        string format           = "";
                        //json操作部分,返回json
                        if (Act == "Finish")//凭证随附操作完成
                        {
                            format = "json";
                            if (CheckUserPopedoms("X") || CheckUserPopedoms("3-1-1-10"))
                            {
                                try
                                {
                                    OrderInfo oi = Orders.GetOrderInfoModel(OrderID);
                                    if (oi != null)
                                    {
                                        if (oi.oState != 1)
                                        {
                                            if (oi.oSteps == 2)
                                            {
                                                oi.oSteps = 3;
                                                Orders.UpdateOrderInfo(oi);

                                                tbProductsInfo.UpdateProductsStorageByOrderID(OrderID);//更新当前在途库存情况

                                                OrderWorkingLogInfo owl       = new OrderWorkingLogInfo();
                                                decimal             _sumMoney = 0;

                                                if (CertificateIDStr.Trim() != "")
                                                {
                                                    string[] CertificateIDStrArray = Utils.SplitString(CertificateIDStr, ",");
                                                    if (CertificateIDStrArray.Length > 0)
                                                    {
                                                        CertificateInfo _ci = new CertificateInfo();
                                                        try
                                                        {
                                                            foreach (string _tStr in CertificateIDStrArray)
                                                            {
                                                                if (_tStr.Trim() != "")
                                                                {
                                                                    _ci = Certificates.GetCertificateInfoModel(Convert.ToInt32(_tStr));
                                                                    if (_ci != null)
                                                                    {
                                                                        _sumMoney += _ci.cMoney;
                                                                        tMsg      += "凭证号:" + _ci.cCode + ",单位:" + _ci.toObjectName + ",金额:" + _ci.cMoney + ";";
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        finally
                                                        {
                                                            _ci = null;
                                                        }
                                                    }
                                                }

                                                owl.OrderID     = oi.OrderID;
                                                owl.UserID      = this.userid;
                                                owl.oType       = 9;
                                                owl.oMsg        = (tMsg.Trim() != "") ? "随附凭证,合计金额:" + _sumMoney.ToString() + ",凭证摘要:" + tMsg + " ,完成财务操作." : "没有任何凭证随附.";
                                                owl.pAppendTime = DateTime.Now;

                                                Orders.AddOrderWorkingLogInfo(owl);

                                                owl.OrderID     = oi.OrderID;
                                                owl.UserID      = this.userid;
                                                owl.oType       = 3;
                                                owl.oMsg        = "系统自动发货处理,等待收货.";
                                                owl.pAppendTime = DateTime.Now;

                                                Orders.AddOrderWorkingLogInfo(owl);

                                                AddMsgLine("发货 操作成功!");
                                            }
                                            else
                                            {
                                                AddErrLine("单据非 已审核 待 发货 状态,无法进行 发货 操作!请重试!");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("此单已作废!");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("参数错误,该单据不存在!请重试!");
                                    }
                                }
                                catch
                                {
                                    AddErrLine("发货 操作失败!请重试!");
                                }
                            }
                            else
                            {
                                AddErrLine("权限不足!");
                            }
                        }


                        if (format == "json")
                        {
                            Response.ClearContent();
                            Response.Buffer          = true;
                            Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1);
                            Response.Expires         = 0;

                            Response.Charset         = "utf-8";
                            Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                            Response.ContentType     = "application/json";
                            string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"}}";
                            Response.Write(Json_Str);
                            Response.End();
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        public DataTable StorageList = new DataTable();//仓库列表
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-4-2"))
                {
                    OrderID   = HTTPRequest.GetInt("orderid", 0);
                    OrderType = HTTPRequest.GetInt("ordertype", 0);
                    if (OrderID > 0)
                    {
                        oi = Orders.GetOrderInfoModel(OrderID);
                        if (oi != null)
                        {
                            if (!ispost)
                            {
                                dList       = Orders.GetOrderNOFullList(OrderID);
                                StorageList = tbStorageInfo.GetStorageInfoList("").Tables[0];
                            }
                            else
                            {
                                int loop_count = HTTPRequest.GetInt("loop_count", 0);
                                if (loop_count > 0)
                                {
                                    int     s_StorageID        = 0;
                                    int     ProductsID         = 0;
                                    decimal Quantity           = 0;
                                    int     t_StorageID        = 0;
                                    string  _OrderListDataJson = "";
                                    for (int i = 1; i <= loop_count; i++)
                                    {
                                        s_StorageID = HTTPRequest.GetInt("s_StorageID_" + i, 0);
                                        ProductsID  = HTTPRequest.GetInt("ProductsID_" + i, 0);
                                        t_StorageID = HTTPRequest.GetInt("t_StorageID_" + i, 0);
                                        Quantity    = HTTPRequest.GetString("Quantity_" + i).Trim() != "" ? Convert.ToDecimal(HTTPRequest.GetString("Quantity_" + i).Trim()) : 0;

                                        if (s_StorageID > 0 && ProductsID > 0)
                                        {
                                            if (t_StorageID > 0)
                                            {
                                                _OrderListDataJson += "{\"OrderListID\":0," +
                                                                      "\"OrderID\":0," +
                                                                      "\"StorageID\":" + s_StorageID + "," +
                                                                      "\"ProductsID\":" + ProductsID + "," +
                                                                      "\"oQuantity\":" + (0 - Quantity) + "," +
                                                                      "\"oPrice\":0," +
                                                                      "\"oMoney\":0," +
                                                                      "\"StoresSupplierID\":0," +
                                                                      "\"IsPromotions\":0," +
                                                                      "\"oWorkType\":0," +
                                                                      "\"oAppendTime\":\"" + DateTime.Now + "\"},";

                                                _OrderListDataJson += "{\"OrderListID\":0," +
                                                                      "\"OrderID\":0," +
                                                                      "\"StorageID\":" + t_StorageID + "," +
                                                                      "\"ProductsID\":" + ProductsID + "," +
                                                                      "\"oQuantity\":" + Quantity + "," +
                                                                      "\"oPrice\":0," +
                                                                      "\"oMoney\":0," +
                                                                      "\"StoresSupplierID\":0," +
                                                                      "\"IsPromotions\":0," +
                                                                      "\"oWorkType\":0," +
                                                                      "\"oAppendTime\":\"" + DateTime.Now + "\"},";
                                            }
                                            else
                                            {
                                                _OrderListDataJson += "{\"OrderListID\":0," +
                                                                      "\"OrderID\":0," +
                                                                      "\"StorageID\":" + s_StorageID + "," +
                                                                      "\"ProductsID\":" + ProductsID + "," +
                                                                      "\"oQuantity\":" + (0 - Quantity) + "," +
                                                                      "\"oPrice\":0," +
                                                                      "\"oMoney\":0," +
                                                                      "\"StoresSupplierID\":0," +
                                                                      "\"IsPromotions\":0," +
                                                                      "\"oWorkType\":0," +
                                                                      "\"oAppendTime\":\"" + DateTime.Now + "\"},";

                                                _OrderListDataJson += "{\"OrderListID\":0," +
                                                                      "\"OrderID\":0," +
                                                                      "\"StorageID\":" + s_StorageID + "," +
                                                                      "\"ProductsID\":" + ProductsID + "," +
                                                                      "\"oQuantity\":" + Quantity + "," +
                                                                      "\"oPrice\":0," +
                                                                      "\"oMoney\":0," +
                                                                      "\"StoresSupplierID\":0," +
                                                                      "\"IsPromotions\":0," +
                                                                      "\"oWorkType\":0," +
                                                                      "\"oAppendTime\":\"" + DateTime.Now + "\"},";
                                            }
                                        }
                                    }
                                    if (_OrderListDataJson.Trim() != "")
                                    {
                                        _OrderListDataJson = "{\"OrderListJson\":[" + Utils.ReSQLSetTxt(_OrderListDataJson) + "]}";
                                    }

                                    OrderInfo       _oi = new OrderInfo();
                                    OrderNOFullInfo _of = new OrderNOFullInfo();

                                    _oi.oOrderNum         = Orders.GetNewOrderNum();
                                    _oi.oType             = 9;//调拨
                                    _oi.StoresID          = 0;
                                    _oi.oCustomersName    = "";
                                    _oi.oCustomersContact = "";
                                    _oi.oCustomersTel     = "";
                                    _oi.oCustomersAddress = "";
                                    _oi.oCustomersOrderID = "";
                                    _oi.oCustomersNameB   = "";
                                    _oi.StaffID           = 0;
                                    _oi.UserID            = this.userid;
                                    _oi.oAppendTime       = DateTime.Now;
                                    _oi.oOrderDateTime    = DateTime.Now;
                                    _oi.oState            = 0;
                                    _oi.oSteps            = 1;
                                    _oi.OrderListDataJson = (OrderListDataJson)JavaScriptConvert.DeserializeObject(_OrderListDataJson, typeof(OrderListDataJson));
                                    int ToOrderID = Orders.AddOrderInfoAndList(_oi);
                                    if (ToOrderID > 0)
                                    {
                                        for (int i = 1; i <= loop_count; i++)
                                        {
                                            s_StorageID = HTTPRequest.GetInt("s_StorageID_" + i, 0);
                                            ProductsID  = HTTPRequest.GetInt("ProductsID_" + i, 0);
                                            t_StorageID = HTTPRequest.GetInt("t_StorageID_" + i, 0);
                                            Quantity    = HTTPRequest.GetString("Quantity_" + i).Trim() != "" ? Convert.ToDecimal(HTTPRequest.GetString("Quantity_" + i).Trim()) : 0;

                                            if (s_StorageID > 0 && ProductsID > 0)
                                            {
                                                if (t_StorageID > 0)
                                                {
                                                    _of.OrderID       = OrderID;
                                                    _of.OrderToID     = ToOrderID;
                                                    _of.ProductsID    = ProductsID;
                                                    _of.FormStorageID = s_StorageID;
                                                    _of.ToStorageID   = t_StorageID;
                                                    _of.oQuantity     = Quantity;
                                                    _of.oState        = 0;
                                                    _of.oAppendTimie  = DateTime.Now;
                                                    _of.UserID        = this.userid;

                                                    Orders.AddOrderNOFullInfo(_of);
                                                }
                                                else
                                                {
                                                    _of.OrderID       = OrderID;
                                                    _of.OrderToID     = ToOrderID;
                                                    _of.ProductsID    = ProductsID;
                                                    _of.FormStorageID = s_StorageID;
                                                    _of.ToStorageID   = s_StorageID;
                                                    _of.oQuantity     = Quantity;
                                                    _of.oState        = 0;
                                                    _of.oAppendTimie  = DateTime.Now;
                                                    _of.UserID        = this.userid;

                                                    Orders.AddOrderNOFullInfo(_of);
                                                }
                                            }
                                        }

                                        //审核
                                        _oi = Orders.GetOrderInfoModel(ToOrderID);
                                        Orders.VerifyOrder(_oi.OrderID);
                                        tbProductsInfo.UpdateProductsStorageByOrderID(OrderID);//更新当前在途库存情况


                                        OrderWorkingLogInfo owl = new OrderWorkingLogInfo();

                                        //原单操作记录
                                        owl.OrderID     = oi.OrderID;
                                        owl.UserID      = this.userid;
                                        owl.oType       = 7;
                                        owl.oMsg        = "非全额单据,调拨处理,系统自动完成,原单据:" + oi.oOrderNum + ",调拨单据:" + _oi.oOrderNum;
                                        owl.pAppendTime = DateTime.Now;

                                        Orders.AddOrderWorkingLogInfo(owl);

                                        //调拨单操作记录
                                        owl.OrderID     = _oi.OrderID;
                                        owl.UserID      = this.userid;
                                        owl.oType       = 2;
                                        owl.oMsg        = "非全额单据,调拨处理,系统自动完成,原单据:" + oi.oOrderNum;
                                        owl.pAppendTime = DateTime.Now;

                                        Orders.AddOrderWorkingLogInfo(owl);
                                        _oi.oSteps = 3;
                                        Orders.UpdateOrderInfo(_oi);

                                        tbProductsInfo.UpdateProductsStorageByOrderID(ToOrderID);//更新当前在途库存情况

                                        owl             = new OrderWorkingLogInfo();
                                        owl.OrderID     = _oi.OrderID;
                                        owl.UserID      = this.userid;
                                        owl.oType       = 3;
                                        owl.oMsg        = "非全额单据,调拨处理,系统自动完成,原单据:" + oi.oOrderNum;
                                        owl.pAppendTime = DateTime.Now;

                                        Orders.AddOrderWorkingLogInfo(owl);
                                        //完成收货操作
                                        _oi.oSteps = 4;
                                        Orders.UpdateOrderInfo(_oi);

                                        tbProductsInfo.UpdateProductsStorageByOrderID(ToOrderID);//更新当前在途库存情况

                                        owl             = new OrderWorkingLogInfo();
                                        owl.OrderID     = _oi.OrderID;
                                        owl.UserID      = this.userid;
                                        owl.oType       = 4;
                                        owl.oMsg        = "非全额单据,调拨处理,系统自动完成,原单据:" + oi.oOrderNum;
                                        owl.pAppendTime = DateTime.Now;

                                        Orders.AddOrderWorkingLogInfo(owl);

                                        //完成核销操作
                                        _oi.oSteps = 5;
                                        Orders.UpdateOrderInfo(_oi);

                                        tbProductsInfo.UpdateProductsStorageByOrderID(ToOrderID);//更新当前在途库存情况

                                        owl             = new OrderWorkingLogInfo();
                                        owl.OrderID     = _oi.OrderID;
                                        owl.UserID      = this.userid;
                                        owl.oType       = 5;
                                        owl.oMsg        = "非全额单据,调拨处理,系统自动完成,原单据:" + oi.oOrderNum;
                                        owl.pAppendTime = DateTime.Now;

                                        Orders.AddOrderWorkingLogInfo(owl);

                                        AddMsgLine("非全额收获单处理完成!转调拨单:" + _oi.oOrderNum);
                                        AddScript("window.setTimeout('parent.location=parent.location;',2000);");
                                    }
                                    else
                                    {
                                        AddErrLine("操作失败!");
                                    }
                                }
                                else
                                {
                                    AddErrLine("数据错误!");
                                }
                            }
                        }
                        else
                        {
                            AddErrLine("参数错误,单据不存在!");
                        }
                    }
                    else
                    {
                        AddErrLine("参数错误!");
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
예제 #8
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            string Act      = HTTPRequest.GetString("Act");
            int    pagesize = HTTPRequest.GetInt("pagesize", 0);
            int    page     = HTTPRequest.GetInt("page", 0);

            ProductList = tbProductsInfo.GetProductsInfoList("").Tables[0];

            if (Act != "")
            {
                Response.ClearContent();
                Response.Buffer          = true;
                Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1);

                Response.Expires = 0;
                string Json_Str = "";

                if (ispost)
                {
                    if (Act == "Add")
                    {
                        try
                        {
                            string JsonStr = HTTPRequest.GetString("json");
                            Order  oo      = (Order)JavaScriptConvert.DeserializeObject(JsonStr, typeof(Order));
                            if (oo != null)
                            {
                                if (oo.O_ORDERNUM.Trim() != "")
                                {
                                    if (!Orders.ExistsOrderInfo(oo.O_ORDERNUM))
                                    {
                                        bool      isneworder = false;
                                        OrderInfo oi         = new OrderInfo();
                                        oi.oOrderNum = oo.O_ORDERNUM;
                                        oi.oType     = (oo.O_REMARK == "4") ? 1 : (oo.O_REMARK == "8") ? 2 : (oo.O_REMARK == "1") ? 3 : (oo.O_REMARK == "5") ? 4 : (oo.O_REMARK == "2") ? 5 : (oo.O_REMARK == "3") ? 6 : (oo.O_REMARK == "7") ? 7 : (oo.O_REMARK == "6") ? 10 : 0;
                                        switch (oi.oType)
                                        {
                                        case 1:
                                        case 2:    //供货商
                                            SupplierInfo si = new SupplierInfo();
                                            try
                                            {
                                                si = tbSupplierInfo.GetSupplierInfoModelByName(oo.c_name);
                                                if (si != null)
                                                {
                                                    oi.StoresID          = si.SupplierID;
                                                    oi.oCustomersName    = si.sName;
                                                    oi.oCustomersContact = si.sLinkMan;
                                                    oi.oCustomersTel     = si.sTel;
                                                    oi.oCustomersAddress = si.sAddress;
                                                }
                                            }
                                            finally
                                            {
                                                si = null;
                                            }
                                            break;

                                        case 3:
                                        case 4:
                                        case 5:
                                        case 6:
                                        case 7:
                                            StoresInfo sti = new StoresInfo();
                                            try
                                            {
                                                sti = tbStoresInfo.GetStoresInfoModelByName(oo.c_name);
                                                if (sti != null)
                                                {
                                                    oi.StoresID          = sti.StoresID;
                                                    oi.oCustomersName    = sti.sName;
                                                    oi.oCustomersContact = sti.sContact;
                                                    oi.oCustomersTel     = sti.sTel;
                                                    oi.oCustomersAddress = sti.sAddress;
                                                }
                                            }
                                            finally
                                            {
                                                sti = null;
                                            }
                                            break;

                                        case 10:
                                            oi.StoresID          = 0;
                                            oi.oCustomersName    = "";
                                            oi.oCustomersContact = "";
                                            oi.oCustomersTel     = "";
                                            oi.oCustomersAddress = "";
                                            break;
                                        }

                                        oi.oCustomersOrderID = oo.C_ORDERID;
                                        oi.oCustomersNameB   = oo.C_MD;
                                        StaffInfo sai = new StaffInfo();
                                        sai = tbStaffInfo.GetStaffInfoModelByName(oo.sa_name);
                                        if (sai != null)
                                        {
                                            oi.StaffID = sai.StaffID;
                                        }
                                        oi.UserID         = this.userid;
                                        oi.oAppendTime    = Convert.ToDateTime(oo.O_TIME);
                                        oi.oOrderDateTime = Convert.ToDateTime(oo.O_CREATETIME);
                                        oi.oState         = 0;
                                        oi.oSteps         = 1;

                                        isneworder = (oo.O_ISCHECK == "1") ? true : false;

                                        string tListStr = "";

                                        if (oo.OrderData != null)
                                        {
                                            foreach (OrderData od in oo.OrderData)
                                            {
                                                ProductsInfo pi = new ProductsInfo();
                                                try
                                                {
                                                    pi = tbProductsInfo.GetProductsInfoModelByName(od.p_name);
                                                    if (pi == null)
                                                    {
                                                        pi = tbProductsInfo.GetProductsInfoModelByBarcode(od.p_code);
                                                    }

                                                    tListStr += "{\"OrderListID\":0,\"OrderID\":0,\"StorageID\":1,\"ProductsID\":" + pi.ProductsID + ",\"oQuantity\":" + Convert.ToDecimal(od.s_quantity) + ",\"oPrice\":" + Convert.ToDecimal(od.s_price) + ",\"oMoney\":" + Convert.ToDecimal(od.s_total) + ",\"StoresSupplierID\":" + oi.StoresSupplierID + ",\"IsPromotions\":0,\"oWorkType\":0,\"oAppendTime\":\"" + oi.oAppendTime + "\"," +
                                                                "\"OrderFieldValueInfo\":[{\"OrderFieldValueID\":0,\"OrderFieldID\":1,\"OrderListID\":0,\"oFieldValue\":\"" + od.makedate + "\",\"IsVerify\":0,\"oAppendTime\":\"" + oi.oAppendTime + "\"}," +
                                                                "{\"OrderFieldValueID\":0,\"OrderFieldID\":2,\"OrderListID\":0,\"oFieldValue\":\"" + od.Manufacturers + "\",\"IsVerify\":0,\"oAppendTime\":\"" + oi.oAppendTime + "\"}," +
                                                                "{\"OrderFieldValueID\":0,\"OrderFieldID\":3,\"OrderListID\":0,\"oFieldValue\":\"" + od.Durability + "\",\"IsVerify\":0,\"oAppendTime\":\"" + oi.oAppendTime + "\"}]},";
                                                }
                                                finally
                                                {
                                                    pi = null;
                                                }
                                            }
                                        }
                                        if (tListStr.Trim() != "")
                                        {
                                            tListStr = tListStr.Substring(0, tListStr.Length - 1);
                                        }
                                        tListStr = "{\"OrderListJson\":[" + tListStr + "]}";

                                        oi.OrderListDataJson = (OrderListDataJson)JavaScriptConvert.DeserializeObject(tListStr, typeof(OrderListDataJson));;
                                        int OrderID = Orders.AddOrderInfoAndList(oi);
                                        {
                                            oi = Orders.GetOrderInfoModel(OrderID);

                                            //完成审核操作
                                            Orders.VerifyOrder(oi.OrderID);

                                            tbProductsInfo.UpdateProductsStorageByOrderID(OrderID);//更新当前在途库存情况

                                            OrderWorkingLogInfo owl = new OrderWorkingLogInfo();
                                            owl.OrderID     = oi.OrderID;
                                            owl.UserID      = this.userid;
                                            owl.oType       = 2;
                                            owl.oMsg        = "数据迁移,系统自动处理";
                                            owl.pAppendTime = oi.oAppendTime;

                                            Orders.AddOrderWorkingLogInfo(owl);

                                            if (!isneworder)
                                            {
                                                //完成发货操作
                                                oi.oSteps = 3;
                                                Orders.UpdateOrderInfo(oi);

                                                tbProductsInfo.UpdateProductsStorageByOrderID(OrderID);//更新当前在途库存情况

                                                owl             = new OrderWorkingLogInfo();
                                                owl.OrderID     = oi.OrderID;
                                                owl.UserID      = this.userid;
                                                owl.oType       = 3;
                                                owl.oMsg        = "数据迁移,系统自动处理";
                                                owl.pAppendTime = oi.oAppendTime;

                                                Orders.AddOrderWorkingLogInfo(owl);
                                                //完成收货操作
                                                oi.oSteps = 4;
                                                Orders.UpdateOrderInfo(oi);

                                                tbProductsInfo.UpdateProductsStorageByOrderID(OrderID);//更新当前在途库存情况

                                                owl             = new OrderWorkingLogInfo();
                                                owl.OrderID     = oi.OrderID;
                                                owl.UserID      = this.userid;
                                                owl.oType       = 4;
                                                owl.oMsg        = "数据迁移,系统自动处理";
                                                owl.pAppendTime = oi.oAppendTime;

                                                Orders.AddOrderWorkingLogInfo(owl);

                                                //完成核销操作
                                                oi.oSteps = 5;
                                                Orders.UpdateOrderInfo(oi);

                                                tbProductsInfo.UpdateProductsStorageByOrderID(OrderID);//更新当前在途库存情况

                                                owl             = new OrderWorkingLogInfo();
                                                owl.OrderID     = oi.OrderID;
                                                owl.UserID      = this.userid;
                                                owl.oType       = 5;
                                                owl.oMsg        = "数据迁移,系统自动处理";
                                                owl.pAppendTime = oi.oAppendTime;

                                                Orders.AddOrderWorkingLogInfo(owl);
                                            }
                                            else
                                            {
                                                //完成发货操作
                                                oi.oSteps = 3;
                                                Orders.UpdateOrderInfo(oi);

                                                tbProductsInfo.UpdateProductsStorageByOrderID(OrderID);//更新当前在途库存情况

                                                owl             = new OrderWorkingLogInfo();
                                                owl.OrderID     = oi.OrderID;
                                                owl.UserID      = this.userid;
                                                owl.oType       = 3;
                                                owl.oMsg        = "数据迁移,系统自动处理";
                                                owl.pAppendTime = oi.oAppendTime;
                                            }
                                        }
                                        Json_Str = "{\"results\": true,\"msg\":\"" + oi.OrderID + "\",\"orderid\":\"" + oo.O_ORDERNUM + "\"}";
                                    }
                                    else
                                    {
                                        Json_Str = "{\"results\": false,\"msg\":\"单据已存在.\",\"orderid\":\"" + oo.O_ORDERNUM + "\"}";
                                    }
                                }
                                else
                                {
                                    Json_Str = "{\"results\": false,\"msg\":\"对象为空.\"}";
                                }
                            }
                            else
                            {
                                Json_Str = "{\"results\": false,\"msg\":\"单号为空.\"}";
                            }
                        }
                        catch (Exception ex)
                        {
                            Json_Str = "{\"results\": false,\"msg\":\"" + ex.Message + "," + ex.Data + "\"}";
                        }
                        Response.Charset         = "utf-8";
                        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                        Response.ContentType     = "application/json";

                        Response.Write(Json_Str);
                    }
                    if (Act == "PAttribute")
                    {
                        int     ProductID    = HTTPRequest.GetInt("pid", 0);
                        string  JsonStr      = HTTPRequest.GetString("JsonStr");
                        int     PriceClassID = 0;
                        decimal Price        = 0;
                        if (ProductID > 0 && JsonStr.Trim() != "")
                        {
                            PAttribute oo = (PAttribute)JavaScriptConvert.DeserializeObject(JsonStr, typeof(PAttribute));
                            if (oo != null)
                            {
                                foreach (PAttributePrice pa in oo.PAttributePrice)
                                {
                                    if (pa != null)
                                    {
                                        if (pa.pr_Name.Trim() != "")
                                        {
                                            try
                                            {
                                                Price        = Convert.ToDecimal(pa.a_Price);
                                                PriceClassID = DataClass.GetPriceClassInfoModel(pa.pr_Name).PriceClassID;
                                                tbPriceClassDefaultPriceInfo.SavePriceClassDefaultPrice(PriceClassID, ProductID, Price, 0);
                                            }
                                            catch
                                            {
                                            }
                                        }
                                    }
                                }
                            }
                            Response.Charset         = "utf-8";
                            Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                            Response.ContentType     = "application/json";

                            Response.Write("{\"results\": true,\"msg\":\"OK.\",\"PID\":" + ProductID + "}");
                        }
                    }
                }
                else
                {
                    if (Act == "GetOrderList" || Act == "GetPAttribute")
                    {
                        WebClient client = new WebClient();
                        byte[]    bytes  = null;
                        if (Act == "GetOrderList")
                        {
                            bytes = client.DownloadData(new Uri("http://erp.bdu9.com/datapost.aspx?Act=" + Act + "&pagesize=" + pagesize + "&page=" + page + ""));
                        }
                        if (Act == "GetPAttribute")
                        {
                            bytes = client.DownloadData(new Uri("http://erp.bdu9.com/datapost.aspx?Act=" + Act + "&pid=" + HTTPRequest.GetInt("pid", 0) + "&pname=" + tbProductsInfo.GetProductsInfoModel(HTTPRequest.GetInt("pid", 0)).pName));
                        }
                        if (bytes.Length == 0)
                        {
                            Response.ContentType = "text/plain";
                            Response.Write("(not loaded)");
                        }
                        else
                        {
                            Response.BinaryWrite(bytes);
                        }
                    }
                }

                Response.End();
            }
        }
예제 #9
0
 public static void UpdateOrderWorkingLogInfo(OrderWorkingLogInfo model)
 {
     DatabaseProvider.GetInstance().UpdateOrderWorkingLogInfo(model);
 }
예제 #10
0
 public static int AddOrderWorkingLogInfo(OrderWorkingLogInfo model)
 {
     return(DatabaseProvider.GetInstance().AddOrderWorkingLogInfo(model));
 }
예제 #11
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("8-3-2-1"))
                {
                    Act = HTTPRequest.GetString("Act");
                    m_TradeInfoID_Str = HTTPRequest.GetString("m_TradeInfoID");
                    if (m_TradeInfoID_Str.Trim() != "")
                    {
                        m_TradeInfoID_Str = Utils.ReSQLSetTxt("," + m_TradeInfoID_Str + ",");

                        if (ispost)
                        {
                            OrderInfo oi = new OrderInfo();

                            string receiver_state    = Utils.ChkSQL(HTTPRequest.GetString("receiver_state"));
                            string receiver_city     = Utils.ChkSQL(HTTPRequest.GetString("receiver_city"));
                            string receiver_district = Utils.ChkSQL(HTTPRequest.GetString("receiver_district"));
                            string receiver_address  = Utils.ChkSQL(HTTPRequest.GetString("receiver_address"));
                            string receiver_zip      = Utils.ChkSQL(HTTPRequest.GetString("receiver_zip"));
                            string receiver_name     = Utils.ChkSQL(HTTPRequest.GetString("receiver_name"));
                            string receiver_mobile   = Utils.ChkSQL(HTTPRequest.GetString("receiver_mobile"));
                            string receiver_phone    = Utils.ChkSQL(HTTPRequest.GetString("receiver_phone"));

                            string from_name     = Utils.ChkSQL(HTTPRequest.GetString("from_name"));
                            string from_state    = Utils.ChkSQL(HTTPRequest.GetString("from_state"));
                            string from_city     = Utils.ChkSQL(HTTPRequest.GetString("from_city"));
                            string from_district = Utils.ChkSQL(HTTPRequest.GetString("from_district"));
                            string from_address  = Utils.ChkSQL(HTTPRequest.GetString("from_address"));
                            string from_zip      = Utils.ChkSQL(HTTPRequest.GetString("from_zip"));
                            string from_mobile   = Utils.ChkSQL(HTTPRequest.GetString("from_mobile"));
                            string from_phone    = Utils.ChkSQL(HTTPRequest.GetString("from_phone"));


                            int    ExpName = HTTPRequest.GetInt("ExpName", 0);
                            string ExpNO   = Utils.ChkSQL(HTTPRequest.GetString("ExpNO"));
                            string tMsg    = Utils.ChkSQL(HTTPRequest.GetString("tMsg"));

                            int    m_SendGoodsID      = HTTPRequest.GetInt("m_SendGoodsID", 0);
                            string _OrderListDataJson = HTTPRequest.GetString("OrderListDataJson");

                            //创建发货单
                            if (Act == "Add")
                            {
                                try {
                                    oi.oOrderNum = "----------";// Orders.GetNewOrderNum();
                                    //if (!Orders.ExistsOrderInfo(oi.oOrderNum))
                                    {
                                        oi.oType             = 3;                                      //销售发货单
                                        oi.StoresID          = M_Config.StoresID;                      //系统客户编号
                                        oi.oCustomersName    = M_Config.StoresName;                    //客户名称,
                                        oi.oCustomersContact = receiver_name;                          //联系人
                                        oi.oCustomersTel     = receiver_mobile + "," + receiver_phone; //联系电话
                                        oi.oCustomersAddress = receiver_address;                       //地址
                                        oi.oCustomersOrderID = m_TradeInfoID_Str;                      //客户订单号
                                        oi.oCustomersNameB   = "";
                                        oi.StaffID           = 0;                                      //业务员暂留空
                                        oi.UserID            = this.userid;
                                        oi.oAppendTime       = DateTime.Now;
                                        oi.oOrderDateTime    = DateTime.Now;
                                        oi.oState            = 0;
                                        oi.oSteps            = 1;
                                        oi.oPrepay           = 0;
                                        oi.OrderListDataJson = (OrderListDataJson)JavaScriptConvert.DeserializeObject(_OrderListDataJson, typeof(OrderListDataJson));
                                        int OrderID = Orders.AddOrderInfoAndList(oi);
                                        if (OrderID > 0)
                                        {
                                            OrderWorkingLogInfo owl = new OrderWorkingLogInfo();
                                            owl.OrderID     = OrderID;
                                            owl.UserID      = this.userid;
                                            owl.oType       = 0;
                                            owl.oMsg        = M_Config.StoresName + "-" + M_Config.m_Name + ",下单:" + m_TradeInfoID_Str;
                                            owl.pAppendTime = DateTime.Now;

                                            Orders.AddOrderWorkingLogInfo(owl);

                                            //网店发货单
                                            SendGoods.m_ConfigInfoID    = M_Config.m_ConfigInfoID;
                                            SendGoods.OrderID           = OrderID;
                                            SendGoods.m_TradeInfoID     = m_TradeInfoID_Str;
                                            SendGoods.receiver_name     = receiver_name;
                                            SendGoods.receiver_state    = receiver_state;
                                            SendGoods.receiver_city     = receiver_city;
                                            SendGoods.receiver_district = receiver_district;
                                            SendGoods.receiver_address  = receiver_address;
                                            SendGoods.receiver_zip      = receiver_zip;
                                            SendGoods.receiver_mobile   = receiver_mobile;
                                            SendGoods.receiver_phone    = receiver_phone;
                                            SendGoods.from_name         = M_Config.StoresName;
                                            SendGoods.from_state        = from_state;
                                            SendGoods.from_city         = from_city;
                                            SendGoods.from_district     = from_district;
                                            SendGoods.from_address      = from_address;
                                            SendGoods.from_zip          = from_zip;
                                            SendGoods.from_mobile       = from_mobile;
                                            SendGoods.from_phone        = from_phone;
                                            SendGoods.mExpName          = ExpName;
                                            SendGoods.mExpNO            = ExpNO;
                                            SendGoods.mMemo             = tMsg;
                                            SendGoods.mState            = 0;
                                            SendGoods.mAppendTime       = DateTime.Now;

                                            m_SendGoodsID = M_Utils.AddM_SendGoodsInfo(SendGoods);
                                            if (m_SendGoodsID > 0)
                                            {
                                                AddMsgLine("单据创建成功!<p class=\"SendGood\"><br>查看发货单据?-><a href=\"javascript:void(0);\" onclick=\"javascript:OrderDO.Show(" + OrderID + ");\">查看</a></p>");
                                                #region 发送邮件给审核人员
                                                try
                                                {
                                                    oi = Orders.GetOrderInfoModel(OrderID);
                                                    UsersUtils.SendUserMailByPopedom("3-2-1-2", "销售发货单 需审核,单号:" + oi.oOrderNum, "销售发货单 需审核,单号:" + oi.oOrderNum);
                                                }
                                                catch
                                                {
                                                }
                                                #endregion
                                            }
                                            else //网店订单生成失败,作废系统订单
                                            {
                                                oi = Orders.GetOrderInfoModel(OrderID);

                                                oi.oState = 1;
                                                Orders.UpdateOrderInfo(oi);

                                                tbProductsInfo.UpdateProductsStorageByOrderID(OrderID);//更新当前在途库存情况

                                                OrderWorkingLogInfo _owl = new OrderWorkingLogInfo();
                                                owl.OrderID     = oi.OrderID;
                                                owl.UserID      = this.userid;
                                                owl.oType       = -1;
                                                owl.oMsg        = "网店订单生成失败,系统自动作废发货单!网店单号:" + m_TradeInfoID_Str;
                                                owl.pAppendTime = DateTime.Now;

                                                Orders.AddOrderWorkingLogInfo(owl);
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("新建单据失败,请重试!");
                                        }
                                    }
                                    //else
                                    {
                                        //    AddErrLine("发货单据号重复,单据添加失败,请重试!");
                                    }
                                }
                                finally
                                {
                                    oi = null;
                                }
                            }
                            //修改操作
                            if (Act == "Edit")
                            {
                                int m_TradeInfoID = HTTPRequest.GetInt("m_TradeInfoID", 0);
                                SendGoods = M_Utils.GetM_SendGoodsInfoModelBym_TradeInfoID(m_TradeInfoID);
                                if (SendGoods != null)
                                {
                                    oi = Orders.GetOrderInfoModel(SendGoods.OrderID);
                                    oi.oCustomersContact = receiver_name;                          //联系人
                                    oi.oCustomersTel     = receiver_mobile + "," + receiver_phone; //联系电话
                                    oi.oCustomersAddress = receiver_address;                       //地址

                                    oi.StaffID = 0;                                                //业务员暂留空

                                    oi.OrderListDataJson = (OrderListDataJson)JavaScriptConvert.DeserializeObject(_OrderListDataJson, typeof(OrderListDataJson));
                                    if (Orders.UpdateOrderInfoAndList(oi))
                                    {
                                        OrderWorkingLogInfo owl = new OrderWorkingLogInfo();
                                        owl.OrderID     = oi.OrderID;
                                        owl.UserID      = this.userid;
                                        owl.oType       = 1;
                                        owl.oMsg        = "网购订单修改操作!";
                                        owl.pAppendTime = DateTime.Now;

                                        Orders.AddOrderWorkingLogInfo(owl);

                                        SendGoods.receiver_name     = receiver_name;
                                        SendGoods.receiver_state    = receiver_state;
                                        SendGoods.receiver_city     = receiver_city;
                                        SendGoods.receiver_district = receiver_district;
                                        SendGoods.receiver_address  = receiver_address;
                                        SendGoods.receiver_zip      = receiver_zip;
                                        SendGoods.receiver_mobile   = receiver_mobile;
                                        SendGoods.receiver_phone    = receiver_phone;
                                        SendGoods.from_name         = M_Config.StoresName;
                                        SendGoods.from_state        = from_state;
                                        SendGoods.from_city         = from_city;
                                        SendGoods.from_district     = from_district;
                                        SendGoods.from_address      = from_address;
                                        SendGoods.from_zip          = from_zip;
                                        SendGoods.from_mobile       = from_mobile;
                                        SendGoods.from_phone        = from_phone;
                                        SendGoods.mExpName          = ExpName;
                                        SendGoods.mExpNO            = ExpNO;
                                        SendGoods.mMemo             = tMsg;

                                        M_Utils.UpdateM_SendGoodsInfo(SendGoods);

                                        AddMsgLine("更新成功!");
                                    }
                                    else
                                    {
                                        AddErrLine("发货单更新失败!");
                                    }
                                }
                                else
                                {
                                    AddErrLine("参数错误!");
                                }
                            }
                        }
                        else
                        {
                            Sender = tbStoresInfo.GetStoresInfoModel(M_Config.StoresID);

                            if (Act == "Edit")
                            {
                                //取 TradeID
                                int m_TradeInfoID = HTTPRequest.GetInt("m_TradeInfoID", 0);
                                SendGoods = M_Utils.GetM_SendGoodsInfoModelBym_TradeInfoID(m_TradeInfoID);
                                if (SendGoods != null)
                                {
                                    SendGoods.m_TradeInfoID = Utils.ReSQLSetTxt("0," + SendGoods.m_TradeInfoID + ",");
                                    tList = M_Utils.GetM_TradeInfoList(" m_ConfigInfoID=" + M_Config.m_ConfigInfoID + " and m_TradeInfoID in(" + SendGoods.m_TradeInfoID + ")").Tables[0];
                                    oList = M_Utils.GetM_OrderInfoList(" m_ConfigInfoID=" + M_Config.m_ConfigInfoID + " and m_TradeInfoID in(" + SendGoods.m_TradeInfoID + ")").Tables[0];

                                    DataTable OrderListData = Orders.GetOrderListInfoList(" OrderID=" + SendGoods.OrderID + " and oWorkType=1 order by OrderListID asc").Tables[0];
                                    if (OrderListData != null)
                                    {
                                        foreach (DataRow dr_OrderListData in OrderListData.Rows)
                                        {
                                            OrderListDataJsonStr += "{\"OrderListID\":" + dr_OrderListData["OrderListID"].ToString() + "," +
                                                                    "\"OrderID\":" + dr_OrderListData["OrderID"].ToString() + "," +
                                                                    "\"StorageID\":" + dr_OrderListData["StorageID"].ToString() + "," +
                                                                    "\"StorageName\":\"" + dr_OrderListData["StorageName"].ToString() + "\"," +
                                                                    "\"ProductsID\":" + dr_OrderListData["ProductsID"].ToString() + "," +
                                                                    "\"ProductsName\":\"" + dr_OrderListData["ProductsName"].ToString() + "\"," +
                                                                    "\"oQuantity\":" + dr_OrderListData["oQuantity"].ToString() + "," +
                                                                    "\"oPrice\":" + dr_OrderListData["oPrice"].ToString() + "," +
                                                                    "\"oMoney\":" + dr_OrderListData["oMoney"].ToString() + "," +
                                                                    "\"StoresSupplierID\":" + dr_OrderListData["StoresSupplierID"].ToString() + "," +
                                                                    "\"IsPromotions\":" + dr_OrderListData["IsPromotions"].ToString() + "," +
                                                                    "\"oWorkType\":" + dr_OrderListData["oWorkType"].ToString() + "," +
                                                                    "\"IsGifts\":" + dr_OrderListData["IsGifts"].ToString() + "," +
                                                                    "\"PriceClassID\":" + dr_OrderListData["PriceClassID"].ToString() + "," +
                                                                    "\"oAppendTime\":\"" + dr_OrderListData["oAppendTime"].ToString() + "\"},";
                                        }
                                        if (OrderListDataJsonStr.Trim() != "")
                                        {
                                            OrderListDataJsonStr = "{\"OrderListJson\":[" + Utils.ReSQLSetTxt(OrderListDataJsonStr) + "]}";
                                        }
                                    }
                                }
                                else
                                {
                                    AddErrLine("该交易的发货单不存在!");
                                }
                            }
                            else
                            {
                                oList = M_Utils.GetM_OrderInfoList(" m_ConfigInfoID=" + M_Config.m_ConfigInfoID + " and m_TradeInfoID in(" + m_TradeInfoID_Str + ")").Tables[0];

                                tList = M_Utils.GetM_TradeInfoList(" m_ConfigInfoID=" + M_Config.m_ConfigInfoID + " and m_TradeInfoID in(" + m_TradeInfoID_Str + ")").Tables[0];
                            }
                            eList = M_Utils.GetM_ExpressTemplatesInfoList(" m_ConfigInfoID=" + M_Config.m_ConfigInfoID + " order by mAppendTime desc").Tables[0];
                        }
                    }
                    else
                    {
                        AddErrLine("参数错误!");
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        public string BuyerName             = "";                           //买家昵称

        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-1-1-8") || CheckUserPopedoms("3-1-2-8") || CheckUserPopedoms("3-2-1-8") || CheckUserPopedoms("3-2-2-8") || CheckUserPopedoms("3-2-3-8") || CheckUserPopedoms("3-2-4-8") || CheckUserPopedoms("3-2-5-8") || CheckUserPopedoms("3-3-1-8") || CheckUserPopedoms("3-3-2-8") || CheckUserPopedoms("3-3-3-8"))
                {
                    orderid   = HTTPRequest.GetInt("orderid", 0);
                    ordertype = HTTPRequest.GetInt("ordertype", 0);

                    if (orderid > 0)
                    {
                        oi = Orders.GetOrderInfoModel(orderid);
                        if (oi != null)
                        {
                            string tSteps = ((oi.oSteps == 1) ? "  tbOrderListInfo.oWorkType=0 " : "  tbOrderListInfo.oWorkType<>0 ").ToString();
                            OrderList = Orders.GetOrderListInfoList(" OrderID=" + oi.OrderID + " and " + tSteps + " order by OrderListID asc").Tables[0];

                            //取已收发列表
                            StorageOrderList = tbStorageProductLogInfo.GetStorageProductLogListINOrderList(oi.OrderID).Tables[0];


                            //库存调拨单,整理数据
                            if (oi.oType == 9)
                            {
                                DataTable nOrderList = new DataTable();
                                nOrderList = OrderList.Clone();

                                foreach (DataRow dr in OrderList.Rows)
                                {
                                    if (Convert.ToDecimal(dr["oQuantity"].ToString()) < 0)
                                    {
                                        dr["StorageName"] = "来源:" + dr["StorageName"].ToString();
                                        nOrderList.Rows.Add(dr.ItemArray);
                                    }
                                }
                                nOrderList.AcceptChanges();

                                foreach (DataRow dr in OrderList.Rows)
                                {
                                    foreach (DataRow ddr in nOrderList.Rows)
                                    {
                                        if (Convert.ToInt32(ddr["ProductsID"].ToString()) == Convert.ToInt32(dr["ProductsID"].ToString()))
                                        {
                                            if (Convert.ToDecimal(dr["oQuantity"].ToString()) > 0)
                                            {
                                                ddr["oQuantity"]   = Convert.ToDecimal(dr["oQuantity"].ToString());
                                                ddr["StorageName"] = ddr["StorageName"].ToString() + "<br>去向:" + dr["StorageName"].ToString() + "";
                                            }
                                        }
                                    }
                                    nOrderList.AcceptChanges();
                                }

                                OrderList.Clear();
                                OrderList = nOrderList.Copy();
                            }

                            //制单人
                            print_ui = tbUserInfo.GetUserInfoModel(oi.UserID);
                            //审核人
                            OrderWorkingLogInfo owil = Orders.GetOrderWorkingUserID(oi.OrderID, 2);
                            if (owil != null)
                            {
                                print_v_ui = tbUserInfo.GetUserInfoModel(owil.UserID);
                            }
                            else
                            {
                                print_v_ui = null;
                            }

                            //是否为网购订单
                            _ms = M_Utils.GetM_SendGoodsInfoModelByOrderID(oi.OrderID);
                            if (_ms != null)
                            {
                                IsMOrder = true;
                                _mxsp    = M_Utils.GetM_ExpressTemplatesInfoModel(_ms.mExpName);
                                //转换交易单号
                                oi.oCustomersOrderID = "";
                                string   _m_TradeInfoID    = _ms.m_TradeInfoID;
                                string[] _m_TradeInfoIDArr = Utils.SplitString(_m_TradeInfoID, ",");
                                foreach (string _m_TradeInfoID_Str in _m_TradeInfoIDArr)
                                {
                                    if (_m_TradeInfoID_Str.Trim() != "")
                                    {
                                        M_TradeInfo _mt = new M_TradeInfo();
                                        try
                                        {
                                            try
                                            {
                                                _mt = M_Utils.GetM_TradeInfoModel(Convert.ToInt32(_m_TradeInfoID_Str.Trim()));
                                                if (_mt != null)
                                                {
                                                    BuyerName             = _mt.buyer_nick;
                                                    oi.oCustomersOrderID += _mt.tid.ToString() + " ";
                                                }
                                            }
                                            catch
                                            {
                                            }
                                        }
                                        finally
                                        {
                                            _mt = null;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                IsMOrder = false;
                                _mxsp    = null;
                            }

                            OrderWorkingLogInfo owl = new OrderWorkingLogInfo();
                            owl.OrderID     = oi.OrderID;
                            owl.UserID      = this.userid;
                            owl.oType       = 6;
                            owl.oMsg        = "打印单据,仓库收发货";
                            owl.pAppendTime = DateTime.Now;

                            Orders.AddOrderWorkingLogInfo(owl);
                        }
                        else
                        {
                            AddErrLine("参数错误,单据不存在!");
                        }
                    }
                    else
                    {
                        AddErrLine("参数错误!");
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        public DataSet OrderListDataSet = new DataSet();        //分页时使用,存储分页后的多个表

        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-1-1-8") || CheckUserPopedoms("3-1-2-8") || CheckUserPopedoms("3-2-1-8") || CheckUserPopedoms("3-2-2-8") || CheckUserPopedoms("3-2-3-8") || CheckUserPopedoms("3-2-4-8") || CheckUserPopedoms("3-2-5-8") || CheckUserPopedoms("3-3-1-8") || CheckUserPopedoms("3-3-2-8") || CheckUserPopedoms("3-3-3-8"))
                {
                    orderid   = HTTPRequest.GetInt("orderid", 0);
                    ordertype = HTTPRequest.GetInt("ordertype", 0);

                    if (orderid > 0)
                    {
                        oi = Orders.GetOrderInfoModel(orderid);
                        if (oi != null)
                        {
                            string tSteps   = ((oi.oSteps == 1) ? "  tbOrderListInfo.oWorkType=0 " : "  tbOrderListInfo.oWorkType<>0 ").ToString();
                            string tSteps_b = ((oi.oSteps == 1) ? " IsVerify=0 " : " IsVerify<>0 ").ToString();

                            OrderList = Orders.GetOrderListInfoList(" OrderID=" + oi.OrderID + " and IsGifts=0 and " + tSteps + " order by OrderListID asc").Tables[0];

                            OrderFieldList = Orders.GetOrderFieldInfoList(" OrderType=" + ordertype + " and fState=0 and fPrintAdd=0").Tables[0];
                            if (OrderFieldList != null)
                            {
                                OrderFieldValueList = Orders.GetOrderFieldValueInfoList(" OrderListID in(select tbOrderListInfo.OrderListID from tbOrderListInfo where tbOrderListInfo.OrderID=" + oi.OrderID + " and tbOrderListInfo.IsGifts=0 and " + tSteps + ") and " + tSteps_b + "").Tables[0];
                            }

                            if (OrderFieldList != null)
                            {
                                int       i  = 0;
                                DataTable dt = OrderList.Clone();
                                foreach (DataRow dr in OrderList.Rows)
                                {
                                    dt.ImportRow(dr);
                                    i++;
                                    if (i % config.PrintAddRow == 0)
                                    {
                                        OrderListDataSet.Tables.Add(dt);
                                        dt           = OrderList.Clone();
                                        dt.TableName = "t_" + i;
                                    }
                                }
                                if (dt.Rows.Count > 0)
                                {
                                    //剩下的行数
                                    OrderListDataSet.Tables.Add(dt);
                                    dt           = OrderList.Clone();
                                    dt.TableName = "t_" + (i + 1);
                                }
                            }

                            //制单人
                            print_ui = tbUserInfo.GetUserInfoModel(oi.UserID);

                            OrderWorkingLogInfo owl = new OrderWorkingLogInfo();
                            owl.OrderID     = oi.OrderID;
                            owl.UserID      = this.userid;
                            owl.oType       = 10;
                            owl.oMsg        = "打印随附单";
                            owl.pAppendTime = DateTime.Now;
                            Orders.AddOrderWorkingLogInfo(owl);
                        }
                        else
                        {
                            AddErrLine("参数错误,单据不存在!");
                        }
                    }
                    else
                    {
                        AddErrLine("参数错误!");
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }