public static void ClearTaskOrder(string tch) { string sql = "delete from TaskOrder where TCH='" + tch + "'"; SqlCe.ExecuteNonQuery(sql); }
public static DataTable GetExpShip(string kb) { string sql = "select CPH,CM,sum(JS)-sum(WCJS) SYJS,sum(WCJS) WCJS from ExportStoragePlan where CKB='" + kb + "' and JHH like '3%' group by CPH,CM"; return(SqlCe.ExecuteQuery(sql)); }
public static void RecvData(string Datagram) { if (msg.UnPackage(Datagram)) { switch (msg.MessageID) { //case "WXZD03": // SqlCe.ExecuteNonQuery("delete from FrameDetail where kjh='" + msg.ItemValue("KJH") + "' and stamp!='" + msg.ItemValue("stamp") + "' "); // break; case "UAZD02": SqlCe.ExecuteNonQuery("delete from FrameLayout where FrameID='" + msg.ItemValue("FrameID") + "' and ParkID='" + msg.ItemValue("ParkID") + "' and Mold='" + msg.ItemValue("Mold") + "'"); break; case "UAZD03": SqlCe.ExecuteNonQuery("delete from FrameLayoutExp where FrameID='" + msg.ItemValue("FrameID") + "' and ParkID='" + msg.ItemValue("ParkID") + "'"); break; case "UAZD05": if (Global.curFrame != null) { Global.curFrame.HCH = msg.ItemValue("HCH"); } SqlCe.ExecuteNonQuery("delete from TaskOrder where HCH='" + msg.ItemValue("HCH") + "'"); break; default: break; } msg.Save(); switch (msg.MessageID) { //case "WXZD03": // InvokeMethod(Global.frmCurrent, "RefreshFrameInfo", new object[] { }); // break; //case "WXZD1B": // Global.sZdh = msg.ItemValue("ch"); // string dtRemote = msg.ItemValue("sj"); // if (dtRemote != "") // { // SystemTime st = new SystemTime(); // st.wYear = ushort.Parse(dtRemote.Substring(0, 4)); // st.wMonth = ushort.Parse(dtRemote.Substring(4, 2)); // st.wDay = ushort.Parse(dtRemote.Substring(6, 2)); // st.Whour = ushort.Parse(dtRemote.Substring(8, 2)); // st.wMinute = ushort.Parse(dtRemote.Substring(10, 2)); // st.wSecond = ushort.Parse(dtRemote.Substring(12, 2)); // SetLocalTime(st); // } // break; //case "WXZD1E": // SqlCe.ExecuteNonQuery("delete from SendMsg where GramID='" + msg.ItemValue("dwh") + "' and GramTime='" + msg.ItemValue("sj") + "'"); // break; case "UAZD01": //UACS反馈信息 string sMsg = ""; switch (msg.ItemValue("Message_No")) { case "PT_CarArrive": sMsg = "框架入位"; SetCurFrameStatus(FrameStatus.PT_CarArrive); if (Global.curFrame != null) { Global.curFrame.CarArrived = true; } InvokeMethod(Global.frmCurrent, "showDialogMsg", new object[] { "停车位" + msg.ItemValue("Parking_No") + "框架已经入位!" }); break; case "PT_LaserStart": sMsg = "扫描启动"; SetCurFrameStatus(FrameStatus.PT_LaserStart); break; case "PT_LaserEnd": SetCurFrameStatus(FrameStatus.PT_LaserEnd); sMsg = "扫描结束"; break; case "PS_In_PortableEnd": sMsg = "入库上传"; SetCurFrameStatus(FrameStatus.PS_In_PortableEnd); InvokeMethod(Global.frmCurrent, "showDialogMsg", new object[] { "入库框架材料布局信息已经上传!" }); break; case "PT_CranePlanCreated": SetCurFrameStatus(FrameStatus.PT_CranePlanCreated); sMsg = "生成计划"; break; case "PS_OperateStart": sMsg = "作业开始"; SetCurFrameStatus(FrameStatus.PS_OperateStart); break; case "PS_OperatePause": sMsg = "作业暂停"; SetCurFrameStatus(FrameStatus.PS_OperatePause); break; case "PS_Out_PortableEnd": sMsg = "出库上传"; SetCurFrameStatus(FrameStatus.PS_Out_PortableEnd); break; case "PS_CarLeave": sMsg = "框架离位"; SetCurFrameStatus(FrameStatus.PS_CarLeave); if (Global.curFrame != null) { //Global.curFrame.CarArrived = false; if (Global.curFrame.KZ == "空" || Global.curFrame.KZ == "拼") { ClearExpFrameLayout(msg.ItemValue("Parking_No")); } } break; case "PT_OperateFini": sMsg = "作业完成"; SetCurFrameStatus(FrameStatus.PT_OperateFini); ClearTaskOrder(msg.ItemValue("Parking_No")); if (Global.curFrame != null) { if (Global.curFrame.KZ == "重") { ClearImpFrameLayout(msg.ItemValue("Parking_No")); } } break; case "FeedBack4CheckBank": sMsg = "盘库信息已经接收"; InvokeMethod(Global.frmCurrent, "showDialogMsg", new object[] { sMsg }); break; } if (sMsg != "") { if (msg.ItemValue("Ret") == "-1") { sMsg += "异常"; sMsg += msg.ItemValue("Message"); } else if (msg.ItemValue("Ret") == "1") { sMsg += "正常"; } InvokeMethod(Global.frmCurrent, "showMessage", new object[] { sMsg }); } break; case "UAZD02": //入库配载图 string mold = msg.ItemValue("Mold"); if (mold == "20") //激光扫描结果 { if (Global.curFrame != null) { Global.curFrame.status = FrameStatus.PT_LaserEnd; if (Global.frmCurrent.Name == "FrameIn") { if (Global.curFrame.KZ == "重") { InvokeMethod(Global.frmCurrent, "to_frmDgv", new object[] { }); } } else if (Global.frmCurrent.Name == "frmDgv") { if (Global.curFrame.KZ == "重") { //暂时屏蔽激光扫描功能 //InvokeMethod(Global.frmCurrent, "LoadData", new object[] { }); } } } } break; case "UAZD03": //出库配载图 if (Global.curFrame != null) { if (Global.curFrame.KZ == "空" || Global.curFrame.KZ == "拼") { InvokeMethod(Global.frmCurrent, "to_frmSxChange", new object[] { }); } } break; case "UAZD04": rstamp = msg.ItemValue("stamp"); ralljhs = int.Parse(msg.ItemValue("RJHS")); rallcls = int.Parse(msg.ItemValue("RCLS")); rjhs = 0; rcls = 0; cstamp = msg.ItemValue("stamp"); calljhs = int.Parse(msg.ItemValue("CJHS")); callcls = int.Parse(msg.ItemValue("CCLS")); cjhs = 0; ccls = 0; ThreadStart ts = new ThreadStart(DownLoadPlan); td = new Thread(ts); td.Start(); break; case "UAZD05": InvokeMethod(Global.frmCurrent, "LoadPlan", new object[] { }); break; default: break; } } }
public static void UpdateWtdInKw(string jhh, string lbl, string kw, string js, string zl) { string sql = "update wtddetail set KW='" + kw + "',JS=" + js + ",ZL=" + zl + " where WTDH='" + jhh + "' and LBL='" + lbl + "'"; SqlCe.ExecuteNonQuery(sql); }
public static void ClearZF2KW() { string sql = "delete from ZF2KW"; SqlCe.ExecuteNonQuery(sql); }
private bool SaveDetailTbl() { string sql = ""; string nvsql = ""; int looplength = _fields.Length - _loopindex - 1; string[] whsql = new string[_loopnum]; sql = " where 1=1 "; for (int i = 0; i < _loopindex; i++) { if (_fields[i].IsPK == 1) { nvsql = namevaluesql(_fields[i].FieldType, _fields[i].FieldName, _content[i]); if (nvsql != "") { sql += "and " + nvsql + " "; } } } for (int i = 0; i < _loopnum; i++) { whsql[i] = sql; for (int j = _loopindex + 1; j < _fields.Length; j++) { if (_fields[j].IsPK == 1) { nvsql = namevaluesql(_fields[j].FieldType, _fields[j].FieldName, _content[j + i * looplength]); if (nvsql != "") { whsql[i] += "and " + nvsql + " "; } } } } if (_operation == "D") { for (int i = 0; i < _loopnum; i++) { sql = "delete from " + _dtablename + whsql[i]; try { SqlCe.ExecuteNonQuery(sql); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(sql); SqlCe.ExecuteNonQuery("insert into error values('" + sql.Replace("'", "''") + "','" + ex.Message.Replace("'", "''") + "',getDate())"); } } return(true); } for (int i = 0; i < _loopnum; i++) { bool bExist = false; DataTable dt = SqlCe.ExecuteQuery("select * from " + _dtablename + whsql[i]); if (dt.Rows.Count > 0) { bExist = true; } dt.Dispose(); if (bExist == false) { sql = "insert into " + _dtablename + "("; for (int j = 0; j < _loopindex; j++) { if ((_fields[j].IsPK == 1 || _fields[j].IsPK == 2) && _fields[j].FieldType != "") { sql += _fields[j].FieldName + ","; } } for (int j = _loopindex + 1; j < _fields.Length; j++) { if (_fields[j].FieldType != "") { sql += _fields[j].FieldName + ","; } } sql = sql.Substring(0, sql.Length - 1); sql += ") values ("; for (int j = 0; j < _loopindex; j++) { if ((_fields[j].IsPK == 1 || _fields[j].IsPK == 2) && _fields[j].FieldType != "") { sql += valuesql(_fields[j].FieldType, _content[j]); } } for (int j = _loopindex + 1; j < _fields.Length; j++) { if (_fields[j].FieldType != "") { sql += valuesql(_fields[j].FieldType, _content[j + i * looplength]); } } sql = sql.Substring(0, sql.Length - 1); sql += ")"; try { SqlCe.ExecuteNonQuery(sql); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(sql); SqlCe.ExecuteNonQuery("insert into error values('" + sql.Replace("'", "''") + "','" + ex.Message.Replace("'", "''") + "',getDate())"); } } else { sql = "update " + _dtablename + " set "; for (int j = 0; j < _loopindex; j++) { if (_fields[j].IsPK == 2 && _fields[j].FieldType != "") { nvsql = namevaluesql(_fields[j].FieldType, _fields[j].FieldName, _content[j]); if (nvsql != "") { sql += nvsql + ","; } } } for (int j = _loopindex + 1; j < _fields.Length; j++) { if (_fields[j].IsPK == 0 && _fields[j].FieldType != "") { nvsql = namevaluesql(_fields[j].FieldType, _fields[j].FieldName, _content[j + i * looplength]); if (nvsql != "") { sql += nvsql + ","; } } } sql = sql.Substring(0, sql.Length - 1); sql += whsql[i]; try { SqlCe.ExecuteNonQuery(sql); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(sql); SqlCe.ExecuteNonQuery("insert into error values('" + sql.Replace("'", "''") + "','" + ex.Message.Replace("'", "''") + "',getDate())"); } } } return(true); }
public static void UpdateImpKw(string jhh, string make, string zfh, string clh, string kw) { string sql = "update ImportStorageAcceptOrder set KW='" + kw + "' where ZFH='" + zfh + "' and JHH='" + jhh + "' and Make='" + make + "' and CLH='" + clh + "'"; SqlCe.ExecuteNonQuery(sql); }
public static void ClearWtdOutScanStatus(string jhh, string lbl) { string sql = "update wtddetail set WCFlag=0,SCANTIME='',lbl=clh where LBL='" + lbl + "' and WTDH='" + jhh + "'"; SqlCe.ExecuteNonQuery(sql); }
public static void SetExpScanStatus(string jhh, string make, string zfh, string clh, string now) { string sql = "update ExportStorageAcceptOrder set WCFlag=1,SCANTIME='" + now + "' where CLH='" + clh + "' and ZFH='" + zfh + "' and JHH='" + jhh + "' and Make='" + make + "'"; SqlCe.ExecuteNonQuery(sql); }
public static void FinishImpScanCL(string jhh, string make) { string sql = "update ImportStorageAcceptOrder set WCFlag=2 where WCFlag=1 and JHH='" + jhh + "' and Make='" + make + "'"; SqlCe.ExecuteNonQuery(sql); }
public static void ClearImpScanStatus(string jhh, string make, string zfh, string clh) { string sql = "update ImportStorageAcceptOrder set WCFlag=0,SCANTIME='',KW='',CH='' where CLH='" + clh + "' and ZFH='" + zfh + "' and JHH='" + jhh + "' and Make='" + make + "'"; SqlCe.ExecuteNonQuery(sql); }
public static DataTable GetWtdCl(string jhh) { string sql = "select CLH,substring(KW,4,8) KW,JS,ZL,QA,SCANTIME,WCFLAG,LBL,FLAG from wtddetail where WTDH='" + jhh + "'"; return(SqlCe.ExecuteQuery(sql)); }
public static DataTable GetWtd(string kb) { string sql = "select WTDH,HPMC,ZJS,ZZL,CRFLAG,SJFS,WCJS,WCZL from Wtd where KB='" + kb + "'"; return(SqlCe.ExecuteQuery(sql)); }
public static DataTable GetBasicQuality() { string sql = "select id,name from BasicQuality"; return(SqlCe.ExecuteQuery(sql)); }
public static void ClearExpFrameLayout(string tch) { string sql = "delete from FrameLayerOutExp where ParkID='" + tch + "'"; SqlCe.ExecuteNonQuery(sql); }
public static void SetWtdOutScanStatus(string jhh, string clh, string wjs, string wzl, string now) { string sql = "update wtddetail set WCFlag=1,SCANTIME='" + now + "',wjs=" + wjs + ",wzl=" + wzl + " where CLH='" + clh + "' and WTDH='" + jhh + "'"; SqlCe.ExecuteNonQuery(sql); }
public static void SendText(string datagram) { string data = datagram.Replace("'", "''"); SqlCe.ExecuteNonQuery("insert into SendMsg(Msg,ID,SendTime,Lock,Done) values('" + "##" + data + "@@" + "',newID(),getDate(),0,0)"); }
private bool SaveMainTbl() { string sql = ""; string nvsql = ""; int fldCnt = (_loopindex >= 0) ? _loopindex : _fields.Length; string whsql = " where 1=1 "; for (int i = 0; i < fldCnt; i++) { if (_fields[i].IsPK == 1) { nvsql = namevaluesql(_fields[i].FieldType, _fields[i].FieldName, _content[i]); if (nvsql != "") { whsql += "and " + nvsql + " "; } } } if (_operation == "D") { sql = "delete from " + _mtablename + whsql; try { SqlCe.ExecuteNonQuery(sql); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(sql); SqlCe.ExecuteNonQuery("insert into error values('" + sql.Replace("'", "''") + "','" + ex.Message.Replace("'", "''") + "',getDate())"); } return(true); } DataTable dt = SqlCe.ExecuteQuery("select * from " + _mtablename + whsql); bool bExist = false; if (dt.Rows.Count > 0) { bExist = true; } dt.Dispose(); if (bExist == false) { sql = "insert into " + _mtablename + "("; for (int i = 0; i < fldCnt; i++) { if (_fields[i].FieldType != "") { sql += _fields[i].FieldName + ","; } } sql = sql.Substring(0, sql.Length - 1); sql += ") values ("; for (int j = 0; j < fldCnt; j++) { sql += valuesql(_fields[j].FieldType, _content[j]); } sql = sql.Substring(0, sql.Length - 1); sql += ")"; try { SqlCe.ExecuteNonQuery(sql); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(sql); SqlCe.ExecuteNonQuery("insert into error values('" + sql.Replace("'", "''") + "','" + ex.Message.Replace("'", "''") + "',getDate())"); } } else { sql = "update " + _mtablename + " set "; for (int j = 0; j < fldCnt; j++) { if (_fields[j].IsPK == 0 || _fields[j].IsPK == 2) { nvsql = namevaluesql(_fields[j].FieldType, _fields[j].FieldName, _content[j]); if (nvsql != "") { sql += nvsql + ","; } } } sql = sql.Substring(0, sql.Length - 1); sql = sql + whsql; try { SqlCe.ExecuteNonQuery(sql); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(sql); SqlCe.ExecuteNonQuery("insert into error values('" + sql.Replace("'", "''") + "','" + ex.Message.Replace("'", "''") + "',getDate())"); } } return(true); }