Exemple #1
0
        /*
         * 检查hash表中分拣数据状态,如果只有num个任务号未分拣,则开始新取拨烟数据。
         *
         */
        public int getTaskFinishNum()
        {
            String sql = "select count(1) num from (select distinct tasknum from t_produce_poke where status=15)";
            int    num = int.Parse(DataPublic.ExecuteScalar(sql).ToString());

            return(num);
            //int retVal = 0;
            //retVal = this.htSize - hasFinish;
            //return retVal;
        }
Exemple #2
0
        public void finishOrder(String taskno)
        {
            String sql = "update t_produce_task set state=30 where tasknum=" + taskno;

            DataPublic.ExecuteScalar(sql);
            //更新移库命令

            //计算品牌库存  确定是否发送开箱 以及出库命令
            //取订单里面的所有品牌
            String sql2 = "select itemno from t_produce_taskline where tasknum=" + taskno;
            //取库存
            String sql3 = "select sum(itemqty) from t_wms_storagearea_inoutline where cigarettecode=''";
            //取烟仓阀值
            String sql4 = "select THRESHOLD from t_procuce_sorttrough where CIGARETTECODE='' and troughtype=10";
            //取重力式货架阀值
            String sql5 = "select THRESHOLD from t_procuce_sorttrough where CIGARETTECODE='' and troughtype=20";
            //对比库存与阀值  确定是否发送开箱以及立库出库
        }
Exemple #3
0
        public static object[] GetTask()
        {
            object[] values = new object[73];
            for (int i = 0; i < values.Length; i++)
            {
                values[i] = 0;
            }


            //按排序先取4个车组 排除主皮带号相同的车组
            //
            //  通过 hashtable 过滤重复值
            //Hashtable ht = new Hashtable();
            //for (int i = 0; i < result.length; i++)
            //{
            //    if (ht.ContainsKey(""))
            //    { }
            //    else
            //    { ht.Add("mainbelt", "regioncode");
            //     更新对应车组状态为分拣中
            //    }
            //}
            //根据车组取订单发送  同时更新订单状态
            string sql = "select tasknum from(select distinct tasknum from t_produce_poke where status=10  order by tasknum) where rownum=1";
            //writelog.Write(sql);
            int tasknum = int.Parse(DataPublic.ExecuteScalar(sql).ToString());

            //OracleDataReader reader = DataPublic.ReadDb(sql);
            //writelog.Write("search sql" + sql);
            //if (reader != null)
            //{
            //    if (reader.Read())
            //    {
            //        tasknum = int.Parse(reader[tasknum].ToString());
            //    }
            //    reader.Close();
            //    reader.Dispose();
            //}
            if (tasknum != 0)
            {
                //sql = "select decode(min(sortnum),'',0,min(sortnum)) from t_produce_poke where status=10 and tasknum=" + tasknum;
                //int sortnum = int.Parse(DataPublic.ExecuteScalar(sql).ToString());
                //if (sortnum != 0)
                //{
                sql = "select sortnum,sortmachine, sum(pokenum) pokenum,machineseq,sortmachine,tasknum from t_produce_poke  where tasknum=" + tasknum + " group by tasknum, sortnum,sortmachine,machineseq";
                // writelog.Write(sql);878777

                OracleDataReader myread = DataPublic.ReadDb(sql);
                try
                {
                    int i          = 0;
                    int totalcount = 0;
                    while (myread.Read())
                    {
                        if (i == 0)
                        {
                            values[0]  = int.Parse(myread["tasknum"].ToString());
                            values[1]  = int.Parse(myread["sortmachine"].ToString());
                            values[3]  = 0;
                            values[72] = 1;
                        }
                        totalcount += int.Parse(myread["pokenum"].ToString());
                        int troughnum = int.Parse(myread["machineseq"].ToString());
                        values[3 + troughnum] = int.Parse(myread["pokenum"].ToString());
                        //if ((int)values[1] == 1)
                        //{
                        //    values[4] = 0;
                        //    values[5] = 0;
                        //    values[6] = 0;
                        //    values[7] = 0;
                        //    values[8] = 0;
                        //    values[9] = 0;
                        //    values[10] = 0;
                        //    values[11] = 0;
                        //    values[12] = 0;
                        //    values[13] = 0;
                        //    values[14] = 0;
                        //    values[15] = 0;
                        //    values[16] = 0;
                        //    values[17] = 0;
                        //    values[18] = 0;
                        //    values[19] = 0;//4-19 分拣机一
                        //}
                        //else if ((int)values[1] == 2)
                        //{
                        //    values[20] = 0;//20-49分拣机二
                        //    values[21] = 0;
                        //    values[22] = 0;
                        //    values[23] = 0;
                        //    values[24] = 0;
                        //    values[25] = 0;
                        //    values[26] = 0;
                        //    values[27] = 0;
                        //    values[28] = 0;
                        //    values[29] = 0;
                        //    values[30] = 0;
                        //    values[31] = 0;
                        //    values[32] = 0;
                        //    values[33] = 0;
                        //    values[34] = 0;
                        //    values[35] = 0;
                        //    values[36] = 0;
                        //    values[37] = 0;
                        //    values[38] = 0;
                        //    values[39] = 0;
                        //    values[40] = 0;
                        //    values[41] = 0;
                        //    values[42] = 0;
                        //    values[43] = 0;
                        //    values[44] = 0;
                        //    values[45] = 0;
                        //    values[46] = 0;
                        //    values[47] = 0;
                        //    values[48] = 0;
                        //    values[49] = 0;
                        //}
                        //else
                        //{
                        //    values[50] = 0;//分拣三
                        //    values[51] = 0;
                        //    values[52] = 0;
                        //    values[53] = 0;
                        //    values[54] = 0;
                        //    values[55] = 0;
                        //    values[56] = 0;
                        //    values[57] = 0;
                        //    values[58] = 0;
                        //    values[59] = 0;
                        //    values[60] = 0;
                        //    values[61] = 0;
                        //    values[62] = 0;
                        //    values[63] = 0;
                        //    values[64] = 0;
                        //    values[65] = 0;
                        //    values[66] = 0;
                        //    values[67] = 0;
                        //    values[68] = 0;
                        //    values[69] = 0;
                        //    values[70] = 0;
                        //    values[71] = 0;
                        //}
                    }
                    values[2] = totalcount;
                }
                catch (Exception e)
                {
                    writelog.Write(e.Message);
                    if (e.InnerException != null)
                    {
                        writelog.Write(e.InnerException.Message);
                    }
                }
                finally
                {
                    myread.Close();
                    myread.Dispose();
                }
                // }
            }
            return(values);
        }