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(); }
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; }