Пример #1
0
        public JsonResult InitProduce(string dcode, string cccode)
        {
            JsonData            d  = new JsonData();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_ProductionCapacity sal = new Sys_ProductionCapacity();

                if (cccode != "")
                {
                    sal = spscb.Query(" and  cccode='" + cccode + "'");
                    d.d = js.Serialize(sal);
                }
                else
                {
                    Sys_Depment sd = sdb.Query(" and dcode='" + dcode + "'");
                    sal.cccode = spscb.CreateCode().ToString().PadLeft(4, '0');
                    sal.dcode  = dcode;
                    sal.dname  = sd.dname;
                    sal.id     = 0;
                    d.d        = js.Serialize(sal);
                }
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }
Пример #2
0
        public JsonResult SaveProduce(string cccode, string cid, string plcode, string pdcode, string pdname, string pnum)
        {
            JsonData d = new JsonData();
            Sys_ProductionCapacity sb = new Sys_ProductionCapacity();
            SessionUserValidate    iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_ProduceCate sal = spcb.Query(" and  lcode='" + plcode + "'");
                sb.cccode = cccode;
                sb.ccname = "";
                sb.dname  = pdname;
                sb.dcode  = pdcode;
                sb.cnum   = Convert.ToInt32(pnum);
                sb.lcode  = plcode;
                sb.lname  = sal.lname;
                sb.cdate  = DateTime.Now.ToString();
                if (cid == "0")
                {
                    if (spscb.Add(sb) > 0)
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
                else
                {
                    if (spscb.Update(sb))
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }