예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;
            string sql    = string.Empty;

            //取原材料或者产品
            if (ToolManager.CheckQueryString("IsMaterial"))
            {
                //原材料
                if (ToolManager.GetQueryString("IsMaterial").Equals("true"))
                {
                    sql = string.Format(@" select top 20  MaterialNumber,MaterialName from MarerialInfoTable ");

                    sql += string.Format(@"  where
MaterialNumber like '%{0}%' or MaterialNumber like'%{0}' or MaterialNumber like '{0}%' or
MaterialName like '%{0}%' or MaterialName like'%{0}' or MaterialName like '{0}%' 
order by MaterialNumber asc", ToolManager.GetQueryString("MaterialNumber"));

                    DataTable dt = SqlHelper.GetTable(sql);
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            result += string.Format(" <tr><td>{0}</td><td>{1}</td></tr>", dr["MaterialName"], dr["MaterialNumber"]);
                        }
                    }
                }
                else//产品
                {
                }
            }
            //取库存数量
            if (ToolManager.CheckQueryString("TableName"))
            {
                string tableName                 = ToolManager.GetQueryString("TableName");
                string warehouseNumber           = ToolManager.GetQueryString("WarehouseNumber"); //出入库编号
                string supplierMaterialNumberStr = string.Empty;                                  //供应商物料编号字符串
                string customerMaterialNumberStr = string.Empty;                                  //客户物料编号字符串
                string qty = string.Empty;                                                        //库存数量
                //原材料
                if (ToolManager.GetQueryString("IsMaterialForQty").Equals("true"))
                {
                    string materialNumber = ToolManager.GetQueryString("MaterialNumber"); //原材料编号
                    sql = string.Format(@"select SupplierMaterialNumber
from MaterialSupplierProperty where MaterialNumber='{0}'", materialNumber);
                    supplierMaterialNumberStr = ControlBindManager.GetOption(sql, "SupplierMaterialNumber", "SupplierMaterialNumber");
                    sql = string.Format(@"
select CustomerMaterialNumber from MaterialCustomerProperty where MaterialNumber='{0}'", materialNumber);
                    customerMaterialNumberStr = ControlBindManager.GetOption(sql, "CustomerMaterialNumber", "CustomerMaterialNumber");
                    qty    = StoreroomToolManager.GetinventoryQty(materialNumber, "", "", warehouseNumber, tableName, ToolEnum.ProductType.Marerial);
                    result = supplierMaterialNumberStr + "^" + customerMaterialNumberStr + "^" + qty;
                }
                else //产品
                {
                }
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
        }
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (ToolManager.GetQueryString("IsQueryOdersNumber").Equals("true")) //查询订单的ajax请求
            {
                string    sql = string.Format(@"  select distinct top 10  InventoryNumber from StockInventoryLog  
 where 
InventoryNumber like '%{0}%' or InventoryNumber like'%{0}' or InventoryNumber like '{0}%'  order by  InventoryNumber desc ", ToolManager.GetQueryString("OdersNumber"));
                DataTable dt  = SqlHelper.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        result += string.Format(" <tr><td>{0}</td></tr>", dr["InventoryNumber"]);
                    }
                }
            }
            else if (ToolManager.GetQueryString("IsQueryOdersNumber").Equals("false"))
            {
                string odersNumber = ToolManager.GetQueryString("OdersNumber");         //盘点编号
                string sql         = string.Format(@"select distinct (mo.MaterialNumber+'^'+mo.Version) as Value,
(p.ProductName+' 【'+mo.Version+'】') as Text 
 from (select * from StockInventoryLogDetail where [Version] !='0') mo
inner join Product p on mo.MaterialNumber=p.ProductNumber
where mo.InventoryNumber='{0}'  ", odersNumber);
                result = "<option value =\"\">- - - - - 请 选 择 - - - - -</option>";
                DataTable dt = SqlHelper.GetTable(sql);
                foreach (DataRow dr in dt.Rows)
                {
                    result += string.Format(" <option value ='{0}'>{1}</option> ", dr["Value"], dr["Text"]);
                }
            }
            else
            {
                string ordersNumber = ToolManager.GetQueryString("OdersNumber"); //盘点
                string product      = ToolManager.GetQueryString("Prouduct");
                if (string.IsNullOrEmpty(product))
                {
                    result = "";
                }
                else
                {
                    string   warehouseNumber = ToolManager.GetQueryString("WarehouseNumber");
                    string[] products        = product.Split('^');
                    string   inventoryQty    = StoreroomToolManager.GetinventoryQty("", products[0], products[1], warehouseNumber, "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product);
                    inventoryQty = inventoryQty == "" ? "0" : inventoryQty;
                    result       = inventoryQty;
                }
            }

            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
        }
        protected void drpProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            string products = drpProduct.SelectedValue;

            string[] temp = products.Split('^');
            if (string.IsNullOrEmpty(products))
            {
                lbInventoryQty.Text = "";
                return;
            }
            lbInventoryQty.Text = StoreroomToolManager.GetinventoryQty("", temp[0], temp[1], warehouseNumber, "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product);
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                trPlanNumberOrderNumber.Visible = false;
                Check();
                string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber");
                lbWarehouseNumber.Text = warehouseNumber;
                if (ToolManager.CheckQueryString("DocumentNumber") && ToolManager.CheckQueryString("WarehouseNumber") &&
                    ToolManager.CheckQueryString("ProductNumber") && ToolManager.CheckQueryString("Version") &&
                    ToolManager.CheckQueryString("PlanNumberOrderNumber") && ToolManager.CheckQueryString("RowNumber")
                    )
                {
                    string    documentNumber        = ToolManager.GetQueryString("DocumentNumber");
                    string    productNumber         = ToolManager.GetQueryString("ProductNumber");
                    string    version               = ToolManager.GetQueryString("Version");
                    string    planNumberOrderNumber = ToolManager.GetQueryString("PlanNumberOrderNumber");
                    string    rowNumber             = ToolManager.GetQueryString("RowNumber");
                    string    sql = string.Format(@" select * from ProductWarehouseLogDetail where WarehouseNumber='{0}'
 and DocumentNumber='{1}' and ProductNumber ='{2}' and Version ='{3}'  and RowNumber='{4}' and OrdersNumber='{5}'", warehouseNumber, documentNumber, productNumber, version, rowNumber, planNumberOrderNumber);
                    DataTable dt  = SqlHelper.GetTable(sql);
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        lbOdersNumber.Text            = dr["DocumentNumber"] == null ? "" : dr["DocumentNumber"].ToString();
                        lbProduct.Text                = dr["ProductNumber"].ToString() + "|" + dr["Version"].ToString();
                        txtCustomerProductNumber.Text = dr["CustomerProductNumber"] == null ? "" : dr["CustomerProductNumber"].ToString();
                        txtQty.Text          = dr["Qty"] == null ? "" : dr["Qty"].ToString();
                        lbOldQty.Text        = dr["Qty"] == null ? "" : dr["Qty"].ToString();
                        txtReason.Text       = dr["ReturnReason"] == null ? "" : dr["ReturnReason"].ToString() == "" ? "无" : dr["ReturnReason"].ToString();
                        txtRemark.Text       = dr["Remark"] == null ? "" : dr["Remark"].ToString();
                        txtInventoryQty.Text = StoreroomToolManager.GetinventoryQty("", dr["ProductNumber"].ToString(), dr["Version"].ToString(), warehouseNumber
                                                                                    , "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product);
                        lbOrdersNumber.Text    = dr["OrdersNumber"] == null ? "" : dr["OrdersNumber"].ToString();
                        lbRowNumber.Text       = dr["RowNumber"] == null ? "" : dr["RowNumber"].ToString();
                        txtOdersNumber.Visible = false;
                        lbOdersNumber.Visible  = true;
                        drpProduct.Visible     = false;
                        btnSubmit.Text         = "修改";

                        if (!planNumberOrderNumber.Equals("0"))
                        {
                            trPlanNumberOrderNumber.Visible = false;
                            trRowNumber.Visible             = false;
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Check();
                BindDrpProduct();
                if (ToolManager.CheckQueryString("DocumentNumber") && ToolManager.CheckQueryString("WarehouseNumber") &&
                    ToolManager.CheckQueryString("ProductNumber") && ToolManager.CheckQueryString("Version"))
                {
                    string documentNumber  = "无";
                    string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber");
                    string productNumber   = ToolManager.GetQueryString("ProductNumber");
                    string version         = ToolManager.GetQueryString("Version");
                    string sql             = string.Format(@"
 select ReturnReason ,Qty ,Remark  from ProductWarehouseLogDetail
 where WarehouseNumber ='{0}' and DocumentNumber ='{1}' and ProductNumber ='{2}' and Version ='{3}'", warehouseNumber, documentNumber
                                                           , productNumber, version);
                    DataTable dt = SqlHelper.GetTable(sql);
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        txtProductNumber.Text = productNumber;
                        txtVersion.Text       = version;
                        lbProduct.Text        = productNumber + "|" + version;
                        txtQty.Text           = dr["Qty"] == null ? "" : dr["Qty"].ToString();
                        lbOldQty.Text         = dr["Qty"] == null ? "" : dr["Qty"].ToString();
                        txtReason.Text        = dr["ReturnReason"] == null ? "" : dr["ReturnReason"].ToString();
                        txtRemark.Text        = dr["Remark"] == null ? "" : dr["Remark"].ToString();

                        lbInventoryQty.Text = StoreroomToolManager.GetinventoryQty("", productNumber, version, warehouseNumber, "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product);

                        btnSubmit.Text     = "修改";
                        drpProduct.Visible = false;
                        lbProduct.Visible  = true;
                    }
                }
                else
                {
                    btnSubmit.Text     = "添加";
                    drpProduct.Visible = true;
                    lbProduct.Visible  = false;
                }
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (ToolManager.GetQueryString("IsQueryOdersNumber").Equals("true")) //查询销售订单的ajax请求
            {
                string changeDirection = System.Web.HttpContext.Current.Server.UrlDecode(ToolManager.GetQueryString("ChangeDirection")).Trim();
                string conditon        = string.Empty;
                switch (changeDirection)
                {
                case "退货入库": conditon = " and  so.OdersType ='正常订单' ";
                    break;

                case "包装入库": conditon = " and  so.OdersType ='正常订单' ";
                    break;

                case "维修入库": conditon = " and  so.OdersType ='维修订单' ";
                    break;

                case "销售出库": conditon = " and  so.OdersType ='正常订单' ";
                    break;

                case "样品出库": conditon = " and  so.OdersType ='样品订单' ";
                    break;

                case "维修出库": conditon = " and  so.OdersType ='维修订单' ";
                    break;
                }

                string    sql = string.Format(@"select distinct top 10 t.OdersNumber from ( select distinct top 10   mo.OdersNumber from MachineOderDetail mo inner join SaleOder so on so.OdersNumber =mo.OdersNumber
   where 1=1   {1}
order by mo.OdersNumber desc) t where 
t.OdersNumber like '%{0}%' or t.OdersNumber like'%{0}' or t.OdersNumber like '{0}%'  ", ToolManager.GetQueryString("OdersNumber"), conditon);
                DataTable dt  = SqlHelper.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        result += string.Format(" <tr><td>{0}</td></tr>", dr["OdersNumber"]);
                    }
                }
            }
            else if (ToolManager.GetQueryString("IsQueryOdersNumber").Equals("false"))
            {
                string odersNumber = ToolManager.GetQueryString("OdersNumber");         //销售订单号
                string sql         = string.Format(@"select distinct (mo.ProductNumber+'^'+mo.Version) as Value,
(p.ProductName+' 【'+mo.Version+'】') as Text 
 from MachineOderDetail mo
inner join Product p on mo.ProductNumber=p.ProductNumber
where mo.OdersNumber='{0}'  ", odersNumber);
                result = "<option value =\"\">- - - - - 请 选 择 - - - - -</option>";
                DataTable dt = SqlHelper.GetTable(sql);
                foreach (DataRow dr in dt.Rows)
                {
                    result += string.Format(" <option value ='{0}'>{1}</option> ", dr["Value"], dr["Text"]);
                }
            }
            else
            {
                string ordersNumber = ToolManager.GetQueryString("OdersNumber");
                string product      = ToolManager.GetQueryString("Prouduct");
                if (string.IsNullOrEmpty(product))
                {
                    result = "^";
                }
                else
                {
                    string   warehouseNumber = ToolManager.GetQueryString("WarehouseNumber");
                    string[] products        = product.Split('^');
                    string   sql             = string.Format(@"select CustomerProductNumber from  ProductCustomerProperty
where CustomerId=(
select CustomerId from SaleOder where OdersNumber ='{0}')
and ProductNumber='{1}' and Version ='{2}'", ordersNumber, products[0], products[1]);
                    result = SqlHelper.GetScalar(sql);
                    string inventoryQty = StoreroomToolManager.GetinventoryQty("", products[0], products[1], warehouseNumber, "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product);
                    inventoryQty = inventoryQty == "" ? "0" : inventoryQty;
                    result       = result + "^" + inventoryQty;
                }
            }

            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
        }