Exemplo n.º 1
0
        /// <summary>
        /// DEH是否存在
        /// </summary>
        /// <param name="_model"></param>
        /// <returns></returns>
        bool ExistsDEH(barCodeEntity.TPADEH _model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.AppendFormat("SELECT COUNT(1) FROM TPADEH WHERE DEH001='{0}' AND DEH002='{1}'", _model.Dhe001, _model.Dhe002);

            return(SqlHelper.Exists(strSql.ToString( )));
        }
Exemplo n.º 2
0
 /// <summary>
 /// DEH编辑一条记录
 /// </summary>
 /// <param name="_model"></param>
 /// <param name="strSql"></param>
 /// <returns></returns>
 public string UpdateDEH(barCodeEntity.TPADEH _model, StringBuilder strSql)
 {
     strSql = new StringBuilder( );
     strSql.Append("UPDATE TPADEH SET ");
     strSql.Append("DEH004=CONVERT(varchar(100), GETDATE(), 112),");
     strSql.Append("DEH005=CONVERT(varchar(100), GETDATE(), 112) ");
     strSql.AppendFormat("WHERE DEH001='{0}' AND DEH002='{1}'", _model.Dhe001, _model.Dhe002);
     return(strSql.ToString( ));
 }
Exemplo n.º 3
0
        /// <summary>
        /// DEH增加一条记录
        /// </summary>
        /// <param name="_model"></param>
        /// <param name="strSql"></param>
        /// <returns></returns>
        public string InsertDEH(barCodeEntity.TPADEH _model, StringBuilder strSql)
        {
            strSql = new StringBuilder( );
            strSql.Append("INSERT INTO TPADEH (");
            strSql.Append("DEH001,DEH002,DEH003,DEH004,DEH005) ");
            strSql.Append("VALUES (");
            strSql.AppendFormat("'{0}','{1}','{2}',CONVERT(varchar(100), GETDATE(), 112),CONVERT(varchar(100), GETDATE(), 112)) ", _model.Dhe001, _model.Dhe002, _model.Dhe003);

            return(strSql.ToString( ));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 生成入库记录
        /// </summary>
        /// <param name="idxList"></param>
        /// <param name="documentType"></param>
        /// <returns></returns>
        public bool InsertToLibrary(List <int> idxList, string rklx, DataTable table)
        {
            if (idxList.Count < 1)
            {
                return(false);
            }
            StringBuilder strSql    = new StringBuilder( );
            ArrayList     SQLString = new ArrayList( );
            DataTable     dt        = LibraryDa(idxList, strSql);

            if (dt != null && dt.Rows.Count > 0)
            {
                barCodeEntity.JSKLHA _modelOne = new barCodeEntity.JSKLHA( );
                barCodeEntity.JSKLHB _modelTwo = new barCodeEntity.JSKLHB( );
                barCodeEntity.barCodeReportEntity _modelTre = new barCodeEntity.barCodeReportEntity( );
                barCodeEntity.TPADEH _modelDHE = new barCodeEntity.TPADEH( );
                _modelTre.BAR019 = 0;

                _modelOne.LHA002 = "条码";
                _modelOne.LHA004 = rklx;
                _modelOne.LHA001 = _modelTwo.LHB001 = _modelTre.BAR011 = LibraryOrderOddNum( );
                _modelOne.LHA003 = DateTime.Now.ToString("yyyyMMdd");
                _modelOne.LHA012 = "F";

                SQLString.Add(InsertLHA(_modelOne, strSql));
                List <string> strList = new List <string> ( );
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (strList.Count < 1)
                    {
                        _modelTwo.LHB002 = "001";
                    }
                    else
                    {
                        _modelTwo.LHB002 = maxStrList(strList).ToString( );
                        if (Convert.ToInt32(_modelTwo.LHB002) < 9)
                        {
                            _modelTwo.LHB002 = "00" + (Convert.ToInt32(_modelTwo.LHB002) + 1).ToString( );
                        }
                        else if (Convert.ToInt32(_modelTwo.LHB002) >= 9 && Convert.ToInt32(_modelTwo.LHB002) < 99)
                        {
                            _modelTwo.LHB002 = "0" + (Convert.ToInt32(_modelTwo.LHB002) + 1).ToString( );
                        }
                        else
                        {
                            _modelTwo.LHB002 = (Convert.ToInt32(_modelTwo.LHB002) + 1).ToString( );
                        }
                    }
                    strList.Add(_modelTwo.LHB002);

                    _modelTre.BAR008 = dt.Rows [i] ["BAR008"].ToString( );
                    if (table.Select("BAR008='" + _modelTre.BAR008 + "'").Length > 0)
                    {
                        _modelTre.BAR019 = Convert.ToInt32(table.Select("BAR008='" + _modelTre.BAR008 + "'") [0] ["BAR023"].ToString( ));
                    }

                    _modelTre.BAR023 = 0;
                    SQLString.Add(EditBAR(_modelTre, strSql));

                    _modelTwo.LHB003 = _modelDHE.Dhe001 = dt.Rows [i] ["BAR001"].ToString( );
                    _modelTwo.LHB004 = dt.Rows [i] ["BAR002"].ToString( );
                    _modelTwo.LHB005 = dt.Rows [i] ["DEA003"].ToString( );
                    _modelTwo.LHB006 = dt.Rows [i] ["DDA001"].ToString( );
                    _modelTwo.LHB007 = 1;
                    _modelTwo.LHB008 = /*string . IsNullOrEmpty ( dt . Rows [ i ] [ "COUN" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( dt . Rows [ i ] [ "COUN" ] . ToString ( ) );*/ _modelTre.BAR019;
                    _modelTwo.LHB011 = "F";
                    _modelTwo.LHB019 = _modelDHE.Dhe002 = dt.Rows [i] ["BAR007"].ToString( );
                    _modelTwo.LHB020 = 1;
                    _modelTwo.LHB021 = 1;
                    _modelTwo.LHB022 = dt.Rows [i] ["DEA003"].ToString( );
                    _modelTwo.LHB023 = _modelTwo.LHB008;
                    _modelTwo.LHB024 = dt.Rows [i] ["BAR004"].ToString( );
                    _modelTwo.LHB960 = dt.Rows [i] ["BAR007"].ToString( );
                    _modelTwo.LHB980 = Math.Round(acreage(dt.Rows [i] ["DEA057"].ToString( )) * _modelTwo.LHB008, 2);
                    _modelTwo.LHB961 = dt.Rows [i] ["DEA961"].ToString( );
                    _modelDHE.Dhe003 = dt.Rows [i] ["BAR025"].ToString( );


                    SQLString.Add(InsertLHB(_modelTwo, strSql));
                    if (ExistsDEH(_modelDHE))
                    {
                        SQLString.Add(UpdateDEH(_modelDHE, strSql));
                    }
                    else
                    {
                        SQLString.Add(InsertDEH(_modelDHE, strSql));
                    }
                }

                //if ( !string . IsNullOrEmpty ( _modelOne . LHA001 ) )
                //{
                //    SQLString . Add ( EditBAR ( _modelTre ,strSql ,idxList ) );
                //}

                return(SqlHelper.ExecuteSqlTran(SQLString));
            }
            else
            {
                return(false);
            }
        }