public JsonResult QueryGyAllList(string lcode) { JsonData d = new JsonData(); ArrayList r = new ArrayList(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { r.Add(iv.badstr); List <Sys_ProductionProcess> ls = asppb.QueryList(""); if (ls != null) { foreach (Sys_ProductionProcess sw in ls) { ArrayList al = new ArrayList(); al.Add(sw.gcode); al.Add(sw.gname); if (lcode != "") { Sys_ProductionProcessLinePoint sp = sppcb.Query(" and gcode='" + sw.gcode + "' and lcode='" + lcode + "'"); if (sp != null) { al.Add(sp.nsort); al.Add(sp.usetime); } else { al.Add(0); al.Add(0); } } else { al.Add(0); al.Add(0); } r.Add(al); } } } else { r.Add(iv.badstr); } d.d = js.Serialize(r); return(Json(d)); }
public JsonResult SaveLine(string lcode, string lname, string lid, List <object[]> prow) { JsonData d = new JsonData(); Sys_ProductionProcessLine spp = new Sys_ProductionProcessLine(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { int utime = 0; int cnum = 1; spp.lname = lname; spp.lcode = lcode; spp.maker = iv.u.ename; spp.cdate = DateTime.Now.ToString(); if (iv.u.rcode != "xtgl") { spp.dcode = iv.u.dcode.Substring(0, 8); } else { spp.dcode = ""; } if (lid == "0") { if (sppb.Add(spp) > 0) { d.d = "S"; } else { d.d = "F"; } } else { if (sppb.Update(spp)) { d.d = "S"; } else { d.d = "F"; } } if (d.d == "S") { List <Sys_ProductionProcessLinePoint> pl = new List <Sys_ProductionProcessLinePoint>(); if (prow != null) { foreach (object[] o in prow) { if (o[2].ToString() != "0") { if (cnum < Convert.ToInt32(o[2])) { cnum = Convert.ToInt32(o[2]); } Sys_ProductionProcessLinePoint p = new Sys_ProductionProcessLinePoint(); p.lcode = lcode; p.lname = lname; p.cdate = DateTime.Now.ToString(); p.gcode = o[1].ToString(); p.gname = o[0].ToString(); p.maker = iv.u.ename; p.nsort = Convert.ToInt32(o[2]); p.pregcode = ""; p.ptype = ""; p.usetime = Convert.ToInt32(o[3]); pl.Add(p); utime = utime + p.usetime; } } if (cnum == pl.Count) { List <Sys_ProductionProcessLinePoint> spl = new List <Sys_ProductionProcessLinePoint>(); for (int sn = 1; sn <= cnum; sn++) { foreach (Sys_ProductionProcessLinePoint p in pl) { if (p.nsort == sn) { spl.Add(p); break; } } } if (cnum == spl.Count) { sppcb.AddList(lcode, spl); sppb.UpUtime(lcode, utime); } else { sppb.Delete(lcode); d.d = "F"; } } else { sppb.Delete(lcode); d.d = "F"; } } } } else { d.d = iv.badstr; } return(Json(d)); }