예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (tbChooseName.Tag == null)
            {
                MessageBox.Show("请选择出库品牌");
                return;
            }
            T_WMS_ATSCELL_OUT detail = AtsCellOutService.getDetailById(detailId);

            INF_JOBDOWNLOAD job = new INF_JOBDOWNLOAD();
            decimal         id  = BaseService.GetSeq("select S_ATSCELL_OUT.nextval from dual");

            job.TARGET = address[cbAdress.SelectedIndex];

            job.PLANQTY    = detail.REQUESTQTY;
            job.SOURCE     = AtsCellOutService.getCellNoBig(detail.CIGARETTECODE, int.Parse(detail.REQUESTQTY.ToString()));
            job.BARCODE    = AtsCellInfoService.GetCellInfo(job.SOURCE).PALLETNO; //托盘号
            job.JOBTYPE    = 52;                                                  //
            job.PRIORITY   = 50;
            job.CREATEDATE = DateTime.Now;
            job.BRANDID    = detail.BARCODE;
            job.TUTYPE     = 4;
            job.INPUTTYPE  = 10;
            job.TASKNO     = id;
            using (TransactionScope ts = new TransactionScope())
            {
                InfJobDownLoadService.InsertEntity(job);

                AtsCellOutService.updateDetailById(detailId);
                ts.Complete();
            }
        }
예제 #2
0
 public static void InsertObject(T_WMS_ATSCELL_OUT cellout)
 {
     using (Entities entity = new Entities())
     {
         entity.T_WMS_ATSCELL_OUT.AddObject(cellout);
         entity.SaveChanges();
     }
 }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (cbAdress.SelectedIndex == -1)
            {
                MessageBox.Show("请选择出库口");
                return;
            }

            if (tbChooseName.Tag == null)
            {
                MessageBox.Show("请选择出库品牌");
                return;
            }
            if (cbAdress.SelectedIndex == 2)
            {
                if (((List <String>)tbChooseName.Tag)[0].ToString() != "1111111")
                {
                    MessageBox.Show("托盘出库中只能出库托盘");
                    return;
                }
                else
                {
                    if (InfJobDownLoadService.GetPalletUnFinishTask() > 0)
                    {
                        DialogResult MsgBoxResult = MessageBox.Show("已有在出库的托盘任务,确定要空托盘出库?",           //对话框的显示内容
                                                                    "操作提示",                           //对话框的标题
                                                                    MessageBoxButtons.YesNo,          //定义对话框的按钮,这里定义了YSE和NO两个按钮
                                                                    MessageBoxIcon.Question,          //定义对话框内的图表式样,这里是一个黄色三角型内加一个感叹号
                                                                    MessageBoxDefaultButton.Button2); //定义对话框的按钮式样
                        //Console.WriteLine(MsgBoxResult);
                        if (MsgBoxResult == DialogResult.Yes)
                        {
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
            if (cbType.SelectedIndex == -1)
            {
                MessageBox.Show("请选择出库类型");
                return;
            }
            if (tbPlanQty.Text == "")
            {
                MessageBox.Show("请输入计划数量");
                return;
            }
            int planQty = int.Parse(tbPlanQty.Text);
            //   String barCode = ((List<String>)tbChooseName.Tag)[2].ToString();
            String     cigaretteName = ((List <String>)tbChooseName.Tag)[1].ToString();
            String     cigaretteCode = ((List <String>)tbChooseName.Tag)[0].ToString();
            int        totalQty      = int.Parse(((List <String>)tbChooseName.Tag)[3].ToString());
            T_WMS_ITEM itemDetail    = ItemService.GetItemByCode(cigaretteCode);

            if (planQty > totalQty)
            {
                MessageBox.Show("计划出库数量大于库存,请修改出库数量");
                return;
            }
            //10 调拨出库 20 抽检出库 30 补货出库 40 盘点出库 100 其他
            if (cbType.SelectedIndex != 0)//非调拨出库
            {
                if (planQty > itemDetail.FULLCOUNT)
                {
                    MessageBox.Show("计划数量不能大于满盘数量");
                    return;
                }
                else
                {
                    INF_JOBDOWNLOAD job = new INF_JOBDOWNLOAD();
                    decimal         id  = BaseService.GetSeq("select S_ATSCELL_OUT.nextval from dual");
                    job.TARGET = address[cbAdress.SelectedIndex];

                    if (cbType.SelectedIndex == 4)
                    {
                        job.SOURCE = ((List <String>)tbChooseName.Tag)[2].ToString();
                        AtsCellOutService.UpdateCellOutStatus(job.SOURCE, planQty);
                    }
                    else
                    {
                        if (cbType.SelectedIndex == 1)
                        {
                            job.SOURCE = AtsCellOutService.getCellNoBig(cigaretteCode, planQty);//先进先出
                        }
                        else
                        {
                            job.SOURCE = AtsCellOutService.getCellNoMath(cigaretteCode, planQty);//先进先出
                        }
                    }
                    if (job.SOURCE == "")
                    {
                        MessageBox.Show("下载任务失败,请修改任务");
                        return;
                    }
                    else
                    {
                        //   AtsCellOutService.UpdateCellOutStatus(job.SOURCE,planQty);
                    }
                    job.BARCODE    = AtsCellInfoService.GetCellInfo(job.SOURCE).PALLETNO; //托盘号
                    job.PLANQTY    = planQty;
                    job.JOBTYPE    = 52;                                                  //
                    job.PRIORITY   = 50;
                    job.CREATEDATE = DateTime.Now;
                    job.BRANDID    = itemDetail.BIGBOX_BAR;
                    if (cbAdress.SelectedIndex == 1)
                    {
                        job.TUTYPE = 3;//二楼人工口
                    }
                    else
                    {
                        job.TUTYPE = 4;
                    }
                    job.INPUTTYPE = 10;
                    job.TASKNO    = id;
                    job.TARGET    = address[cbAdress.SelectedIndex];
                    using (TransactionScope ts = new TransactionScope())
                    {
                        InfJobDownLoadService.InsertEntity(job);

                        T_WMS_ATSCELL_OUT outcell = new T_WMS_ATSCELL_OUT();
                        outcell.REQUESTQTY = job.PLANQTY;
                        outcell.OUTTARGET  = job.TARGET;
                        //10 调拨出库 20 抽检出库 30 补货出库 40 盘点出库 100 其他
                        if (cbType.SelectedIndex == 5)
                        {
                            outcell.OUTTYPE = 100;
                        }
                        else
                        {
                            outcell.OUTTYPE = (cbType.SelectedIndex + 1) * 10;
                        }
                        outcell.CREATETIME    = DateTime.Now;
                        outcell.BARCODE       = job.BRANDID;
                        outcell.CIGARETTECODE = cigaretteCode;
                        outcell.STATUS        = 20;
                        outcell.CIGARETTENAME = cigaretteName;
                        outcell.ID            = id;
                        outcell.RETURNQTY     = 0;
                        outcell.LOCKRETURNQTY = 0;
                        outcell.ACTQTY        = 0;
                        outcell.ACTRETURNQTY  = 0;
                        AtsCellOutService.InsertObject(outcell);
                        ts.Complete();
                    }
                }
            }
            else
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    decimal id = BaseService.GetSeq("select S_ATSCELL_OUT.nextval from dual");

                    T_WMS_ATSCELL_OUT outcell = new T_WMS_ATSCELL_OUT();
                    outcell.REQUESTQTY    = planQty;
                    outcell.OUTTARGET     = address[cbAdress.SelectedIndex];
                    outcell.OUTTYPE       = 10;
                    outcell.STATUS        = 20;
                    outcell.CREATETIME    = DateTime.Now;
                    outcell.BARCODE       = itemDetail.BIGBOX_BAR;
                    outcell.CIGARETTECODE = cigaretteCode;
                    outcell.CIGARETTENAME = cigaretteName;
                    outcell.RETURNQTY     = 0;
                    outcell.LOCKRETURNQTY = 0;
                    outcell.ACTQTY        = 0;
                    outcell.ACTRETURNQTY  = 0;
                    outcell.ID            = id;
                    AtsCellOutService.InsertObject(outcell);

                    while (planQty > 0)
                    {
                        int             tempQty = 0;
                        INF_JOBDOWNLOAD job     = new INF_JOBDOWNLOAD();

                        job.TARGET = address[cbAdress.SelectedIndex];
                        job.SOURCE = AtsCellOutService.getCellNoByTime(cigaretteCode);

                        if (job.SOURCE == "")
                        {
                            MessageBox.Show("任务下载失败,请修改任务");
                            break;
                        }
                        else
                        {
                            T_WMS_ATSCELLINFO_DETAIL detail = AtsCellInfoDetailService.GetDetail(job.SOURCE);
                            if (detail.QTY >= planQty)
                            {
                                AtsCellOutService.UpdateCellOutStatus(job.SOURCE, planQty);
                                tempQty = planQty;
                                planQty = 0;
                            }
                            else
                            {
                                AtsCellOutService.UpdateCellOutStatus(job.SOURCE, int.Parse(detail.QTY.ToString()));
                                planQty -= int.Parse(detail.QTY.ToString());
                                tempQty  = int.Parse(detail.QTY.ToString());
                            }
                        }
                        job.BARCODE    = AtsCellInfoService.GetCellInfo(job.SOURCE).PALLETNO; //托盘号
                        job.PLANQTY    = tempQty;
                        job.JOBTYPE    = 52;                                                  //一楼出库
                        job.PRIORITY   = 50;
                        job.CREATEDATE = DateTime.Now;
                        job.BRANDID    = itemDetail.BIGBOX_BAR;
                        job.TUTYPE     = 4;
                        job.INPUTTYPE  = 10;
                        job.TASKNO     = id;
                        InfJobDownLoadService.InsertEntity(job);
                    }
                    ts.Complete();
                }
            }
            tbChooseName.Tag  = null;
            tbChooseName.Text = "";
            search();
            MessageBox.Show("出库任务已下达");
        }
예제 #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            List <int> indexList  = new List <int>();
            int        requestQty = 0;
            String     code       = "";

            for (var i = 0; i < this.dataGridView1.RowCount; i++)
            {
                if (this.dataGridView1.Rows[i].Cells[0].Value != null && this.dataGridView1.Rows[i].Cells[0].Value.ToString().ToLower() == "true")
                {
                    indexList.Add(i);
                    if (code != "")
                    {
                        if (code != this.dataGridView1.Rows[i].Cells[1].Value.ToString())
                        {
                            MessageBox.Show("同一品牌才能合盘");
                            return;
                        }
                    }
                    else
                    {
                        code = this.dataGridView1.Rows[i].Cells[1].Value.ToString();
                    }
                    requestQty += int.Parse(this.dataGridView1.Rows[i].Cells[5].Value.ToString());
                    decimal fullcount = ItemService.GetItemByBarCode(code).FULLCOUNT ?? 0;
                    if (requestQty > fullcount)
                    {
                        MessageBox.Show("合盘后的返库数量不能大于满托盘数量");
                        return;
                    }
                }
            }
            if (indexList.Count > 0)
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    T_WMS_ATSCELL_OUT newEntity = null;
                    for (int i = 0; i < indexList.Count; i++)
                    {
                        T_WMS_ATSCELL_OUT temp = list[indexList[i]];
                        if (newEntity == null)
                        {
                            newEntity = new T_WMS_ATSCELL_OUT();
                            newEntity.ACTRETURNQTY  = temp.ACTRETURNQTY;
                            newEntity.ACTQTY        = temp.ACTQTY;
                            newEntity.BARCODE       = temp.BARCODE;
                            newEntity.CIGARETTECODE = temp.CIGARETTECODE;
                            newEntity.CIGARETTENAME = temp.CIGARETTENAME;
                            newEntity.CREATETIME    = DateTime.Now;
                            newEntity.RETURNQTY     = temp.RETURNQTY;
                            newEntity.REQUESTQTY    = temp.REQUESTQTY;
                            newEntity.OUTTYPE       = temp.OUTTYPE;
                            newEntity.REMAK         = temp.ID + ";";
                        }
                        else
                        {
                            newEntity.RETURNQTY += temp.RETURNQTY;
                            newEntity.ACTQTY    += temp.ACTQTY;
                            newEntity.REMAK     += temp.ID + ";";
                        }
                        AtsCellOutService.deleteById(temp.ID);
                    }
                    decimal id = BaseService.GetSeq("select S_ATSCELL_OUT.nextval from dual");
                    newEntity.ID = id;
                    AtsCellOutService.InsertObject(newEntity);
                    ts.Complete();
                    // search();
                }
                search();
            }
        }