internal bool BulkCopyDelete()
        {
            int        count = 0, pageSize = 5000;
            MDataTable dt     = null;
            bool       result = false;

            using (MAction action = new MAction(mdt.TableName, _Conn))
            {
                action.SetAopState(Aop.AopOp.CloseAll);
                if (action.DataBaseVersion.StartsWith("08"))
                {
                    pageSize = 1000;
                }
                count = mdt.Rows.Count / pageSize + 1;
                DalBase sourceHelper = action.dalHelper;
                if (_dalHelper != null)
                {
                    action.dalHelper = _dalHelper;
                }
                else
                {
                    action.BeginTransation();
                }

                MCellStruct keyColumn  = jointPrimaryIndex != null ? mdt.Columns[jointPrimaryIndex[0]] : mdt.Columns.FirstPrimary;
                string      columnName = keyColumn.ColumnName;
                for (int i = 0; i < count; i++)
                {
                    dt = mdt.Select(i + 1, pageSize, null);//分页读取
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        #region 核心逻辑
                        string whereIn = SqlCreate.GetWhereIn(keyColumn, dt.GetColumnItems <string>(columnName, BreakOp.NullOrEmpty, true), action.DataBaseType);
                        result = action.Delete(whereIn) || action.RecordsAffected == 0;
                        if (result)
                        {
                            sourceTable.RecordsAffected += action.RecordsAffected;//记录总删除的数量。
                        }
                        else
                        {
                            sourceTable.RecordsAffected = 0;
                            string msg = "Error On : MDataTable.AcceptChanges.Delete." + mdt.TableName + " : where (" + whereIn + ") : " + action.DebugInfo;
                            sourceTable.DynamicData = msg;
                            Log.Write(msg, LogType.DataBase);
                            break;
                        }
                        #endregion
                    }
                }
                if (_dalHelper == null)
                {
                    action.EndTransation();
                }
                else
                {
                    action.dalHelper = sourceHelper;//还原。
                }
            }
            return(result);
        }
Exemple #2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         sqlCreate = new SqlCreate();
         if (cbxProjName.SelectedIndex == -1)
         {
             MessageBox.Show("请选择项目!");
             return;
         }
         StaticClass.List_SMInfrared_Config = sqlCreate.Select_SMInfrared_Config();
         foreach (StructClass.StructSMInfrared_Config structSMInfrared_Config in StaticClass.List_SMInfrared_Config)
         {
             if (structSMInfrared_Config.ProjName == cbxProjName.Text)
             {
                 StaticClass.ProjName     = cbxProjName.Text;
                 StaticClass.DataBaseName = structSMInfrared_Config.DataBaseName;
             }
         }
         if (StaticClass.ProjName == null || StaticClass.DataBaseName == null)
         {
             MessageBox.Show("系统登陆异常!");
             return;
         }
         DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        internal static MDataTable Join(MDataTable dtA, string tableName, string joinOnName, params string[] appendColumns)
        {
            MDataTable dtB = null;

            using (MAction action = new MAction(tableName, dtA.Conn))
            {
                if (!action.Data.Columns.Contains(joinOnName))
                {
                    joinOnName = action.Data.Columns.FirstPrimary.ColumnName;
                }
                //action.SetAopOff();
                action.dalHelper.IsAllowRecordSql = false;//屏蔽SQL日志记录 2000数据库大量的In条件会超时。
                if (appendColumns.Length > 0)
                {
                    List <string> items = new List <string>(appendColumns.Length + 1);
                    items.AddRange(appendColumns);
                    if (!items.Contains(joinOnName))
                    {
                        items.Add(joinOnName);
                    }
                    action.SetSelectColumns(items.ToArray());
                }
                string whereIn = SqlCreate.GetWhereIn(action.Data[joinOnName].Struct, dtA.GetColumnItems <string>(dtA.joinOnIndex, BreakOp.NullOrEmpty, true), action.DalType);
                dtB            = action.Select(whereIn);
                dtB.JoinOnName = joinOnName;
            }
            return(Join(dtA, dtB, appendColumns));
        }
        /// <summary>
        /// 2010-11-21
        /// </summary>
        /// <param name="supplyTable"></param>
        public void InsertSupply(DataTable supplyTable, bool isUseSerialNo)
        {
            DataRow[] rows     = supplyTable.Select("", "BATCH,SERIALNO");
            int       serialNo = 1;

            foreach (DataRow row in rows)
            {
                SqlCreate sqlCreate = new SqlCreate("AS_SC_SUPPLY", SqlType.INSERT);
                sqlCreate.AppendQuote("ORDERDATE", row["ORDERDATE"]);
                sqlCreate.Append("BATCHNO", row["BATCHNO"]);
                sqlCreate.AppendQuote("LINECODE", row["LINECODE"]);
                sqlCreate.Append("SERIALNO", isUseSerialNo ? row["SERIALNO"] : serialNo++);

                sqlCreate.Append("ORIGINALSORTNO", row["SORTNO"]);
                sqlCreate.Append("SORTNO", row["SORTNO"]);

                sqlCreate.AppendQuote("CIGARETTECODE", row["CIGARETTECODE"]);
                sqlCreate.AppendQuote("CIGARETTENAME", row["CIGARETTENAME"]);

                sqlCreate.AppendQuote("CHANNELCODE", row["CHANNELCODE"]);
                sqlCreate.Append("CHANNELGROUP", row["CHANNELGROUP"]);
                sqlCreate.Append("GROUPNO", row["GROUPNO"]);

                ExecuteNonQuery(sqlCreate.GetSQL());
            }
        }
        /// <summary>
        /// 2010-11-21
        /// </summary>
        /// <param name="channelTable"></param>
        public void UpdateQuantity(DataTable channelTable, bool isUseBalance)
        {
            foreach (DataRow channelRow in channelTable.Rows)
            {
                string sql = "UPDATE AS_SC_CHANNELUSED SET CIGARETTECODE = '{0}',CIGARETTENAME = '{1}',QUANTITY={2} " +
                             " WHERE ORDERDATE='{3}' AND BATCHNO='{4}' AND LINECODE='{5}' AND CHANNELCODE='{6}'";
                ExecuteNonQuery(string.Format(sql, channelRow["CIGARETTECODE"], channelRow["CIGARETTENAME"], channelRow["QUANTITY"],
                                              channelRow["ORDERDATE"], channelRow["BATCHNO"].ToString().Trim(), channelRow["LINECODE"], channelRow["CHANNELCODE"]));

                if (isUseBalance && channelRow["CHANNELTYPE"].ToString() == "3" && channelRow["CIGARETTECODE"].ToString() == channelRow["D_CIGARETTECODE"].ToString())
                {
                    SqlCreate sqlCreate = new SqlCreate("AS_SC_BALANCE", SqlType.INSERT);

                    sqlCreate.AppendQuote("ORDERDATE", channelRow["ORDERDATE"]);
                    sqlCreate.Append("BATCHNO", channelRow["BATCHNO"]);
                    sqlCreate.AppendQuote("CHANNELID", channelRow["CHANNELID"]);
                    sqlCreate.AppendQuote("LINECODE", channelRow["LINECODE"]);
                    sqlCreate.AppendQuote("CHANNELCODE", channelRow["CHANNELCODE"]);
                    sqlCreate.AppendQuote("CHANNELNAME", channelRow["CHANNELNAME"]);
                    sqlCreate.AppendQuote("CIGARETTECODE", channelRow["CIGARETTECODE"]);
                    sqlCreate.AppendQuote("CIGARETTENAME", channelRow["CIGARETTENAME"]);

                    int quantity = Convert.ToInt32(channelRow["QUANTITY"]) % 50;
                    int balance  = Convert.ToInt32(channelRow["BALANCE"]);

                    sqlCreate.Append("QUANTITY", balance >= quantity ? 0 - quantity : 50 - quantity);

                    ExecuteNonQuery(sqlCreate.GetSQL());
                }
                else
                {
                    ExecuteNonQuery(string.Format("DELETE FROM AS_SC_BALANCE WHERE CHANNELID = '{0}'", channelRow["CHANNELID"]));
                }
            }
        }
        internal void InsertStockChannelUsed(string orderDate, int batchNo, DataTable channelTable)
        {
            foreach (DataRow row in channelTable.Rows)
            {
                SqlCreate sqlCreate = new SqlCreate("AS_SC_STOCKCHANNELUSED", SqlType.INSERT);
                sqlCreate.AppendQuote("ORDERDATE", orderDate);
                sqlCreate.Append("BATCHNO", batchNo);

                sqlCreate.AppendQuote("CHANNELCODE", row["CHANNELCODE"]);
                sqlCreate.AppendQuote("CHANNELNAME", row["CHANNELNAME"]);
                sqlCreate.AppendQuote("CHANNELTYPE", row["CHANNELTYPE"]);

                sqlCreate.AppendQuote("CIGARETTECODE", row["CIGARETTECODE"]);
                sqlCreate.AppendQuote("CIGARETTENAME", row["CIGARETTENAME"]);

                sqlCreate.Append("QUANTITY", row["QUANTITY"]);
                sqlCreate.Append("REMAINQUANTITY", row["REMAINQUANTITY"]);

                sqlCreate.Append("ORDERNO", row["ORDERNO"]);
                sqlCreate.Append("LEDNO", row["LEDNO"]);

                sqlCreate.AppendQuote("STATUS", row["STATUS"]);
                sqlCreate.AppendQuote("ISSTOCKIN", row["ISSTOCKIN"]);

                ExecuteNonQuery(sqlCreate.GetSQL());
            }
        }
        public void InsertSupply(DataTable supplyTable, string lineCode, string orderDate, int batchNo)
        {
            if (this.lineCode != lineCode)
            {
                this.lineCode = lineCode;
                string sql = string.Format("SELECT CASE WHEN MAX(SERIALNO) IS NULL THEN 1000 ELSE MAX(SERIALNO) END  FROM AS_SC_SUPPLY WHERE LINECODE='{0}' AND ORDERDATE = '{1}' AND BATCHNO = {2} ", lineCode, orderDate, batchNo);
                serialNo = Convert.ToInt32(ExecuteScalar(sql));
            }

            foreach (DataRow row in supplyTable.Rows)
            {
                SqlCreate sqlCreate = new SqlCreate("AS_SC_SUPPLY", SqlType.INSERT);
                sqlCreate.AppendQuote("ORDERDATE", row["ORDERDATE"]);
                sqlCreate.Append("BATCHNO", row["BATCHNO"]);
                sqlCreate.Append("SERIALNO", serialNo++);
                sqlCreate.AppendQuote("LINECODE", row["LINECODE"]);
                sqlCreate.Append("ORIGINALSORTNO", row["SORTNO"]);
                sqlCreate.Append("SORTNO", row["SORTNO"]);
                sqlCreate.Append("GROUPNO", row["GROUPNO"]);
                sqlCreate.Append("CHANNELGROUP", row["CHANNELGROUP"]);
                sqlCreate.AppendQuote("CHANNELCODE", row["CHANNELCODE"]);
                sqlCreate.AppendQuote("CIGARETTECODE", row["CIGARETTECODE"]);
                sqlCreate.AppendQuote("CIGARETTENAME", row["CIGARETTENAME"]);
                ExecuteNonQuery(sqlCreate.GetSQL());
            }
        }
        //public void SaveOrder(DataTable orderTable)
        //{
        //    foreach (DataRow orderRow in orderTable.Rows)
        //    {
        //        SqlCreate sql = new SqlCreate("AS_SC_ORDER", SqlType.INSERT);
        //        sql.AppendQuote("ORDERDATE", orderRow["ORDERDATE"]);
        //        sql.Append("BATCHNO", orderRow["BATCHNO"]);
        //        sql.AppendQuote("LINECODE", orderRow["LINECODE"]);
        //        sql.Append("SORTNO", orderRow["SORTNO"]);
        //        sql.Append("PALLETNO", orderRow["PALLETNO"]);

        //        sql.AppendQuote("CHANNELCODE", orderRow["CHANNELCODE"]);
        //        sql.AppendQuote("CIGARETTECODE", orderRow["CIGARETTECODE"]);

        //        sql.AppendQuote("CIGARETTENAME", orderRow["CIGARETTENAME"]);
        //        sql.Append("QUANTITY", orderRow["QUANTITY"]);

        //        ExecuteNonQuery(sql.GetSQL());
        //    }
        //}

        public void SaveOrderMaster(DataTable masterTable)
        {
            foreach (DataRow orderRow in masterTable.Rows)
            {
                SqlCreate sql = new SqlCreate("AS_SC_PALLETMASTER", SqlType.INSERT);
                sql.AppendQuote("ORDERDATE", orderRow["ORDERDATE"]);
                sql.Append("BATCHNO", orderRow["BATCHNO"]);
                sql.AppendQuote("LINECODE", orderRow["LINECODE"]);
                sql.Append("SORTNO", orderRow["SORTNO"]);
                sql.AppendQuote("ORDERID", orderRow["ORDERID"]);

                sql.AppendQuote("AREACODE", orderRow["AREACODE"]);
                sql.AppendQuote("AREANAME", orderRow["AREANAME"]);

                sql.AppendQuote("ROUTECODE", orderRow["ROUTECODE"]);
                sql.AppendQuote("ROUTENAME", orderRow["ROUTENAME"]);

                sql.AppendQuote("CUSTOMERCODE", orderRow["CUSTOMERCODE"]);
                sql.AppendQuote("CUSTOMERNAME", orderRow["CUSTOMERNAME"]);

                sql.AppendQuote("ADDRESS", orderRow["ADDRESS"]);
                sql.AppendQuote("ORDERNO", orderRow["ORDERNO"]);

                sql.Append("QUANTITY", orderRow["QUANTITY"]);
                sql.Append("ABNORMITY_QUANTITY", orderRow["ABNORMITY_QUANTITY"]);

                ExecuteNonQuery(sql.GetSQL());
            }
        }
Exemple #9
0
        public void InsertHandSupplyOrders(DataTable newSupplyOrders)
        {
            foreach (DataRow dataRow in newSupplyOrders.Rows)
            {
                SqlCreate sqlCreate = new SqlCreate("AS_SC_HANDLESUPPLY", SqlType.INSERT);

                sqlCreate.AppendQuote("ORDERDATE", dataRow["ORDERDATE"]);
                sqlCreate.AppendQuote("BATCHNO", dataRow["BATCHNO"]);
                sqlCreate.AppendQuote("LINECODE", dataRow["LINECODE"]);
                sqlCreate.Append("SORTNO", dataRow["SORTNO"]);

                sqlCreate.AppendQuote("SUPPLYBATCH", dataRow["SUPPLYBATCH"]);
                sqlCreate.AppendQuote("ORDERID", dataRow["ORDERID"]);

                sqlCreate.AppendQuote("CIGARETTECODE", dataRow["CIGARETTECODE"]);
                sqlCreate.AppendQuote("CIGARETTENAME", dataRow["CIGARETTENAME"]);

                sqlCreate.AppendQuote("CHANNELCODE", dataRow["CHANNELCODE"]);

                sqlCreate.Append("QUANTITY", dataRow["QUANTITY"]);

                sqlCreate.AppendQuote("STATUS", "0");

                ExecuteNonQuery(sqlCreate.GetSQL());
            }
        }
Exemple #10
0
        public void InsertNewSupplyOrders(DataTable newSupplyOrders)
        {
            foreach (DataRow dataRow in newSupplyOrders.Rows)
            {
                SqlCreate sqlCreate = new SqlCreate("AS_SC_ORDER", SqlType.INSERT);

                sqlCreate.AppendQuote("ORDERDATE", dataRow["ORDERDATE"]);
                sqlCreate.AppendQuote("BATCHNO", dataRow["BATCHNO"]);
                sqlCreate.AppendQuote("LINECODE", dataRow["LINECODE"]);
                sqlCreate.Append("SORTNO", dataRow["SORTNO"]);

                sqlCreate.AppendQuote("ORDERID", dataRow["ORDERID"]);
                sqlCreate.Append("ORDERNO", dataRow["ORDERNO"]);

                sqlCreate.AppendQuote("CIGARETTECODE", dataRow["CIGARETTECODE"]);
                sqlCreate.AppendQuote("CIGARETTENAME", dataRow["CIGARETTENAME"]);

                sqlCreate.AppendQuote("CHANNELCODE", dataRow["CHANNELCODE"]);
                sqlCreate.AppendQuote("CHANNELGROUP", dataRow["CHANNELGROUP"]);
                sqlCreate.AppendQuote("CHANNELORDER", dataRow["CHANNELORDER"]);

                sqlCreate.Append("QUANTITY", dataRow["QUANTITY"]);
                sqlCreate.Append("EXPORTNO", dataRow["EXPORTNO"]);
                sqlCreate.Append("PACKNO", dataRow["PACKNO"]);

                ExecuteNonQuery(sqlCreate.GetSQL());
            }
        }
Exemple #11
0
        internal static MDataTable Join(MDataTable dtA, string tableName, string joinOnName, params string[] appendColumns)
        {
            MDataTable dtB = null;

            using (MAction action = new MAction(tableName, dtA.Conn))
            {
                if (!action.Data.Columns.Contains(joinOnName))
                {
                    joinOnName = action.Data.Columns.FirstPrimary.ColumnName;
                }
                //action.SetAopState(CYQ.Data.Aop.AopOp.CloseAll);
                action.dalHelper.IsRecordDebugInfo = false || AppDebug.IsContainSysSql;//屏蔽SQL日志记录 2000数据库大量的In条件会超时。
                if (appendColumns.Length > 0)
                {
                    if (appendColumns.Length == 1)
                    {
                        appendColumns = appendColumns[0].Split(',');
                    }
                    List <string> items = new List <string>(appendColumns.Length + 1);
                    items.AddRange(appendColumns);
                    if (!items.Contains(joinOnName))
                    {
                        items.Add(joinOnName);
                    }
                    action.SetSelectColumns(items.ToArray());
                }
                string whereIn = SqlCreate.GetWhereIn(action.Data[joinOnName].Struct, dtA.GetColumnItems <string>(dtA.joinOnIndex, BreakOp.NullOrEmpty, true), action.DataBaseType);
                dtB            = action.Select(whereIn);
                dtB.JoinOnName = joinOnName;
            }
            return(Join(dtA, dtB, appendColumns));
        }
        internal bool BulkCopyUpdate()
        {
            int        count = 0, pageSize = 5000;
            MDataTable dt = null;

            using (MAction action = new MAction(mdt.TableName, _Conn))
            {
                action.SetAopState(Aop.AopOp.CloseAll);
                if (action.DalVersion.StartsWith("08"))
                {
                    pageSize = 1000;
                }
                count = mdt.Rows.Count / pageSize + 1;
                DbBase sourceHelper = action.dalHelper;
                if (_dalHelper != null)
                {
                    action.dalHelper = _dalHelper;
                }
                else
                {
                    action.BeginTransation();
                }

                bool        result     = false;
                MCellStruct keyColumn  = jointPrimaryIndex != null ? mdt.Columns[jointPrimaryIndex[0]] : mdt.Columns.FirstPrimary;
                string      columnName = keyColumn.ColumnName;
                for (int i = 0; i < count; i++)
                {
                    dt = mdt.Select(i + 1, pageSize, null);//分页读取
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        #region 核心逻辑
                        string     whereIn = SqlCreate.GetWhereIn(keyColumn, dt.GetColumnItems <string>(columnName, BreakOp.NullOrEmpty, true), action.DalType);
                        MDataTable dtData  = action.Select(whereIn); //获取远程数据。
                        dtData.Load(dt);                             //重新加载赋值。
                        result = action.Delete(whereIn);             //如果存在IsDeleted,会被转Update(导致后续无法Insert)
                        if (result)
                        {
                            dtData.DynamicData = action;
                            result             = dtData.AcceptChanges(AcceptOp.InsertWithID);
                        }
                        if (!result)
                        {
                            break;
                        }
                        #endregion
                    }
                }
                if (_dalHelper == null)
                {
                    action.BeginTransation();
                }
                else
                {
                    action.dalHelper = sourceHelper;//还原。
                }
            }
            return(true);
        }
Exemple #13
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="dataSet"></param>
        public void UpdateEntity(string sortID, string areaCode)
        {
            SqlCreate sqlCreate = new SqlCreate("AS_BI_AREA", SqlType.UPDATE);

            sqlCreate.Append("SORTID", sortID);
            sqlCreate.AppendWhereQuote("AREACODE", areaCode);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
Exemple #14
0
        internal void InsertEntity(string orderDate, string orderId)
        {
            SqlCreate sqlCreate = new SqlCreate("AS_HANDLE_SORT_ORDER", SqlType.INSERT);

            sqlCreate.AppendQuote("ORDERDATE", orderDate);
            sqlCreate.AppendQuote("ORDERID", orderId);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
Exemple #15
0
        public void UpdateEntity(string lineCode, string status)
        {
            SqlCreate sqlCreate = new SqlCreate("AS_BI_LINEINFO", SqlType.UPDATE);

            sqlCreate.AppendQuote("STATUS", status);
            sqlCreate.AppendWhereQuote("LINECODE", lineCode);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
Exemple #16
0
        /// <summary>
        /// ¸üÐÂ
        /// </summary>
        /// <param name="dataSet"></param>
        public void UpdateEntity(string sortID, string lineCode, string routeCode)
        {
            SqlCreate sqlCreate = new SqlCreate("AS_BI_ROUTE", SqlType.UPDATE);

            sqlCreate.Append("SORTID", sortID);
            sqlCreate.AppendQuote("LINECODE", lineCode);
            sqlCreate.AppendWhereQuote("ROUTECODE", routeCode);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
        public void UpdateEntity(string departmentID, string departmentName, string remark)
        {
            SqlCreate sqlCreate = new SqlCreate("AS_BI_DEPARTMENT", SqlType.UPDATE);

            sqlCreate.AppendQuote("DEPARTMENTNAME", departmentName);
            sqlCreate.AppendQuote("REMARK", remark);
            sqlCreate.AppendWhereQuote("DEPARTMENTID", departmentID);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
        public void InsertEntity(string departmentName, string remark)
        {
            int       maxID     = Convert.ToInt32(ExecuteScalar("SELECT CASE WHEN MAX(DEPARTMENTID) IS NULL THEN 0 ELSE MAX(DEPARTMENTID) END FROM AS_BI_DEPARTMENT")) + 1;
            SqlCreate sqlCreate = new SqlCreate("AS_BI_DEPARTMENT", SqlType.INSERT);

            sqlCreate.AppendQuote("DEPARTMENTID", maxID.ToString().PadLeft(5, '0'));
            sqlCreate.AppendQuote("DEPARTMENTNAME", departmentName);
            sqlCreate.AppendQuote("REMARK", remark);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
Exemple #19
0
        public void UpdateEntity(string cigaretteCode, string cigaretteName, string isAbnormity, string barcode)
        {
            SqlCreate sqlCreate = new SqlCreate("AS_BI_CIGARETTE", SqlType.UPDATE);

            sqlCreate.AppendQuote("CIGARETTENAME", cigaretteName);
            sqlCreate.AppendQuote("ISABNORMITY", isAbnormity);
            sqlCreate.AppendQuote("BARCODE", barcode);
            sqlCreate.AppendWhereQuote("CIGARETTECODE", cigaretteCode);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
 public void UpdateEntity(Dictionary <string, string> parameters)
 {
     foreach (string key in parameters.Keys)
     {
         SqlCreate sqlCreate = new SqlCreate("AS_SYS_PARAMETER", SqlType.UPDATE);
         sqlCreate.AppendQuote("PARAMETERVALUE", parameters[key]);
         sqlCreate.AppendWhereQuote("PARAMETERNAME", key);
         ExecuteNonQuery(sqlCreate.GetSQL());
     }
 }
 //zys_2011-10-06
 public void UpdateStatus(DataTable table)
 {
     DataRow[] stockOutRows = table.Select(string.Format("STATE = '1'"), "STOCKOUTID");
     foreach (DataRow row in stockOutRows)
     {
         SqlCreate sqlCreate = new SqlCreate("AS_STOCK_OUT", SqlType.UPDATE);
         sqlCreate.AppendQuote("STATE", "1");
         sqlCreate.AppendWhere("STOCKOUTID", row["STOCKOUTID"]);
         ExecuteNonQuery(sqlCreate.GetSQL());
     }
 }
        internal bool LoadDataInsert(DalType dalType, bool keepID)
        {
            bool fillGUID        = CheckGUIDAndDateTime(dalType);
            bool isNeedCreateDal = (_dalHelper == null);

            if (isNeedCreateDal && dalType != DalType.Oracle)
            {
                _dalHelper = DalCreate.CreateDal(_Conn);
                _dalHelper.isAllowInterWriteLog = false;
            }
            string path      = MDataTableToFile(mdt, fillGUID ? true : keepID, dalType);
            string formatSql = dalType == DalType.MySql ? SqlCreate.MySqlBulkCopySql : SqlCreate.OracleBulkCopySql;
            string sql       = string.Format(formatSql, path, SqlFormat.Keyword(mdt.TableName, dalType),
                                             AppConst.SplitChar, SqlCreate.GetColumnName(mdt.Columns, keepID, dalType));

            if (dalType == DalType.Oracle)
            {
                string ctlPath = CreateCTL(sql, path);
                sql = string.Format(SqlCreate.OracleSqlIDR, "sa/123456@ORCL", ctlPath, ctlPath.Replace(".ctl", ".out"));//只能用进程处理
            }
            try
            {
                if (dalType == DalType.Oracle)
                {
                    return(ExeSqlLoader(sql));
                }
                else
                {
                    if (_dalHelper.ExeNonQuery(sql, false) != -2)
                    {
                        return(true);
                    }
                }
            }
            catch (Exception err)
            {
                if (err.InnerException != null)
                {
                    err = err.InnerException;
                }
                sourceTable.DynamicData = err;
                Log.WriteLogToTxt(err);
            }
            finally
            {
                if (isNeedCreateDal && _dalHelper != null)
                {
                    _dalHelper.Dispose();
                    _dalHelper = null;
                }
                // File.Delete(path);
            }
            return(false);
        }
Exemple #23
0
 //zys_2011-10-06
 public void UpdateStockOutIdToStockIn(DataTable table)
 {
     DataRow[] stockInRows = table.Select(string.Format("STOCKINID IS NOT NULL AND STOCKOUTID <> 0 "), "STOCKINID");
     foreach (DataRow row in stockInRows)
     {
         SqlCreate sqlCreate = new SqlCreate("AS_STOCK_IN", SqlType.UPDATE);
         sqlCreate.AppendQuote("STOCKOUTID", row["STOCKOUTID"]);
         sqlCreate.AppendWhere("STOCKINID", row["STOCKINID"]);
         ExecuteNonQuery(sqlCreate.GetSQL());
     }
 }
 /// <summary>
 /// 2010-11-21
 /// </summary>
 /// <param name="channelTable"></param>
 public void UpdateChannel(DataTable channelTable)
 {
     foreach (DataRow row in channelTable.Rows)
     {
         SqlCreate sqlCreate = new SqlCreate("AS_BI_STOCKCHANNEL", SqlType.UPDATE);
         sqlCreate.AppendQuote("CIGARETTECODE", row["CIGARETTECODE"]);
         sqlCreate.AppendQuote("CIGARETTENAME", row["CIGARETTENAME"]);
         sqlCreate.Append("QUANTITY", row["QUANTITY"]);
         sqlCreate.AppendWhereQuote("CHANNELCODE", row["CHANNELCODE"]);
         ExecuteNonQuery(sqlCreate.GetSQL());
     }
 }
Exemple #25
0
 public void InsertEntity(DataSet dataSet)
 {
     foreach (DataRow dataRow in dataSet.Tables["AS_SYS_BARCODE"].Rows)
     {
         if (dataRow.RowState == DataRowState.Added)
         {
             SqlCreate sqlCreate = new SqlCreate("AS_SYS_BARCODE", SqlType.UPDATE);
             sqlCreate.AppendQuote("CIGARETTECODE", dataRow["CIGARETTECODE"]);
             ExecuteNonQuery(sqlCreate.GetSQL());
         }
     }
 }
Exemple #26
0
        public void UpdateEntity(string employeeCode, string employeeName, string departmentID, string status, string remark)
        {
            SqlCreate sqlCreate = new SqlCreate("AS_BI_EMPLOYEE", SqlType.UPDATE);

            sqlCreate.AppendQuote("EMPLOYEECODE", employeeCode);
            sqlCreate.AppendQuote("EMPLOYEENAME", employeeName);
            sqlCreate.AppendQuote("DEPARTMENTID", departmentID);
            sqlCreate.AppendQuote("STATUS", status);
            sqlCreate.AppendQuote("REMARK", remark);
            sqlCreate.AppendWhereQuote("EMPLOYEECODE", employeeCode);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
        public void UpdateEntity(string channelCode, string cigaretteCode, string cigaretteName, int quantity, string status, string isStockIn)
        {
            SqlCreate sqlCreate = new SqlCreate("AS_BI_STOCKCHANNEL", SqlType.UPDATE);

            sqlCreate.AppendQuote("CIGARETTECODE", cigaretteCode.Trim());
            sqlCreate.AppendQuote("CIGARETTENAME", cigaretteName.Trim());
            sqlCreate.AppendQuote("REMAINQUANTITY", quantity);
            sqlCreate.AppendQuote("STATUS", status);
            sqlCreate.AppendQuote("ISSTOCKIN", isStockIn);
            sqlCreate.AppendWhereQuote("CHANNELCODE", channelCode);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
Exemple #28
0
        public void Insert(int stockInID, int batchNo, string channelCode, string cigaretteCode, string cigaretteName, string barode, string state)
        {
            SqlCreate sqlCreate = new SqlCreate("AS_STOCK_IN", SqlType.INSERT);

            sqlCreate.Append("STOCKINID", stockInID);
            sqlCreate.Append("BATCHNO", batchNo);
            sqlCreate.AppendQuote("CHANNELCODE", channelCode);
            sqlCreate.AppendQuote("CIGARETTECODE", cigaretteCode);
            sqlCreate.AppendQuote("CIGARETTENAME", cigaretteName);
            sqlCreate.AppendQuote("BARCODE", barode);
            sqlCreate.AppendQuote("STATE", state);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
Exemple #29
0
        public void InsertEntity(string employeeCode, string employeeName, string departmentID, string status, string remark)
        {
            int       maxID     = Convert.ToInt32(ExecuteScalar("SELECT CASE WHEN MAX(EMPLOYEEID) IS NULL THEN 0 ELSE MAX(EMPLOYEEID) END FROM AS_BI_EMPLOYEE")) + 1;
            SqlCreate sqlCreate = new SqlCreate("AS_BI_EMPLOYEE", SqlType.INSERT);

            sqlCreate.AppendQuote("EMPLOYEEID", maxID.ToString().PadLeft(5, '0'));
            sqlCreate.AppendQuote("EMPLOYEECODE", employeeCode);
            sqlCreate.AppendQuote("EMPLOYEENAME", employeeName);
            sqlCreate.AppendQuote("DEPARTMENTID", departmentID);
            sqlCreate.AppendQuote("STATUS", status);
            sqlCreate.AppendQuote("REMARK", remark);
            ExecuteNonQuery(sqlCreate.GetSQL());
        }
Exemple #30
0
 public void InsertEntity(DataSet dataSet)
 {
     foreach (DataRow dataRow in dataSet.Tables[0].Rows)
     {
         if (dataRow.RowState == DataRowState.Added)
         {
             SqlCreate sqlCreate = new SqlCreate("sys_GroupList", SqlType.INSERT);
             sqlCreate.AppendQuote("GroupName", dataRow["GroupName"]);
             sqlCreate.AppendQuote("Memo", dataRow["Memo"].ToString().Replace("\'", "\''"));
             ExecuteNonQuery(sqlCreate.GetSQL());
         }
     }
 }