diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index 857b984..56ef4e5 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -363,7 +363,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel DataTable WorkOrderstepdata = WorkOrderSQL.ExecuteDataSet("select * from WorkOrder where (State='111' or State='112') AND EndTime >'" + DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'", null).Tables[0]; //读取表写入缓存 for (int k = 0; k < WorkOrderstepdata.Rows.Count; k++) - { + {//网络 string WorkOrderdata_m = WorkOrderstepdata.Select()[k].Field("Machines").ToString(); //string m= WorkOrderstepdata.Rows[k].Field("Machines"); if (Convert.ToBoolean(Selet_Machines(Machines, "Type", "Name='" + WorkOrderdata_m + "'"))) @@ -381,7 +381,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel "WorkOrder ='" + WorkOrderstepdata.Select()[k].Field("WorkOrder").ToString() + "'", null); } else - { + {//串口 } } @@ -393,7 +393,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel string WorkOrderdata_m = WorkOrderdata.Select()[k].Field("Machines").ToString(); //string m = WorkOrderdata.Rows[k].Field("Machines"); if (Convert.ToBoolean( Selet_Machines(Machines, "Type", "Name='" + WorkOrderdata_m + "'"))) - { + {//网络 //string WorkOrderdata_m = WorkOrderdata.Select()[k].Field("Machines").ToString(); string State = Selet_Machines(Machines, "State", "Name='" + WorkOrderdata_m + "'").ToString(); @@ -418,7 +418,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel } } else - { + {//串口 //string WorkOrderdata_m = WorkOrderdata.Select()[k].Field("Machines").ToString(); string State = Selet_Machines(Machines, "State", "Name='" + WorkOrderdata_m + "'").ToString(); string POR = Selet_Machines(Machines, "Serial", "ID='" + k + "'").ToString(); @@ -452,7 +452,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel string WorkOrderset_m = WorkOrderset_.Select()[k].Field("Machines").ToString(); //string m = WorkOrderset_.Rows[k].Field("Machines"); if (Convert.ToBoolean(Selet_Machines(Machines, "Type", "Name='" + WorkOrderset_m + "'"))) - { + {//网络 //string WorkOrderset_m = WorkOrderset_.Select()[k].Field("Machines").ToString(); string WorkOrderset_w = WorkOrderset_.Select()[k].Field("WorkOrder").ToString(); int index = Convert.ToInt16(Selet_Machines(Machines, "ID", "Name='" + WorkOrderset_m + "'").ToString()); @@ -472,7 +472,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel "WorkOrder ='" + WorkOrderdata.Select()[k].Field("WorkOrder").ToString() + "'", null); } else - { + {//串口 //string WorkOrderset_m = WorkOrderset_.Select()[k].Field("Machines").ToString(); string WorkOrderset_w = WorkOrderset_.Select()[k].Field("WorkOrder").ToString(); string POR = Selet_Machines(Machines, "Serial", "ID='" + k + "'").ToString(); @@ -669,7 +669,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel if (Convert.ToBoolean(MachinesRow["CALL"])) { if (Convert.ToBoolean(MachinesRow["Type"])) - { + {//网络 stringQueue.Enqueue(new QueueString { ID = Convert.ToInt16(MachinesRow["ID"]), @@ -677,13 +677,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel }); } else - { + {//串口 string POR = MachinesRow["Serial"].ToString(); stringQueueSerial.Enqueue(new QueueSerial { ID = POR, - DAT = "SC827[" + MachinesRow["Station"] + DAT = "SC827[" + MachinesRow["Station"]+"]" }); } @@ -780,13 +780,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel Row["DispenseEndTime"] = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); Row.EndEdit(); } - - // MainWindow.InfData.Rows.Add(new object[] { dataRow["Machine"], - // Resources.Dyelot + dataRow["Dyelot"] + Resources.Step + dataRow["Step"]+ - // Resources.DispenseException, - // Selet_Machines(Machines, "SYSKEY", "Name='" + dataRow["Machine"] + "'"), - // Selet_Machines(Machines, "ID", "Name='" + dataRow["Machine"] + "'")}); - } } } @@ -798,7 +791,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel { if (dt.Select("PowderState = 301").Count() > 0) { - // Dyelot_CALL.Rows.Remove(dataRow); DataTable dr = await bDCSqlHelper.SELECT("DyelotsBulkedRecipe", "Dyelot = '" + dataRow.Field("Dyelot") + "' AND ReDye = " + dataRow.Field("ReDye") + @@ -849,7 +841,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel { if (dt.Select("ChemicalState = 301").Count() > 0) { - // Dyelot_CALL.Rows.Remove(dataRow); DataTable dr = await bDCSqlHelper.SELECT("DyelotsBulkedRecipe", "Dyelot = '" + dataRow.Field("Dyelot") + "' AND ReDye = " + dataRow.Field("ReDye") + @@ -902,29 +893,36 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel {//301列表发送完成至染机(203=>301) foreach (DataRow row in Dyelot_CALL.Select("State='301' OR State='309'")) { - Dictionary Product_ = new Dictionary();//缓存函数 - Product_.Add("State", row.Field("State")); - Product_.Add("Step", row.Field("Step")); - Product_.Add("Dyelot", row.Field("Dyelot")); - Product_.Add("ProductCode", row.Field("ProductCode")); - Product_.Add("Amount", row.Field("Amount")); - Product_.Add("DispenseEndTime", row.Field("DispenseEndTime")); + if (Convert.ToBoolean(MachinesRow["Type"])) + {//网络 + Dictionary Product_ = new Dictionary();//缓存函数 + Product_.Add("State", row.Field("State")); + Product_.Add("Step", row.Field("Step")); + Product_.Add("Dyelot", row.Field("Dyelot")); + Product_.Add("ProductCode", row.Field("ProductCode")); + Product_.Add("Amount", row.Field("Amount")); + Product_.Add("DispenseEndTime", row.Field("DispenseEndTime")); - stringQueue.Enqueue(new QueueString - { - ID = Convert.ToInt16(Selet_Machines(Machines, - "ID", "Name='" + row.Field("Machine") + "'")), - DAT = "SC828" + Selet_Machines(Machines, - "SYSKEY", "Name='" + row.Field("Machine") + "'") + Product_.ToJsonString() - }); - if (row["State"].ToString() == "309") - { - MainWindow.InfData.Rows.Add(new object[] { row["Machine"], + stringQueue.Enqueue(new QueueString + { + ID = Convert.ToInt16(Selet_Machines(Machines, + "ID", "Name='" + row.Field("Machine") + "'")), + DAT = "SC828" + Selet_Machines(Machines, + "SYSKEY", "Name='" + row.Field("Machine") + "'") + Product_.ToJsonString() + }); + if (row["State"].ToString() == "309") + { + MainWindow.InfData.Rows.Add(new object[] { row["Machine"], Resources.Step + row["Step"]+ Resources.DispenseException, Selet_Machines(Machines, "SYSKEY", "Name='" + row["Machine"] + "'"), Selet_Machines(Machines, "ID", "Name='" + row["Machine"] + "'")}); + } + Dyelot_CALL.Rows.Remove(row); + } + else + {//串口 + } - Dyelot_CALL.Rows.Remove(row); } } catch (Exception EX) { LogGing.ERRDATA(EX); }