private void SetSortingLock(int islock) { string indexcolname = ""; string custcolname = ""; foreach (DataGridViewColumn column in dataGridViewXs[superTabControl1.SelectedTab.Name].Columns) { if (column.DataPropertyName.ToUpper() == "INDEXNO") { indexcolname = column.Name; } if (column.DataPropertyName.ToUpper() == "CUSTCODE") { custcolname = column.Name; } } foreach (DataGridViewRow selectedRow in dataGridViewXs[superTabControl1.SelectedTab.Name].SelectedRows) { //改变任务状态 string indexcolvalue = selectedRow.Cells[indexcolname].Value.ToString(); string custvalue = selectedRow.Cells[custcolname].Value.ToString(); SortingLineTask sortingLineTask = SortingLineTask.GetSortingLineByIndex(indexcolvalue); sortingLineTask.ISLOCK = islock; sortingLineTask.SaveSortingTaskProcess(sortingLineTask.ID); } LoadOrder(); }
private void GetPrintCust(int indexno) { flowLayoutPanel1.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(flowLayoutPanel1, true, null); flowLayoutPanel4.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(flowLayoutPanel4, true, null); flowLayoutPanel4.Controls.Clear(); flowLayoutPanel1.Controls.Clear(); SortingLineTask sortingLineTask = SortingLineTask.GetSortingLineByIndex(indexno.ToString()); Label button = new Label(); button.Width = 120; button.Height = 20; button.Text = "当前客户"; flowLayoutPanel4.Controls.Add(button); button = new Label(); button.Width = 120; button.Height = 20; button.Text = "序号:" + sortingLineTask.INDEXNO; flowLayoutPanel4.Controls.Add(button); button = new Label(); button.Width = 120; button.Height = 20; button.Text = "客户名:" + sortingLineTask.ShortName; flowLayoutPanel4.Controls.Add(button); button = new Label(); button.Width = 300; button.Height = 20; button.Text = sortingLineTask.CUSTCODE; flowLayoutPanel4.Controls.Add(button); SortingLineTaskDetails sortingLineTaskDetails = SortingLineTaskDetails.GetSortingLineTaskDetailsByIndex(indexno); foreach (SortingLineTaskDetail sortingLineTaskDetail in sortingLineTaskDetails) { button = new Label(); button.Width = 20; button.Height = 120; if (sortingLineTaskDetail.CIGNAME.Count() > 7) { sortingLineTaskDetail.CIGNAME = sortingLineTaskDetail.CIGNAME.Substring(0, 7); } button.Text = sortingLineTaskDetail.LINEBOXCODE + Environment.NewLine + sortingLineTaskDetail.CIGNAME.Replace("(", " ").Replace(")", " ") + Environment.NewLine + sortingLineTaskDetail.QTY; flowLayoutPanel1.Controls.Add(button); } ButtonX buttonx = new ButtonX(); buttonx.Width = 50; buttonx.Height = 50; buttonx.Text = "显示更多客户列表"; buttonx.Click += new EventHandler(buttonx_Click); flowLayoutPanel4.Controls.Add(buttonx); }
private void SetSortingStatus(int status) { string indexcolname = ""; string custcolname = ""; foreach (DataGridViewColumn column in dataGridViewXs[superTabControl1.SelectedTab.Name].Columns) { if (column.DataPropertyName.ToUpper() == "INDEXNO") { indexcolname = column.Name; } if (column.DataPropertyName.ToUpper() == "CUSTCODE") { custcolname = column.Name; } } foreach (DataGridViewRow selectedRow in dataGridViewXs[superTabControl1.SelectedTab.Name].SelectedRows) { //改变任务状态 string indexcolvalue = selectedRow.Cells[indexcolname].Value.ToString(); string custvalue = selectedRow.Cells[custcolname].Value.ToString(); SortingLineTask sortingLineTask = SortingLineTask.GetSortingLineByIndex(indexcolvalue); sortingLineTask.Status = status; if (status == 2) { sortingLineTask.PLCADDRESS = 9; } if (status == 0) { sortingLineTask.PLCADDRESS = 0; SortingLineTaskDetail.SaveStatus(sortingLineTask.ID, "", 0); } sortingLineTask.SaveSortingTaskProcess(sortingLineTask.ID); //改变烟包状态 //List<CigBoxInfo> cigBoxInfoList = CigBoxInfoList.GetBoxInfoByCustiomNo(custvalue, indexcolvalue, // SortingLine.GetNonSortingLineCode()); //foreach (CigBoxInfo cigBoxInfo in cigBoxInfoList) //{ // if (status != 2) // { // CigBoxInfo.SaveProcess(cigBoxInfo.ID, 0); // } // else // { // CigBoxInfo.SaveProcess(cigBoxInfo.ID, status); // } //} } }
private string GetNCustCigInfo() { SortingLineTask sortingLineTask; if (indexno > 0) { sortingLineTask = SortingLineTask.GetSortingLineByIndex(nindexno.ToString()); return(sortingLineTask.CUSTCODE); //SortingLineTaskDetails sortingLineTaskDetails = SortingLineTaskDetails.GetSortingLineTaskDetailsByIndex(indexno); } return("0"); }
public SortingLineTask TaskFinish() { bool isRun = false; SortingArrive sortingArrive = new SortingArrive(); SorgingPackingFinished sorgingPackingFinished = new SorgingPackingFinished(); SortingLineTask sortingLineTask = null; try { //扫描烟条到达信号地址区是否有已到达的任务(DB10:DBW50) MonitorLog monitorLog; for (int i = 1; i <= sortingArrive.Count; i++) { int arrivevalue = 0; //获取地址内的值 string a = sortingArrive[i]; arrivevalue = Convert.ToInt32(plc.GetPlcValue(sortingArrive[i]).Value); //非0表示已有完成的客户订单 if (arrivevalue != 0) { //获取DB15中对应的分拣任务号 DB15Model mdl = DB15List.dicArr.FirstOrDefault(o => o.Key == i).Value; string taskno = plc.GetPlcValue(mdl.taskNo).Value.ToString(); //通过任务号关联订单中的序号获取分拣订单保存 if (Convert.ToInt32(taskno) > 0) { sortingLineTask = SortingLineTask.GetSortingLineByIndex(taskno); sortingLineTask.Status = 2; sortingLineTask.SaveSortingTaskProcess(sortingLineTask.ID); sortingLineTask.SaveStatus(); //写日志 monitorLog = MonitorLog.NewMonitorLog(); monitorLog.LOGNAME = "INDEXNO:" + sortingLineTask.INDEXNO + " CUSTNO:" + sortingLineTask.CUSTCODE + " 分拣任务到达数据库保存"; monitorLog.LOGINFO = ""; monitorLog.LOGLOCATION = "PLC"; monitorLog.LOGTYPE = 0; monitorLog.Save(); } //成功后保存发送的烟包信息 //List<CigBoxInfo> cigBoxInfoList = CigBoxInfoList.GetBoxInfoByCustiomNo(sortingLineTask.CUSTCODE, // sortingLineTask.INDEXNO.ToString(), SortingLine.GetNonSortingLineCode()); //foreach (CigBoxInfo cigBoxInfo in cigBoxInfoList) //{ // CigBoxInfo.SaveProcess(cigBoxInfo.ID, 2); //} //写日志 //monitorLog = MonitorLog.NewMonitorLog(); //monitorLog.LOGNAME = "INDEXNO:" + cigBoxInfoList[0].IndexNO + " 分拣烟包到达保存"; //monitorLog.LOGINFO = ""; //monitorLog.LOGLOCATION = "PLC"; //monitorLog.LOGTYPE = 0; //monitorLog.Save(); //查看装箱数据块中是否已修改 //==0表示未修改可以写数据 if (Convert.ToInt32(plc.GetPlcValue(sorgingPackingFinished[i]).Value) == 0) { //将装箱完成信号地址区中对应的出口置1(DB10:DBW0) PlcValue writeVlaue = new PlcValue(); writeVlaue.Value = arrivevalue; isRun = plc.SetPlcValue(sorgingPackingFinished[i], writeVlaue); //写值不成功返回空对象 if (!isRun) { sortingLineTask = null; } else { //写日志 monitorLog = MonitorLog.NewMonitorLog(); monitorLog.LOGNAME = "INDEXNO:" + sortingLineTask.INDEXNO + " 地址位" + sorgingPackingFinished[i] + ":装箱修改为1"; monitorLog.LOGINFO = ""; monitorLog.LOGLOCATION = "PLC"; monitorLog.LOGTYPE = 0; monitorLog.Save(); } break; } //==1表示已修改过继续下一个地址位 else { sortingLineTask = null; //写日志 monitorLog = MonitorLog.NewMonitorLog(); monitorLog.LOGNAME = "装箱已经修改过为1"; monitorLog.LOGINFO = ""; monitorLog.LOGLOCATION = "PLC"; monitorLog.LOGTYPE = 0; monitorLog.Save(); } } Thread.Sleep(50); } //break后执行 //写日志 //monitorLog = MonitorLog.NewMonitorLog(); //monitorLog.LOGNAME = "分拣任务到达循环结束"; //monitorLog.LOGINFO = ""; //monitorLog.LOGLOCATION = "PLC"; //monitorLog.LOGTYPE = 0; //monitorLog.Save(); } catch (Exception ex) { //写日志 MonitorLog monitorLog = MonitorLog.NewMonitorLog(); monitorLog.LOGNAME = "PLC分拣任务到达异常"; monitorLog.LOGINFO = ex.Message; monitorLog.LOGLOCATION = "PLC"; monitorLog.LOGTYPE = 0; monitorLog.Save(); return(null); } return(sortingLineTask); }
private LPTPrintSetup printset = new LPTPrintSetup(); //打印类 private void PirintSet(object type) { try { string indexcolname = ""; string custcolname = ""; foreach (DataGridViewColumn column in dgviewnone.Columns) { if (column.DataPropertyName.ToUpper() == "INDEXNO") { indexcolname = column.Name; } if (column.DataPropertyName.ToUpper() == "CUSTCODE") { custcolname = column.Name; } } IEnumerable <DataGridViewRow> rows = dgviewnone.SelectedRows.Cast <DataGridViewRow>(); DataGridViewRow[] Rows = rows.ToArray(); Array.Reverse(Rows); //对颠倒的行再次颠倒 foreach (DataGridViewRow selectedRow in Rows) { string indexcolvalue = selectedRow.Cells[indexcolname].Value.ToString(); string custvalue = selectedRow.Cells[custcolname].Value.ToString(); SortingLineTask sortingLineTask = SortingLineTask.GetSortingLineByIndex(indexcolvalue); //获取常规烟包 List <CigBoxInfo> cigBoxInfoList = CigBoxInfoList.GetBoxInfoByCustiomNo(sortingLineTask.CUSTCODE, sortingLineTask.INDEXNO.ToString(), AppUtil._SortingLineId); //获取异型烟包 int abnoboxcount = CigBoxInfoList.GetAbnoCigBoxNum(sortingLineTask.ORDERDATE, sortingLineTask.SORTINGTASKNO.ToString(), AppUtil._AbnoSortingLineId, sortingLineTask.CUSTCODE); OutPort outPort = new OutPort(Convert.ToInt32(indexcolvalue)); outPort.GetCustSeq(); foreach (CigBoxInfo cigBoxInfo in cigBoxInfoList) { BusinessLogic.Print.PrintInfo PSInfo = new BusinessLogic.Print.PrintInfo(); PSInfo.CustomerName = sortingLineTask.ShortName; PSInfo.CustomerCode = sortingLineTask.CUSTCODE; PSInfo.IndexNo = sortingLineTask.INDEXNO.ToString(); PSInfo.SortingDate = "(" + sortingLineTask.ORDERDATE + ")"; PSInfo.BoxNo = cigBoxInfo.BOXSEQ.ToString() + "/"; PSInfo.BoxCount = cigBoxInfo.BOXCOUNT.ToString(); PSInfo.CurrentNum = cigBoxInfo.BOXQTY.ToString() + "/" + sortingLineTask.SortingLineTaskDetails.GetTotQty().ToString(); //PSInfo.TaskNumber = sortingLineTask.SortingLineTaskDetails.GetTotQty().ToString(); PSInfo.DelivyLine = sortingLineTask.LINENAME; PSInfo.CustomerSqe = "(" + outPort["COUNTLINE"] + "/" + outPort["MAXCOUNTLINE"] + ")户"; //PSInfo.CustomerTotSeq = outPort["MAXCOUNTLINE"]; PSInfo.AbnoBoxCount = "异" + abnoboxcount; PSInfo.Address = cigBoxInfo.Address; PSInfo.BoxIndex = CigBoxInfoList.GetBoxIndex(PSInfo.IndexNo, cigBoxInfo.BOXSEQ.ToString(), AppUtil._SortingLineId); printset.SetupThePrinting(MyPrintDocument, new SYSPrintsettings(), PSInfo); if (Convert.ToInt32(type) == 1) { printPreviewDialog1.PrintPreviewControl.Zoom = 1.0; this.printPreviewDialog1.ShowDialog(); } else { MyPrintDocument.Print(); } } } } catch (Exception) { throw; } }