Example #1
0
        protected void ASPxGridView12_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            string s = e.Parameters;

            string[]      s1     = s.Split('|');
            ASPxGridView  atl1   = (ASPxGridView)sender;
            int           count1 = atl1.Selection.Count;
            List <object> aa     = atl1.GetSelectedFieldValues("RMES_ID");
            List <object> ghtm   = atl1.GetSelectedFieldValues("GHTM");

            if (count1 < 1)
            {
                return;
            }
            string ids = "'";

            for (int j = 0; j < aa.Count; j++)
            {
                ids += aa[j] + "','";
            }
            if (ids.EndsWith(",'"))
            {
                ids = ids.Substring(0, ids.Length - 2);
            }
            string insert_sql = "insert into atpujhsn_tmp select rmes_id,ghtm from DP_KCB t where t.RMES_ID in ({0})";

            insert_sql = string.Format(insert_sql, ids);
            dc.ExeSql(insert_sql);
        }
Example #2
0
        protected void fpSpDetail_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
        {
            string s = e.Parameters;

            string[] s1       = s.Split('|');
            string   type1    = s1[0];
            int      rowIndex = int.Parse(s1[1]);
            string   sql      = "";

            ASPxGridView  atl1     = (ASPxGridView)sender;
            int           count1   = atl1.Selection.Count;
            List <object> m_Ghtm   = atl1.GetSelectedFieldValues("GHTM");
            List <object> m_RkDate = atl1.GetSelectedFieldValues("RKDATE");

            switch (type1)
            {
            case "Delete":

                for (int i = 0; i < count1; i++)
                {
                    sql = "delete from dp_rckwcbtemp where ghtm='" + m_Ghtm[i] + "' and rkdate='" + m_RkDate[i] + "' and MachineName='" + GV_MachineName + "' and gzdd='" + GV_Depot + "'";
                    dc.ExeSql(sql);
                }
                e.Result = "OK,已删除!";
                break;

            default:

                break;
            }
        }
Example #3
0
        public void Effect_Inserting(object sender, ASPxDataInsertingEventArgs e)
        {
            ASPxGridView detailGridView = (ASPxGridView)sender;

            ASPxGridView   editform_gv = (ASPxGridView)detailGridView.FindEditFormTemplateControl("cnr").FindControl("gv1");
            ASPxFormLayout fl          = (ASPxFormLayout)detailGridView.FindEditFormTemplateControl("cnr").FindControl("Effect_Layout_Form");


            for (int i = 0; i < editform_gv.Selection.Count; i++)
            {
                SqlCommand cmd;
                string     effect_obid   = editform_gv.GetSelectedFieldValues("OBID")[i].ToString();
                string     detector_obid = detailGridView.GetMasterRowKeyValue().ToString();
                string     load_qry      = "insert into TB_DE_LINK(OBID, LEFTREL, RIGHTREL, N1CREATIONDATE, N1CREATIONSESID)  ";
                load_qry = load_qry + "VALUES (NEWID(), '" + detector_obid + "', '" + effect_obid + "',  ";
                load_qry = load_qry + "REPLACE(REPLACE(CONVERT(varchar(23), GETDATE(), 121), '-','/'),'  ', '-') , '" + SessionInfo.UserName + "')  ";
                cmd      = new SqlCommand(load_qry, fgm_moduler.func_Class.conn);
                cmd.ExecuteNonQuery();
            }

            e.Cancel = true;
            Detector_Grid.CancelEdit();

            //makeDetectorGridView();
            //makeEffectGridView();

            //Session["Dataset"] = DetectorVoting;

            //Detector_Grid.DataSource = DetectorVoting;
            //Detector_Grid.DataBind();
        }
Example #4
0
        private void SubGuardarPlantilla()
        {
            int             lintIndice          = Convert.ToInt32(Session["ID"]);
            int             lintDYR_ID          = Convert.ToInt32(Session["DYR_ID"]);
            string          lStrCuencas         = string.Empty;
            string          lStrSecciones       = string.Empty;
            ASPxPageControl lObjPageControl     = (ASPxPageControl)ASPxGridViewPlantillaEncabezado.FindDetailRowTemplateControl(lintIndice, "ASPxPageControlPlantilla");
            ASPxGridView    lObjGridViewCuenca  = (ASPxGridView)lObjPageControl.FindControl("ASPxGridViewCuenca");
            ASPxGridView    lObjGridViewSeccion = (ASPxGridView)lObjPageControl.FindControl("ASPxGridViewSeccion");
            List <object>   lObjCuencas         = lObjGridViewCuenca.GetSelectedFieldValues("SubCuencaRio_ID");
            List <object>   lObjSecciones       = lObjGridViewSeccion.GetSelectedFieldValues("SubSeccion_ID");

            foreach (object lObjCuenca in lObjCuencas)
            {
                lStrCuencas += lObjCuenca.ToString() + ",";
            }
            foreach (object lObjSeccion in lObjSecciones)
            {
                lStrSecciones += lObjSeccion.ToString() + ",";
            }
            if (lStrCuencas.Length > 0)
            {
                lStrCuencas = lStrCuencas.Substring(0, lStrCuencas.Length - 1);
            }
            if (lStrSecciones.Length > 0)
            {
                lStrSecciones = lStrSecciones.Substring(0, lStrSecciones.Length - 1);
            }
            using (ICCEntities lObjEntidad = new ICCEntities())
            {
                lObjEntidad.xSpCrearPlantilla(lintDYR_ID, lStrCuencas, lStrSecciones);
                lObjEntidad.SaveChanges();
            }
        }
        protected void productsGrid_SelectionChanged(object sender, EventArgs e)
        {
            ASPxGridView  grid         = (ASPxGridView)sender;
            object        masterKey    = grid.GetMasterRowKeyValue();
            List <object> selectedKeys = grid.GetSelectedFieldValues(new string[] { "ProductID" });

            SelectedRows[masterKey] = selectedKeys;
        }
Example #6
0
 public static List <int> GetSelectedFieldValues(ASPxGridView gv, string keyFiled)
 {
     return(gv.GetSelectedFieldValues(keyFiled).Cast <int>().ToList());
     //var listId = new List<int>();
     //foreach (int item in gv.GetSelectedFieldValues(keyFiled))
     //    listId.Add(item);
     //return listId;
 }
Example #7
0
    protected void FilterOutNonSelectedRows(ASPxGridView gridView, bool selectedRows)
    {
        CriteriaOperator selectionCriteria = new InOperator(gridView.KeyFieldName, gridView.GetSelectedFieldValues(gridView.KeyFieldName));

        if (!selectedRows)
        {
            selectionCriteria = selectionCriteria.Not();
        }
        gridView.FilterExpression = (GroupOperator.Combine(GroupOperatorType.And, selectionCriteria)).ToString();
    }
Example #8
0
        internal static int?GetSelectedId(ASPxGridView gv)
        {
            //Devuelvo el ultimo elegido o null
            int?i = null;

            foreach (int recId in gv.GetSelectedFieldValues("RecId"))
            {
                i = recId;
            }
            return(i);
        }
Example #9
0
    protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
    {
        ASPxGridView grid = sender as ASPxGridView;

        //Switch the grid to edit mode for the last selected row
        if (e.Parameters == "StartEditing")
        {
            object lastSelectedRowKeyValue     = grid.GetSelectedFieldValues("ID")[grid.Selection.Count - 1];
            int    lastSelectedRowVisibleIndex = grid.FindVisibleIndexByKeyValue(lastSelectedRowKeyValue);
            grid.StartEdit(lastSelectedRowVisibleIndex);
        }
    }
Example #10
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            var basket     = new ShoppingBasket(Session, User.Identity.GetUserId());
            var selctedIds = ASPxGridView.GetSelectedFieldValues("Id").Cast <int>().ToList();

            foreach (var selId in selctedIds)
            {
                basket.RemoveProduct(selId);
            }

            Response.Redirect(Request.RawUrl);
        }
Example #11
0
 internal static bool IsSelectedRecId(int recId, ASPxGridView gv)
 {
     //Devuelvo si el RecId es uno de los seleccionados
     foreach (int auxRecId in gv.GetSelectedFieldValues("RecId"))
     {
         if (auxRecId == recId)
         {
             return(true);
         }
     }
     return(false);
 }
Example #12
0
    public void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string s = e.Parameters;

        string[] s1       = s.Split('|');
        string   type1    = s1[0];
        int      rowIndex = int.Parse(s1[1]);
        //string sn="",xmdm="",fdjxl="",xmmc="",RunValue="",sj1="",sj2="",zdmc="";
        ASPxGridView atl1   = (ASPxGridView)sender;
        int          count1 = atl1.Selection.Count;

        List <object> aa = atl1.GetSelectedFieldValues("SN");

        string xmdm     = ASPxGridView1.GetRowValues(rowIndex, "DETECT_CODE").ToString();
        string fdjxl    = ASPxGridView1.GetRowValues(rowIndex, "PRODUCT_SERIES").ToString();
        string xmmc     = ASPxGridView1.GetRowValues(rowIndex, "DETECT_NAME").ToString();
        string RunValue = ASPxGridView1.GetRowValues(rowIndex, "WORK_TIME").ToString();
        string sj1      = ASPxGridView1.GetRowValues(rowIndex, "DETECT_VALUE").ToString();
        string sj2      = ASPxGridView1.GetRowValues(rowIndex, "DETECT_VALUE").ToString();
        string zdmc     = ASPxGridView1.GetRowValues(rowIndex, "STATION_NAME").ToString();
        string sn       = ASPxGridView1.GetRowValues(rowIndex, "SN").ToString();
        string rmesid   = ASPxGridView1.GetRowValues(rowIndex, "RMES_ID").ToString();

        switch (type1)
        {
        case "Treated":

            for (int i = 0; i < count1; i++)
            {
                //取消确认

                string sql7 = " update  DATA_SN_DETECT_QUERY set  USER_ID='" + theUserId + "',DETECT_TIME=SYSDATE, DETECT_FLAG='N' WHERE SN ='" + aa[i] + "'";
                dc.ExeSql(sql7);
            }
            break;

        case "Untreated":

            for (int i = 0; i < count1; i++)
            {
                //进行确认
                string sql6 = "UPDATE DATA_SN_DETECT_QUERY SET USER_ID='" + theUserId + "',DETECT_TIME=SYSDATE,DETECT_FLAG='Y'  where SN =  '" + aa[i] + "' ";
                dc.ExeSql(sql6);
            }
            break;

        default:

            break;
        }
        ASPxGridView1.JSProperties.Add("cpCallbackName", "refresh");
    }
Example #13
0
        protected void BtnAddToShoppingCart_Click(object sender, EventArgs e)
        {
            var selctedIds       = ASPxGridView.GetSelectedFieldValues("Id").Cast <int>().ToList();
            var selectedProducts = (from d in _db.Products
                                    where selctedIds.Contains(d.Id)
                                    select d).ToList();

            string currentUserId = User.Identity.GetUserId();

            var basket = new ShoppingBasket(Session, currentUserId);

            basket.AddProducts(selectedProducts);

            Response.Redirect("/Store/ManageBasket.aspx");
        }
Example #14
0
        protected void GetSelectionButton_Click(object sender, EventArgs e)
        {
            ASPxGridView  grid        = ASPxGridLookup1.GridView;
            List <object> fieldValues = grid.GetSelectedFieldValues(new string[] { "ProductName" });

            ASPxListBox1.Items.Clear();

            if (fieldValues.Count > 0)
            {
                foreach (object item in fieldValues)
                {
                    ASPxListBox1.Items.Add(item.ToString());
                }
            }
        }
Example #15
0
    protected void grid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        //Get and Process the list of selected records in order to populate the list of pkvals
        #region process selected records
        var selected_keys = gv.GetSelectedFieldValues("valdocID");



        List <int> pkvals = new List <int>();

        foreach (object key in e.Keys.Values)
        {
            int  ikey;
            bool isint = int.TryParse(key.ToString(), out ikey);
            if (isint)
            {
                pkvals.Add(ikey);
            }
        }

        //Add the other selected rows to the update if the user has selected the "Update All" checkbox
        if (selected_keys.Count > 0)
        {
            foreach (object k in selected_keys)
            {
                int  ikey;
                bool isint = int.TryParse(k.ToString(), out ikey);
                if (!pkvals.Contains(ikey))
                {
                    pkvals.Add(ikey);
                }
            }
        }
        #endregion



        string result = dataops.dxGrid_UpdateData("valdocID", pkvals, e.NewValues, "ValantTJ", "dbo", "valantdocdump");

        gv.CancelEdit();
        e.Cancel = true;
        //ViewState["needBind"] = "true";
        gv.DataBind();
    }
Example #16
0
        protected void grvEmpleados_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            try
            {
                ASPxGridView grid = (sender as ASPxGridView);
                //Switch the grid to edit mode for the last selected row
                if (e.Parameters == "StartEditing")
                {
                    object lastSelectedRowKeyValue     = grid.GetSelectedFieldValues(Constantes.ColumnaInfoAdicUserId)[grid.Selection.Count - 1];
                    int    lastSelectedRowVisibleIndex = grid.FindVisibleIndexByKeyValue(lastSelectedRowKeyValue);
                    grid.StartEdit(lastSelectedRowVisibleIndex);
                }
                else
                {
                    string strKey = "";
                    List <TreeListNode> lstSelectedNodes = trlDepartamentos.GetSelectedNodes();
                    if (lstSelectedNodes.Count > 0)
                    {
                        foreach (TreeListNode Node in lstSelectedNodes)
                        {
                            strKey += Node.Key + ",";
                        }
                        strKey = strKey.Substring(0, strKey.Length - 1);
                        Session["DepartamentoSelected"] = strKey;
                        DataTable dtbEmpleados = (DataTable)Session[Constantes.SessionTblInfoAdicional];
                        String    strFilter    = Constantes.ColumnaInfoAdicUserId + " in (" + strKey + ")";
                        DataRow[] dtrFilter    = dtbEmpleados.Select(strFilter);
                        DataTable dtbFilter    = dtbEmpleados.Clone();

                        foreach (DataRow row in dtrFilter)
                        {
                            dtbFilter.ImportRow(row);
                        }
                        Session[Constantes.SessionTblInfoAdicional1] = dtbFilter;

                        grid.DataSource = dtbFilter;
                        grid.DataBind();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 internal static bool IsSelectedRecId(int recId, ASPxGridView gv)
 {
     //Devuelvo si el RecId es uno de los seleccionados
     foreach (int auxRecId in gv.GetSelectedFieldValues("RecId"))
         if (auxRecId == recId)
             return true;
     return false;
 }
Example #18
0
    protected void gridEmployees_CustomCallback(object source, ASPxGridViewCustomCallbackEventArgs e)
    {
        string       param = e.Parameters.ToString();
        ASPxGridView gdv   = source as ASPxGridView;

        gdv.JSProperties[JSPROPERTY_CALLBACK_TYPE] = param;
        switch (param)
        {
        case GRID_INVERSE:
            if (gdv.VisibleRowCount > 0)
            {
                for (int i = 0; i < gdv.VisibleRowCount; i++)
                {
                    gdv.Selection.SetSelection(i, !gdv.Selection.IsRowSelected(i));
                }
            }
            break;

        case GRID_BINDING:
            gdv.DataBind();
            break;

        case GRID_SELECT_BY_VALUE:
            if (gdv.VisibleRowCount > 0 && bteEmployees.Text.Length > 0)
            {
                DataRow dr;
                if (multiSelection)
                {
                    string[] employeesNos = bteEmployees.Text.Split(',');
                    if (employeesNos.Length > 0)
                    {
                        bool          isContain;
                        StringBuilder accounts     = new StringBuilder();
                        StringBuilder selectedText = new StringBuilder();
                        StringBuilder employeeNos  = new StringBuilder();
                        for (int i = 0; i < gdv.VisibleRowCount; i++)
                        {
                            dr        = gdv.GetDataRow(i);
                            isContain = employeesNos.Contains <string>(dr[FIELDNAME_EMPLOYEENO].ToString());
                            gdv.Selection.SetSelection(i, isContain);
                            if (isContain)
                            {
                                accounts.AppendFormat(",{0}", dr[FIELDNAME_ACCOUNTID]);
                                employeeNos.AppendFormat(",{0}", dr[FIELDNAME_EMPLOYEENO]);
                                selectedText.AppendFormat("<br>{0} - {1} - {2}", dr[FIELDNAME_DIVISIONCODE],
                                                          dr[FIELDNAME_EMPLOYEENO], dr[FIELDNAME_EMPLOYEENAME]);
                            }
                        }
                        if (accounts.Length > 0)
                        {
                            //gdv.JSProperties[JSPROPERTY_LBL_SELECTED] = TEXT_EMPLOYEES;
                            gdv.JSProperties[JSPROPERTY_TEXT_POPUP_SELECTED] = selectedText.ToString();
                            gdv.JSProperties[JSPROPERTY_SELECTED_ACCOUNTID]  = accounts.ToString().Substring(1);
                            gdv.JSProperties[JSPROPERTY_SELECTED_EMPLOYEENO] = employeeNos.ToString().Substring(1);
                            return;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < gdv.VisibleRowCount; i++)
                    {
                        dr = gdv.GetDataRow(i);
                        gdv.Selection.SetSelection(i, bteEmployees.Text == dr[FIELDNAME_EMPLOYEENO].ToString());
                        if (gdv.Selection.IsRowSelected(i))
                        {
                            gdv.JSProperties[JSPROPERTY_LBL_SELECTED]        = dr[FIELDNAME_EMPLOYEENAME];
                            gdv.JSProperties[JSPROPERTY_SELECTED_ACCOUNTID]  = dr[FIELDNAME_ACCOUNTID];
                            gdv.JSProperties[JSPROPERTY_SELECTED_EMPLOYEENO] = dr[FIELDNAME_EMPLOYEENO];
                            return;
                        }
                    }
                }
            }
            gdv.Selection.UnselectAll();
            gdv.JSProperties[JSPROPERTY_LBL_SELECTED]        = "";
            gdv.JSProperties[JSPROPERTY_TEXT_POPUP_SELECTED] = "";
            gdv.JSProperties[JSPROPERTY_SELECTED_ACCOUNTID]  = "";
            gdv.JSProperties[JSPROPERTY_SELECTED_EMPLOYEENO] = "";

            break;

        case GRID_SELECTED:
            if (gdv.VisibleRowCount > 0)
            {
                if (multiSelection)
                {
                    StringBuilder accounts     = new StringBuilder();
                    StringBuilder selectedText = new StringBuilder();
                    StringBuilder employeeNos  = new StringBuilder();
                    List <object> selectedList = gdv.GetSelectedFieldValues(FIELDNAME_ACCOUNTID, FIELDNAME_DIVISIONCODE
                                                                            , FIELDNAME_EMPLOYEENO, FIELDNAME_EMPLOYEENAME);
                    foreach (object obj in selectedList)
                    {
                        object[] data = obj as object[];
                        accounts.AppendFormat(",{0}", data[0]);
                        employeeNos.AppendFormat(",{0}", data[2]);
                        selectedText.AppendFormat("<br>{0} - {1} - {2}", data[1], data[2], data[3]);
                    }
                    if (accounts.Length > 0)
                    {
                        //gdv.JSProperties[JSPROPERTY_LBL_SELECTED] = TEXT_EMPLOYEES;
                        gdv.JSProperties[JSPROPERTY_TEXT_POPUP_SELECTED] = selectedText.ToString();
                        gdv.JSProperties[JSPROPERTY_SELECTED_ACCOUNTID]  = accounts.ToString().Substring(1);
                        gdv.JSProperties[JSPROPERTY_SELECTED_EMPLOYEENO] = employeeNos.ToString().Substring(1);
                    }
                    else
                    {
                        //gdv.JSProperties[JSPROPERTY_LBL_SELECTED] = "";
                        gdv.JSProperties[JSPROPERTY_TEXT_POPUP_SELECTED] = "";
                        gdv.JSProperties[JSPROPERTY_SELECTED_ACCOUNTID]  = "";
                        gdv.JSProperties[JSPROPERTY_SELECTED_EMPLOYEENO] = "";
                    }
                }
                else
                {
                    int      index = Int32.Parse(hddEmployeesSelected[HDDKEY_SELECTED_INDEX].ToString());
                    object[] data  = gdv.GetRowValues(index, FIELDNAME_ACCOUNTID, FIELDNAME_EMPLOYEENO
                                                      , FIELDNAME_EMPLOYEENAME) as object[];
                    gdv.JSProperties[JSPROPERTY_SELECTED_ACCOUNTID]  = data[0];
                    gdv.JSProperties[JSPROPERTY_SELECTED_EMPLOYEENO] = data[1];
                    gdv.JSProperties[JSPROPERTY_LBL_SELECTED]        = data[2];
                    gdv.Selection.UnselectAll();
                    gdv.Selection.SetSelection(index, true);
                }
            }
            break;

        case GRID_UNDO_SELECTED:
            gdv.Selection.UnselectAll();
            if (!hddEmployeesSelected.Contains(HDDKEY_EMPLOYEES_SELECTED) ||
                String.IsNullOrEmpty(hddEmployeesSelected[HDDKEY_EMPLOYEES_SELECTED].ToString()))
            {
                return;
            }
            string[] keys = hddEmployeesSelected[HDDKEY_EMPLOYEES_SELECTED].ToString().Split(',');
            foreach (string key in keys)
            {
                gdv.Selection.SetSelectionByKey(Int32.Parse(key), true);
            }
            break;

        default: break;
        }
    }
Example #19
0
        //初始化流水号列表
        //private void init_listLSH()
        //{
        //    string sql = "select ghtm from zzplshb where 1 = 1 ";
        //    if (txtPCode1.Text.Trim() != "")
        //    {
        //        sql += " AND gzdd = rh_get_data('G','" + txtPCode1.Text.Trim() + "','','','') ";
        //    }
        //    else
        //    {
        //        sql += " AND GZDD = '' ";
        //    }

        //    DataTable dt = dc.GetTable(sql);
        //    ASPxListBoxUnused.DataSource = dt;
        //    ASPxListBoxUnused.DataBind();
        //}

        //调序
        public void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
        {
            string s = e.Parameters;

            string[] s1 = s.Split('|');
            string   type1 = s1[0];
            int      rowIndex = int.Parse(s1[1]);
            string   sql = "";
            string   rowid, sx, zddm;

            ASPxGridView  atl1   = (ASPxGridView)sender;
            int           count1 = atl1.Selection.Count;
            List <object> aa     = atl1.GetSelectedFieldValues("ROWID");

            try
            {
                rowid = ASPxGridView1.GetRowValues(rowIndex, "ROWID").ToString();
                sx    = ASPxGridView1.GetRowValues(rowIndex, "SX").ToString();
                zddm  = ASPxGridView1.GetRowValues(rowIndex, "ZDDM").ToString();
            }
            catch
            {
                e.Result = "Fail,缺少关键值!";
                return;
            }
            switch (type1)
            {
            case "Up":
                sql = "SELECT MAX(SX) FROM ZDXLB WHERE SX<'" + sx + "' AND gzdd = rh_get_data('G','" + txtPCode.Text.Trim() + "','','','') ";
                dc.setTheSql(sql);
                string newsx = dc.GetTable().Rows[0][0].ToString();
                if (dc.GetTable().Rows.Count == 0 || newsx == "")
                {
                    e.Result = "Fail,当前已最小序!";
                    break;
                }
                //??添加ROWNUM是防止多个序号一样的全部改变序号
                sql = "update ZDXLB set SX='" + sx + "' where SX='" + newsx + "' AND ROWNUM = '1' AND gzdd = rh_get_data('G','" + txtPCode.Text.Trim() + "','','','') ";
                dc.ExeSql(sql);
                sql = "update ZDXLB set SX='" + newsx + "' where ROWID='" + rowid + "' ";
                dc.ExeSql(sql);
                //e.Result = "OK,上调成功!";
                break;

            case "Down":
                sql = "SELECT MIN(SX) FROM ZDXLB WHERE SX>'" + sx + "' AND gzdd = rh_get_data('G','" + txtPCode.Text.Trim() + "','','','') ";
                dc.setTheSql(sql);
                newsx = dc.GetTable().Rows[0][0].ToString();
                if (dc.GetTable().Rows.Count == 0 || newsx == "")
                {
                    e.Result = "Fail,当前已最大序!";
                    break;
                }
                //??添加ROWID是防止多个序号一样的全部改变序号
                sql = "update ZDXLB set SX='" + sx + "' where SX='" + newsx + "' AND ROWNUM = '1' AND gzdd = rh_get_data('G','" + txtPCode.Text.Trim() + "','','','') ";
                dc.ExeSql(sql);
                sql = "update ZDXLB set SX='" + newsx + "' where ROWID='" + rowid + "' ";
                dc.ExeSql(sql);
                //e.Result = "OK,下调成功!";
                break;

            default:

                break;
            }
        }
 internal static int? GetSelectedId(ASPxGridView gv)
 {
     //Devuelvo el ultimo elegido o null
     int? i = null;
     foreach (int recId in gv.GetSelectedFieldValues("RecId"))
         i = recId;
     return i;
 }
Example #21
0
    public void ASPxGridView2_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string s = e.Parameters;

        string[] s1       = s.Split('|');
        string   type1    = s1[0];
        int      rowIndex = int.Parse(s1[1]);

        ASPxGridView atl1   = (ASPxGridView)sender;
        int          count1 = atl1.Selection.Count;
        //string rmesid = ASPxGridView2.GetRowValues(rowIndex, "RMES_ID").ToString();
        List <object> aa = atl1.GetSelectedFieldValues("SN");

        switch (type1)
        {
        case "Treated2":

            for (int i = 0; i < count1; i++)
            {
                //取消确认
                string sql = " update  DATA_SN_DETECT_QUERY set  USER_ID='" + theUserId + "',SCAN_TIME=SYSDATE, SCAN_FLAG='N' WHERE SN ='" + aa[i] + "'";
                dc.ExeSql(sql);
            }
            break;

        case "Untreated2":

            for (int i = 0; i < count1; i++)
            {
                //进行确认
                string sql4 = " update  DATA_SN_DETECT_QUERY set  USER_ID='" + theUserId + "',SCAN_TIME=SYSDATE, SCAN_FLAG='Y' WHERE SN ='" + aa[i] + "'";
                dc.ExeSql(sql4);
            }
            break;

        default:

            break;
        }
        ASPxGridView2.JSProperties.Add("cpCallbackName", "refresh");
        //string s = e.Parameters;
        //string[] s1 = s.Split('|');
        //string type1 = s1[0];
        //int rowIndex = int.Parse(s1[1]);

        //string rmesid = ASPxGridView2.GetRowValues(rowIndex, "RMES_ID").ToString();
        //switch (type1)
        //{
        //    case "Treated2":


        //        string sql = "update DATA_SN_BOM_TEMP  set CONFIRM_FLAG='N' where rmes_id='" + rmesid + "'";
        //        dc.ExeSql(sql);
        //        string sql2 = "delete from DATA_SN_BOM where  rmes_id =  '" + rmesid + "' ";

        //        dc.ExeSql(sql2);



        //        break;
        //    case "Untreated2":

        //        string sql4 = "insert into DATA_SN_BOM select * from DATA_SN_BOM_TEMP WHERE RMES_ID=  '" + rmesid + "'";
        //        dc.ExeSql(sql4);

        //        string sql5 = "delete from  DATA_SN_BOM_TEMP where rmes_id =  '" + rmesid + "' ";
        //        dc.ExeSql(sql5);

        //        break;

        //    default:

        //        break;
        //}
    }
Example #22
0
        //private void SpecificServersRebuildGrids(object fromGridVal, object toGridVal)
        //{
        //    ASPxGridView fromGrid = (ASPxGridView)fromGridVal;
        //    ASPxGridView toGrid = (ASPxGridView)toGridVal;
        //    DataTable dataFrom = new DataTable();
        //    DataTable dataTo = new DataTable();
        //    dataTo.Columns.Add("ID");
        //    dataTo.Columns.Add("ServerName");
        //    dataTo.Columns.Add("Location");
        //    dataTo.Columns.Add("ServerType");
        //    if (Session["visible"] != null && Session["visible"] != "")
        //    {
        //        dataFrom = (DataTable)Session["visible"];
        //    }
        //    //else
        //    //{
        //    //    dataFrom = (DataTable)Session["ServerVisibleDataGrid"];
        //    //}
        //    List<int> Id = new List<int>();
        //    List<Object> SelectItemServerID = fromGrid.GetSelectedFieldValues("ID");
        //    foreach (object SelectItemID in SelectItemServerID)
        //    {
        //        foreach (DataRow Dr in dataFrom.Rows)
        //        {
        //            if (Dr["ID"].ToString() == SelectItemID.ToString())
        //            {

        //                Id.Add(dataFrom.Rows.IndexOf(Dr));
        //                dataTo.ImportRow(Dr);
        //                //dataFrom.Rows.Remove(Dr);

        //            }
        //            dataTo.AcceptChanges();

        //        }

        //    }
        //    foreach (int DrID in Id)
        //    {
        //        dataFrom.Rows[DrID].Delete();
        //    }

        //    dataFrom.AcceptChanges();

        //    DataTable NotVisible = new DataTable();
        //    NotVisible.Columns.Add("ID");
        //    NotVisible.Columns.Add("ServerName");
        //    NotVisible.Columns.Add("Location");
        //    NotVisible.Columns.Add("ServerType");
        //    if (Session["NotVisible"] != null && Session["NotVisible"] != "")
        //    {
        //        NotVisible = (DataTable)Session["NotVisible"];
        //        foreach (DataRow dr in dataTo.Rows)
        //        {
        //            NotVisible.ImportRow(dr);
        //        }

        //    }
        //    else
        //    {
        //        Session["NotVisible"] = dataTo;
        //    }
        //    fromGrid.DataSource = dataFrom;
        //    fromGrid.KeyFieldName = "ID";
        //    fromGrid.DataBind();
        //    fromGrid.Selection.UnselectAll();
        //    Session["visible"] = dataFrom;
        //    if (NotVisible.Rows.Count == 0)
        //    {
        //        toGrid.DataSource = (DataTable)Session["NotVisible"];
        //    }
        //    else
        //    {
        //        toGrid.DataSource = NotVisible;
        //    }
        //    toGrid.KeyFieldName = "ID";
        //    toGrid.DataBind();
        //}

        private void SpecificServersRebuildGrids(object fromGridVal, object toGridVal, string fromSession, string toSession)
        {
            ASPxGridView fromGrid = (ASPxGridView)fromGridVal;
            ASPxGridView toGrid   = (ASPxGridView)toGridVal;
            DataTable    dataFrom = new DataTable();
            DataTable    dataTo   = new DataTable();

            dataTo.Columns.Add("ID");
            dataTo.Columns.Add("ServerName");
            dataTo.Columns.Add("Location");
            dataTo.Columns.Add("ServerType");
            if (Session[fromSession] != null && Session[fromSession] != "")
            {
                dataFrom = (DataTable)Session[fromSession];
            }

            //else
            //{
            //    dataFrom = (DataTable)Session["ServerVisibleDataGrid"];
            //}
            List <int>    Id = new List <int>();
            List <Object> SelectItemServerID = fromGrid.GetSelectedFieldValues("ID");

            foreach (object SelectItemID in SelectItemServerID)
            {
                foreach (DataRow Dr in dataFrom.Rows)
                {
                    try
                    {
                        if (Dr["ID"].ToString() == SelectItemID.ToString())
                        {
                            Id.Add(dataFrom.Rows.IndexOf(Dr));
                            dataTo.ImportRow(Dr);
                            //dataFrom.Rows.Remove(Dr);
                        }
                        dataTo.AcceptChanges();
                    }
                    catch { }
                }
            }
            foreach (int DrID in Id)
            {
                dataFrom.Rows[DrID].Delete();
            }

            dataFrom.AcceptChanges();

            DataTable NotVisible = new DataTable();

            NotVisible.Columns.Add("ID");
            NotVisible.Columns.Add("ServerName");
            NotVisible.Columns.Add("Location");
            NotVisible.Columns.Add("ServerType");
            if (Session[toSession] != null && Session[toSession] != "")
            {
                NotVisible = (DataTable)Session[toSession];
                foreach (DataRow dr in dataTo.Rows)
                {
                    NotVisible.ImportRow(dr);
                }
            }
            else
            {
                Session[toSession] = dataTo;
            }
            fromGrid.DataSource   = dataFrom;
            fromGrid.KeyFieldName = "ID";
            fromGrid.DataBind();
            fromGrid.Selection.UnselectAll();
            Session[fromSession] = dataFrom;
            if (NotVisible.Rows.Count == 0)
            {
                toGrid.DataSource = (DataTable)Session[toSession];
            }
            else
            {
                toGrid.DataSource = NotVisible;
            }
            toGrid.KeyFieldName = "ID";
            toGrid.DataBind();
            //9/21/2015 NS added
            Session[toSession] = NotVisible;
        }
Example #23
0
        protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            //多选删除,判断是否可以删除
            ASPxGridView  atl1   = (ASPxGridView)sender;
            int           count1 = atl1.Selection.Count;
            List <object> aa     = atl1.GetSelectedFieldValues("RMES_ID");
            List <object> flag1  = atl1.GetSelectedFieldValues("CONFIRM_FLAG");
            List <object> flag2  = atl1.GetSelectedFieldValues("RUN_FLAG");
            List <object> flag3  = atl1.GetSelectedFieldValues("ITEM_FLAG");
            List <object> flag4  = atl1.GetSelectedFieldValues("THIRD_FLAG");

            List <object> plancode1     = atl1.GetSelectedFieldValues("PLAN_CODE");
            List <object> planso1       = atl1.GetSelectedFieldValues("PLAN_SO");
            List <object> plinecode1    = atl1.GetSelectedFieldValues("PLINE_CODE");
            List <object> planseq1      = atl1.GetSelectedFieldValues("PLAN_SEQ");
            List <object> rountingsite1 = atl1.GetSelectedFieldValues("ROUNTING_SITE");
            List <object> planqty1      = atl1.GetSelectedFieldValues("PLAN_QTY");

            for (int i = 0; i < aa.Count; i++)
            {
                try
                {
                    if (flag1[i].ToString() == "N" && flag2[i].ToString() == "N" && flag3[i].ToString() == "N" && flag4[i].ToString() == "N")
                    {
                        string plancode  = plancode1[i].ToString();
                        string planso    = planso1[i].ToString();
                        string PlineCode = plinecode1[i].ToString();
                        string Planseq   = planseq1[i].ToString();
                        string Rsite     = rountingsite1[i].ToString();
                        string qty       = planqty1[i].ToString();

                        //string plancode = e.Values["PLAN_CODE"].ToString();
                        //string planso = e.Values["PLAN_SO"].ToString();
                        //string PlineCode = e.Values["PLINE_CODE"].ToString();
                        //string Planseq = e.Values["PLAN_SEQ"].ToString();
                        //string Rsite = e.Values["ROUNTING_SITE"].ToString();
                        //string qty = e.Values["PLAN_QTY"].ToString();
                        userManager theUserManager = (userManager)Session["theUserManager"];

                        //PlanFactory.PL_CREATE_PLAN("DELETE", theCompanyCode, PlineCode, "", "", plancode, planso, "", "B", "", "", "", "", "", "", "0", "0", "", "", "", "", "", "Y");
                        PlanFactory.PL_CREATE_PLAN("DELETE", theCompanyCode, PlineCode, "", Planseq, plancode, planso, "", "B", theUserId, theUserManager.getUserName(), "", "", "", qty, "0", "0", Rsite, "", "", "", "", "Y");
                    }
                }
                catch
                { }
            }
            e.Cancel = true;
            setCondition();
        }
        void gridView_SelectionChanged(object sender, EventArgs e)
        {
            if (SecuritySystem.CurrentUser is Student)
            {
                Student student      = SecuritySystem.CurrentUser as Student;
                string  currentClass = student.StudentClass.ClassCode;

                ASPxGridView gc = sender as ASPxGridView;

                List <Vacancy> tempList = new List <Vacancy>(listVacancies);

                List <object> listobj     = gc.GetSelectedFieldValues(new string[] { "LessonCode" });
                ObjectSpace   objectSpace = Application.CreateObjectSpace();

                Vacancy vc;
                string  strFilter = "", strInclude = "";
                foreach (int strLessonCode in listobj)
                {
                    Lesson lesson = objectSpace.FindObject <Lesson>(new BinaryOperator("LessonCode", strLessonCode));
                    strInclude += String.Format("OR ([LessonCode]={0})", lesson.LessonCode);
                    foreach (TkbSemester tkbsem in lesson.TKBSemesters)
                    {
                        vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
                        tempList.Add(vc);
                    }
                }
                if (strInclude != "")
                {
                    strInclude = String.Format("({0})", strInclude.Substring(3));
                }

                if (listobj.Count > 0)
                {
                    using (XPCollection xpLesson = new XPCollection(objectSpace.Session, typeof(Lesson)))
                    {
                        foreach (Lesson lesson in xpLesson)
                        {
                            foreach (TkbSemester tkbsem in lesson.TKBSemesters)
                            {
                                vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
                                if (Utils.IsConfictTKB(tempList, vc))
                                {
                                    strFilter += String.Format("AND ([LessonCode]<>{0})", lesson.LessonCode);
                                    break;
                                }
                            }
                        }
                        if (strFilter != "")
                        {
                            strFilter = String.Format("({0})", strFilter.Substring(4));
                        }
                    }
                }
                if (strInclude != "" && strFilter != "")
                {
                    strFilter = String.Format("({0} OR {1})", strFilter, strInclude);
                }
                else if (strInclude != "")
                {
                    strFilter = strInclude;
                }

                if (strFilter != "")
                {
                    if (gc.FilterExpression.Contains("TkbLesson.ClassIDs"))
                    {
                        gc.FilterExpression = string.Format("([TkbLesson.ClassIDs] Like '%{0}%') AND {1}", currentClass, strFilter);
                    }
                    else
                    {
                        gc.FilterExpression = strFilter;
                    }
                }
            }
        }
Example #25
0
    public void gridCallBackOption(ASPxGridView grid, string param, string KeyFieldName, SqlDataSource ds)
    {
        try
        {

            HttpCookie myCookie = Request.Cookies[CU.getuserid().ToString()];

            switch (param)
            {
                case "isShowFiltertrue":
                    grid.Settings.ShowFilterBar = GridViewStatusBarMode.Visible;
                    if (myCookie != null) myCookie["GroupFilter"] = "true";
                    break;
                case "isShowFilterfalse":
                    grid.Settings.ShowFilterBar = GridViewStatusBarMode.Hidden;
                    if (myCookie != null) myCookie["GroupFilter"] = "false";
                    break;
                case "isShowHScrolltrue":
                    grid.Settings.HorizontalScrollBarMode = DevExpress.Web.ASPxClasses.ScrollBarMode.Visible;
                    if (myCookie != null) myCookie["HScroll"] = "true";
                    break;
                case "isShowHScrollfalse":
                    grid.Settings.HorizontalScrollBarMode = DevExpress.Web.ASPxClasses.ScrollBarMode.Hidden;
                    if (myCookie != null) myCookie["HScroll"] = "false";
                    break;
                case "isShowHypColtrue":
                    grid.AccessibilityCompliant = true;
                    if (myCookie != null) myCookie["HypCol"] = "true";
                    break;
                case "isShowHypColfalse":
                    grid.AccessibilityCompliant = false;
                    if (myCookie != null) myCookie["HypCol"] = "false";
                    break;
                case "isShowGrouptrue":
                    grid.Settings.ShowGroupPanel = true;
                    if (myCookie != null) myCookie["Grouptrue"] = "true";
                    break;
                case "isShowGroupfalse":
                    grid.Settings.ShowGroupPanel = false;
                    if (myCookie != null) myCookie["Grouptrue"] = "false";
                    break;
            }

            List<object> listKeyValueOK = new List<object>();

            if (param.IndexOf("focus") >= 0)
            {
                int id = 0;
                Int32.TryParse(param.Replace("focus", ""), out id);
                if (id > 0)
                    grid.FocusedRowIndex = grid.FindVisibleIndexByKeyValue(param.Replace("focus", ""));
            }
            else if (param.IndexOf("action") >= 0)
            {
                int action = int.Parse(param.Replace("action", ""));

                List<object> listkeyvalue = grid.GetSelectedFieldValues(grid.KeyFieldName);
                SiAuto.Main.LogColored(System.Drawing.Color.Purple, grid.KeyFieldName + "Số dòng :" + listkeyvalue.Count);
                if (listkeyvalue.Count > 0)
                {
                    for (int i = 0; i < listkeyvalue.Count; i++)
                    {
                        SiAuto.Main.LogColored(System.Drawing.Color.Purple, "key so :" + i.ToString() + "----" + listkeyvalue[i]);
                        string currentCode = "isApproved=" + action + " AND " + grid.KeyFieldName + "=" + listkeyvalue[i];
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            var values = new Dictionary<string, object>
                        {
                            {"isApproved",action},
                            {grid.KeyFieldName,listkeyvalue[i]}
                        };

                            EU.updateTblScript(globalModuleID, values);
                            listKeyValueOK.Add(listkeyvalue[i]);
                        }
                    }

                    if (listKeyValueOK.Count > 0)
                    {
                        if (action == 1)
                        {
                            WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "APPROVED", string.Join(";", listKeyValueOK));
                            UserUtils.Log(CU.getLoginID(), globalModuleID, -1, string.Join(";", listKeyValueOK), "", "Duyệt thành công !", "APPROVED");
                        }
                        else
                        {
                            WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "NOTAPPROVED", string.Join(";", listKeyValueOK));
                            UserUtils.Log(CU.getLoginID(), globalModuleID, -1, string.Join(";", listKeyValueOK), "", "Bỏ duyệt thành công !", "NOTAPPROVED");
                        }
                        listKeyValueOK.Clear();
                    }
                }
                else
                {
                    object currentFocused = grid.GetRowValues(grid.FocusedRowIndex, grid.KeyFieldName);
                    string currentCode = "isApproved=" + action + " AND " + grid.KeyFieldName + "=" + currentFocused.ToString();
                    bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                    if (check == true)
                    {
                        if (currentFocused != null)
                        {
                            var values = new Dictionary<string, object>{
                            {"isApproved",action},
                            {grid.KeyFieldName,currentFocused}
                        };
                            EU.updateTblScript(globalModuleID, values);

                            if (action == 1)
                            {
                                SiAuto.Main.LogColored(Color.Green, "Chuan bi workflow APPROVED");
                                WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "APPROVED", currentFocused.ToString());
                                SiAuto.Main.LogColored(Color.Green, "End workflow APPROVED");

                                SiAuto.Main.LogColored(Color.Green, "ghi vao tray - bảng SY_audit_trail APPROVED");
                                //UserUtils.Log(CU.getLoginID(), globalModuleID, -1, currentFocused.ToString(), "", "Duyệt thành công !", "APPROVED");
                                SiAuto.Main.LogColored(Color.Green, "end tray ");
                            }
                            else
                            {
                                SiAuto.Main.LogColored(Color.Green, "Chuan bi workflow NOTAPPROVED");
                                WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "NOTAPPROVED", currentFocused.ToString());
                                SiAuto.Main.LogColored(Color.Green, "End workflow NOTAPPROVED");

                                SiAuto.Main.LogColored(Color.Green, "ghi vao tray - bảng SY_audit_trail NOTAPPROVED");
                                //UserUtils.Log(CU.getLoginID(), globalModuleID, -1, currentFocused.ToString(), "", "Bỏ duyệt thành công !", "NOTAPPROVED");
                                SiAuto.Main.LogColored(Color.Green, "end tray NOTAPPROVED");
                            }
                        }
                    }
                }
                UserUtils.Log(CU.getLoginID(), globalModuleID, -1, -1, listkeyvalue.ToString(), "", "APPROVED :" + action);
            }

            else if (param.IndexOf("delselect") >= 0)
            {
                List<object> listid = grid.GetSelectedFieldValues(new string[] { grid.KeyFieldName });

                if (listid.Count > 0)
                {
                    for (int i = 0; i < listid.Count; i++)
                    {
                        SiAuto.Main.LogColored(System.Drawing.Color.Purple, "key so :" + i.ToString() + "----" + listid[i]);
                        string currentCode = "isDeleted=1 AND " + grid.KeyFieldName + "=" + listid[i];
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            string rowDeleted = EU.deleteMultiTblScript(globalModuleID, grid.KeyFieldName, string.Join(",", listid));
                            listKeyValueOK.Add(listid[i]);
                        }
                    }
                    if (listKeyValueOK.Count > 0)
                    {
                        WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "DELETED", string.Join(";", listKeyValueOK));
                        listKeyValueOK.Clear();
                    }
                }
                else
                {
                    object currentFocused = grid.GetRowValues(grid.FocusedRowIndex, grid.KeyFieldName);
                    if (currentFocused != null)
                    {
                        string currentCode = "isDeleted=1 AND " + grid.KeyFieldName + "=" + currentFocused.ToString();
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            string rowDeleted = EU.deleteMultiTblScript(globalModuleID, grid.KeyFieldName, string.Join(",", currentFocused.ToString()));
                            if (int.Parse(rowDeleted) > 0)
                            {
                                SiAuto.Main.LogColored(Color.Green, "Chuan bi workflow DELETED");
                                WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "DELETED", currentFocused.ToString());
                                SiAuto.Main.LogColored(Color.Green, "End workflow DELETED");

                                SiAuto.Main.LogColored(Color.Green, "ghi vao tray - bảng SY_audit_trail DELETED");
                                UserUtils.Log(CU.getLoginID(), globalModuleID, -1, int.Parse(currentFocused.ToString()), "", "Xóa thành công !", "DELETED");
                                SiAuto.Main.LogColored(Color.Green, "end tray DELETED");
                            }

                        }
                    }
                }

            }
            else if (param.IndexOf("RestoreSelect") >= 0)
            {

                List<object> listid = grid.GetSelectedFieldValues(new string[] { grid.KeyFieldName });
                if (listid.Count > 0)
                {
                    for (int i = 0; i < listid.Count; i++)
                    {
                        SiAuto.Main.LogColored(System.Drawing.Color.Purple, "key so :" + i.ToString() + "----" + listid[i]);
                        string currentCode = "isDeleted=0 AND " + grid.KeyFieldName + "=" + listid[i];
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            string rowDeleted = EU.restoreMultiTblScript(globalModuleID, grid.KeyFieldName, string.Join(",", listid));
                            listKeyValueOK.Add(listid[i]);
                        }
                    }
                    if (listKeyValueOK.Count > 0)
                    {
                        WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "RESTORED", string.Join(";", listKeyValueOK));
                        listKeyValueOK.Clear();
                    }
                }
                else
                {
                    object currentFocused = grid.GetRowValues(grid.FocusedRowIndex, grid.KeyFieldName);
                    if (currentFocused != null)
                    {
                        string currentCode = "isDeleted=0 AND " + grid.KeyFieldName + "=" + currentFocused.ToString();
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            string rowDeleted = EU.restoreMultiTblScript(globalModuleID, grid.KeyFieldName, string.Join(",", currentFocused.ToString()));
                            if (int.Parse(rowDeleted) > 0)
                            {
                                SiAuto.Main.LogColored(Color.Green, "Chuan bi workflow RESTORED");
                                WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "RESTORED", currentFocused.ToString());
                                SiAuto.Main.LogColored(Color.Green, "End workflow RESTORED");

                                SiAuto.Main.LogColored(Color.Green, "ghi vao tray - bảng SY_audit_trail RESTORED");
                                UserUtils.Log(CU.getLoginID(), globalModuleID, -1, int.Parse(currentFocused.ToString()), "", "Phục hồi thành công !", "RESTORED");
                                SiAuto.Main.LogColored(Color.Green, "end tray RESTORED");
                            }
                        }
                    }
                }
            }
            grid.DataBind();
            if (myCookie != null) Response.Cookies.Set(myCookie);
        }
        catch (Exception ex)
        {

            throw new Exception(ex.Message);
        }
    }
Example #26
0
        //计划调序
        public void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
        {
            string s = e.Parameters;

            string[] s1    = s.Split('|');
            string   type1 = s1[0];

            string sql = "";

            ASPxGridView  atl1      = (ASPxGridView)sender;
            int           count1    = atl1.Selection.Count;
            List <object> aa        = atl1.GetSelectedFieldValues("RMES_ID");
            List <object> flags     = atl1.GetSelectedFieldValues("RUN_FLAG");
            List <object> plancode  = atl1.GetSelectedFieldValues("PLAN_CODE");
            List <object> plinecode = atl1.GetSelectedFieldValues("PLINE_CODE");


            switch (type1)
            {
            case "Confirm":
                if (flags.Contains("Y"))
                {
                    e.Result = "Fail,包含不可操作项!";
                    //e.Result = "OK,上调成功!";
                    break;
                }
                for (int i = 0; i < count1; i++)
                {
                    sql = "update data_plan set RUN_FLAG='Y' where rmes_id='" + aa[i] + "' and run_flag='N'";
                    dc.ExeSql(sql);
                }
                e.Result = "OK,已执行!";
                break;

            case "Cancel":
                if (flags.Contains("N"))
                {
                    e.Result = "Fail,包含不可操作项!";
                    //e.Result = "OK,上调成功!";
                    break;
                }
                for (int i = 0; i < count1; i++)
                {
                    sql = "update data_plan set RUN_FLAG='N' where rmes_id='" + aa[i] + "' and run_flag='Y'";
                    dc.ExeSql(sql);
                }
                e.Result = "OK,已取消!";
                break;

            case "Unlock":
                string password = s1[1];

                for (int i = 0; i < count1; i++)
                {
                    sql = "select yhmm from ms_skip_password where gzdd='" + plinecode[i] + "' and yhmm='" + password + "'";
                    dataConn  dc = new dataConn(sql);
                    DataTable dt = dc.GetTable();
                    if (dt.Rows.Count <= 0)
                    {
                        e.Result = "Fail,密码错误!";
                    }
                    else
                    {
                        sql = "update atpujhb_tmp set flag='Y' where jhmc='" + plancode[i] + "'";
                        dc.ExeSql(sql);
                        e.Result = "Password,解锁成功!";
                    }
                }

                break;

            default:

                break;
            }
        }
Example #27
0
        //计划调序
        public void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
        {
            string s = e.Parameters;

            string[] s1       = s.Split('|');
            string   type1    = s1[0];
            int      rowIndex = int.Parse(s1[1]);
            string   sql      = "";

            ASPxGridView  atl1   = (ASPxGridView)sender;
            int           count1 = atl1.Selection.Count;
            List <object> aa     = atl1.GetSelectedFieldValues("RMES_ID");
            List <object> flags  = atl1.GetSelectedFieldValues("RUN_FLAG");

            //try
            //{
            //    rmesid = ASPxGridView1.GetRowValues(rowIndex, "RMES_ID").ToString();
            //    planseq = ASPxGridView1.GetRowValues(rowIndex, "PLAN_SEQ").ToString();
            //    begindate = Convert.ToString(ASPxGridView1.GetRowValues(rowIndex, "BEGIN_DATE")).Substring(0, Convert.ToString(ASPxGridView1.GetRowValues(rowIndex, "BEGIN_DATE")).IndexOf(" "));
            //    plinecode1 = ASPxGridView1.GetRowValues(rowIndex, "PLINE_CODE") as string;
            //}
            //catch
            //{
            //    e.Result = "Fail,缺少关键值!";
            //    return;
            //}
            switch (type1)
            {
            case "Confirm":
                if (flags.Contains("P"))
                {
                    e.Result = "Fail,包含不可操作项!";
                    //e.Result = "OK,上调成功!";
                    break;
                }
                for (int i = 0; i < count1; i++)
                {
                    sql = "update data_plan set RUN_FLAG='P' where rmes_id='" + aa[i] + "' and run_flag='Y' ";
                    dc.ExeSql(sql);
                }
                e.Result = "OK,已暂停!";
                break;

            case "Cancel":
                if (flags.Contains("N") || flags.Contains("Y") || flags.Contains("C"))
                {
                    e.Result = "Fail,包含不可操作项!";
                    //e.Result = "OK,上调成功!";
                    break;
                }
                for (int i = 0; i < count1; i++)
                {
                    sql = "update data_plan set RUN_FLAG='Y' where rmes_id='" + aa[i] + "' and run_flag='P' ";
                    dc.ExeSql(sql);
                }
                e.Result = "OK,已恢复!";
                break;

            default:

                break;
            }
        }
Example #28
0
        protected void UpdateAttributeDefaults(string SessionName, ASPxGridView ProfilesGridView, HtmlGenericControl Error, HtmlGenericControl Success)
        {
            Error.Style.Value   = "display: none;";
            Success.Style.Value = "display: none";
            List <object> fieldValues = ProfilesGridView.GetSelectedFieldValues(new string[] { "RelatedField", "DefaultValue", "RelatedTable" });

            bool   Update           = false;
            int    profileid        = 0;
            string AttributeErrors  = "";
            string AppliedAttribute = "";

            if (fieldValues.Count > 0)
            {
                int       ProfileMasterID   = 0;
                DataTable ProfilesDataTable = new DataTable();
                if (Session[SessionName] != null && Session[SessionName] != "")
                {
                    ProfilesDataTable = (DataTable)Session[SessionName];
                }
                for (int i = 0; i < ProfilesDataTable.Rows.Count; i++)
                {
                    if (ProfilesDataTable.Rows[i]["isSelected"].ToString() == "true")
                    {
                        ProfileMasterID = Convert.ToInt32(ProfilesDataTable.Rows[i]["ID"]);

                        Update = VSWebBL.SecurityBL.ProfilesMasterBL.Ins.UpdateProfiles(CollectDataForProfiles(ProfilesDataTable.Rows[i]), ProfilesDataTable.Rows[i]["ID"].ToString());



                        if (Update == false)
                        {
                            if (AttributeErrors == "")
                            {
                                AttributeErrors += ProfilesDataTable.Rows[i]["AttributeName"].ToString();
                            }
                            else
                            {
                                AttributeErrors += ", " + ProfilesDataTable.Rows[i]["AttributeName"].ToString();
                            }
                        }
                        else
                        {
                            if (AppliedAttribute == "")
                            {
                                AppliedAttribute += ProfilesDataTable.Rows[i]["AttributeName"].ToString();
                            }
                            else
                            {
                                AppliedAttribute += ", " + ProfilesDataTable.Rows[i]["AttributeName"].ToString();
                            }
                        }
                    }
                }
                if (AttributeErrors != "")
                {
                    //2/26/2014 NS modified
                    //Error.InnerHtml = "The default values for " + SessionName + " attributes(s): " + AttributeErrors + " were NOT updated.";
                    //10/6/2014 NS modified for VSPLUS-990
                    Error.InnerHtml = "The following default values for " + SessionName + " were NOT updated: " + AttributeErrors + " ." +
                                      "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                    Error.Style.Value = "display: block";
                }
                if (AppliedAttribute != "")
                {
                    //2/26/2014 NS modified
                    //Success.InnerHtml = "The default values for " + SessionName + " attributes(s): " + AppliedAttribute + " were updated.";
                    //10/6/2014 NS modified for VSPLUS-990
                    Success.InnerHtml = "The following default values for " + SessionName + " were successfully updated: " + AppliedAttribute + "." +
                                        "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                    Success.Style.Value = "display: block";
                }
            }
            else
            {
                //2/26/2014 NS modified
                //Error.InnerHtml = "Kindly select the required attributes to update their default values";
                //10/6/2014 NS modified for VSPLUS-990
                Error.InnerHtml = "Please select at least one attribute to update its default values." +
                                  "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                Error.Style.Value = "display: block";
            }
        }
Example #29
0
        public void ConsultaDoc()
        {
            string wheretxt  = String.Empty;
            string strSitDoc = String.Empty;

            if (FiltrodataInicio.Date.Year > 1900 && FiltrodataFim.Date.Year > 1900)
            {
                wheretxt += " and (do.DataCadastro >= '" + FiltrodataInicio.Date.ToString("yyyy-MM-dd") + "') and (do.DataCadastro <= '" + FiltrodataFim.Date.ToString("yyyy-MM-dd") + "')";
            }

            if (FiltroNumeroDoc.Value != null)
            {
                wheretxt += " and do.NumeroDoc like '%" + FiltroNumeroDoc.Text.Trim() + "%'";
            }

            if (FiltrocboEmpresa.Value != null)
            {
                wheretxt += " and do.IdEmpresa = " + FiltrocboEmpresa.Value;
            }

            if (FiltrocboTipo.Value != null)
            {
                wheretxt += " and do.IdTipoDoc = " + FiltrocboTipo.Value;
            }

            if (FiltrolukSitDoc.Value != null)
            {
                ASPxGridView gridFiltrolukSit = FiltrolukSitDoc.GridView;

                List <object> fieldValues = gridFiltrolukSit.GetSelectedFieldValues(new string[] { "NomeSituacaoDoc" });

                int count = 1;

                if (fieldValues.Count > 0)
                {
                    for (int i = 0; i < fieldValues.Count; i++)
                    {
                        if (count == fieldValues.Count)
                        {
                            strSitDoc += "sd.NomeSituacaoDoc like '%" + fieldValues[i] + "%'";
                        }
                        else
                        {
                            strSitDoc += "sd.NomeSituacaoDoc like '%" + fieldValues[i] + "%' OR ";
                            count++;
                        }
                    }

                    strSitDoc = " and (" + strSitDoc + ")";
                }
            }

            if (wheretxt != String.Empty || strSitDoc != String.Empty)
            {
                SqlCommand comm = new SqlCommand();
                comm.Connection  = con;
                comm.CommandText = @"SELECT do.IdDoc, do.IdTipoDoc, do.IdEmpresa, do.IdContato, do.DataCadastro, do.IdUsuario, do.DataVencimento, do.Vencimento,
                                     do.Observacao, do.Remessa, ti.NomeTipoDoc, e.NomeEmpresa, do.NumeroDoc, do.IdSituacaoDoc, sd.NomeSituacaoDoc, c.NomeContato,

                                     (Select sum(id.Total)
                                     from ItemDoc id
                                     where id.IdDoc = do.IdDoc) as Total

                                     FROM Doc do
                                     join Empresa e on do.IdEmpresa = e.IdEmpresa
                                     join Contato c on do.IdContato = c.IdContato
                                     join TipoDoc ti on do.IdTipoDoc = ti.IdTipoDoc 
                                     join SituacaoDoc sd on do.IdSituacaoDoc = sd.IdSituacaoDoc    
                                                                                                                                         
                                     where 1=1 " + wheretxt + strSitDoc + " order by do.IdDoc desc";

                con.Open();
                SqlDataReader reader   = comm.ExecuteReader();
                var           varTable = new DataTable();
                varTable.Load(reader);
                con.Close();

                if (varTable.Rows.Count > 0)
                {
                    grvDoc.DataSource = varTable;
                    grvDoc.DataBind();
                }
                else
                {
                    grvDoc.DataSource = null;
                    grvDoc.DataBind();
                }
            }
            else
            {
                grvDoc.DataSource = null;
                grvDoc.DataBind();
            }
        }
Example #30
0
        protected void ASPxCallbackPanel5_Callback(object sender, CallbackEventArgsBase e)
        {
            string[] s     = e.Parameter.Split('|');
            string   flag  = s[0];
            string   value = s[1];

            switch (flag)
            {
            case "add":
                ASPxGridView  atl1   = (ASPxGridView)sender;
                int           count1 = atl1.Selection.Count;
                List <object> aa     = atl1.GetSelectedFieldValues("RMES_ID");
                List <object> ghtm   = atl1.GetSelectedFieldValues("GHTM");
                if (count1 < 1)
                {
                    return;
                }
                string ids = "'";
                for (int j = 0; j < aa.Count; j++)
                {
                    ids += aa[j] + "','";
                }
                if (ids.EndsWith(",'"))
                {
                    ids = ids.Substring(0, ids.Length - 2);
                }
                string insert_sql = "insert into atpujhsn_tmp select rmes_id,ghtm from DP_KCB t where t.RMES_ID in ({0})";
                insert_sql = string.Format(insert_sql, ids);
                dc.ExeSql(insert_sql);

                //if (string.IsNullOrEmpty(value)) return;
                //string value1 = s[2];
                //string[] _ids = value.Split(',');
                //string ids = "'";
                //for (int i = 0; i < _ids.Length; i++)
                //{
                //    ids += _ids[i] + "','";
                //}
                //if (ids.EndsWith(",'"))
                //    ids = ids.Substring(0, ids.Length - 2);
                //string[] _ids1 = value1.Split(',');
                //string ids1 = "'";
                //for (int i = 0; i < _ids1.Length; i++)
                //{
                //    ids1 += _ids1[i] + "','";
                //}
                //if (ids1.EndsWith(",'"))
                //    ids1 = ids1.Substring(0, ids1.Length - 2);
                ////判断流水号是否重复
                //ASPxCallbackPanel5.JSProperties.Clear();
                //string sql12 = "select count(1) from data_plan_sn where sn in  ({0})  ";
                //sql12 = string.Format(sql12, ids1);
                //dc.setTheSql(sql12);
                //if (dc.GetValue() != "0")
                //{
                //    //提示重复
                //    ASPxCallbackPanel5.JSProperties.Add("cpCallbackName", "Fail");
                //    ASPxCallbackPanel5.JSProperties.Add("cpCallbackRet", "流水号已使用!");
                //    break;
                //}
                //string insert_sql = "insert into atpujhsn_tmp select rmes_id,ghtm from DP_KCB t where t.RMES_ID in ({0})";
                //insert_sql = string.Format(insert_sql,ids);
                //dc.ExeSql(insert_sql);
                //for (int i = 0; i < _ids1.Length; i++)
                //{
                //    ASPxListBoxUsed.Items.Add(_ids[i], _ids1[i]);
                //}
                //ASPxListBoxUnused.Items.Remove(ASPxListBoxUnused.SelectedItem);

                break;

            case "del":
                if (string.IsNullOrEmpty(value))
                {
                    return;
                }
                string del_value1 = s[2];
                ASPxCallbackPanel5.JSProperties.Clear();

                string[] del__ids = value.Split(',');
                string   del_ids  = "'";
                for (int i = 0; i < del__ids.Length; i++)
                {
                    del_ids += del__ids[i] + "','";
                }
                if (del_ids.EndsWith(",'"))
                {
                    del_ids = del_ids.Substring(0, del_ids.Length - 2);
                }

                string[] del__ids1 = del_value1.Split(',');
                string   del_ids1  = "'";
                for (int i = 0; i < del__ids1.Length; i++)
                {
                    del_ids1 += del__ids1[i] + "','";
                }
                if (del_ids1.EndsWith(",'"))
                {
                    del_ids1 = del_ids1.Substring(0, del_ids1.Length - 2);
                }

                string del_sql = "delete from atpujhsn_tmp where RMES_ID in (" + del_ids + ")";
                dc.ExeSql(del_sql);
                //for (int i = 0; i < del_ids1.Length; i++)
                //{
                //    ASPxListBoxUnused.Items.Add(del__ids[i], del__ids1[i]);
                //}
                //ASPxListBoxUsed.Items.Remove(ASPxListBoxUnused.SelectedItem);

                break;

            case "js":
                ASPxListBoxUsed.Items.Clear();
                //ASPxListBoxUnused.Items.Clear();
                string sql = "delete from atpujhsn_tmp ";     //清空临时表
                dc.ExeSql(sql);

                break;

            default:
                ASPxCallbackPanel5.JSProperties.Clear();
                break;
            }
            string    usedsql = "select rmes_id,ghtm from ATPUJHSN_tmp t  order by ghtm";
            DataTable useddt  = dc.GetTable(usedsql);

            ASPxListBoxUsed.DataSource = useddt;
            ASPxListBoxUsed.DataBind();
            //ASPxListBoxUsed.SelectAll();
            string    sql1  = "select t.rmes_id,t.ghtm,t.so from DP_KCB t where lq_flag='Y' and t.ghtm not in (select ghtm from ATPUJHSN where ghtm is not null) and t.ghtm not in (select ghtm from ATPUJHSN_tmp where ghtm is not null) order by so,ghtm ";
            DataTable ghtm1 = dc.GetTable(sql1);

            //ASPxListBoxUnused.DataSource = ghtm;
            //ASPxListBoxUnused.DataBind();
            ASPxGridView12.DataSource = ghtm1;
            ASPxGridView12.DataBind();
            ASPxGridView12.Selection.UnselectAll();
            lblYqty.Text = useddt.Rows.Count.ToString();
        }
Example #31
0
    public void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string s = e.Parameters;
        string[] s1 = s.Split('|');
        string type1 = s1[0];
        int rowIndex = int.Parse(s1[1]);
        //string sn="",xmdm="",fdjxl="",xmmc="",RunValue="",sj1="",sj2="",zdmc="";
        ASPxGridView atl1 = (ASPxGridView)sender;
        int count1 = atl1.Selection.Count;
     
        List<object> aa = atl1.GetSelectedFieldValues("RMES_ID");

        string xmdm = ASPxGridView1.GetRowValues(rowIndex, "DETECT_CODE").ToString();
        string fdjxl = ASPxGridView1.GetRowValues(rowIndex, "PRODUCT_SERIES").ToString();
        string xmmc = ASPxGridView1.GetRowValues(rowIndex, "DETECT_NAME").ToString();
        string RunValue = ASPxGridView1.GetRowValues(rowIndex, "WORK_TIME").ToString();
        string sj1 = ASPxGridView1.GetRowValues(rowIndex, "DETECT_VALUE").ToString();
        string sj2 = ASPxGridView1.GetRowValues(rowIndex, "DETECT_VALUE").ToString();
        string zdmc = ASPxGridView1.GetRowValues(rowIndex, "STATION_NAME").ToString();
        string sn = ASPxGridView1.GetRowValues(rowIndex, "SN").ToString();
        string rmesid = ASPxGridView1.GetRowValues(rowIndex, "RMES_ID").ToString();
        switch (type1)
        {
            case "Treated":

                //if (xmmc == "LJTM")
                //{
                //    string sql = "update DATA_SN_DETECT_DATA_TEMP  set detect_flag='N' where rmes_id= '" + rmesid + "'";
                //    string sql2 = "delete from data_sn_detect_data where  rmes_id= '" + rmesid + "'";
                //    string sql3 = "delete from data_sn_bom where rmes_id= '" + rmesid + "'";
                //    dc.ExeSql(sql);
                //    dc.ExeSql(sql2);
                //    dc.ExeSql(sql3);
                //}
                //else
                //{
                //    string sql = "update DATA_SN_DETECT_DATA_TEMP  set detect_flag='N' where sn='" + sn + "' and  detect_code='" + xmdm + "' and "
                //               + "work_time=to_date('" + RunValue + "','YYYY-MM-DD HH24:MI:SS') and  pline_code='" + txtPCode.Value.ToString() + "'";
                //    dc.ExeSql(sql);
                //    string sql2 = "delete from data_sn_detect_data where  rmes_id =  '" + rmesid + "' ";

                //    dc.ExeSql(sql2);

                //}


                break;
            case "Untreated":

                for (int i = 0; i < count1; i++)
                {
                    //插入日志表,查询已确认的记录
                    string sql6 = "insert into data_sn_detect_data_temp_log select a.*,sysdate  from data_sn_detect_data_temp a where rmes_id=  '" + aa[i] + "'";
                    dc.ExeSql(sql6);
                    //进行确认
                    string sql4 = "insert into  data_sn_detect_data select * from data_sn_detect_data_temp where rmes_id=  '" + aa[i] + "'";
                    dc.ExeSql(sql4);
                    
                    string sql5 = "delete from  data_sn_detect_data_temp where rmes_id =  '" + aa[i] + "' ";
                    dc.ExeSql(sql5);
                   
                }
                break;

            default:

                break;
        }

    }
Example #32
0
        //计划调序
        public void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
        {
            string s = e.Parameters;
            string[] s1 = s.Split('|');
            string type1 = s1[0];
            int rowIndex = int.Parse(s1[1]);
            string sql = "";
            string rmesid, planseq, begindate, plinecode1;

            ASPxGridView atl1 = (ASPxGridView)sender;
            int count1 = atl1.Selection.Count;
            List<object> aa = atl1.GetSelectedFieldValues("RMES_ID");

            try
            {
                rmesid = ASPxGridView1.GetRowValues(rowIndex, "RMES_ID").ToString();
                planseq = ASPxGridView1.GetRowValues(rowIndex, "PLAN_SEQ").ToString();
                begindate = Convert.ToString(ASPxGridView1.GetRowValues(rowIndex, "BEGIN_DATE")).Substring(0, Convert.ToString(ASPxGridView1.GetRowValues(rowIndex, "BEGIN_DATE")).IndexOf(" "));
                plinecode1 = ASPxGridView1.GetRowValues(rowIndex, "PLINE_CODE") as string;
            }
            catch
            {
                e.Result = "Fail,缺少关键值!";
                return;
            }
            switch (type1)
            {
                case "Up":
                    sql = "select max(plan_seq) from data_plan where begin_date=to_date('" + begindate + "','yyyy-mm-dd') and plan_seq<'" + planseq + "' and pline_code='" + plinecode1 + "'  ";
                    dc.setTheSql(sql);
                    string planseq1 = dc.GetTable().Rows[0][0].ToString();
                    if (dc.GetTable().Rows.Count == 0 || planseq1 == "")
                    {
                        e.Result = "Fail,当前已最小序!";
                        break;
                    }

                    sql = "update data_plan set plan_seq='" + planseq + "' where plan_seq='" + planseq1 + "' and  begin_date=to_date('" + begindate + "','yyyy-mm-dd') and pline_code='" + plinecode1 + "' ";
                    dc.ExeSql(sql);
                    sql = "update data_plan set plan_seq='" + planseq1 + "' where rmes_id='" + rmesid + "' ";
                    dc.ExeSql(sql);
                    //e.Result = "OK,上调成功!";
                    break;
                case "Down":
                    sql = "select min(plan_seq) from data_plan where begin_date=to_date('" + begindate + "','yyyy-mm-dd') and plan_seq>'" + planseq + "' and pline_code='" + plinecode1 + "'  ";
                    dc.setTheSql(sql);
                    planseq1 = dc.GetTable().Rows[0][0].ToString();
                    if (dc.GetTable().Rows.Count == 0 || planseq1 == "")
                    {
                        e.Result = "Fail,当前已最大序!";
                        break;
                    }
                    sql = "update data_plan set plan_seq='" + planseq + "' where plan_seq='" + planseq1 + "' and  begin_date=to_date('" + begindate + "','yyyy-mm-dd') and pline_code='" + plinecode1 + "'  ";
                    dc.ExeSql(sql);
                    sql = "update data_plan set plan_seq='" + planseq1 + "' where rmes_id='" + rmesid + "' ";
                    dc.ExeSql(sql);
                    //e.Result = "OK,下调成功!";
                    break;
                case "Confirm":
                    for (int i = 0; i < count1; i++)
                    {
                        sql = "update data_plan set confirm_flag='Y' where rmes_id='" + aa[i] + "'";
                        dc.ExeSql(sql);
                    }
                    //e.Result = "OK,已确认!";
                    break;
                case "Cancel":
                    for (int i = 0; i < count1; i++)
                    {
                        sql = "update data_plan set confirm_flag='N' where rmes_id='" + aa[i] + "'";
                        dc.ExeSql(sql);
                    }
                    //e.Result = "OK,取消确认!";
                    break;
                default:

                    break;
            }
        }
Example #33
0
        //计划调序
        public void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
        {
            string s = e.Parameters;

            string[] s1 = s.Split('|');
            string   type1 = s1[0];
            int      rowIndex = int.Parse(s1[1]);
            string   sql = "";
            string   rmesid, planseq, begindate, plinecode1;

            ASPxGridView  atl1   = (ASPxGridView)sender;
            int           count1 = atl1.Selection.Count;
            List <object> aa     = atl1.GetSelectedFieldValues("RMES_ID");
            List <object> flags  = atl1.GetSelectedFieldValues("ITEM_FLAG");
            List <object> flags1 = atl1.GetSelectedFieldValues("CONFIRM_FLAG");
            List <object> flags2 = atl1.GetSelectedFieldValues("BOM_FLAG");
            List <object> flags3 = atl1.GetSelectedFieldValues("RUN_FLAG");
            List <object> flags4 = atl1.GetSelectedFieldValues("THIRD_FLAG");

            //try
            //{
            //    rmesid = ASPxGridView1.GetRowValues(rowIndex, "RMES_ID").ToString();
            //    planseq = ASPxGridView1.GetRowValues(rowIndex, "PLAN_SEQ").ToString();
            //    begindate = Convert.ToString(ASPxGridView1.GetRowValues(rowIndex, "BEGIN_DATE")).Substring(0, Convert.ToString(ASPxGridView1.GetRowValues(rowIndex, "BEGIN_DATE")).IndexOf(" "));
            //    plinecode1 = ASPxGridView1.GetRowValues(rowIndex, "PLINE_CODE") as string;
            //}
            //catch
            //{
            //    e.Result = "Fail,缺少关键值!";
            //    return;
            //}
            switch (type1)
            {
            case "Cbt1":     //接收
                if (flags1.Contains("N") || flags2.Contains("N") || flags3.Contains("Y") || flags3.Contains("C") || flags3.Contains("F"))
                {
                    e.Result = "Fail,包含不可操作项!";
                    //e.Result = "OK,上调成功!";
                    break;
                }
                else
                {
                    if (flags.Contains("Y") || flags.Contains("R"))
                    {
                        e.Result = "Fail,包含不可操作项!";
                        //e.Result = "OK,上调成功!";
                        break;
                    }
                    for (int i = 0; i < count1; i++)
                    {
                        sql = "update data_plan set Item_Flag='R' where rmes_id='" + aa[i] + "'";
                        dc.ExeSql(sql);
                    }
                    e.Result = "OK,已接收!";
                }
                //e.Result = "OK,上调成功!";
                break;

            case "Cbt2":     //取消接收
                if (flags.Contains("Y") || flags.Contains("N"))
                {
                    e.Result = "Fail,包含不可操作项!";
                    //e.Result = "OK,上调成功!";
                    break;
                }
                for (int i = 0; i < count1; i++)
                {
                    sql = "update data_plan set Item_Flag='N' where rmes_id='" + aa[i] + "'";
                    dc.ExeSql(sql);
                }
                e.Result = "OK,取消接收成功!";
                break;

            case "Confirm":
                if (flags.Contains("Y") || flags.Contains("N"))
                {
                    e.Result = "Fail,包含不可操作项!";
                    //e.Result = "OK,上调成功!";
                    break;
                }
                bool isth = false;
                for (int i = 0; i < count1; i++)
                {
                    string plancode1 = dc.GetValue("select plan_code from data_plan where rmes_id='" + aa[i] + "'");
                    if (dc.GetValue("select count(1) from SJBOMSOTH where jhdm='" + plancode1 + "' and istrue=0 ") != "0")
                    {
                        isth     = true;
                        e.Result = "Fail," + plancode1 + "一对一替换未确认!";
                        break;
                    }
                    if (dc.GetValue("select count(1) from sjbomsothmuti where jhdm='" + plancode1 + "' and istrue=0 ") != "0")
                    {
                        isth     = true;
                        e.Result = "Fail," + plancode1 + "多对多替换未确认!";
                        break;
                    }
                }
                if (!isth)
                {
                    for (int i = 0; i < count1; i++)
                    {
                        sql = "update data_plan set Item_Flag='Y' where rmes_id='" + aa[i] + "'";
                        dc.ExeSql(sql);
                    }
                    e.Result = "OK,已确认!";
                }
                break;

            case "Cancel":
                if (flags.Contains("N") || flags.Contains("R") || flags4.Contains("Y"))
                {
                    e.Result = "Fail,包含不可操作项!";
                    //e.Result = "OK,上调成功!";
                    break;
                }
                for (int i = 0; i < count1; i++)
                {
                    sql = "update data_plan set Item_Flag='R' where rmes_id='" + aa[i] + "'";
                    dc.ExeSql(sql);
                }
                e.Result = "OK,取消确认!";
                break;

            default:

                break;
            }
        }