List <T_WMS_ITEM> GetList() { List <T_WMS_ITEM> list = new List <T_WMS_ITEM>(); T_WMS_ITEM item = new T_WMS_ITEM(); WmsService service = new WmsService(); T_WMS_ITEM itemname = service.GetItemByBarCode(code); if (itemname != null) { item.ITEMNAME = itemname.ITEMNAME; } else { item.ITEMNAME = "未知卷烟"; } item.BIGBOX_BAR = "(91)" + code + "0000" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now); for (int i = 0; i < num; i++) { list.Add(item); } return(list); }
public RdlcReport(String code, int num) { this.code = code; this.num = num; InitializeComponent(); reportViewer1.LocalReport.EnableExternalImages = true; BarCode128 barCode = new BarCode128(); WmsService service = new WmsService(); T_WMS_ITEM item = service.GetItemByCode(code); if (item != null) { code = "91" + item.BIGBOX_BAR + "0000" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now); } FileInfo file = new FileInfo(Application.StartupPath + "\\code.jpg"); if (file.Exists) { file.Delete(); } barCode.GetCodeImage(code, LabelPrint.MvcGuestBook.Common.BarCode128.Encode.Code128C).Save("code.jpg"); System.Drawing.Printing.PageSettings ps = reportViewer1.GetPageSettings();// new System.Drawing.Printing.PageSettings(); ps.Landscape = false; Microsoft.Reporting.WinForms.ReportParameter params1; params1 = new Microsoft.Reporting.WinForms.ReportParameter("ImageAddress", "file:///" + Application.StartupPath + "\\code.jpg"); reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter[] { params1 }); reportViewer1.SetPageSettings(ps); }
/// <summary> /// 验证是否有新品牌 /// </summary> /// <returns></returns> public Response ValidNewItem(decimal maxSyncseq) { Response response = new Response(); using (DZEntities dzEntities = new DZEntities()) { //正常使用的品牌信息 var T_WMS_ITEM = (from item in dzEntities.T_WMS_ITEM where item.ROWSTATUS == 10 select new { id = item.ID, itemno = item.ITEMNO, itemname = item.ITEMNAME }).ToList(); //maxSyncseq批次接收的订单信息 var T_WMS_ORDERITEM = (from order in dzEntities.T_PRODUCE_ORDER join line in dzEntities.T_PRODUCE_ORDERLINE on order.BILLCODE equals line.BILLCODE where order.SYNSEQ == maxSyncseq select new { id = line.CIGARETTECODE, itemno = line.CIGARETTECODE, itemname = line.CIGARETTENAME }).ToList();; var newItem = T_WMS_ORDERITEM.Except(T_WMS_ITEM).ToList(); if (newItem.Count() > 0) { decimal count = newItem.Count(); string itemnamestr = ""; foreach (var item in newItem) { var query = (from cig in dzEntities.T_WMS_ITEM where cig.ID == item.id select cig).ToList(); if (query.Count() > 0) { query.FirstOrDefault().ROWSTATUS = 10; query.FirstOrDefault().SHIPTYPE = "2"; } else { T_WMS_ITEM iteminfo = new T_WMS_ITEM(); iteminfo.ID = item.id; iteminfo.ITEMNO = item.itemno; iteminfo.ITEMNAME = item.itemname; iteminfo.SHIPTYPE = "2"; iteminfo.ROWSTATUS = 10; dzEntities.T_WMS_ITEM.AddObject(iteminfo); } int count1 = dzEntities.SaveChanges(); itemnamestr = itemnamestr + "," + item.itemname; } //dzEntities.SaveChanges(); response.IsSuccess = false; response.MessageText = "订单接收发现【" + count + "】个新品牌(" + itemnamestr.Substring(1) + "),请为新品牌完善品牌信息!"; } else { response.IsSuccess = true; response.MessageText = "本次接收暂未发现新品牌!"; } } return(response); }
List <T_WMS_ITEM> GetList() { List <T_WMS_ITEM> list = new List <T_WMS_ITEM>(); T_WMS_ITEM item = new T_WMS_ITEM(); item.BIGBOX_BAR = code; for (int i = 0; i < num; i++) { list.Add(item); } return(list); }
List <T_WMS_ITEM> GetList(String code, int num) { List <T_WMS_ITEM> list = new List <T_WMS_ITEM>(); WmsService service = new WmsService(); T_WMS_ITEM item = service.GetItemByCode(code); if (item != null) { //item.BIGBOX_BAR = "(91)" + item.BIGBOX_BAR + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now)+"0000000000"; item.BIGBOX_BAR = "(91)" + item.BIGBOX_BAR + "0000" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now); } for (int i = 0; i < num; i++) { list.Add(item); } return(list); }
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); } } } } } }
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("出库任务已下达"); }
public Response AutoGenReplan() { Response response = new Response(); Boolean flag = false; int i = 0; using (DZEntities entites = new DZEntities()) { TransactionOptions transactionOption = new TransactionOptions(); transactionOption.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; using (TransactionScope tran = new TransactionScope(TransactionScopeOption.Required, transactionOption)) { try { decimal maxid = 0; //卧式通道预补货 var wsList = (from ws in entites.T_PRODUCE_SORTTROUGH where ws.STATE == "10" && ws.GROUPNO == 3 select ws).ToList(); var itemList = (from item in entites.T_WMS_ITEM where item.ROWSTATUS == 10 select item).ToList(); if (wsList.Any()) { foreach (var item in wsList) { T_WMS_ITEM citem = itemList.Find(x => x.ITEMNO == item.CIGARETTECODE); //计算需要预补多少件 decimal jtsize = citem.JT_SIZE ?? 0; if (jtsize > 0) { decimal ct = ((item.THRESHOLD - item.MANTISSA) / jtsize) ?? 0; double cigCount = Math.Floor(Convert.ToDouble(ct)); if (cigCount > 0) { for (int j = 0; j < cigCount; j++) { i++; T_PRODUCE_REPLENISHPLAN plan = new T_PRODUCE_REPLENISHPLAN(); plan.CIGARETTECODE = item.CIGARETTECODE; plan.CIGARETTENAME = item.CIGARETTENAME; plan.ID = (++maxid); plan.JYCODE = citem.BIGBOX_BAR; plan.REPLENISHQTY = 1; plan.TASKNUM = maxid.ToString(); plan.MANTISSA = item.MANTISSA + citem.JT_SIZE; item.MANTISSA = plan.MANTISSA; plan.TROUGHNUM = item.MACHINESEQ.ToString(); //通道编号默认 plan.STATUS = 0; //新增状态 plan.TYPE = 10; //排程自动补货 plan.SEQ = 1; plan.ISCOMPLETED = 10; //已生成托盘补货计划 entites.T_PRODUCE_REPLENISHPLAN.AddObject(plan); //item.STATUS = 10;//已生成托盘补货计划 } } } } entites.SaveChanges();//提交 最多24条补货 } //根据订单正常补货 var sortList = (from item in entites.T_PRODUCE_SORTTROUGH where item.TROUGHTYPE == 10 && item.STATE == "10" && (item.CIGARETTETYPE == 30 || item.CIGARETTETYPE == 40) select item).ToList(); sortList.ForEach(x => x.LASTMANTISSA = x.MANTISSA);//更新上次尾数 var pokeList1 = (from item in entites.T_UN_POKE where item.STATUS == 0 select item).ToList(); var pokeList = (from item in entites.T_UN_POKE where item.STATUS == 0 group item by new { item.SORTNUM, item.TROUGHNUM, item.CIGARETTECODE } into g orderby g.Key.SORTNUM, g.Key.TROUGHNUM select new { SORTNUM = g.Key.SORTNUM, TROUGHNUM = g.Key.TROUGHNUM, CIGARETTECODE = g.Key.CIGARETTECODE, POKENUM = g.Sum(x => x.POKENUM) }).ToList(); var list = (from item in entites.T_PRODUCE_REPLENISHPLAN select item.ID).ToList(); if (list.Count > 0) { maxid = list.Max(); } if (pokeList1.Any()) { foreach (var item in pokeList) { T_PRODUCE_SORTTROUGH sorttrough = sortList.Find(x => x.CIGARETTECODE == item.CIGARETTECODE && x.TROUGHNUM == item.TROUGHNUM); T_WMS_ITEM citem = itemList.Find(x => x.ITEMNO == item.CIGARETTECODE); sorttrough.MANTISSA = sorttrough.MANTISSA - item.POKENUM; if (sorttrough.THRESHOLD - sorttrough.MANTISSA >= citem.JT_SIZE)//如果空出一件烟就可以补 { i++; T_PRODUCE_REPLENISHPLAN plan = new T_PRODUCE_REPLENISHPLAN(); plan.CIGARETTECODE = item.CIGARETTECODE; plan.CIGARETTENAME = sorttrough.CIGARETTENAME; plan.ID = (++maxid); plan.JYCODE = citem.BIGBOX_BAR; plan.REPLENISHQTY = 1; plan.TASKNUM = maxid.ToString(); plan.MANTISSA = sorttrough.MANTISSA + citem.JT_SIZE; sorttrough.MANTISSA = plan.MANTISSA; plan.TROUGHNUM = sorttrough.MACHINESEQ.ToString(); //通道编号默认 plan.STATUS = 0; //新增状态 plan.TYPE = 30; //排程自动补货 plan.SEQ = 0; plan.ISCOMPLETED = 10; //已生成托盘补货计划 entites.T_PRODUCE_REPLENISHPLAN.AddObject(plan); //item.STATUS = 10;//已生成托盘补货计划 if (i == 100) { entites.SaveChanges(); i = 0; } } // //entites.SaveChanges(); } pokeList1.ForEach(x => x.STATUS = 10); entites.SaveChanges(); tran.Complete(); flag = true; response.MessageText = "补货计划生成成功!"; } else { flag = false; response.MessageText = "暂无新的分拣数据,无需生成补货计划!"; } response.IsSuccess = flag; } catch (Exception e) { flag = false; response.MessageText = "生成补货计划出错,请联系系统管理员!" + e.ToString(); response.IsSuccess = flag; } return(response); } } }
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("请选择记录"); } }
public void GetAllOrder(decimal packageNo) { int allCount = 0; using (Entities entity = new Entities()) { DateTime TIEM = new DateTime(); DateTime TIEM2 = new DateTime(); DateTimeFormatInfo format = new DateTimeFormatInfo(); format.ShortDatePattern = "yyyy-MM-dd"; TIEM = Convert.ToDateTime("2019-03-21", format); TIEM2 = Convert.ToDateTime("2019-03-21", format); //var query = (from item in entity.T_UN_TASK_H // where item.BILLCODE =="CS10429225" && item.PACKAGEMACHINE == packageNo //&& item.ORDERDATE >= TIEM && item.ORDERDATE <= TIEM2 //&& item.TASKNUM == 799261 // orderby item.TASKNUM // select item).ToList(); var query = (from item in entity.V_PRODUCE_PACKAGEINFO where //item.EXPORT == packageNo && item.BILLCODE == "CS10429225" //&& item.ALLOWSORT=="非标" // && (item.TASKNUM == 664692 || item.TASKNUM == 663143) group item by new { item.BILLCODE, item.TASKNUM } into allcode select new { allcode.Key.BILLCODE, allcode.Key.TASKNUM }).OrderBy(x => x.TASKNUM).ToList(); ptid = entity.T_PACKAGE_TASK.Count() > 0 ? entity.T_PACKAGE_TASK.Max(x => x.PTID) + 1 : 1; if (query != null) { int i = 0; //decimal maxSeq = GetSeq("select decode(max(ptid),null,0,max(ptid)) from t_package_task "); foreach (var v in query) { i++; int pcount = 0; List <T_PACKAGE_TASK> task = new List <T_PACKAGE_TASK>(); var query2 = (from item2 in entity.V_PRODUCE_PACKAGEINFO where item2.BILLCODE == v.BILLCODE && item2.ALLOWSORT == "非标" orderby item2.SENDTASKNUM, item2.MACHINESEQ, item2.TROUGHNUM select item2).ToList(); if (query2 != null) { foreach (var v2 in query2) { allCount = allCount + 1; pcount = pcount + 1; T_PACKAGE_TASK temp = new T_PACKAGE_TASK(); temp.PTID = ptid; temp.CIGARETTECODE = v2.CIGARETTECODE; T_WMS_ITEM tempItem = ItemService.GetItemByCode(v2.CIGARETTECODE); temp.CIGARETTENAME = tempItem.ITEMNAME; temp.CIGHIGH = tempItem.IHEIGHT; temp.CIGWIDTH = tempItem.IWIDTH; temp.CIGWIDTH = tempItem.IWIDTH; temp.CIGLENGTH = tempItem.ILENGTH; temp.BILLCODE = v2.BILLCODE; temp.SORTNUM = v2.TASKNUM; temp.CIGNUM = allCount; temp.CIGSEQ = pcount; //temp.PACKAGESEQ = v2.EXPORT; temp.ALLPACKAGESEQ = 0; //temp.PACKAGENO = v2.PACKAGEMACHINE; temp.PACKAGENO = 1;//v2.EXPORT; //temp.CIGTYPE = "2"; temp.CIGTYPE = v2.ALLOWSORT == "非标" ? "2" : "1"; temp.STATE = 0; //0 新增 10 确定 temp.NORMAILSTATE = 0; //0 新增 10 确定 temp.NORMALQTY = 1; temp.UNIONPACKAGETAG = 0; temp.DOUBLETAKE = "0"; ////temp.ORDERSEQ = v2.PRIORITY; ////temp.ORDERQTY = v2.ORDERQUANTITY; temp.CIGSTATE = 10; task.Add(temp); ptid++; } allpackagenum++; GenPackageInfo(task, entity); foreach (var item in task) { item.PACKTASKNUM = item.ALLPACKAGESEQ; entity.T_PACKAGE_TASK.AddObject(item); } if (i == 5) { entity.SaveChanges(); i = 0; } } } entity.SaveChanges(); } } }
// 发送堆垛机命令 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; } int itemCount = ItemService.GetItemCountByBarCode(((List <String>)tbChooseName.Tag)[1].ToString()); if (itemCount > 1) { MessageBox.Show("存在重复的件码,请联系管理员!"); return; } INF_JOBDOWNLOAD job = new INF_JOBDOWNLOAD(); T_WMS_ITEM item = ItemService.GetItemByBarCode(((List <String>)tbChooseName.Tag)[1].ToString()); CBAddress.BeginInvoke(new getIndex(getCBSelectIndex)); job.SOURCE = address[CBAddress.SelectedIndex]; job.TARGET = "A1"; job.PLANQTY = num; job.JOBTYPE = 10;//码垛任务 job.PRIORITY = 50; job.CREATEDATE = DateTime.Now; job.FULLCOUNT = item.FULLCOUNT; job.PILETYPE = decimal.Parse(item.DXTYPE); job.BRANDID = ((List <String>)tbChooseName.Tag)[1].ToString(); job.TUTYPE = 1;//件箱 job.INPUTTYPE = 10; job.INBOUNDNO = int.Parse(((List <String>)tbChooseName.Tag)[0].ToString()); if (InfJobDownLoadService.CheckJobExist(job.INBOUNDNO ?? 0)) { MessageBox.Show("任务已存在"); return; } using (TransactionScope ts = new TransactionScope()) { InfJobDownLoadService.InsertEntity(job); ts.Complete(); } this.BeginInvoke(new SearchHanlder(search)); searchTask(); initText(); MessageBox.Show("任务已下达"); updateListBox(job.JOBID + "号任务已下达;入口地址:" + job.SOURCE); WriteLog.GetLog().Write(job.JOBID + "号任务已下达;入口地址:" + job.SOURCE); }
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; }