示例#1
0
        public JsonResult InitProcessCost(string gcode, string ucode)
        {
            JsonData            d  = new JsonData();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_ProductionProcessCost sal = new Sys_ProductionProcessCost();
                if (ucode != "")
                {
                    sal = sppcb.Query(" and  ucode='" + ucode + "'");
                }
                else
                {
                    Sys_ProductionProcess spp = new Sys_ProductionProcess();
                    spp = asppb.Query(" and gcode='" + gcode + "'");
                    if (spp != null)
                    {
                        sal.gcode = spp.gcode;
                        sal.gname = spp.gname;
                    }
                    sal.ucode = sppcb.CreateCode().ToString().PadLeft(4, '0');
                    sal.id    = 0;
                }
                d.d = js.Serialize(sal);
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }
示例#2
0
        public JsonResult SaveProcessCost(string bjtype, string uc, string ucode, string ugcode, string ugname, string uh, string umid, string uk, string ulg, string ulh, string ulk, string umname, string uname, string unum, string utg, string uth, string utj, string utk, string utype)
        {
            JsonData d = new JsonData();
            Sys_ProductionProcessCost spp = new Sys_ProductionProcessCost();
            SessionUserValidate       iv  = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_ConsumeMaterial scm = scmb.Query(" and mcode='" + umname + "'");
                if (scm != null)
                {
                    spp.mname = scm.mname;
                    spp.mcode = scm.mcode;
                }
                spp.gcode = ugcode;
                spp.gname = ugname;
                spp.ucode = ucode;
                spp.uname = uname;
                spp.unum  = Convert.ToDecimal(unum);
                spp.mc    = uc;
                spp.mk    = uk;
                spp.mh    = uh;
                spp.utj   = Convert.ToInt32(utj);
                spp.ulg   = Convert.ToInt32(ulg);
                spp.ulk   = Convert.ToInt32(ulk);
                spp.ulh   = Convert.ToInt32(ulh);
                spp.utg   = Convert.ToInt32(utg);
                spp.utk   = Convert.ToInt32(utk);
                spp.uth   = Convert.ToInt32(uth);
                spp.utype = utype;
                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 (umid == "0")
                {
                    if (sppcb.Add(spp) > 0)
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
                else
                {
                    if (sppcb.Update(spp))
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
                string [] arr = bjtype.Split(';');
                sppcpb.AddList(uname, ucode, arr);
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }