public JsonResult InitMaterial(string pmcode, string mcode) { JsonData d = new JsonData(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { Sys_ConsumeMaterial sal = new Sys_ConsumeMaterial(); if (mcode != "") { sal = scmb.Query(" and mcode='" + mcode + "'"); } else { if (pmcode != "") { Sys_ConsumeMaterialCate smc = scmcb.Query(" and ccode='" + pmcode + "'"); if (smc != null) { sal.pmcode = smc.ccode; sal.pmname = smc.cname; } } sal.mcode = pmcode + scmb.CreateCode(pmcode).ToString().PadLeft(3, '0'); sal.id = 0; } d.d = js.Serialize(sal); } else { d.d = iv.badstr; } return(Json(d)); }
public JsonResult SaveCate(string ccode, string cname, string cid, string pccode, string pcname) { JsonData d = new JsonData(); Sys_ConsumeMaterialCate spp = new Sys_ConsumeMaterialCate(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { spp.cname = cname; spp.ccode = ccode; spp.pcname = pcname; spp.pccode = pccode; 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 (cid == "0") { if (scmcb.Add(spp) > 0) { d.d = "S"; scmcb.UpdateEnd(pccode); } else { d.d = "F"; } } else { if (scmcb.Update(spp)) { d.d = "S"; } else { d.d = "F"; } } } else { d.d = iv.badstr; } return(Json(d)); }