Beispiel #1
0
        private void btnEnableStandby_Click(object sender, EventArgs e)
        {
            T_PRODUCE_SORTTROUGH selectedSourceItem, selectedStandbyItem;

            selectedSourceItem  = cbsource.SelectedItem as T_PRODUCE_SORTTROUGH;
            selectedStandbyItem = cbStandby.SelectedItem as T_PRODUCE_SORTTROUGH;


            if (selectedSourceItem == null)
            {
                MessageBox.Show("请选择源通道!");
                return;
            }
            if (selectedStandbyItem == null)
            {
                MessageBox.Show("请选择备用通道!");
                return;
            }
            if (!string.IsNullOrWhiteSpace(selectedStandbyItem.CIGARETTECODE))
            {
                MessageBox.Show(string.Format("该通道已经设置了{0}品牌!", selectedStandbyItem.CIGARETTENAME));
                return;
            }
            try
            {
                //获取该通道已经分拣完成的任务
                ProducePokeService.FetchTaskByTroughNo(selectedSourceItem.TROUGHNUM, selectedStandbyItem.TROUGHNUM);
                MessageBox.Show("更换成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (InBound.Business.ProducePokeService.GetStepNum() != 2)
            {
                MessageBox.Show("请先处理任务更新已完成!");
                return;
            }
            Db.Open();
            OracleParameter[] sqlpara;
            sqlpara = new OracleParameter[2];

            sqlpara[0] = new OracleParameter("p_ErrCode", OracleType.VarChar, 1000);
            sqlpara[1] = new OracleParameter("p_ErrMsg", OracleType.VarChar, 2000);

            sqlpara[0].Direction = ParameterDirection.Output;
            sqlpara[1].Direction = ParameterDirection.Output;

            Db.ExecuteNonQueryWithProc("p_produce_wms_sorttrough", sqlpara);

            string errcode = sqlpara[0].Value == null ? "" : sqlpara[0].Value.ToString();
            string errmsg  = sqlpara[1].Value == null ? "" : sqlpara[1].Value.ToString();

            Db.Close();
            if (errcode == "1")
            {
                MessageBox.Show("数据已同步");
                ProducePokeService.WriteSortNumToDb(LsitMainSN, 3);//写入3时,表示同步烟柜已经完成
                WriteLog.GetLog().Write("写入3,表示同步烟柜已经完成");
            }
            else
            {
                MessageBox.Show(errmsg);
            }
        }
Beispiel #3
0
 private void btnSorntum_Click(object sender, EventArgs e)
 {
     try
     {
         btnSorntum.Enabled = false;
         decimal Step = -1;                                          //步骤
         ProducePokeService.ReadSortNumByDb(out LsitMainSN, out Step);
         if (Step == 0)                                              //步骤为0时,是第一次自动获取
         {
             LsitMainSN = ProducePokeService.GetSortnumByNotCalcu(); //获取最大的没有发送且已计算的任务号
             ProducePokeService.WriteSortNumToDb(LsitMainSN, 1);     //写入1时,为第一次获取
             WriteLog.GetLog().Write("获取最大的没有发送且已计算的任务号\r\n1号主皮带任务号:" + LsitMainSN[0] + "\r\n2号主皮带任务号:" + LsitMainSN[1] + "\r\n3号主皮带任务号:" + LsitMainSN[2] + "\r\n4号主皮带任务号:" + LsitMainSN[3]);
             WriteLog.GetLog().Write("写入1 ,为第一次获取最大的没有发送且已计算的任务号");
         }
         else
         {
             WriteLog.GetLog().Write("从数据库获取任务号\r\n1号主皮带任务号:" + +LsitMainSN[0] + "\r\n2号主皮带任务号:" + LsitMainSN[1] + "\r\n3号主皮带任务号:" + LsitMainSN[2] + "\r\n4号主皮带任务号:" + LsitMainSN[3]);
         }
         txtSortnum1.Text = LsitMainSN[0].ToString(); //一号主皮带任务号
         txtSortnum2.Text = LsitMainSN[1].ToString(); //二号主皮带任务号
         txtSortnum3.Text = LsitMainSN[2].ToString(); //三号主皮带任务号
         txtSortnum4.Text = LsitMainSN[3].ToString(); //四号主皮带任务号
     }
     catch (Exception ex)
     {
         MessageBox.Show("获取失败,请查看日志");
         WriteLog.GetLog().Write("自动获取任务失败,错误记录:" + ex.Message);
     }
     finally
     {
         btnSorntum.Enabled = true;
     }
 }
Beispiel #4
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("条烟顺序生成结束");
     }
 }
Beispiel #5
0
        public void OnLoadGroup()
        {
            this.cblist.BeginInvoke(new Action(() =>
            {
                cblist.Items.Clear();
                List <PokeGroupUIModel> _pokeList = ProducePokeService.GetGroupNo().Select(s => new PokeGroupUIModel
                {
                    GroupKind = "1",
                    GroupNum  = s.GROUPNO.ToString(),
                    GroupDesc = s.GROUPNO + "正常烟",
                    ConfigKey = "1" + s.GROUPNO.ToString(),
                }).OrderBy(o => o.GroupNum).ToList();

                List <PokeGroupUIModel> _unpokeList = UnPokeService.GetLinenum().Select(s => new PokeGroupUIModel
                {
                    GroupKind = "2",
                    GroupNum  = s.LINENUM,
                    GroupDesc = s.LINENUM + "(异)",
                    ConfigKey = "2" + s.LINENUM.ToString(),
                }).OrderBy(o => o.GroupNum).ToList();

                _unionAllPokeGroupList = _pokeList.Union(_unpokeList).ToList();
                cblist.DataSource      = _unionAllPokeGroupList;
                cblist.ValueMember     = "GroupNum";
                cblist.DisplayMember   = "GroupDesc";
                for (int i = 0; i < cblist.Items.Count; i++)
                {
                    cblist.SetItemChecked(i, true);
                }
            }));
        }
Beispiel #6
0
        private void gvdata_SelectionChanged(object sender, EventArgs e)
        {
            if (gvdata.SelectedRows != null && gvdata.SelectedRows[0].Cells[1].Value == null)
            {
                return;
            }

            string regionCode            = gvdata.SelectedRows[0].Cells[1].Value.ToString();
            List <PokeGroupUIModel> list = ProducePokeService.GetGroupNoByRegionCode(regionCode).
                                           Select(s => new PokeGroupUIModel
            {
                GroupKind = "1",
                GroupNum  = s.GROUPNO.ToString(),
                GroupDesc = s.GROUPNO + "正常烟",
                ConfigKey = "1" + s.GROUPNO.ToString(),
            }).OrderBy(o => o.GroupNum).ToList();

            cblist.DataSource    = list;
            cblist.ValueMember   = "GroupNum";
            cblist.DisplayMember = "GroupDesc";
            for (int i = 0; i < cblist.Items.Count; i++)
            {
                cblist.SetItemChecked(i, true);
            }
        }
Beispiel #7
0
        private void FetchProducePokeData(PokeGroupUIModel model)
        {
            List <OrderGroupDetail> _pokeList = ProducePokeService.FetchProducePokeList(decimal.Parse(model.GroupNum));

            if (_pokeList.Count == 0)
            {
                return;
            }
            StringBuilder info = new StringBuilder();

            foreach (var item in _pokeList)
            {
                //   info.AppendFormat("{0},{1},{2},{3},{4},{5};\n", item.TASKNUM, item.TASKQTY, item.GROUPNO, item.POKENUM, item.TROUGHNUM, item.BILLCODE);
            }
            ExpToZipFile(info.ToString(), model);
        }
Beispiel #8
0
 public void ThreadToUpdate()//线程方法
 {
     try
     {
         ProducePokeService.UpdateAfterBySortnum(this.List, this.Status);
         MessageBox.Show(this.Info);
         WriteLog.GetLog().Write(Info);
     }
     catch (Exception ex)
     {
         WriteLog.GetLog().Write(ex.InnerException.Message.ToString());
         throw ex;
     }
     finally
     {
         Lbl.Visible  = false;
         Btn1.Enabled = true;
     }
 }
Beispiel #9
0
        private void FetchProducePokeData(PokeGroupUIModel model, String seq)
        {
            List <OrderGroupDetail> _pokeList = ProducePokeService.FetchProducePokeList(decimal.Parse(model.GroupNum));

            if (_pokeList.Count == 0)
            {
                return;
            }
            StringBuilder info = new StringBuilder();

            // info = info + tasknum + taskseq + "," + tasknum + "," + cuscode + "," + cusname + "," + itemno + "," + itemname + "," + quantity + "," + synseq + "," + seq + "," + regioncode + "," + regioncode + "," + orderdate + "," + orderdate + "," + bianhao + ",1;\r\n";
            // int i = 0;
            foreach (var item in _pokeList)
            {
                // i++;
                info.AppendFormat("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15};\r\n", item.TaskNum, item.TaskNum, item.CustomerCode, item.CustomerName, item.CigaretteCode, item.CigaretteName, item.PokeNum, seq, item.Seq, item.RegionCode, item.RegionName, item.OrderDate, DateTime.Now.ToShortTimeString(), "01", "1", "", "");
            }
            ExpToZipFile(info.ToString(), model);
        }
Beispiel #10
0
        void cmbBind(ComboBox source, ComboBox tag)
        {
            switch (source.SelectedIndex)
            {
            case 0:
                ProducePokeService.GetYGtroughnum(1, 2).ForEach(f => tag.Items.Add(f));
                break;

            case 1:
                ProducePokeService.GetYGtroughnum(3, 4).ForEach(f => tag.Items.Add(f));
                break;

            case 2:
                ProducePokeService.GetYGtroughnum(5, 6).ForEach(f => tag.Items.Add(f));
                break;

            case 3:
                ProducePokeService.GetYGtroughnum(7, 8).ForEach(f => tag.Items.Add(f));
                break;
            }
        }
Beispiel #11
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string throwString = "";

            try
            {
                if (!string.IsNullOrWhiteSpace(txtSortnum1.Text) && !string.IsNullOrWhiteSpace(txtSortnum2.Text) && !string.IsNullOrWhiteSpace(txtSortnum3.Text) && !string.IsNullOrWhiteSpace(txtSortnum4.Text))
                {
                    DialogResult MsgBoxResult = MessageBox.Show("确定要更新任务?",                       //对话框的显示内容
                                                                "操作提示",                           //对话框的标题
                                                                MessageBoxButtons.YesNo,          //定义对话框的按钮,这里定义了YSE和NO两个按钮
                                                                MessageBoxIcon.Question,          //定义对话框内的图表式样,这里是一个黄色三角型内加一个感叹号
                                                                MessageBoxDefaultButton.Button2); //定义对话框的按钮式样

                    if (MsgBoxResult == DialogResult.Yes)
                    {
                        if (InBound.Business.ProducePokeService.GetStepNum() != 1)
                        {
                            MessageBox.Show("请先获取本次定位的任务!");
                            return;
                        }
                        decimal status = 0;
                        btnUpdate.Enabled = false;
                        throwString       = "更新完成\r\n1号主皮带任务号:" + txtSortnum1.Text +
                                            "\r\n2号主皮带任务号:" + txtSortnum2.Text +
                                            "\r\n3号主皮带任务号:" + txtSortnum3.Text +
                                            "\r\n4号主皮带任务号:" + txtSortnum4.Text +
                                            "\r\n状态更新为" + status + "完成";
                        if (LsitMainSN.Sum() == 0)
                        {
                            MessageBox.Show("请自动获取任务号");
                            btnUpdate.Enabled = true;
                            return;
                        }
                        if (rbNew.Checked)//新增
                        {
                            if (InBound.Business.ProducePokeService.GetStepNum() != 4)
                            {
                                MessageBox.Show("请先更换poke表烟柜通道数据!");
                                return;
                            }
                            status = 10;
                            decimal Step = -1;                                      //步骤
                            ProducePokeService.ReadSortNumByDb(out LsitMainSN, out Step);
                            if (Step == 4)                                          //当完成烟柜转移备用烟柜的时,才清除数据库任务号,增添容错率
                            {
                                ProducePokeService.WriteSortNumToDb(LsitMainSN, 0); //写入0时,为第二次更新最大任务号后面的为10 更新成功 最后一步
                            }

                            throwString = "更新完成\r\n1号主皮带任务号:" + txtSortnum1.Text +
                                          "\r\n2号主皮带任务号:" + txtSortnum2.Text +
                                          "\r\n3号主皮带任务号:" + txtSortnum3.Text +
                                          "\r\n4号主皮带任务号:" + txtSortnum4.Text +
                                          "\r\n状态更新为" + status + "新增";
                            txtSortnum1.Clear(); txtSortnum2.Clear(); txtSortnum3.Clear(); txtSortnum4.Clear();
                            btnReTiaoyan.Visible = true;
                            WriteLog.GetLog().Write("写入0,为第二次更新最大任务号后面的为10 更新成功,条烟顺序重新生成");
                        }
                        else if (rbEnd.Checked)//完成
                        {
                            if (ProducePokeService.GetStepNum() != 1)
                            {
                                MessageBox.Show("请先获取每根主皮带任务号! ");
                                return;
                            }
                            status = 20;

                            throwString = "更新完成\r\n1号主皮带任务号:" + txtSortnum1.Text +
                                          "\r\n2号主皮带任务号:" + txtSortnum2.Text +
                                          "\r\n3号主皮带任务号:" + txtSortnum3.Text +
                                          "\r\n4号主皮带任务号:" + txtSortnum4.Text +
                                          "\r\n状态更新为" + status + "完成";
                            ProducePokeService.WriteSortNumToDb(LsitMainSN, 2);// //写入2时,为第一次更新最大任务号后面的为20 更新成功
                            WriteLog.GetLog().Write("写入2时,为第一次更新最大任务号后面的为20 更新成功");
                        }
                        else
                        {
                            MessageBox.Show("请先选择任务状态! ");
                            return;
                        }
                        foreach (var item in LsitMainSN)//判断任务号是否有效
                        {
                            if (item > 0)
                            {
                                if (!ProducePokeService.GetExistSortnum(item))
                                {
                                    MessageBox.Show("更新失败,无效的任务号:" + item);
                                    WriteLog.GetLog().Write("无效的任务号:" + item);
                                    return;
                                }
                            }
                        }
                        label25.Visible = true;
                        myThread my = new myThread(LsitMainSN, status, throwString, label25, btnUpdate, btnUpdate);
                        Thread   t  = new Thread(new ThreadStart(my.ThreadToUpdate));
                        t.Start();

                        //ThreadToUpdate(LsitMainSN, status, throwString);
                    }
                }
                else
                {
                    MessageBox.Show("请输入任务号");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("更新失败,未知异常,请查看日志");
                WriteLog.GetLog().Write(throwString + "更新失败," +
                                        "\r\n异常:" + ex.Message);
            }
        }
Beispiel #12
0
        private void button7_Click(object sender, EventArgs e)
        {
            if (InBound.Business.ProducePokeService.GetStepNum() != 3)
            {
                MessageBox.Show("请先同步仓储烟柜信息!");
                return;
            }
            if (comboBox_group.SelectedIndex > -1 && cmbSoucreYG.SelectedIndex > -1 && cmbTagGroup.SelectedIndex > -1 && cmbTagYG.SelectedIndex > -1)
            {
                DialogResult re = MessageBox.Show("请确认:分拣组" + comboBox_group.Text + "\r" + cmbSoucreYG.Text + "" + label18.Text + "\r与\r" + cmbTagYG.Text + "\r" + label22.Text + "\r换道?", "提示",
                                                  MessageBoxButtons.YesNo,          //定义对话框的按钮,这里定义了YSE和NO两个按钮
                                                  MessageBoxIcon.Question,          //定义对话框内的图表式样,这里是一个黄色三角型内加一个感叹号
                                                  MessageBoxDefaultButton.Button2); //定义对话框的按钮式样);
                if (re == DialogResult.Yes)
                {
                    button7.Enabled = false;
                    try
                    {
                        ProducePokeService.FetchPokeTroughByTroughNo(cmbSoucreYG.Text, cmbTagYG.Text);
                        ProducePokeService.WriteSortNumToDb(LsitMainSN, 4);//写入4时,为换道成功
                        WriteLog.GetLog().Write("写入4时,为换道成功,通道" + cmbSoucreYG.Text + "与" + cmbTagYG.Text + "交换");
                        MessageBox.Show("换道成功,请检查数据");
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("换道失败,请重试");
                    }
                    finally
                    {
                        button7.Enabled = true;
                    }
                }
            }
            else
            {
                MessageBox.Show("请把烟柜填写完整!");
            }
            //if (cmbSoucreYG.Text.Length <= 0)
            //{
            //    MessageBox.Show("请选择原通道");
            //    return;
            //}
            //if (cmbTagYG.Text.Length <= 0)
            //{
            //    MessageBox.Show("请选择目标通道");
            //    return;
            //}

            //DialogResult re = MessageBox.Show("请确认:分拣组" + comboBox_group.Text + "\r" + cmbSoucreYG.Text + "烟柜\r与\r" + cmbTagYG.Text + "烟柜\r换道?", "提示" ,
            //                                            MessageBoxButtons.YesNo,//定义对话框的按钮,这里定义了YSE和NO两个按钮
            //                                            MessageBoxIcon.Question,//定义对话框内的图表式样,这里是一个黄色三角型内加一个感叹号
            //                                            MessageBoxDefaultButton.Button2);//定义对话框的按钮式样);
            //if (re == DialogResult.OK)
            //{
            //    try
            //    {
            //        ProducePokeService.FetchPokeByTroughNo(cmbSoucreYG.Text, cmbTagYG.Text);
            //        MessageBox.Show("换道成功,请检查数据");
            //    }
            //    catch (Exception)
            //    {
            //        MessageBox.Show("换道失败,请重试");
            //    }

            //}
        }