Ejemplo n.º 1
0
 void edit_std(Hashtable SQLString, StringBuilder strSql, ProductionErpEntity.StatorCoilSTDEntity _std)
 {
     strSql = new StringBuilder( );
     strSql.Append("UPDATE MOXSTD SET ");
     strSql.Append("STD004=@STD004,");
     strSql.Append("STD006=@STD006,");
     strSql.Append("STD007=@STD007,");
     strSql.Append("STD008=@STD008,");
     strSql.Append("STD012=@STD012,");
     strSql.Append("STD013=@STD013 ");
     strSql.Append("WHERE idx=@idx");
     SqlParameter [] parameter =
     {
         new SqlParameter("@idx",    SqlDbType.Int,       4),
         new SqlParameter("@STD004", SqlDbType.NVarChar, 50),
         new SqlParameter("@STD006", SqlDbType.Int,       4),
         new SqlParameter("@STD007", SqlDbType.NVarChar, 50),
         new SqlParameter("@STD008", SqlDbType.Date,      3),
         new SqlParameter("@STD012", SqlDbType.NVarChar, 50),
         new SqlParameter("@STD013", SqlDbType.NVarChar, 50)
     };
     parameter [0].Value = _std.idx;
     parameter [1].Value = _std.STD004;
     parameter [2].Value = _std.STD006;
     parameter [3].Value = _std.STD007;
     parameter [4].Value = _std.STD008;
     parameter [5].Value = _std.STD012;
     parameter [6].Value = _std.STD013;
     SQLString.Add(strSql, parameter);
 }
Ejemplo n.º 2
0
        void add_std(Hashtable SQLString, StringBuilder strSql, ProductionErpEntity.StatorCoilSTDEntity _std)
        {
            strSql = new StringBuilder( );
            strSql.Append("INSERT INTO MOXSTD (");
            strSql.Append("STD001,STD002,STD003,STD004,STD005,STD006,STD007,STD008,STD010,STD011) ");
            strSql.Append("VALUES (");
            strSql.Append("@STD001,@STD002,@STD003,@STD004,@STD005,@STD006,@STD007,@STD008,@STD010,@STD011) ");
            SqlParameter [] parameter =
            {
                new SqlParameter("@STD001", SqlDbType.NVarChar, 50),
                new SqlParameter("@STD002", SqlDbType.NVarChar, 50),
                new SqlParameter("@STD003", SqlDbType.NVarChar, 50),
                new SqlParameter("@STD004", SqlDbType.NVarChar, 50),
                new SqlParameter("@STD005", SqlDbType.NVarChar, 50),
                new SqlParameter("@STD006", SqlDbType.Int,       4),
                new SqlParameter("@STD007", SqlDbType.NVarChar, 50),
                new SqlParameter("@STD008", SqlDbType.Date,      3),
                new SqlParameter("@STD010", SqlDbType.NChar,    10),
                new SqlParameter("@STD011", SqlDbType.NChar, 10)
            };
            parameter [0].Value = _std.STD001;
            parameter [1].Value = _std.STD002;
            parameter [2].Value = _std.STD003;
            parameter [3].Value = _std.STD004;
            parameter [4].Value = _std.STD005;
            parameter [5].Value = _std.STD006;
            parameter [6].Value = _std.STD007;
            parameter [7].Value = _std.STD008;
            parameter [8].Value = _std.STD010;
            parameter [9].Value = _std.STD011;

            SQLString.Add(strSql, parameter);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// edit data from view to database
        /// </summary>
        /// <param name="_stc"></param>
        /// <param name="table"></param>
        /// <returns></returns>
        public bool Save(ProductionErpEntity.StatorCoilSTCEntity _stc, DataTable table)
        {
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );

            edit_stc(SQLString, strSql, _stc);
            ProductionErpEntity.StatorCoilSTDEntity _std = new ProductionErpEntity.StatorCoilSTDEntity( );
            _std.STD001 = _stc.STC001;
            for (int i = 0; i < table.Rows.Count; i++)
            {
                _std.idx    = string.IsNullOrEmpty(table.Rows [i] ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["idx"].ToString( ));
                _std.STD004 = table.Rows [i] ["STD004"].ToString( );
                _std.STD006 = string.IsNullOrEmpty(table.Rows [i] ["STD006"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["STD006"].ToString( ));
                _std.STD007 = table.Rows [i] ["STD007"].ToString( );
                if (string.IsNullOrEmpty(table.Rows [i] ["STD008"].ToString( )))
                {
                    _std.STD008 = null;
                }
                else
                {
                    _std.STD008 = Convert.ToDateTime(table.Rows [i] ["STD008"].ToString( ));
                }
                _std.STD012 = table.Rows [i] ["STD012"].ToString( );
                _std.STD013 = table.Rows [i] ["STD013"].ToString( );
                edit_std(SQLString, strSql, _std);
            }

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// add data to database
        /// </summary>
        /// <param name="codeNum"></param>
        /// <returns></returns>
        bool Add(string codeNum)
        {
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );

            ProductionErpEntity.StatorCoilSTCEntity _stc = new ProductionErpEntity.StatorCoilSTCEntity( );
            ProductionErpEntity.StatorCoilSTDEntity _std = new ProductionErpEntity.StatorCoilSTDEntity( );
            _stc.STC001 = _std.STD001 = codeNum;
            string    zaS = string.Empty, zS = string.Empty, pfS = string.Empty, psG = string.Empty;
            DataTable dt = getWinBase(codeNum);

            if (dt != null && dt.Rows.Count > 0)
            {
                _stc.STC002 = string.IsNullOrEmpty(dt.Rows [0] ["WIB010"].ToString( )) == true ? 0 : Convert.ToInt32(dt.Rows [0] ["WIB010"].ToString( ));
                _stc.STC003 = dt.Rows [0] ["SRT002"].ToString( );
                _stc.STC004 = dt.Rows [0] ["WIB003"].ToString( );
                zaS         = dt.Rows [0] ["WIB004"].ToString( );
                zS          = dt.Rows [0] ["WIB005"].ToString( );
                pfS         = dt.Rows [0] ["WIB012"].ToString( );
                psG         = dt.Rows [0] ["WIB013"].ToString( );

                add_stc(SQLString, strSql, _stc);
            }
            else
            {
                return(false);
            }

            _std.STD006 = 0;
            _std.STD007 = string.Empty;
            _std.STD008 = null;
            std_para(SQLString, strSql, _std, zaS, zS, pfS, psG);

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }
Ejemplo n.º 5
0
        public FormStatorCoil( )
        {
            InitializeComponent( );

            _stc      = new ProductionErpEntity.StatorCoilSTCEntity( );
            _std      = new ProductionErpEntity.StatorCoilSTDEntity( );
            _bll      = new ProductionErpBll.Bll.StatorCoilBll( );
            tableView = new DataTable( );
            tablePow  = new DataTable( );

            Utility.GridViewMoHuSelect.SetFilter(gridView1);
            Utility.GridViewMoHuSelect.SetFilter(View);
            FieldInfo fi = typeof(XPaint).GetField("graphics", BindingFlags.Static | BindingFlags.NonPublic);

            fi.SetValue(null, new DrawXPaint( ));

            barMenu.LinksPersistInfo.RemoveAt(toolExport.Id);
            barMenu.LinksPersistInfo.RemoveAt(toolDelete.Id);
            barMenu.LinksPersistInfo.RemoveAt(toolAdd.Id);

            wait.Hide( );
            controlUnEnable( );

            DataTable userTable = _bll.getUserDataTable( );

            txtUser.Properties.DataSource    = userTable;
            txtUser.Properties.DisplayMember = "DBA002";
            txtUser.Properties.ValueMember   = "DBA001";
        }
Ejemplo n.º 6
0
        void edit_std(Hashtable SQLString, ProductionErpEntity.StatorCoilSTDEntity _std)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("UPDATE MOXSTD SET ");
            strSql.Append("STD004=@STD004 ");
            strSql.Append("WHERE STD001=@STD001 AND STD002=@STD002 AND STD003=@STD003");
            SqlParameter [] parameter =
            {
                new SqlParameter("@STD001", SqlDbType.NVarChar, 50),
                new SqlParameter("@STD002", SqlDbType.NVarChar, 50),
                new SqlParameter("@STD003", SqlDbType.NVarChar, 50),
                new SqlParameter("@STD004", SqlDbType.NVarChar, 50)
            };
            parameter [0].Value = _std.STD001;
            parameter [1].Value = _std.STD002;
            parameter [2].Value = _std.STD003;
            parameter [3].Value = _std.STD004;
            SQLString.Add(strSql, parameter);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// query dataTable from database
        /// </summary>
        /// <param name="codeNum"></param>
        /// <returns></returns>
        public DataTable tableView(string codeNum)
        {
            Hashtable SQLString = new Hashtable( );

            ProductionErpEntity.StatorCoilSTDEntity _std = new ProductionErpEntity.StatorCoilSTDEntity( );
            _std.STD001 = codeNum;
            DataTable dt = getOtherData(codeNum);

            if (dt != null && dt.Rows.Count > 0)
            {
                _std.STD002 = "检验";
                _std.STD003 = "耐压2260V,测试一分钟无击穿";
                if (dt.Rows [0] ["RES005"] != null)
                {
                    _std.STD004 = dt.Rows [0] ["RES005"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
                if (_std.STD004 != string.Empty)
                {
                    edit_std(SQLString, _std);
                }
                _std.STD003 = "匝间检验合格";
                if (dt.Rows [0] ["RES006"] != null)
                {
                    _std.STD004 = dt.Rows [0] ["RES006"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
                if (_std.STD004 != string.Empty)
                {
                    edit_std(SQLString, _std);
                }
                _std.STD003 = "绝缘电阻(MΩ)";
                if (dt.Rows [0] ["RES007"] != null)
                {
                    _std.STD004 = dt.Rows [0] ["RES007"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
                if (_std.STD004 != string.Empty)
                {
                    edit_std(SQLString, _std);
                }
                _std.STD003 = "(黄-绿)线间电阻(Ω)";
                if (dt.Rows [0] ["RES008"] != null)
                {
                    _std.STD004 = dt.Rows [0] ["RES008"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
                if (_std.STD004 != string.Empty)
                {
                    edit_std(SQLString, _std);
                }
                _std.STD003 = "(绿-红)线间电阻(Ω)";
                if (dt.Rows [0] ["RES009"] != null)
                {
                    _std.STD004 = dt.Rows [0] ["RES009"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
                if (_std.STD004 != string.Empty)
                {
                    edit_std(SQLString, _std);
                }
                _std.STD003 = "(黄-红)线间电阻(Ω)";
                if (dt.Rows [0] ["RES010"] != null)
                {
                    _std.STD004 = dt.Rows [0] ["RES010"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
                if (_std.STD004 != string.Empty)
                {
                    edit_std(SQLString, _std);
                }
                _std.STD003 = "环境温度(℃)";
                if (dt.Rows [0] ["RES011"] != null)
                {
                    _std.STD004 = dt.Rows [0] ["RES011"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
                if (_std.STD004 != string.Empty)
                {
                    edit_std(SQLString, _std);
                }
                _std.STD003 = "电阻不平衡度";
                if (dt.Rows [0] ["RES012"] != null)
                {
                    _std.STD004 = dt.Rows [0] ["RES012"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
                if (_std.STD004 != string.Empty)
                {
                    edit_std(SQLString, _std);
                }
            }
            DataTable dl = getBL(codeNum);

            if (dl != null && dl.Rows.Count > 0)
            {
                if (dl.Rows [0] ["WIB011"] != null)
                {
                    _std.STD004 = dl.Rows [0] ["WIB011"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
                _std.STD003 = "并联路数";
                _std.STD002 = "绕线";
                if (_std.STD004 != string.Empty)
                {
                    edit_std(SQLString, _std);
                }
            }
            StringBuilder strSql = new StringBuilder( );

            if (SqlHelper.ExecuteSqlTran(SQLString))
            {
                strSql.Append("SELECT DISTINCT A.idx,STD001,STD002,STD003,CASE WHEN STD004='True' THEN '合格' WHEN STD004='False' THEN '不合格' WHEN STD003='接头数量' THEN CONVERT(VARCHAR,ISNULL(WIE013,0)) ELSE STD004 END STD004,STD005,CASE STD002 WHEN '绕线' THEN ISNULL(WIE014,0) ELSE STD006 END STD006,CASE STD002 WHEN '绕线' THEN WIE015 ELSE STD007 END STD007,CASE STD002 WHEN '绕线' THEN WIE016 ELSE STD008 END STD008,STD012,STD013,STD010,STD011 FROM MOXSTD A LEFT JOIN MOXART B ON A.STD002=B.ART001 LEFT JOIN MOXARP C ON B.idx=C.ARP003 LEFT JOIN MOXWIE D ON A.STD001=D.WIE005 ");
                strSql.AppendFormat("WHERE STD001='{0}' AND ARP004 LIKE '定子%' AND ARP001='{1}' ORDER BY STD010,STD011", codeNum, CarpenterBll.UserInformation.UserNum);
            }
            return(SqlHelper.ExecuteDataTable(strSql.ToString( )));
        }
Ejemplo n.º 8
0
        void std_para(Hashtable SQLString, StringBuilder strSql, ProductionErpEntity.StatorCoilSTDEntity _std, string zaS, string zS, string pfS, string psG)
        {
            DataTable dt     = getOtherData(_std.STD001);
            bool      result = false;

            if (dt != null && dt.Rows.Count > 0)
            {
                result = true;
            }
            _std.STD002 = "绕线";
            _std.STD003 = "确认线圈匝数";
            _std.STD004 = zaS.ToString( );
            _std.STD005 = "匝数测试仪";
            _std.STD010 = "1";
            _std.STD011 = "0";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "确认线圈组数";
            _std.STD004 = zS.ToString( );
            _std.STD005 = "目测";
            _std.STD010 = "1";
            _std.STD011 = "1";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "接头数量";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD010 = "1";
            _std.STD011 = "2";
            add_std(SQLString, strSql, _std);
            DataTable dl = getBL(_std.STD001);

            if (dl != null && dl.Rows.Count > 0)
            {
                if (dl.Rows [0] ["WIB011"] != null)
                {
                    _std.STD004 = dl.Rows [0] ["WIB011"].ToString( );
                }
                else
                {
                    _std.STD004 = string.Empty;
                }
            }
            _std.STD003 = "并联路数";
            _std.STD005 = "目测";
            _std.STD010 = "1";
            _std.STD011 = "3";
            add_std(SQLString, strSql, _std);
            _std.STD002 = "嵌线";
            _std.STD003 = "确认接头数量";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD010 = "2";
            _std.STD011 = "4";
            add_std(SQLString, strSql, _std);
            //_std . STD002 = "绑扎整形焊接";
            _std.STD003 = "引出线规格(平方)";
            _std.STD004 = pfS.ToString( );
            _std.STD005 = "目测";
            _std.STD010 = "3";
            _std.STD011 = "5";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "引出线长度(mm)";
            _std.STD004 = psG.ToString( );
            _std.STD005 = "钢尺";
            _std.STD010 = "3";
            _std.STD011 = "6";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "焊接接头数量";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD010 = "3";
            _std.STD011 = "7";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "出线端线尺寸合格";
            _std.STD004 = string.Empty;
            _std.STD005 = "钢尺";
            _std.STD010 = "3";
            _std.STD011 = "8";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "非出线端线包尺寸合格";
            _std.STD004 = string.Empty;
            _std.STD005 = "钢尺";
            _std.STD010 = "3";
            _std.STD011 = "9";
            add_std(SQLString, strSql, _std);
            _std.STD002 = "检验";
            _std.STD003 = "耐压2260V,测试一分钟无击穿";
            if (result && dt.Rows [0] ["RES005"] != null)
            {
                _std.STD004 = dt.Rows [0] ["RES005"].ToString( );
            }
            else
            {
                _std.STD004 = string.Empty;
            }
            _std.STD005 = "耐压测试仪";
            _std.STD010 = "4";
            _std.STD011 = "10";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "匝间检验合格";
            if (result && dt.Rows [0] ["RES006"] != null)
            {
                _std.STD004 = dt.Rows [0] ["RES006"].ToString( );
            }
            else
            {
                _std.STD004 = string.Empty;
            }
            _std.STD005 = "匝间测试仪";
            _std.STD011 = "11";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "绝缘电阻(MΩ)";
            if (result && dt.Rows [0] ["RES007"] != null)
            {
                _std.STD004 = dt.Rows [0] ["RES007"].ToString( );
            }
            else
            {
                _std.STD004 = string.Empty;
            }
            _std.STD005 = "摇表";
            _std.STD011 = "12";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "(黄-绿)线间电阻(Ω)";
            if (result && dt.Rows [0] ["RES008"] != null)
            {
                _std.STD004 = dt.Rows [0] ["RES008"].ToString( );
            }
            else
            {
                _std.STD004 = string.Empty;
            }
            _std.STD005 = string.Empty;
            _std.STD011 = "13";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "(绿-红)线间电阻(Ω)";
            if (result && dt.Rows [0] ["RES009"] != null)
            {
                _std.STD004 = dt.Rows [0] ["RES009"].ToString( );
            }
            else
            {
                _std.STD004 = string.Empty;
            }
            _std.STD005 = string.Empty;
            _std.STD011 = "14";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "(黄-红)线间电阻(Ω)";
            if (result && dt.Rows [0] ["RES010"] != null)
            {
                _std.STD004 = dt.Rows [0] ["RES010"].ToString( );
            }
            else
            {
                _std.STD004 = string.Empty;
            }
            _std.STD005 = string.Empty;
            _std.STD011 = "15";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "环境温度(℃)";
            if (result && dt.Rows [0] ["RES011"] != null)
            {
                _std.STD004 = dt.Rows [0] ["RES011"].ToString( );
            }
            else
            {
                _std.STD004 = string.Empty;
            }
            _std.STD005 = "温度计";
            _std.STD011 = "16";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "电阻不平衡度";
            if (result && dt.Rows [0] ["RES012"] != null)
            {
                _std.STD004 = dt.Rows [0] ["RES012"].ToString( );
            }
            else
            {
                _std.STD004 = string.Empty;
            }
            _std.STD005 = "计算器";
            _std.STD011 = "17";
            add_std(SQLString, strSql, _std);
            //_std . STD003 = "三相电阻偏差不大于平均值的2%";
            //_std . STD004 = string . Empty;
            //_std . STD005 = "直流低电阻测试仪";
            //_std . STD011 = "18";
            //add_std ( SQLString ,strSql ,_std );
            _std.STD003 = "线包尺寸用卡板检验合格%";
            _std.STD004 = string.Empty;
            _std.STD005 = "检具";
            _std.STD011 = "19";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "外观整齐,无漏绑";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "20";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "槽楔整齐,无歪斜";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "21";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "漆包线无破损";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "22";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "绝缘纸维修剪";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "23";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "引出线长度不够";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "24";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "曹契装配不合格";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "25";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "铁芯叠片翘起";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "26";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "虚焊";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "27";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "线包高度超出";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "28";
            add_std(SQLString, strSql, _std);
            _std.STD003 = "绑线松紧不够";
            _std.STD004 = string.Empty;
            _std.STD005 = "目测";
            _std.STD011 = "29";
            add_std(SQLString, strSql, _std);
        }