| | |
| | | { |
| | | public class M141Process_Mysql |
| | | { |
| | | |
| | | string connStrAll = "server=localhost;port=3306;user id=root;password=123456;database=BroDB;charset=utf8"; |
| | | string connStrLocal = "server=localhost;port=3306;user id=root;password=123456;database=BroDB;charset=utf8"; |
| | | |
| | | |
| | | #region 基础操作 |
| | | public void IniDBIP(string IP) |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | public void NewProduct(ProductModel pro) |
| | |
| | | Operatoremysql(str2, connStrAll); |
| | | } |
| | | |
| | | string mysqlstr = $"insert into forall (basketcode,device,plcnum,sn,data,time) values('{pro.BasketCode}','{devicestr}','{pro.SEQUENCE}','{pro.SN}','{JsonConvert.SerializeObject(pro, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All })}','{DateTime.Now.ToString("yyyyMMddHHmmss")}')"; |
| | | string mysqlstr = $"insert into forall (basketcode,zword,device,plcnum,sn,data,time) values('{pro.BasketCode}','{pro.Zword}','{devicestr}','{pro.SEQUENCE}','{pro.SN}','{JsonConvert.SerializeObject(pro, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All })}','{DateTime.Now.ToString("yyyyMMddHHmmss")}')"; |
| | | |
| | | if (Operatoremysql(mysqlstr, connStrAll)) |
| | | { |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public List<Netdefectdetail> GetNetdefectdetails(string plcnum) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | public string Getbasketcode(string plcnum, out string sn) |
| | | public string Getbasketcode(string plcnum, out string sn, out string zword) |
| | | { |
| | | sn = "Noread"; |
| | | zword = "Noread"; |
| | | try |
| | | { |
| | | string mysqlstr = $"select basketcode,sn from forall where plcnum='{plcnum}' && device='S2' order by id desc limit 1"; |
| | | string mysqlstr = $"select basketcode,sn,zword from forall where plcnum='{plcnum}' && device='S2' order by id desc limit 1"; |
| | | var dt = selectdt(mysqlstr, connStrAll); |
| | | if (dt == null || dt.Rows.Count == 0) |
| | | { |
| | |
| | | else |
| | | { |
| | | sn = dt.Rows[0][1].ToString(); |
| | | zword = dt.Rows[0][2].ToString(); |
| | | return dt.Rows[0][0].ToString(); |
| | | } |
| | | } |
| | |
| | | } |
| | | return "NoRead"; |
| | | } |
| | | |
| | | |
| | | public List<ProductModel> GetProductList(string plcnum) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | public DataTable getBasketCode() |
| | | { |
| | | try |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | public void NewBasketcode(string code) |
| | | { |