Beispiel #1
0
        public static void InsertAtsCellInfo(T_WMS_ATSCELLINFO_DETAIL info, Entities data)
        {
            decimal id = 0;

            // DataTable dt = Query("select S_wms_storagearea_inout.nextval from dual", null);
            id      = data.ExecuteStoreQuery <decimal>("select S_t_wms_atscellinfodetail.nextval from dual").First();
            info.ID = id;
            data.AddToT_WMS_ATSCELLINFO_DETAIL(info);
        }
Beispiel #2
0
 public static void InsertAtsCellInfo(T_WMS_ATSCELLINFO_DETAIL info)
 {
     using (Entities data = new Entities())
     {
         decimal id = 0;
         // DataTable dt = Query("select S_wms_storagearea_inout.nextval from dual", null);
         id      = data.ExecuteStoreQuery <decimal>("select S_t_wms_atscellinfodetail.nextval from dual").First();
         info.ID = id;
         data.AddToT_WMS_ATSCELLINFO_DETAIL(info);
         data.SaveChanges();
         WriteLog.GetLog().Write("插入" + info.CIGARETTENAME + ":" + info.CIGARETTECODE + "储位号:" + info.CELLNO);
     }
 }
Beispiel #3
0
        public void sendTask()
        {
            //List<T_WMS_INBOUND_LINE> list = InBoundLineService.GetItem(inboundid);
            //if (list != null && list.Count > 0)
            //{
            //    using (TransactionScope ts = new TransactionScope())
            //    {
            //        foreach (var item in list)
            //        {
            //            INF_JOBDOWNLOAD job = new INF_JOBDOWNLOAD();
            //            CBAddress.BeginInvoke(new getIndex(getCBSelectIndex));
            //            job.SOURCE = address[selectIndex];
            //            job.PLANQTY = item.BOXQTY;
            //            job.JOBTYPE = 1;//入库任务
            //            job.PRIORITY = 50;
            //            job.CREATEDATE = DateTime.Now;
            //            job.BRANDID = decimal.Parse(item.CIGARETTECODE);
            //            job.TUTYPE = 1;

            //            InfJobDownLoadService.InsertEntity(job);
            //            InBoundLineService.Update(item.INBOUNDDETAILID, 0, item.BOXQTY??0);
            //        }
            //        InBoundService.Update(inboundid, "20");
            //        ts.Complete();
            //    }
            //}
            T_WMS_INBOUND_LINE entity = InBoundLineService.GetItemByID(int.Parse(((List <String>)tbChooseName.Tag)[0].ToString()));
            decimal?           num    = 0;

            num = decimal.Parse(tbNum.Text);
            // if (num > (entity.BOXQTY - entity.LOCKQTY))
            //{
            //    MessageBox.Show("任务数量超出入库单数量,请修正.");
            //    return;
            //}
            INF_JOBDOWNLOAD job = new INF_JOBDOWNLOAD();
            // CBAddress.BeginInvoke(new getIndex(getCBSelectIndex));
            T_WMS_ITEM item = ItemService.GetItemByBarCode(((List <String>)tbChooseName.Tag)[0].ToString());

            job.SOURCE    = "1217";// address[selectIndex];
            job.FULLCOUNT = item.FULLCOUNT;
            job.PILETYPE  = decimal.Parse(item.DXTYPE);
            job.TARGET    = AtsCellInService.getCellNo(((List <String>)tbChooseName.Tag)[0].ToString());//储位地址
            if (job.TARGET == "")
            {
                MessageBox.Show("获取储位信息失败");
                return;
            }
            job.PLANQTY    = num;
            job.JOBTYPE    = 20;//入库任务
            job.PRIORITY   = 50;
            job.CREATEDATE = DateTime.Now;
            job.BRANDID    = ((List <String>)tbChooseName.Tag)[0].ToString();
            job.TUTYPE     = 4;
            job.INPUTTYPE  = 10;
            job.INBOUNDNO  = int.Parse(((List <String>)tbChooseName.Tag)[1].ToString());
            String palletNo = RefRFIDPalletService.GetPallet(tbRfid.Text);

            if (palletNo == "E")
            {
                MessageBox.Show("该托盘已在使用,请确认Rfid是否输入正确");
                return;
            }
            job.BARCODE = palletNo;
            if (cbcDuo.Checked)
            {
                job.CDTYPE = 10;
            }
            else
            {
                job.CDTYPE = 0;
            }
            InfJobDownLoadService.InsertEntity(job); //插入任务
            InBoundLineService.Update(job.INBOUNDNO ?? 0, 0, job.PLANQTY ?? 0);
            T_WMS_ATSCELLINFO info = new T_WMS_ATSCELLINFO();

            info.PALLETNO = job.BARCODE;
            // info.DISMANTLE = 1;
            info.CELLNO     = job.TARGET;
            info.STATUS     = 10;//上架
            info.CREATETIME = DateTime.Now;
            info.INBOUNDID  = job.INBOUNDNO;

            info.DISMANTLE = 10;

            AtsCellInfoService.InsertAtsCellInfo(info);

            T_WMS_ATSCELLINFO_DETAIL detail = new T_WMS_ATSCELLINFO_DETAIL();

            detail.CIGARETTECODE = ItemService.GetItemByBarCode(job.BRANDID).ITEMNO;
            detail.CIGARETTENAME = ItemService.GetItemByBarCode(job.BRANDID).ITEMNAME;
            detail.BARCODE       = job.BRANDID;
            detail.QTY           = job.PLANQTY;
            detail.CELLNO        = info.CELLNO;
            AtsCellInfoDetailService.InsertAtsCellInfo(detail);
            MessageBox.Show("任务已下达");
            WriteLog.GetLog().Write(job.JOBID + "号任务已下达;入口地址:" + job.SOURCE);
            searchTask();
            initText();
        }
        public static void AutoWriteFinishTask()
        {
            //10 码垛任务 20  入库单入库任务 30 成品入库 40 返库任务 50 出库任务
            //55补货出库 60 自动拆垛补货任务 70人工拆垛补货任务 80 开箱任务
            //90 托盘条码下达(1194 源地址) 91指定拆垛机械手  97任务取消 100 空托盘回收任务

            using (Entities dataEntity = new Entities())
            {
                var query = (from item in dataEntity.INF_JOBFEEDBACK
                             join item2 in dataEntity.INF_JOBDOWNLOAD
                             on item.JOBID equals item2.JOBID
                             where item.STATUS == 0 && item.FEEDBACKSTATUS == 99
                                                     // && item2.INPUTTYPE == 10
                             select item2).ToList(); //执行完的任务
                var query2 = (from item in dataEntity.INF_EQUIPMENTREQUEST
                              where item.STATUS == 0
                              select item).ToList();  //wcs申请的任务

                var query3 = (from item in dataEntity.INF_JOBDOWNLOAD
                              join item2 in dataEntity.INF_JOBFEEDBACK
                              on item.JOBID equals item2.JOBID
                              where (item.JOBTYPE == 60 || item.JOBTYPE == 70) &&
                              item2.FEEDBACKSTATUS == 1 && item2.STATUS == 0
                              select item2).ToList();
                var query4 = (from item in dataEntity.INF_JOBDOWNLOAD
                              join item2 in dataEntity.INF_JOBFEEDBACK
                              on item.JOBID equals item2.JOBID
                              where (item.JOBTYPE == 80) &&
                              item2.FEEDBACKSTATUS == 100 && item.STATUS == 1    //出重力式货架完成
                              select item).ToList();

                var query5 = (from item in dataEntity.INF_JOBDOWNLOAD
                              join item2 in dataEntity.INF_JOBFEEDBACK
                              on item.JOBID equals item2.JOBID
                              where  item2.FEEDBACKSTATUS == 97 && item.STATUS == 1   //wcs 任务取消
                              select item).ToList();
                if (query5 != null)
                {
                    foreach (var item in query5)
                    {
                        try
                        {
                            if (item.JOBTYPE == 20 || item.JOBTYPE == 30 || item.JOBTYPE == 40 || item.JOBTYPE == 42)   //42的返库后续有可能要特殊处理
                            {
                                using (TransactionScope ts = new TransactionScope())
                                {
                                    item.STATUS = 97;
                                    AtsCellInfoService.delete(item.TARGET);
                                    AtsCellInfoDetailService.delete(item.TARGET);
                                    AtsCellService.UpdateAtsCell(item.TARGET, 10); //更新为空闲
                                    if (item.JOBTYPE == 20)                        //更新锁定数量
                                    {
                                        var inboundLine = (from line in dataEntity.T_WMS_INBOUND_LINE where line.INBOUNDDETAILID == item.INBOUNDNO && line.BARCODE == item.BRANDID select line).FirstOrDefault();
                                        if (inboundLine == null)
                                        {
                                            WriteLog.GetLog().Write("找不到入库单号:" + item.INBOUNDNO);
                                            continue;
                                        }
                                        else
                                        {
                                            inboundLine.LOCKQTY -= item.PLANQTY;
                                        }
                                    }
                                    dataEntity.SaveChanges();
                                    ts.Complete();
                                }
                            }
                            else if (item.JOBTYPE == 50 || item.JOBTYPE == 52 || item.JOBTYPE == 55)
                            {
                                using (TransactionScope ts = new TransactionScope())
                                {
                                    item.STATUS = 97;
                                    AtsCellInfoService.GetCellInfo(item.SOURCE, dataEntity).STATUS = 30;   //
                                    AtsCellService.UpdateAtsCell(item.SOURCE, 10);
                                    AtsCellInfoDetailService.GetDetail(item.SOURCE, dataEntity).REQUESTQTY = 0;
                                    if (item.JOBTYPE == 55)
                                    {
                                        var cd = (from cditem in dataEntity.INF_JOBDOWNLOAD where cditem.EXTATTR2 == item.JOBID select cditem).ToList();
                                        if (cd != null)
                                        {
                                            foreach (var v in cd)
                                            {
                                                v.STATUS = 97;   //取消
                                                StroageInOutService.Del(v.JOBID + "", dataEntity);
                                            }
                                        }
                                    }
                                    dataEntity.SaveChanges();
                                    ts.Complete();
                                }
                            }
                            else if (item.JOBTYPE == 80)
                            {
                                item.STATUS = 97;
                                StroageInOutService.Del(item.JOBID + "", dataEntity);
                                dataEntity.SaveChanges();
                            }
                        }
                        catch (Exception e)
                        {
                            log.Write("错误信息:" + e.Message);
                        }
                    }
                }
                if (query4 != null)
                {
                    foreach (var task in query4)
                    {
                        InfJobDownLoadService.UpdateJopDownLoad(task.JOBID, 10, dataEntity);
                        //var report = (from reportitem in dataEntity.T_WMS_STORAGEAREA_INOUT where reportitem.TASKNO == task.JOBID select reportitem).ToList();
                        //if (report != null && report.Count > 0)
                        //{
                        //    report.ForEach(x => x.STATUS = 20);
                        //}
                    }
                }
                if (query3 != null)
                {
                    foreach (var task in query3)
                    {
                        if (task.PLANQTY != null)
                        {
                            StroageInOutService.UpdateInOut(task.JOBID, task.ACTQTY ?? 0, dataEntity);
                            task.STATUS = 1;
                            dataEntity.SaveChanges();
                        }
                    }
                }
                if (query2 != null && query2.Count > 0)
                {
                    foreach (var temptask in query2)
                    {
                        try{
                            //using (TransactionScope ts = new TransactionScope())
                            //{
                            INF_JOBDOWNLOAD task = new INF_JOBDOWNLOAD();
                            //T_WMS_ATSCELLINFO cellInfo = AtsCellInfoService.CheckPalletExist(temptask.BARCODE);//检查托盘号是否存在
                            //if (temptask.BARCODE != null && temptask.BARCODE != "" && (cellInfo==null))//储位中不存在该托盘 || cellInfo.PALLETNO==temptask.BARCODE))
                            //{
                            task.JOBID           = dataEntity.ExecuteStoreQuery <decimal>("select s_inf_jobdownload.nextval from dual").First() + "";
                            task.ID              = task.JOBID;
                            task.CREATEDATE      = DateTime.Now;
                            task.BRANDID         = temptask.BRANDID;
                            task.PLANQTY         = temptask.REQUESTQTY;
                            task.INPUTTYPE       = 10;
                            temptask.RESPONDDATE = DateTime.Now;
                            if (temptask.REQUESTTYPE != 3)
                            {
                                if (temptask.REQUESTTYPE == 1)                                 //入库请求
                                {
                                    if (temptask.INBOUNDNO == null || temptask.INBOUNDNO == 0) //返库
                                    {
                                        if (temptask.EQUIPMENTID == "1422")                    //空托盘返库
                                        {
                                            task.JOBID = dataEntity.ExecuteStoreQuery <decimal>("select s_inf_jobdownload.nextval from dual").First() + "";

                                            task.BRANDID = "1111111";
                                            task.BARCODE = RefRFIDPalletService.GetSeq() + "";
                                            task.SOURCE  = temptask.EQUIPMENTID;
                                            task.PLANQTY = 10;

                                            task.JOBTYPE = 100;                                               //空托盘回收任务
                                            task.TARGET  = AtsCellInService.getCellNoCode(task.BRANDID + ""); //空托盘指定地址
                                            task.TUTYPE  = 3;

                                            task.PRIORITY = 50;


                                            try
                                            {
                                                if (task.TARGET != null && task.TARGET != "")
                                                {
                                                    using (TransactionScope ts = new TransactionScope())
                                                    {
                                                        T_WMS_ATSCELLINFO info = new T_WMS_ATSCELLINFO();
                                                        // info.PALLETNO = RefRFIDPalletService.GetSeq() + "";// task.BARCODE;

                                                        task.BARCODE    = RefRFIDPalletService.GetSeq() + ""; // AtsCellInfoService.GetCellInfo(task.TARGET).PALLETNO;
                                                        info.CELLNO     = task.TARGET;
                                                        info.STATUS     = 10;                                 //组盘
                                                        info.CREATETIME = DateTime.Now;
                                                        info.INBOUNDID  = task.INBOUNDNO;
                                                        info.PALLETNO   = task.BARCODE;
                                                        info.DISMANTLE  = 10;

                                                        AtsCellInfoService.InsertAtsCellInfo(info);

                                                        T_WMS_ATSCELLINFO_DETAIL detail = new T_WMS_ATSCELLINFO_DETAIL();
                                                        detail.BARCODE = task.BRANDID + "";
                                                        T_WMS_ITEM item = ItemService.GetItemByBarCode(detail.BARCODE);

                                                        detail.CIGARETTECODE = item.ITEMNO;
                                                        detail.CIGARETTENAME = item.ITEMNAME;
                                                        detail.QTY           = task.PLANQTY;
                                                        detail.CELLNO        = info.CELLNO;
                                                        AtsCellInfoDetailService.InsertAtsCellInfo(detail);
                                                        task.CREATEDATE = DateTime.Now;
                                                        task.STATUS     = 0;
                                                        dataEntity.INF_JOBDOWNLOAD.AddObject(task);
                                                        temptask.STATUS = 1;
                                                        dataEntity.SaveChanges();
                                                        ts.Complete();
                                                    }
                                                }
                                                else
                                                {
                                                    WriteLog.GetLog().Write("品牌" + task.BRANDID + "暂无库存");
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                if (task.TARGET != "")
                                                {
                                                    InBoundService.RollBack(task.TARGET); //回滚
                                                }
                                            }
                                        }
                                        else
                                        {
                                            T_WMS_ATSCELLINFO cellInfo = AtsCellInfoService.CheckPalletExist(temptask.BARCODE);//检查托盘号是否存在
                                            if (cellInfo == null)
                                            {
                                                continue;
                                            }
                                            T_WMS_ATSCELLINFO_DETAIL detail = AtsCellInfoDetailService.GetDetail(cellInfo.CELLNO);

                                            if ((detail.REQUESTQTY ?? 0) != detail.QTY)
                                            {
                                                INF_JOBDOWNLOAD task1 = new INF_JOBDOWNLOAD();
                                                task1.JOBID      = dataEntity.ExecuteStoreQuery <decimal>("select s_inf_jobdownload.nextval from dual").First() + "";
                                                task1.ID         = task.JOBID;
                                                task1.BRANDID    = detail.BARCODE;
                                                task1.BARCODE    = cellInfo.PALLETNO;
                                                task1.SOURCE     = temptask.EQUIPMENTID;
                                                task1.PLANQTY    = detail.QTY - detail.REQUESTQTY;
                                                task1.INPUTTYPE  = 10;
                                                task1.JOBTYPE    = 40;//返库任务
                                                task1.TARGET     = AtsCellInService.getCellNoCode(task.BRANDID + "");
                                                task1.TUTYPE     = 4;
                                                task1.PRIORITY   = 50;
                                                task1.STATUS     = 0;
                                                task1.CREATEDATE = DateTime.Now;
                                                dataEntity.INF_JOBDOWNLOAD.AddObject(task1);

                                                T_WMS_ATSCELLINFO info = new T_WMS_ATSCELLINFO();
                                                info.PALLETNO = cellInfo.PALLETNO;
                                                // info.DISMANTLE = 1;
                                                info.CELLNO     = task1.TARGET;
                                                info.STATUS     = 10;//组盘
                                                info.CREATETIME = cellInfo.CREATETIME;
                                                info.INBOUNDID  = task.INBOUNDNO;
                                                task.TUTYPE     = 4;
                                                info.DISMANTLE  = 10;
                                                try
                                                {
                                                    using (TransactionScope ts = new TransactionScope())
                                                    {
                                                        AtsCellInfoService.InsertAtsCellInfo(info);

                                                        T_WMS_ATSCELLINFO_DETAIL details = new T_WMS_ATSCELLINFO_DETAIL();
                                                        details.BARCODE = detail.BARCODE;
                                                        T_WMS_ITEM item = ItemService.GetItemByBarCode(details.BARCODE);
                                                        details.CIGARETTECODE = item.ITEMNO;
                                                        details.CIGARETTENAME = item.ITEMNAME;
                                                        details.QTY           = task1.PLANQTY;
                                                        details.CELLNO        = info.CELLNO;
                                                        AtsCellInfoDetailService.InsertAtsCellInfo(details);
                                                        AtsCellService.UpdateAtsCell(detail.CELLNO, 10);
                                                        AtsCellInfoService.delete(detail.CELLNO);
                                                        AtsCellInfoDetailService.delete(detail.CELLNO);
                                                        temptask.STATUS = 1;
                                                        dataEntity.SaveChanges();
                                                        ts.Complete();
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    if (task1.TARGET != "")
                                                    {
                                                        InBoundService.RollBack(task1.TARGET); //回滚
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                using (TransactionScope ts = new TransactionScope())
                                                {
                                                    AtsCellService.UpdateAtsCell(detail.CELLNO, 10);
                                                    AtsCellInfoService.delete(detail.CELLNO);
                                                    AtsCellInfoDetailService.delete(detail.CELLNO);
                                                    temptask.STATUS = 1;
                                                    dataEntity.SaveChanges();
                                                    ts.Complete();
                                                }
                                            }
                                        }
                                    }
                                    else//入库单入库
                                    {
                                        task.SOURCE    = temptask.EQUIPMENTID;
                                        task.JOBTYPE   = 20;
                                        task.INBOUNDNO = temptask.INBOUNDNO;
                                        // task.BARCODE = RefRFIDPalletService.GetSeq() + ""; //temptask.BARCODE;
                                        task.PRIORITY = 50;
                                        //task.BARCODE=
                                        task.TARGET = AtsCellInService.getCellNoCode(task.BRANDID + "");
                                        try
                                        {
                                            using (TransactionScope ts = new TransactionScope())
                                            {
                                                task.BARCODE = RefRFIDPalletService.GetSeq() + "";
                                                var inboundLine = (from line in dataEntity.T_WMS_INBOUND_LINE where line.INBOUNDDETAILID == task.INBOUNDNO select line).FirstOrDefault();

                                                if (inboundLine != null)
                                                {
                                                    var tq      = (from record in dataEntity.T_WMS_INBOUND_LINE where record.INBOUNDID == inboundLine.INBOUNDID select record).Sum(x => x.LOCKQTY) ?? 0;
                                                    var inbound = (from record in dataEntity.T_WMS_INBOUND where record.INBOUNDID == inboundLine.INBOUNDID select record).FirstOrDefault();

                                                    if (tq < task.PLANQTY)
                                                    {
                                                        inbound.STARTTIME = DateTime.Now;
                                                    }
                                                    //else if (tq + task.PLANQTY == inbound.QTY)
                                                    //{
                                                    //    inbound.FINISHTIME = DateTime.Now;
                                                    //}
                                                    inboundLine.LOCKQTY += task.PLANQTY;
                                                }
                                                if (temptask.TUTYPE == 3 || temptask.TUTYPE == 2)//空托盘、空托盘组
                                                {
                                                    task.BRANDID = "1111111";
                                                }

                                                T_WMS_ATSCELLINFO info = new T_WMS_ATSCELLINFO();
                                                //info.PALLETNO = RefRFIDPalletService.GetSeq() + "";// task.BARCODE;

                                                // AtsCellInfoService.GetCellInfo(task.TARGET).PALLETNO;
                                                info.CELLNO     = task.TARGET;
                                                info.PALLETNO   = task.BARCODE;
                                                info.STATUS     = 10;//组盘
                                                info.CREATETIME = DateTime.Now;
                                                info.INBOUNDID  = task.INBOUNDNO;
                                                if (inboundLine != null)
                                                {
                                                    info.CONSIGNOR = inboundLine.CONSIGNSOR;
                                                }
                                                info.DISMANTLE = 10;
                                                task.TUTYPE    = 4;
                                                AtsCellInfoService.InsertAtsCellInfo(info);

                                                T_WMS_ATSCELLINFO_DETAIL detail = new T_WMS_ATSCELLINFO_DETAIL();
                                                detail.BARCODE = task.BRANDID + "";
                                                T_WMS_ITEM item = ItemService.GetItemByBarCode(detail.BARCODE);

                                                detail.CIGARETTECODE = item.ITEMNO;
                                                detail.CIGARETTENAME = item.ITEMNAME;
                                                detail.QTY           = task.PLANQTY;
                                                detail.CELLNO        = info.CELLNO;
                                                AtsCellInfoDetailService.InsertAtsCellInfo(detail);


                                                task.CREATEDATE = DateTime.Now;
                                                task.STATUS     = 0;
                                                if (task.SOURCE != null && task.SOURCE != "" && task.TARGET != null && task.TARGET != "")//根据地址判断是否下任务
                                                {
                                                    dataEntity.INF_JOBDOWNLOAD.AddObject(task);
                                                }
                                                else
                                                {
                                                    WriteLog.GetLog().Write("品牌" + task.BRANDID + "暂无可用货架");
                                                    continue;
                                                }
                                                //}
                                                //else //储位中存在该托盘  肯定就是返库任务 人工站台拆垛完成触发的返库任务
                                                //{

                                                //}
                                                temptask.STATUS = 1;
                                                dataEntity.SaveChanges();
                                                ts.Complete();
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            if (task.TARGET != "")
                                            {
                                                InBoundService.RollBack(task.TARGET); //回滚
                                            }
                                        }
                                    }
                                }

                                else if (temptask.REQUESTTYPE == 2)//出库请求
                                {
                                    task.TARGET = temptask.EQUIPMENTID;
                                    if (temptask.TUTYPE == 3)//空托盘组
                                    {
                                        task.PRIORITY = 99;
                                        task.JOBTYPE  = 50;
                                        task.BRANDID  = "1111111";

                                        task.SOURCE = AtsCellOutService.getCellNoBig("1111111", 1);//托盘组任务
                                        if (task.SOURCE == "")
                                        {
                                            //WriteLog.GetLog().Write("暂无出库的");
                                            //continue;
                                        }
                                        else
                                        {
                                            task.BARCODE = AtsCellInfoService.GetCellInfo(task.SOURCE).PALLETNO;
                                        }

                                        task.TUTYPE     = temptask.TUTYPE;
                                        task.CREATEDATE = DateTime.Now;
                                        task.STATUS     = 0;
                                        if (task.SOURCE != null && task.SOURCE != "" && task.TARGET != null && task.TARGET != "")//根据地址判断是否下任务
                                        {
                                            dataEntity.INF_JOBDOWNLOAD.AddObject(task);
                                        }
                                        else
                                        {
                                            WriteLog.GetLog().Write("品牌" + task.BRANDID + "暂无库存");
                                        }

                                        temptask.STATUS = 1;
                                        dataEntity.SaveChanges();
                                    }
                                    //else if (temptask.TUTYPE == 2)//空托盘
                                    //{
                                    //    task.JOBTYPE = 90;
                                    //    task.BARCODE = "";//获取托盘号 读取RFID
                                    //}
                                    //else if (temptask.TUTYPE == 4)//实托盘
                                    //{
                                    //    task.JOBTYPE = 50;
                                    //}
                                }

                                // task.TUTYPE = temptask.TUTYPE;


                                // ts.Complete();
                            }
                            else//下达拆垛任务
                            {
                                //新建指定拆垛机械手任务
                                using (TransactionScope ts = new TransactionScope())
                                {
                                    INF_JOBDOWNLOAD inf = InfJobDownLoadService.GetDetail(temptask.JOBID, dataEntity);

                                    inf.STATUS = 10;//出库任务完成

                                    if (temptask.EQUIPMENTID == "1415" && inf.JOBTYPE != 55)
                                    {
                                        temptask.STATUS = 1;
                                    }
                                    else
                                    {
                                        INF_JOBDOWNLOAD load = new INF_JOBDOWNLOAD();
                                        load.ID      = dataEntity.ExecuteStoreQuery <decimal>("select S_INF_JOBDOWNLOAD.nextval from dual").First() + "";
                                        load.JOBID   = load.ID;
                                        load.JOBTYPE = 91;// 指定拆垛机械手任务

                                        load.CREATEDATE = DateTime.Now;
                                        INF_JOBDOWNLOAD item = InfJobDownLoadService.GetDetail(temptask.JOBID);
                                        load.BRANDID = item.BRANDID;
                                        String  cellNo  = item.SOURCE;
                                        decimal jobType = item.JOBTYPE ?? 0;
                                        load.PILETYPE = item.PILETYPE;
                                        T_WMS_ATSCELLINFO_DETAIL detail = AtsCellInfoDetailService.GetDetail(cellNo);
                                        load.EXTATTR1 = (detail.QTY ?? 0) + ""; //实际数量
                                        load.PLANQTY  = detail.REQUESTQTY ?? 0; //拆垛数量
                                        load.BARCODE  = AtsCellInfoService.GetCellInfo(cellNo).PALLETNO;
                                        load.PRIORITY = 50;
                                        //  load.SOURCE = querySource.TROUGHNUM;


                                        load.TARGET   = temptask.EQUIPMENTID;
                                        load.SOURCE   = load.TARGET;
                                        load.PILETYPE = item.PILETYPE;
                                        load.STATUS   = 0;
                                        dataEntity.AddToINF_JOBDOWNLOAD(load);
                                        dataEntity.SaveChanges();


                                        var cdtask = (from taskitem in dataEntity.INF_JOBDOWNLOAD where taskitem.EXTATTR2 == temptask.JOBID && taskitem.STATUS == 2 select taskitem).ToList();
                                        if (cdtask != null && cdtask.Count > 0)
                                        {
                                            cdtask.ForEach(x => x.STATUS     = 0);
                                            cdtask.ForEach(x => x.SOURCE     = temptask.EQUIPMENTID);
                                            cdtask.ForEach(x => x.CREATEDATE = DateTime.Now);
                                        }
                                        if (jobType == 55 && detail.QTY == detail.REQUESTQTY && temptask.EQUIPMENTID != "1415")
                                        {
                                            AtsCellService.UpdateAtsCell(item.SOURCE, 10);//任务置空闲
                                            //AtsCellOutService.UpdateObject(item.TASKNO ?? 0, AtsCellInfoDetailService.GetDetail(item.SOURCE).QTY ?? 0);
                                            AtsCellInfoService.delete(item.SOURCE);
                                            AtsCellInfoDetailService.delete(item.SOURCE);
                                        }
                                        temptask.STATUS = 1;
                                    }



                                    dataEntity.SaveChanges();
                                    ts.Complete();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            WriteLog.GetLog().Write("错误信息:" + ex.Message);
                        }
                    }
                }
                if (query != null && query.Count > 0)
                {
                    foreach (var item in query)
                    {
                        using (TransactionScope ts = new TransactionScope())
                        {
                            try{
                                var feedback = (from feed in dataEntity.INF_JOBFEEDBACK where feed.JOBID == item.JOBID && feed.FEEDBACKSTATUS == 99 select feed).FirstOrDefault();
                                feedback.STATUS = 10;
                                if (item.JOBTYPE == 20 || item.JOBTYPE == 30 || item.JOBTYPE == 40 || item.JOBTYPE == 42 || item.JOBTYPE == 100)//入库单入库任务
                                {
                                    InfJobDownLoadService.UpdateJopDownLoad(item.JOBID, 10, dataEntity);
                                    if (item.JOBTYPE == 20)
                                    {
                                        String code        = item.BRANDID + "";
                                        var    inboundLine = (from line in dataEntity.T_WMS_INBOUND_LINE where line.INBOUNDDETAILID == item.INBOUNDNO && line.BARCODE == code select line).FirstOrDefault();
                                        if (inboundLine == null)
                                        {
                                            WriteLog.GetLog().Write("找不到入库单号:" + item.INBOUNDNO);
                                            continue;
                                        }
                                        inboundLine.ABOXQTY += item.PLANQTY;
                                        if (inboundLine.ABOXQTY + inboundLine.OTHERQTY == inboundLine.BOXQTY)
                                        {
                                            inboundLine.STATUS = "30";
                                        }
                                        var inbound     = (from main in dataEntity.T_WMS_INBOUND where main.INBOUNDID == inboundLine.INBOUNDID select main).FirstOrDefault();
                                        var inBoundList = (from line in dataEntity.T_WMS_INBOUND_LINE where line.INBOUNDID == inboundLine.INBOUNDID select line).ToList();
                                        var needUpdate  = true;
                                        foreach (var l in inBoundList)
                                        {
                                            if (l.ABOXQTY + l.OTHERQTY != l.BOXQTY)
                                            {
                                                needUpdate = false;
                                                break;
                                            }
                                        }
                                        if (needUpdate)
                                        {
                                            inbound.STATUS     = "30"; //入库完成
                                            inbound.ENDTIME    = DateTime.Now;
                                            inbound.FINISHTIME = DateTime.Now;
                                        }
                                    }
                                    if (item.JOBTYPE == 42)  //抽检入库、盘点入库、补货入库、调拨返库、其它
                                    {
                                        AtsCellOutService.UpdateObjectSec(item.TASKNO ?? 0, AtsCellInfoDetailService.GetDetail(item.SOURCE).QTY ?? 0);
                                    }
                                    AtsCellService.UpdateAtsCell(item.TARGET, 20, dataEntity); //更新cellno状态 载货

                                    var info = (from cellinfo in dataEntity.T_WMS_ATSCELLINFO where cellinfo.CELLNO == item.TARGET select cellinfo).FirstOrDefault();
                                    if (info != null)
                                    {
                                        info.STATUS      = 30;
                                        info.INBOUNDTIME = DateTime.Now;
                                    }
                                }
                                else if (item.JOBTYPE == 50 || item.JOBTYPE == 55 || item.JOBTYPE == 52)  //出库任务
                                {
                                    if (item.JOBTYPE == 50)
                                    {
                                        AtsCellService.UpdateAtsCell(item.SOURCE, 10);  //任务置空闲
                                        AtsCellInfoService.delete(item.SOURCE);
                                        AtsCellInfoDetailService.delete(item.SOURCE);
                                        InfJobDownLoadService.UpdateJopDownLoad(item.JOBID, 10, dataEntity);
                                    }
                                    else if (item.JOBTYPE == 52)
                                    {
                                        AtsCellService.UpdateAtsCell(item.SOURCE, 10);  //任务置空闲
                                        AtsCellOutService.UpdateObject(item.TASKNO ?? 0, AtsCellInfoDetailService.GetDetail(item.SOURCE).QTY ?? 0);
                                        AtsCellInfoService.delete(item.SOURCE);
                                        AtsCellInfoDetailService.delete(item.SOURCE);
                                    }
                                    else if (item.JOBTYPE == 55)
                                    {
                                        InfJobDownLoadService.UpdateJopDownLoad(item.JOBID, 10, dataEntity);
                                        //下达拆垛任务
                                        //var task = (from taskitem in dataEntity.INF_JOBDOWNLOAD where taskitem.EXTATTR2 == item.JOBID && taskitem.STATUS == 2 select taskitem).ToList();
                                        //if (task != null && task.Count > 0)
                                        //{
                                        //    task.ForEach(x => x.STATUS = 0);
                                        //}
                                    }
                                }
                                else if (item.JOBTYPE == 60 || item.JOBTYPE == 70)   //拆垛任务完成
                                {
                                    //下达返库任务
                                    INF_JOBDOWNLOAD load = InfJobDownLoadService.GetDetail(item.EXTATTR2, dataEntity);
                                    //INF_JOBDOWNLOAD load2 = InfJobDownLoadService.GetDetail(item.EXTATTR3, dataEntity);
                                    //  T_WMS_ATSCELLINFO_DETAIL detail = AtsCellInfoDetailService.GetDetail(load.SOURCE, dataEntity);
                                    //  T_WMS_ATSCELLINFO cellInfo = AtsCellInfoService.GetCellInfo(load.SOURCE,dataEntity);//检查托盘号是否存在

                                    //if (load!=null && detail!=null && load.BRANDID != detail.BARCODE)
                                    //{
                                    //    log.Write("load.BRANDID:" + load.BRANDID + ";detail.BARCODE:" + detail.BARCODE + ";item.EXTATTR2:" + item.EXTATTR2);
                                    //}
                                    //if (detail != null && load.BRANDID==detail.BARCODE)
                                    //{
                                    InfJobDownLoadService.UpdateJopDownLoad(item.JOBID, 10, dataEntity);

                                    var report = (from reportitem in dataEntity.T_WMS_STORAGEAREA_INOUT where reportitem.TASKNO == item.JOBID select reportitem).ToList();
                                    if (report != null && report.Count > 0)
                                    {
                                        report.ForEach(x => x.STATUS     = 20);
                                        report.ForEach(x => x.FINISHTIME = DateTime.Now);
                                    }
                                    //if (detail.REQUESTQTY == detail.QTY) //&& (cellInfo.DISMANTLE==0)
                                    //{
                                    //    INF_JOBDOWNLOAD task1 = new INF_JOBDOWNLOAD();
                                    //    task1.JOBID = dataEntity.ExecuteStoreQuery<decimal>("select s_inf_jobdownload.nextval from dual").First() + "";
                                    //    task1.ID = task1.JOBID;
                                    //    task1.BRANDID = "111111";// detail.BARCODE;
                                    //    task1.SOURCE = item.SOURCE;
                                    //    task1.PLANQTY = 1;
                                    //    task1.INPUTTYPE = 10;
                                    //    task1.JOBTYPE = 100;//空托盘回收任务
                                    //    task1.TARGET = "1422";//空托盘指定地址
                                    //    task1.TUTYPE = 2;
                                    //    task1.PRIORITY = 50;
                                    //    task1.STATUS = 0;
                                    //    task1.CREATEDATE = DateTime.Now;
                                    //    task1.TASKNO = decimal.Parse(item.EXTATTR2);
                                    //    dataEntity.INF_JOBDOWNLOAD.AddObject(task1);

                                    //}
                                    //if (detail.REQUESTQTY != detail.QTY)
                                    //{

                                    //    INF_JOBDOWNLOAD task1 = new INF_JOBDOWNLOAD();
                                    //    task1.JOBID = dataEntity.ExecuteStoreQuery<decimal>("select s_inf_jobdownload.nextval from dual").First() + "";
                                    //    task1.ID = task1.JOBID;
                                    //    task1.BRANDID = detail.BARCODE;
                                    //    task1.SOURCE = item.SOURCE;
                                    //    task1.PLANQTY = detail.QTY - detail.REQUESTQTY;
                                    //    task1.INPUTTYPE = 10;
                                    //    task1.JOBTYPE = 40;//返库任务
                                    //    task1.TARGET = AtsCellInService.getCellNoCode(detail.BARCODE + "");
                                    //    task1.TUTYPE = 4;
                                    //    task1.PRIORITY = 50;
                                    //    task1.STATUS = 0;
                                    //    task1.CREATEDATE = DateTime.Now;
                                    //    task1.TASKNO = decimal.Parse(item.EXTATTR2);
                                    //    dataEntity.INF_JOBDOWNLOAD.AddObject(task1);

                                    //    T_WMS_ATSCELLINFO info = new T_WMS_ATSCELLINFO();
                                    //    info.PALLETNO = cellInfo.PALLETNO;
                                    //    // info.DISMANTLE = 1;
                                    //    info.CELLNO = task1.TARGET;
                                    //    info.STATUS = 10;//组盘
                                    //    info.CREATETIME = cellInfo.CREATETIME;
                                    //    // info.INBOUNDID = task1.INBOUNDNO;

                                    //    info.DISMANTLE = 10;

                                    //    AtsCellInfoService.InsertAtsCellInfo(info,dataEntity);

                                    //    T_WMS_ATSCELLINFO_DETAIL details = new T_WMS_ATSCELLINFO_DETAIL();
                                    //    details.BARCODE = task1.BRANDID + "";
                                    //    T_WMS_ITEM items = ItemService.GetItemByBarCode(details.BARCODE);
                                    //    details.CIGARETTECODE = items.ITEMNO;
                                    //    details.CIGARETTENAME = items.ITEMNAME;
                                    //    details.QTY = task1.PLANQTY;
                                    //    details.CELLNO = info.CELLNO;
                                    //    details.REQUESTQTY = 0;
                                    //    AtsCellInfoDetailService.InsertAtsCellInfo(details);
                                    //}
                                    //AtsCellService.UpdateAtsCell(detail.CELLNO, 10);//更新储位为空闲状态
                                    //AtsCellInfoService.delete(detail.CELLNO,dataEntity);
                                    //AtsCellInfoDetailService.delete(detail.CELLNO, dataEntity);
                                    //}
                                }
                                else if (item.JOBTYPE == 80)
                                {
                                    var report = (from reportitem in dataEntity.T_WMS_STORAGEAREA_INOUT where reportitem.TASKNO == item.JOBID select reportitem).ToList();
                                    if (report != null && report.Count > 0)
                                    {
                                        report.ForEach(x => x.STATUS     = 20);
                                        report.ForEach(x => x.FINISHTIME = DateTime.Now);
                                    }

                                    INF_JOBDOWNLOAD kxLoad = InfJobDownLoadService.GetDetail(item.JOBID, dataEntity);
                                    kxLoad.STATUS = 20;  //开箱完成
                                }
                                else if (item.JOBTYPE == 120)
                                {
                                    AtsCellCJService.Del(item.EXTATTR1);
                                }
                                dataEntity.SaveChanges();
                                ts.Complete();
                            }
                            catch (Exception ex)
                            {
                                WriteLog.GetLog().Write("错误信息:" + ex.Message);
                            }
                        }
                    }
                }
            }
        }
Beispiel #5
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("出库任务已下达");
        }
Beispiel #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (jobid != null && jobid != "0")
            {
                //InBound.INF_JOBFEEDBACK request = new InBound.INF_JOBFEEDBACK();
                ////request.ID = Guid.NewGuid().ToString("N");
                //request.JOBID = jobid;
                //request.FEEDBACKSTATUS = 99;
                //request.ERRORCODE = "OK";
                //request.ENTERDATE = DateTime.Now;
                ////  request.STATUS = 0;
                //InfFeedBackService.InsertEntity(request);


                //T_WMS_ATSCELLINFO cellInfo = AtsCellInfoService.CheckPalletExist(temptask.BARCODE);//检查托盘号是否存在
                //T_WMS_ATSCELLINFO_DETAIL detail = AtsCellInfoDetailService.GetDetail(cellInfo.CELLNO);
                //if (detail.REQUESTQTY == detail.QTY) //&& (cellInfo.DISMANTLE==0)
                //{
                //    INF_JOBDOWNLOAD task1 = new INF_JOBDOWNLOAD();
                //    task1.JOBID = dataEntity.ExecuteStoreQuery<decimal>("select s_inf_jobdownload.nextval from dual").First() + "";
                //    task1.ID = task1.JOBID;
                //    task1.BRANDID = temptask.BRANDID;
                //    task1.BARCODE = cellInfo.PALLETNO;
                //    task1.SOURCE = temptask.EQUIPMENTID;
                //    task1.PLANQTY = 1;
                //    task1.INPUTTYPE = 10;
                //    task1.JOBTYPE = 100;//空托盘回收任务
                //    task1.TARGET = "1422";//空托盘指定地址
                //    task1.TUTYPE = 2;
                //    task1.CREATEDATE = DateTime.Now;
                //    task1.PRIORITY = 50;
                //    dataEntity.INF_JOBDOWNLOAD.AddObject(task1);

                //}
                // INF_EQUIPMENTREQUEST request = InfEquipmentRequestService.GetEquipMentRequest(jobid);
                INF_JOBDOWNLOAD          download = InfJobDownLoadService.GetDetail(jobid);
                T_WMS_ATSCELLINFO        cellInfo = AtsCellInfoService.GetCellInfoByBarCode(download.BARCODE);
                T_WMS_ATSCELLINFO_DETAIL detail   = AtsCellInfoDetailService.GetDetail(cellInfo.CELLNO);

                using (TransactionScope ts = new TransactionScope())
                {
                    if (detail.REQUESTQTY != detail.QTY)
                    {
                        INF_JOBDOWNLOAD task1 = new INF_JOBDOWNLOAD();
                        // task1.JOBID = dataEntity.ExecuteStoreQuery<decimal>("select s_inf_jobdownload.nextval from dual").First() + "";
                        // task1.ID = task.JOBID;
                        task1.BRANDID    = detail.BARCODE;
                        task1.BARCODE    = cellInfo.PALLETNO;
                        task1.SOURCE     = "1415";
                        task1.PLANQTY    = detail.QTY - detail.REQUESTQTY;
                        task1.INPUTTYPE  = 10;
                        task1.JOBTYPE    = 40;//返库任务
                        task1.TARGET     = AtsCellInService.getCellNoCode(download.BRANDID + "");
                        task1.TUTYPE     = 4;
                        task1.PRIORITY   = 50;
                        task1.STATUS     = 0;
                        task1.CREATEDATE = DateTime.Now;
                        InfJobDownLoadService.InsertEntity(task1);

                        T_WMS_ATSCELLINFO info = new T_WMS_ATSCELLINFO();
                        info.PALLETNO = cellInfo.PALLETNO;
                        // info.DISMANTLE = 1;
                        info.CELLNO     = task1.TARGET;
                        info.STATUS     = 10;//组盘
                        info.CREATETIME = cellInfo.CREATETIME;
                        info.INBOUNDID  = cellInfo.INBOUNDID;
                        //task.TUTYPE = 4;
                        info.DISMANTLE = 0;

                        AtsCellInfoService.InsertAtsCellInfo(info);

                        T_WMS_ATSCELLINFO_DETAIL details = new T_WMS_ATSCELLINFO_DETAIL();
                        details.BARCODE = detail.BARCODE;
                        T_WMS_ITEM item = ItemService.GetItemByBarCode(details.BARCODE);
                        details.CIGARETTECODE = item.ITEMNO;
                        details.CIGARETTENAME = item.ITEMNAME;
                        details.QTY           = task1.PLANQTY;
                        details.CELLNO        = info.CELLNO;
                        AtsCellInfoDetailService.InsertAtsCellInfo(details);
                    }
                    AtsCellService.UpdateAtsCell(detail.CELLNO, 10);
                    AtsCellInfoService.delete(detail.CELLNO);
                    AtsCellInfoDetailService.delete(detail.CELLNO);
                    InfJobDownLoadService.UpdateJopDownLoad(jobid, 3);
                    //  InfEquipmentRequestService.UpdateEquipMentRequest(jobid, 1);
                    ts.Complete();
                }
                search();
            }
            else
            {
                MessageBox.Show("请选择记录");
            }
        }
Beispiel #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (cbAddress.SelectedIndex == -1)
            {
                MessageBox.Show("请选择入口地址");
                return;
            }
            if (tbChooseName.Tag == null)
            {
                MessageBox.Show("请选择品牌");
                return;
            }
            if (tbRfid.Text == "")
            {
                MessageBox.Show("请输入Rfid");
                return;
            }
            INF_JOBDOWNLOAD job = new INF_JOBDOWNLOAD();

            job.SOURCE = address[cbAddress.SelectedIndex];
            job.TARGET = AtsCellInService.getCellNoCode(tbChooseName.Tag.ToString());//储位地址
            if (job.TARGET == "")
            {
                MessageBox.Show("获取储位信息失败");
                return;
            }
            job.PLANQTY    = int.Parse(tbNum.Text);
            job.JOBTYPE    = 30;//成品入库
            job.PRIORITY   = 50;
            job.CREATEDATE = DateTime.Now;
            job.BRANDID    = tbChooseName.Tag.ToString();
            job.TUTYPE     = 4;
            job.INPUTTYPE  = 10;
            String palletNo = RefRFIDPalletService.GetSeq() + "";// RefRFIDPalletService.GetPallet(tbRfid.Text);

            job.BARCODE = palletNo;
            if (palletNo == "E")
            {
                MessageBox.Show("该托盘已在使用,请确认Rfid是否输入正确");
                return;
            }
            if (cbcDuo.Checked)
            {
                job.CDTYPE = 10;
            }
            else
            {
                job.CDTYPE = 0;
            }

            //  InfJobDownLoadService.InsertEntity(job);
            using (TransactionScope ts = new TransactionScope())
            {
                InfJobDownLoadService.InsertEntity(job);

                //InBoundLineService.Update(entity.INBOUNDDETAILID, 0, num ?? 0);
                AtsCellService.UpdateAtsCell(job.TARGET, 30);//更新cellno状态
                T_WMS_ATSCELLINFO info = new T_WMS_ATSCELLINFO();
                info.PALLETNO   = palletNo;
                info.DISMANTLE  = 1;
                info.CELLNO     = job.TARGET;
                info.STATUS     = 10;//组盘
                info.CREATETIME = DateTime.Now;
                //info.INBOUNDID = inboundid;
                if (cbcDuo.Checked)
                {
                    info.DISMANTLE = 10;
                }
                else
                {
                    info.DISMANTLE = 0;
                }
                AtsCellInfoService.InsertAtsCellInfo(info);

                T_WMS_ATSCELLINFO_DETAIL detail = new T_WMS_ATSCELLINFO_DETAIL();
                detail.BARCODE       = tbChooseName.Tag.ToString();
                detail.CIGARETTECODE = ItemService.GetItemByBarCode(detail.BARCODE).ITEMNO;
                detail.CIGARETTENAME = tbChooseName.Text;
                detail.QTY           = decimal.Parse(tbNum.Text);
                detail.CELLNO        = info.CELLNO;

                AtsCellInfoDetailService.InsertAtsCellInfo(detail);
                ts.Complete();
                WriteLog.GetLog().Write("储位明细信息状态:10 储位号:" + job.TARGET);
            }
            //MessageBox.Show("入库完成");

            //InfJobDownLoadService.InsertEntity(job);
            //using (TransactionScope ts = new TransactionScope())
            //{
            //    InfJobDownLoadService.InsertEntity(job);

            //    //InBoundLineService.Update(entity.INBOUNDDETAILID, 0, num ?? 0);
            //    AtsCellService.UpdateAtsCell(job.TARGET,30);//更新cellno状态
            //    T_WMS_ATSCELLINFO info = new T_WMS_ATSCELLINFO();
            //    info.PALLETNO = palletNo;
            //    info.DISMANTLE = 1;
            //    info.CELLNO = job.TARGET;
            //    info.STATUS = 10;//组盘
            //    info.CREATETIME = DateTime.Now;
            //    //info.INBOUNDID = inboundid;
            //    if (cbcDuo.Checked)
            //    {
            //        info.DISMANTLE = 10;
            //    }
            //    else
            //    {
            //        info.DISMANTLE = 0;
            //    }
            //    AtsCellInfoService.InsertAtsCellInfo(info);

            //    T_WMS_ATSCELLINFO_DETAIL detail = new T_WMS_ATSCELLINFO_DETAIL();
            //    detail.CIGARETTECODE = tbChooseName.Tag.ToString();
            //    detail.CIGARETTENAME = tbChooseName.Text;
            //    detail.QTY = decimal.Parse(tbNum.Text);
            //    detail.PALLETNO = info.PALLETNO;
            //    AtsCellInfoDetailService.InsertAtsCellInfo(detail);
            //    ts.Complete();
            //}
            MessageBox.Show("任务已下达");
            updateListBox(job.JOBID + "号任务已下达;入口地址:" + job.SOURCE);
            WriteLog.GetLog().Write(job.JOBID + "号任务已下达;入口地址:" + job.SOURCE);
            tbChooseName.Text = "";
            tbChooseName.Tag  = null;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (cbAddress.SelectedIndex == -1)
            {
                MessageBox.Show("请选择入口地址");
                return;
            }
            if (tbChooseName.Tag == null)
            {
                MessageBox.Show("请选择品牌");
                return;
            }
            if (tbRfid.Text == "")
            {
                MessageBox.Show("请输入Rfid");
                return;
            }
            decimal fullCount = ItemService.GetItemByCode(cigaretteCode).FULLCOUNT ?? 0;

            if (decimal.Parse(tbNum.Text) > fullCount)
            {
                MessageBox.Show("入库数量不能大于满托盘数量");
                return;
            }
            using (TransactionScope ts = new TransactionScope())
            {
                INF_JOBDOWNLOAD job = new INF_JOBDOWNLOAD();

                job.SOURCE = address[cbAddress.SelectedIndex];
                job.TARGET = AtsCellInService.getCellNoCode(cigaretteCode);//储位地址
                if (job.TARGET == "")
                {
                    MessageBox.Show("获取储位信息失败,请联系管理员");
                    return;
                }
                job.PLANQTY    = int.Parse(tbNum.Text);
                job.JOBTYPE    = 42;//返库
                job.PRIORITY   = 50;
                job.CREATEDATE = DateTime.Now;
                job.BRANDID    = tbChooseName.Tag.ToString();
                job.TUTYPE     = 4;
                job.INPUTTYPE  = 10;
                job.TASKNO     = taskNo;
                //job.EXTATTR1 = dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
                String palletNo = RefRFIDPalletService.GetPallet(tbRfid.Text);
                if (palletNo == "E")
                {
                    MessageBox.Show("该托盘已在使用,请确认Rfid是否输入正确");
                    return;
                }
                job.BARCODE = palletNo;
                if (cbcDuo.Checked)
                {
                    job.CDTYPE = 10;
                }
                else
                {
                    job.CDTYPE = 0;
                }
                InfJobDownLoadService.InsertEntity(job);
                AtsCellService.UpdateAtsCell(job.TARGET, 30);

                T_WMS_ATSCELLINFO info = new T_WMS_ATSCELLINFO();
                info.PALLETNO = job.BARCODE;


                info.CELLNO     = job.TARGET;
                info.STATUS     = 10;//组盘
                info.CREATETIME = DateTime.Now;

                info.DISMANTLE = job.CDTYPE;

                AtsCellInfoService.InsertAtsCellInfo(info);
                AtsCellOutService.UpdateObjectThd(taskNo, job.PLANQTY ?? 0);
                T_WMS_ATSCELLINFO_DETAIL detail = new T_WMS_ATSCELLINFO_DETAIL();
                detail.BARCODE = job.BRANDID;

                T_WMS_ITEM item = ItemService.GetItemByBarCode(detail.BARCODE);

                detail.CIGARETTECODE = item.ITEMNO;
                detail.CIGARETTENAME = item.ITEMNAME;
                detail.QTY           = job.PLANQTY;
                detail.CELLNO        = info.CELLNO;
                AtsCellInfoDetailService.InsertAtsCellInfo(detail);
                ts.Complete();
                MessageBox.Show("入库任务下达完成");
            }
            search();
            tbChooseName.Text = "";
            tbChooseName.Tag  = null;
        }