Ejemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public StockListModel GetModel(long StockListID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 StockListID,ManaTaskID,StoreHouseName,StockID,ProductCode,ProductNum,ProductStatus,ProductFrameCode,ProductName,GoodsSiteName,ProductBatchNum,InHouseTime,UpdateTime,Remarks from StockList ");
            strSql.Append(" where StockListID=@StockListID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@StockListID", SqlDbType.BigInt)
            };
            parameters[0].Value = StockListID;

            StockListModel model = new StockListModel();
            DataSet        ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Man_WarnnigConfigModel GetModel(int WarningCode)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 WarningCode,WarningLayer,WarningCata,WarningExplain,WarningName from Man_WarnnigConfig ");
            strSql.Append(" where WarningCode=@WarningCode ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WarningCode", SqlDbType.Int, 4)
            };
            parameters[0].Value = WarningCode;

            Man_WarnnigConfigModel model = new Man_WarnnigConfigModel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取符合条件自动出库库存列表
        /// </summary>
        /// <param name="productStatus">物料状态</param>
        /// <param name="timeInterval">当前时间减去更新时间的时间差(单位小时)</param>
        /// <returns></returns>
        public DataTable GetTimeArriveModelList(string productStatus, int timeInterval, Dictionary <string, List <string> > outStorageBatchDic)
        {
            if (outStorageBatchDic == null || outStorageBatchDic.Count == 0)
            {
                return(null);
            }
            string batchNumSqlA1 = "";
            string batchNumSqlB1 = "";

            for (int i = 0; i < outStorageBatchDic.Keys.Count; i++)
            {
                string        houseName   = outStorageBatchDic.Keys.ElementAt(i);
                List <string> batchesList = outStorageBatchDic[houseName];
                switch (houseName)
                {
                case "A1库房":
                    for (int a = 0; a < batchesList.Count; a++)
                    {
                        if (a == 0)
                        {
                            batchNumSqlA1 += "(ProductBatchNum ='" + batchesList[a] + "'";
                        }
                        else
                        {
                            batchNumSqlA1 += "or ProductBatchNum='" + batchesList[a] + "'";
                        }
                    }
                    batchNumSqlA1 += "and StoreHouseName = '" + houseName + "')";
                    break;

                case "B1库房":
                    for (int b = 0; b < batchesList.Count; b++)
                    {
                        if (b == 0)
                        {
                            batchNumSqlB1 += "(ProductBatchNum ='" + batchesList[b] + "'";
                        }
                        else
                        {
                            batchNumSqlB1 += "or ProductBatchNum='" + batchesList[b] + "'";
                        }
                    }
                    batchNumSqlB1 += "and StoreHouseName = '" + houseName + "')";
                    break;
                }
            }
            string        dtNow  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:dd");
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT  StockList .*  FROM GoodsSite INNER JOIN Stock ON GoodsSite.GoodsSiteID = Stock.GoodsSiteID INNER JOIN StockList ON Stock.StockID = StockList.StockID ");
            strSql.Append(" where  GoodsSiteStoreStatus='有货' and GoodsSiteRunStatus = '任务完成' and");
            strSql.Append(" ProductStatus = '" + productStatus + "' and datediff(hour,UpdateTime,'" + dtNow + "') >=" + timeInterval
                          + " and UpdateTime != '' and (" + batchNumSqlA1 + "or" + batchNumSqlB1 + ")");

            StockListModel model = new StockListModel();
            DataSet        ds    = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(ds.Tables[0]);
            }
            else
            {
                return(null);
            }
        }