Exemplo n.º 1
0
    public void FindPrepareMar()
    {
        string            workorder      = Context.Request.Form["workorder"];
        string            partsdrawingno = Context.Request.Form["partsdrawingno"];
        string            rows           = Context.Request.Form["rows"];
        string            page           = Context.Request.Form["page"];
        int               count          = _bal.FindOnlineWOCount();
        IList <WorkOrder> wo             = _bal.FindOnlineWO(rows, page, workorder, partsdrawingno);

        if (wo != null && wo.Count > 0)
        {
            for (int i = 0; i < wo.Count; i++)
            {
                IList <MaterialStock> objs = _bal.QueryPrepareInfo(wo[i].WO);
                wo[i].MEMO = _bal.FindQMaterialByCustMaterial(wo[i].PartsdrawingCode);//钦纵料号 by tony add 2017-6-19
                if (objs != null && objs.Count > 0)
                {
                    BasCustom       ibb  = _bal.FindCustNameByCode(objs[0].CustName);
                    IList <BasBase> ibb1 = _bal.FindBaseBySubCode(objs[0].StockHouse);

                    if (ibb != null && !string.IsNullOrEmpty(ibb.NAME))
                    {
                        wo[i].CustName = ibb.NAME;
                    }
                    else
                    {
                        wo[i].CustName = objs[0].CustName;
                    }
                    if (ibb1 != null && ibb1.Count > 0)
                    {
                        wo[i].MachineName = ibb1[0].SubName;
                    }
                    else
                    {
                        wo[i].MachineName = objs[0].StockHouse;
                    }
                    wo[i].QUANTITY = objs.Count;
                }
                else
                {
                    wo[i].MachineName = "";
                    wo[i].QUANTITY    = 0;
                }
            }
        }

        Dictionary <String, Object> map = new Dictionary <String, Object>();


        map.Add("total", count);
        map.Add("rows", wo);
        Context.Response.Write(JsonConvert.SerializeObject(map));
    }