Esempio n. 1
0
        public static string QueryPreParePartOrder(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_WjPreparePartOrder bco = bwppb.Query(" and sid='" + sid + "'");
                if (bco != null)
                {
                    r = js.Serialize(bco);
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Esempio n. 2
0
        public static string SavePreParePartOrder(string sid, ArrayList itemlist, string remark)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_WjOrder bwp = bsob.Query(" and sid='" + sid + "'");
                if (bwp != null)
                {
                    bool op = true;
                    bool wp = true;
                    B_WjPreparePartOrder bwpo = new B_WjPreparePartOrder();
                    bwpo.cdate  = DateTime.Now.ToString();
                    bwpo.maker  = iv.u.ename;;
                    bwpo.osid   = bwp.msid;
                    bwpo.remark = remark;
                    bwpo.sid    = CommonBll.GetSid();
                    bwpo.wsid   = bwp.sid;
                    List <B_WjPreParePartGroupProduction> pbpp = new List <B_WjPreParePartGroupProduction>();
                    foreach (object[] al in itemlist)
                    {
                        B_WjPreParePartGroupProduction bpp = new B_WjPreParePartGroupProduction();
                        bpp.cdate = DateTime.Now.ToString();
                        bpp.icode = al[0].ToString();
                        bpp.iname = al[1].ToString();
                        bpp.maker = iv.u.ename;
                        bpp.osid  = bwp.msid;
                        bpp.sid   = bwpo.sid;
                        bpp.wsid  = bwpo.wsid;
                        if (Convert.ToDecimal(al[5].ToString()) + Convert.ToDecimal(al[4].ToString()) < Convert.ToDecimal(al[3].ToString()))
                        {
                            bpp.pnum = Convert.ToDecimal(al[5].ToString());
                            op       = false;
                        }
                        else
                        {
                            bpp.pnum = Convert.ToDecimal(al[3].ToString()) - Convert.ToDecimal(al[4].ToString());
                        }
                        if (Convert.ToDecimal(al[4].ToString()) > 0)
                        {
                            wp = false;
                        }
                        if (Convert.ToDecimal(al[5].ToString()) > 0)
                        {
                            bwpppgpb.Add(bpp);
                        }
                    }
                    if (op && wp)
                    {
                        bwpo.pcode = bwp.wcode;
                    }
                    else
                    {
                        bwpo.pcode = bwp.wcode + "-" + bwppb.GetOrderNum(sid).ToString().PadLeft(2, '0');
                    }
                    if (bwppb.Add(bwpo) > 0)
                    {
                        r = "S";
                        if (op)
                        {
                            cosb.UpState(sid, "iwjbh", 2);
                            cosb.UpState(bwp.osid, "iwjbh", 2);
                        }
                        else
                        {
                            cosb.UpState(sid, "iwjbh", 1);
                            cosb.UpState(bwp.osid, "iwjbh", 1);
                        }
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }