//判断是否是门板 private bool IsDoor(KJLobject k) { bool Door = false; for (int i = 0; i < k.parameters.Count; i++) { if (k.parameters[i].parmName == "KMFX") { Door = true; return(Door); } } return(Door); }
//变量 private string GetParmeteSts(KJLobject kJ) { string str = ""; string sql = "select * from Paramss p inner join boardinfo o"; sql = sql + " on o.id=p.boardid where o.Code= '" + kJ.modelNumber + "'"; List <KJLobject> Klist = new List <KJLobject>(); DataTable dt = new DataTable(); dt = OleHeper.Query(sql).Tables[0]; string sqlsys = "select * from SysPram"; DataTable dtsys = new DataTable(); dtsys = OleHeper.Query(sqlsys).Tables[0]; string orderTy; orderTy = kJ.OrderType == 1 ? "衣柜" : "橱柜"; foreach (parameter parm in kJ.parameters) { foreach (DataRow drs in dtsys.Rows) { if (parm.parmName == drs["Kname"].ToString() && drs["OrderType"].ToString() == orderTy) { str = str + drs["Iname"] + ":=" + parm.parmValue + "|"; } } foreach (DataRow dr in dt.Rows) { string Kname = dr["Kname"].ToString(); if (parm.parmName == Kname) { str = str + dr["Iname"] + ":=" + parm.parmValue + "|"; } } } return(str); }
private void getF(string str, int Type) { JArray jar = JArray.Parse(str); int count = jar.Count; for (int i = 0; i < count; i++) { string jstr = jar[i].ToString(); JObject jss = new JObject(); jss = JObject.Parse(jstr); KJLobject kJLobject = new KJLobject(); kJLobject.modelTypeId = int.Parse(jss["modelTypeId"].ToString()); kJLobject.OrderType = Type; if (jss.Property("modelName") != null) { kJLobject.modelName = jss["modelName"].ToString(); } if (jss.Property("customCode") != null) { kJLobject.customCode = jss["customCode"].ToString(); } if (jss.Property("modelNumber") != null) { kJLobject.modelNumber = jss["modelNumber"].ToString(); } if (jss.Property("obsBrandGoodId") != null) { kJLobject.obsBrandGoodId = jss["obsBrandGoodId"].ToString(); } if (jss.Property("obsModelAccountId") != null) { kJLobject.obsModelAccountId = jss["obsModelAccountId"].ToString(); } if (jss.Property("modelAvailable") != null) { kJLobject.modelAvailable = jss["modelAvailable"].ToString(); } if (jss.Property("needQuotation") != null) { kJLobject.needQuotation = bool.Parse(jss["needQuotation"].ToString()); } if (jss.Property("displayInCostList") != null) { kJLobject.displayInCostList = bool.Parse(jss["displayInCostList"].ToString()); } if (jss.Property("textureName") != null) { kJLobject.textureName = jss["textureName"].ToString(); } if (jss.Property("textureBrandGoodCode") != null) { kJLobject.textureBrandGoodCode = jss["textureBrandGoodCode"].ToString(); } if (jss.Property("textureAvailable") != null) { kJLobject.textureAvailable = bool.Parse(jss["textureAvailable"].ToString()); } if (jss.Property("obsTextureAccountId") != null) { kJLobject.obsTextureAccountId = jss["obsTextureAccountId"].ToString(); } if (jss.Property("id") != null) { kJLobject.id = jss["id"].ToString(); } if (jss.Property("parentId") != null) { kJLobject.parentid = jss["parentId"].ToString(); } List <parameter> lstParm = new List <parameter>(); double W = 0; double H = 0; double D = 0; if (jss.Property("parameters") != null) { string parmstrs = jss["parameters"].ToString(); JArray parmJar = JArray.Parse(parmstrs); foreach (JObject js in parmJar) { parameter pr = new parameter(); if (js.Property("simpleName") != null) { try { pr.parmName = js["simpleName"].ToString(); pr.parmValue = js["value"].ToString(); } catch { } } if (pr.parmName == "") { pr.parmName = js["name"].ToString(); pr.parmValue = js["value"].ToString(); } if (pr.parmName != "") { lstParm.Add(pr); } if (pr.parmName == "H") { H = double.Parse(pr.parmValue); } else if (pr.parmName == "W") { W = double.Parse(pr.parmValue); } else if (pr.parmName == "D") { D = double.Parse(pr.parmValue); } } } if (jss.Property("ignoreParameters") != null) { string ignoreparmstrs = jss["ignoreParameters"].ToString(); JArray ignoreparmJar = JArray.Parse(ignoreparmstrs); foreach (JObject js in ignoreparmJar) { parameter pr = new parameter(); if (js.Property("simpleName") != null) { pr.parmName = js["simpleName"].ToString(); pr.parmValue = js["value"].ToString(); } if (pr.parmName == "") { pr.parmName = js["name"].ToString(); pr.parmValue = js["value"].ToString(); } if (pr.parmName != "") { lstParm.Add(pr); } if (pr.parmName == "H") { H = double.Parse(pr.parmValue); } else if (pr.parmName == "W") { W = double.Parse(pr.parmValue); } else if (pr.parmName == "D") { D = double.Parse(pr.parmValue); } } } kJLobject.parameters = lstParm; kJLobject.parameters.Add(new parameter("color", kJLobject.textureBrandGoodCode + "H|")); kJLobject.absP = getabsP(jss["absPosition"].ToString()); kJLobject.absR = getabsR(jss["absRotation"].ToString()); CaulModel caul = new CaulModel(); caul = caul.getCaulModel(kJLobject.absP, kJLobject.absR, D, W, H); kJLobject.caulModel = caul; if (kJLobject.customCode == "F") { boxseq += 1; kJLobject.boxPostion = kJLobject.absP; kJLobject.HoleGroup = boxseq.ToString(); } else { kJLobject.boxPostion = kJLobject.absP; kJLobject.HoleGroup = boxseq.ToString(); } if (kJLobject.modelNumber != null && kJLobject.modelNumber != "0") { kobj.Add(kJLobject); } if (jss.Property("subModels") != null) { string jschid = jss["subModels"].ToString(); getFurnitureObj(jschid, Type, kJLobject.absP); } else { continue; } } }
private string getCHoleInfo(KJLobject board, List <KJLobject> slist) { //判断板件方向 bool sk = false; bool xk = false; string holeinfo = ""; double holeStart = -19; double Fangxiang = board.absR.z; double fx = 0; fx = board.holeFx; //竖向板件是否有顶底版 //获取底部板件 List <KJLobject> ksx = new List <KJLobject>(); ksx = slist.Where(l => l.caulModel.minZ - board.caulModel.minZ <= 200 && l.caulModel.minZ >= board.caulModel.minZ).ToList(); //获取顶部板件 List <KJLobject> kss = new List <KJLobject>(); kss = slist.Where(l => System.Math.Abs(l.caulModel.maxZ - board.caulModel.maxZ) <= fx).ToList(); //根据方向获取顶底版 if (Fangxiang == 0 || Fangxiang == 180 || Fangxiang == -180) { kss = kss.Where(l => System.Math.Abs(l.caulModel.maxX - board.caulModel.minX) <= fx || System.Math.Abs(l.caulModel.minX - board.caulModel.maxX) <= fx).ToList(); kss = kss.Where(l => l.modelName.Contains("顶板")).ToList(); ksx = ksx.Where(l => System.Math.Abs(l.caulModel.maxX - board.caulModel.minX) <= fx || System.Math.Abs(l.caulModel.minX - board.caulModel.maxX) <= fx).ToList(); ksx = ksx.Where(l => l.modelName.Contains("底板")).ToList(); } else if (Fangxiang == 90 || Fangxiang == -90) { kss = kss.Where(l => System.Math.Abs(l.caulModel.maxY - board.caulModel.minY) <= fx || System.Math.Abs(l.caulModel.minY - board.caulModel.maxY) <= fx).ToList(); kss = kss.Where(l => l.modelName.Contains("顶板")).ToList(); ksx = ksx.Where(l => System.Math.Abs(l.caulModel.maxY - board.caulModel.minY) <= fx || System.Math.Abs(l.caulModel.minY - board.caulModel.maxY) <= fx).ToList(); ksx = ksx.Where(l => l.modelName.Contains("底板")).ToList(); } for (int j = 0; j < slist.Count; j++) { double SPC = 10; double XPC = 10; if ((slist[j].caulModel.minZ >= board.caulModel.minZ && slist[j].caulModel.maxZ <= board.caulModel.maxZ)) { continue; } SPC = System.Math.Abs(board.caulModel.maxZ - slist[j].caulModel.minZ); XPC = System.Math.Abs(board.caulModel.minZ - slist[j].caulModel.maxZ); if (SPC <= fx) { if (kss.Count > 0) { continue; } sk = true; } if (XPC <= fx) { if (ksx.Count > 0) { continue; } xk = true; } if (sk == true || xk == true) { if (board.OrderType == 1) { if (Fangxiang == 0 || Fangxiang == 180 || Fangxiang == -180) { holeStart = System.Math.Abs(board.absP.y - board.boxPostion.y); } else { holeStart = System.Math.Abs(board.absP.x - board.boxPostion.x); } if (holeStart < 1) { board.holeStart = "_69"; } else { board.holeStart = "_39"; } } } if (sk == false && xk == false) { holeinfo = ""; } else if (sk == true && xk == false) { holeinfo = "_S"; } else if (sk == false && xk == true) { holeinfo = "_X"; } else { return("_SX"); } } return(holeinfo); }
private string getSHoleInfo(KJLobject board, List <KJLobject> Clist) { //判断板件方向 bool lk = false; bool rk = false; double holeStart = 100; double holeStart1 = 100; double vholeStart = 100; string holeinfo = ""; double Fangxiang = board.absR.z; double fx = 0; fx = board.holeFx; //获取Z轴方向是否有支撑板件 List <KJLobject> kszy = new List <KJLobject>(); List <KJLobject> ksz = new List <KJLobject>(); List <KJLobject> ksy = new List <KJLobject>(); kszy = Clist.Where(l => System.Math.Abs(board.caulModel.minZ - l.caulModel.maxZ) <= fx || System.Math.Abs(board.caulModel.maxZ - l.caulModel.minZ) <= fx).ToList(); //孔位距边 for (int j = 0; j < Clist.Count; j++) { double ZPC = 10; double YPC = 10; if (board.caulModel.maxZ <= Clist[j].caulModel.minZ || board.caulModel.minZ >= Clist[j].caulModel.maxZ) { continue; } //获取横板上下方是否有板件连接 if (Fangxiang == 0 || Fangxiang == 180) { ZPC = System.Math.Abs(board.caulModel.minX - Clist[j].caulModel.maxX); YPC = System.Math.Abs(board.caulModel.maxX - Clist[j].caulModel.minX); ksz = kszy.Where(l => System.Math.Abs(board.caulModel.minX - l.caulModel.minX) <= fx).ToList(); ksy = kszy.Where(l => System.Math.Abs(board.caulModel.maxX - l.caulModel.maxX) <= fx).ToList(); } else if (Fangxiang == -180) { ZPC = System.Math.Abs(board.caulModel.maxX - Clist[j].caulModel.minX); YPC = System.Math.Abs(board.caulModel.minX - Clist[j].caulModel.maxX); ksz = kszy.Where(l => System.Math.Abs(board.caulModel.maxX - l.caulModel.maxX) <= fx).ToList(); ksy = kszy.Where(l => System.Math.Abs(board.caulModel.minX - l.caulModel.minX) <= fx).ToList(); } else if (Fangxiang == 90) { ZPC = System.Math.Abs(board.caulModel.minY - Clist[j].caulModel.maxY); YPC = System.Math.Abs(board.caulModel.maxY - Clist[j].caulModel.minY); ksz = kszy.Where(l => System.Math.Abs(board.caulModel.minY - l.caulModel.minY) <= fx).ToList(); ksy = kszy.Where(l => System.Math.Abs(board.caulModel.maxY - l.caulModel.maxY) <= fx).ToList(); } else if (Fangxiang == -90) { ZPC = System.Math.Abs(board.caulModel.maxY - Clist[j].caulModel.minY); YPC = System.Math.Abs(board.caulModel.minY - Clist[j].caulModel.maxY); ksz = kszy.Where(l => System.Math.Abs(board.caulModel.maxY - l.caulModel.maxY) <= fx).ToList(); ksy = kszy.Where(l => System.Math.Abs(board.caulModel.minY - l.caulModel.minY) <= fx).ToList(); } if (ZPC <= fx) { //if (Clist[j].modelName.Contains("右侧")) //{ // continue; //} if (ksz.Count > 0) { continue; } lk = true; } if (YPC <= fx) { //if (Clist[j].modelName.Contains("左侧")) //{ // continue; //} if (ksy.Count > 0) { continue; } rk = true; } //判断孔距 if (lk == true || rk == true) { if (board.OrderType == 1) { if (Fangxiang == 0 || Fangxiang == 180 || Fangxiang == -180) { holeStart = System.Math.Abs(board.absP.y - board.boxPostion.y); double k = 0; k = System.Math.Abs(board.absP.y - Clist[j].absP.y); holeStart1 = holeStart1 >= k ? k : holeStart1; vholeStart = System.Math.Abs(Clist[j].absP.y - Clist[j].boxPostion.y); } else { holeStart = System.Math.Abs(board.absP.x - board.boxPostion.x); double k = 0; k = System.Math.Abs(board.absP.x - Clist[j].absP.x); holeStart1 = holeStart1 >= k ? k : holeStart1; } if (holeStart < 1) { if (holeStart1 < 1) { board.holeStart = "_69"; } else { board.holeStart = "_39"; } //board.holeStart = "_69"; } else { board.holeStart = "_39"; } if (vholeStart < 1) { Clist[j].holeStart = "_69"; } } if (board.OrderType == 2) { if (Clist[j].holeStart != "_69") { Clist[j].holeStart = "_39"; } } } if (lk == false && rk == false) { holeinfo = ""; } else if (lk == true && rk == false) { holeinfo = "_L"; } else if (lk == false && rk == true) { holeinfo = "_R"; } else { return("_LR"); } } return(holeinfo); }