private void btnCx_Click(object sender, EventArgs e)
 {
     if (btnCx.Text == "查询")
     {
         if (string.IsNullOrWhiteSpace(txtSortnum.Text))
         {
             MessageBox.Show("不能为空");
         }
         else
         {
             groupBoxUnionInfo.Visible  = false;
             dgvMainBeltInfo.DataSource = UnionTaskInfoService.GetUnionTaskInfo(Convert.ToDecimal(txtSortnum.Text))
                                          .Select(x => new
             {
                 CIGARETTECODE = x.CIGARETTDECODE,
                 CIGARETTNAME  = x.CIGARETTDENAME,
                 QTY           = x.POKENUM,
                 MAINBELT      = x.MainBelt,
                 SORTNUM       = x.SortNum,
                 MACHINESEQ    = x.groupno + ((x.MainBelt - 1) * 8),
                 ISONMAINBELT  = x.IsOnMainBelt > 0 ? "是":"否",
                 //  IsOnBelt = x.IsOnMainBelt,
             }).ToList();//根据索引读取相对应数据
             // DgvBind();
             DgvBind2();
             btnCx.Text = "返回";
         }
     }
     else
     {
         ReadListInfo(ReadIndexByBtn);
         btnCx.Text = "查询";
     }
 }
 void ThreadSortPokeseq()
 {
     try
     {
         UnionTaskInfoService.InsertPokeseqInfo();
         panel3.Visible = false;
         MessageBox.Show("条烟顺序生成成功!");
     }
     catch (DataException date)
     {
         MessageBox.Show("条烟顺序失败:" + date.Message);
         label1.Text = "条烟顺序失败:" + date.Message;
     }
     catch (Exception ex)
     {
         MessageBox.Show("条烟顺序失败:" + ex.Message);
         label1.Text = "条烟顺序失败:" + ex.Message;
     }
     finally
     {
         handlesort(3, false);//告诉父窗体任务结束
         btnPokeSeq.Enabled = false;
         isSort             = false;
     }
 }
Exemple #3
0
 void ThreadSortPokeseq()
 {
     try
     {
         ProducePokeService.RefSortByTiaoyan(LsitMainSN);
         UnionTaskInfoService.InsertPokeseqInfo();
         label24.Visible = false;
         MessageBox.Show("条烟顺序生成成功!");
     }
     catch (DataException date)
     {
         MessageBox.Show("条烟顺序失败:" + date.Message);
         label24.Text = "条烟顺序失败:" + date.Message;
     }
     catch (Exception ex)
     {
         MessageBox.Show("条烟顺序失败:" + ex.Message);
         label24.Text = "条烟顺序失败:" + ex.Message;
     }
     finally
     {
         btnReTiaoyan.Enabled = true;
         button7.Enabled      = true;
         btnUpdate.Enabled    = true;
         LsitMainSN.Clear();
         WriteLog.GetLog().Write("条烟顺序生成结束");
     }
 }
Exemple #4
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            decimal sortNum = 0;

            decimal.TryParse(txtSortNum.Text, out sortNum);
            orderdata.AutoGenerateColumns = false;

            orderdata.DataSource = UnionTaskInfoService.GetUnionTaskInfo(sortNum);
        }
        private void w_SortFm_Load(object sender, EventArgs e)
        {
            int pokecount    = UnionTaskInfoService.GetPokeCount();
            int pokeseqcount = UnionTaskInfoService.GetPokeSEQCount();

            if (pokecount == pokeseqcount)
            {
                btnPokeSeq.Enabled = false;
            }
            else
            {
                btnPokeSeq.Enabled = true;
            }
            lblInFO.Text = "分拣车组信息:";
        }
Exemple #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            decimal sortNum = 0;

            decimal.TryParse(txtSortNum.Text, out sortNum);
            orderdata.AutoGenerateColumns = false;
            decimal beforeNum         = UnionTaskInfoService.getBeforeSortNum(sortNum);
            decimal afterNum          = UnionTaskInfoService.getNextSortNum(sortNum);
            List <UnionTaskInfo> list = UnionTaskInfoService.GetUnionTaskInfo(beforeNum);

            list.AddRange(UnionTaskInfoService.GetUnionTaskInfo(sortNum));
            list.AddRange(UnionTaskInfoService.GetUnionTaskInfo(afterNum));

            orderdata.DataSource = list;
        }
Exemple #7
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            switch (cmbSelectC.SelectedItem.ToString())
            {
            case "所有合流任务":
                dgvTask.DataSource = UnionTaskInfoService.GetUnionAllTaskInfo().Select(x => new
                {
                    CIGARETTECODE = x.CIGARETTDECODE,
                    CIGARETTNAME  = x.CIGARETTDENAME,
                    QTY           = x.POKENUM,
                    MAINBELT      = x.MainBelt,
                    SORTNUM       = x.SortNum,
                    IsOnBelt      = x.IsOnMainBelt > 0 ? "是" : "否",
                    MACHINESEQ    = x.groupno + ((x.MainBelt - 1) * 8)
                }).ToList();        //根据索引读取相对应数据
                DgvBind();
                break;

            case "任务号":
                if (!string.IsNullOrWhiteSpace(txtinfo1.Text))
                {
                    dgvTask.DataSource = InBound.Business.UnionTaskInfoService.GetUnionTaskInfo(Convert.ToDecimal(txtinfo1.Text)).Select(x => new
                    {
                        CIGARETTECODE = x.CIGARETTDECODE,
                        CIGARETTNAME  = x.CIGARETTDENAME,
                        QTY           = x.POKENUM,
                        MAINBELT      = x.MainBelt,
                        SORTNUM       = x.SortNum,
                        IsOnBelt      = x.IsOnMainBelt > 0 ? "是":"否",
                        MACHINESEQ    = x.groupno + ((x.MainBelt - 1) * 8)
                    }).ToList();    //根据索引读取相对应数据
                    DgvBind();
                }
                else
                {
                    MessageBox.Show("请输入任务号");
                }
                break;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int list = UnionTaskInfoService.GetPokeCount();

            MessageBox.Show(list.ToString());
        }
Exemple #9
0
        public static void GetMainBeltInfo(List <MainBeltInfo> infolist)
        {
            if (infolist != null && infolist.Count != 0)
            {
                foreach (var info in infolist)
                {
                    if (info.Quantity > 0 && info.SortNum > 0)
                    {
                        List <UnionTaskInfo> taskList = new List <UnionTaskInfo>();

                        taskList      = UnionTaskInfoService.GetUnionTaskInfo(info.SortNum);
                        info.taskInfo = taskList;
                        for (int i = 1; i <= 8; i++)
                        {
                            var tempIndex  = i;
                            var tempindex2 = i;
                            if (tempIndex == 3)
                            {
                                tempIndex = 4;
                            }
                            else if (tempIndex == 4)
                            {
                                tempIndex = 3;
                            }
                            else if (tempIndex == 7)
                            {
                                tempIndex = 8;
                            }
                            else if (tempIndex == 8)
                            {
                                tempIndex = 7;
                            }
                            decimal tempSortNum  = info.SortNumList[tempindex2 - 1];
                            decimal tempQuantity = info.QuantityList[tempindex2 - 1];
                            var     tempList     = taskList.Where(x => x.groupno == tempIndex).ToList();
                            if (tempList != null && tempList.Count() > 0)
                            {
                                if (tempSortNum > info.SortNum)
                                {
                                    tempList.ForEach(x => x.IsOnMainBelt = 1);
                                }
                                else if (tempSortNum == info.SortNum)
                                {
                                    decimal tempQty = 0;
                                    foreach (var item in tempList)
                                    {
                                        if (tempQty + item.POKENUM <= tempQuantity)
                                        {
                                            item.IsOnMainBelt = 1;
                                            tempQty          += item.POKENUM;
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        #region  备份算法
                        //using (Entities entity = new Entities())
                        //{
                        //    var task = (from item in entity.T_PRODUCE_POKE
                        //                join item2 in entity.T_PRODUCE_SORTTROUGH
                        //                    on item.TROUGHNUM equals item2.TROUGHNUM
                        //                where item.SORTNUM == info.SortNum && item2.TROUGHTYPE == 10 && item2.CIGARETTETYPE == 20
                        //                orderby item.MACHINESEQ
                        //                select
                        //                    new TaskDetail()
                        //                    {
                        //                        CIGARETTDECODE = item2.CIGARETTECODE,
                        //                        CIGARETTDENAME = item2
                        //                            .CIGARETTENAME,
                        //                        GroupNO = item.GROUPNO ?? 0,
                        //                        Machineseq = item.MACHINESEQ ?? 0,
                        //                        MainBelt = item.MAINBELT ?? 0,
                        //                        SortNum
                        //                            = item.SORTNUM ?? 0,
                        //                        POKENUM = item.POKENUM ?? 0,
                        //                        MachineState = item.MACHINESTATE ?? 0
                        //                    }).ToList();

                        //    var exitLoop = false;
                        //    decimal uniontaskquantity = 0;
                        //    while (!exitLoop)
                        //    {
                        //        var isrun = false;
                        //        for (int i = 1; i <= 8; i++)
                        //        {
                        //            int tempgroupno = i;
                        //            if (i == 3)
                        //            {
                        //                tempgroupno = 4;
                        //            }
                        //            else if (i == 4)
                        //            {
                        //                tempgroupno = 3;
                        //            }
                        //            else if (i == 7)
                        //            {
                        //                tempgroupno = 8;
                        //            }
                        //            else if (i == 8)
                        //            {
                        //                tempgroupno = 7;
                        //            }

                        //            var temptask = task.Where(x => x.GroupNO == tempgroupno && x.MachineState != 30).OrderBy(y => y.Machineseq).ToList();
                        //            if (temptask != null && temptask.Count > 0)
                        //            {
                        //                isrun = true;
                        //               //var groupquantity=temptask.Sum(x=)
                        //                decimal tempcount = 0;
                        //                foreach (var titem in temptask)
                        //                {
                        //                    if (tempcount + titem.POKENUM <= 10 && uniontaskquantity + titem.POKENUM <= info.Quantity)
                        //                    {
                        //                        taskList.Insert(0, new UnionTaskInfo()
                        //                        {
                        //                            CIGARETTDECODE = titem.CIGARETTDECODE,
                        //                            CIGARETTDENAME = titem.CIGARETTDENAME,
                        //                            MainBelt = titem.MainBelt,
                        //                            SortNum = titem.SortNum,
                        //                            qty = titem.POKENUM,
                        //                            groupno = titem.GroupNO,
                        //                            machineseq = titem.Machineseq
                        //                        });
                        //                        titem.MachineState = 30;
                        //                        tempcount += titem.POKENUM;
                        //                        uniontaskquantity += titem.POKENUM;
                        //                        if (uniontaskquantity > info.Quantity)
                        //                        {
                        //                            info.MsgCode = "-1";
                        //                            info.ErrorMsg = "读取数量有误,当前任务号:"+info.SortNum+" 读取数量:"+info.Quantity;
                        //                            exitLoop = true;
                        //                            i = 9;
                        //                            break;
                        //                        }
                        //                        if (uniontaskquantity == info.Quantity)
                        //                        {
                        //                            var left=10-tempcount;
                        //                            var check = task.Where(x => x.GroupNO == tempgroupno && x.MachineState != 30 && x.POKENUM<=left).OrderBy(y => y.Machineseq).ToList();
                        //                            if (check != null && check.Count > 0)
                        //                            {
                        //                                info.MsgCode = "-1";
                        //                                info.ErrorMsg = "读取数量有误,当前任务号:" + info.SortNum + " 读取数量:" + info.Quantity;
                        //                            }

                        //                            exitLoop = true;
                        //                            i = 9;
                        //                            break;
                        //                        }
                        //                    }
                        //                    else
                        //                    {
                        //                        if (tempcount + titem.POKENUM > 10)
                        //                        {
                        //                            if (tempcount < 10)
                        //                            {
                        //                                taskList.Insert(0, new UnionTaskInfo()
                        //                                {
                        //                                    CIGARETTDECODE = titem.CIGARETTDECODE,
                        //                                    CIGARETTDENAME = titem.CIGARETTDENAME,
                        //                                    MainBelt = titem.MainBelt,
                        //                                    SortNum = titem.SortNum,
                        //                                    qty = 10 - tempcount,
                        //                                    groupno = titem.GroupNO,
                        //                                    machineseq = titem.Machineseq
                        //                                });
                        //                                titem.POKENUM = titem.POKENUM - (10 - tempcount);

                        //                                uniontaskquantity += (10 - tempcount);
                        //                                if (uniontaskquantity > info.Quantity)
                        //                                {
                        //                                    info.MsgCode = "-1";
                        //                                    info.ErrorMsg = "读取数量有误,当前任务号:" + info.SortNum + " 读取数量:" + info.Quantity;
                        //                                    exitLoop = true;
                        //                                    i = 9;
                        //                                    break;
                        //                                }
                        //                                if (uniontaskquantity == info.Quantity)
                        //                                {
                        //                                    exitLoop = true;
                        //                                    i = 9;
                        //                                    break;
                        //                                }
                        //                            }
                        //                        }
                        //                        else
                        //                        {
                        //                            info.MsgCode = "-1";
                        //                            info.ErrorMsg = "读取数量有误,当前任务号:" + info.SortNum + " 读取数量:" + info.Quantity;
                        //                            exitLoop = true;
                        //                            i = 9;
                        //                            break;
                        //                        }

                        //                        break;

                        //                    }
                        //                }
                        //            }
                        //        }
                        //        if (!isrun)
                        //        {
                        //            if (info.Quantity > uniontaskquantity)
                        //            {
                        //                info.MsgCode = "-1";
                        //                info.ErrorMsg = "读取数量有误,当前任务号:" + info.SortNum + " 读取数量:" + info.Quantity;

                        //            }
                        //            exitLoop = true;
                        //        }
                        //    }
                        //}
                        #endregion
                    }
                }
            }
        }