コード例 #1
0
ファイル: BasicBO.cs プロジェクト: LiuDemin09/QzMes
        public string DelCust(string custCode)
        {
            try
            {
                if (string.IsNullOrEmpty(custCode))
                {
                    return("请选择一条数据进行删除");
                }
                BasCustom bc = DBContext.Find <BasCustom>(BasCustom.Meta.CODE == custCode);
                if (bc == null)
                {
                    return("删除数据不存在");
                }

                //if (!string.IsNullOrEmpty(bc.UpdatedBy) && bc.UpdatedBy != this.UserCode)
                //{
                //    return "无权删除该客户";
                //}
                DBContext.Remove <BasCustom>(BasCustom.Meta.CODE == bc.CODE);

                return("OK");
            }
            catch (Exception ex)
            {
                PubHelper.GetHelper(DBContext).Error(ex, this.UserCode, "DelCust");
                return(ex.Message);
            }
        }
コード例 #2
0
ファイル: BasicBO.cs プロジェクト: LiuDemin09/QzMes
        public string SaveCust(BasCustom obj)
        {
            try
            {
                if (obj == null || string.IsNullOrEmpty(obj.CODE) || string.IsNullOrEmpty(obj.NAME))
                {
                    return("请检查输入数据是否输入完全");
                }
                BasCustom bc = DBContext.Find <BasCustom>(BasCustom.Meta.CODE == obj.CODE);
                if (bc != null)
                {
                    return("客户编号已使用");
                }


                obj.UpdatedBy   = this.UserCode;
                obj.CreatedDate = DateTime.Now;

                DBContext.SaveAndUpdate <BasCustom>(obj);
                return("OK");
            }
            catch (Exception ex)
            {
                PubHelper.GetHelper(DBContext).Error(ex, this.UserCode, "SaveCustInfo");
                throw ex;
            }
        }
コード例 #3
0
ファイル: WsWareHouse.cs プロジェクト: LiuDemin09/QzMes
    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));
    }
コード例 #4
0
 protected bool SaveToDB(string path, string tablename)
 {
     try
     {
         DataTable dt = ExcelManage.InputFromExcel(path, tablename);
         if (dt != null && dt.Rows.Count > 0)
         {
             WsBasic wbi = new WsBasic();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                 {
                     BasCustom bc = new BasCustom();
                     bc.CODE          = dt.Rows[i][0].ToString();
                     bc.NAME          = dt.Rows[i][1].ToString();
                     bc.ADDRESS       = dt.Rows[i][2].ToString();
                     bc.TransType     = dt.Rows[i][3].ToString();
                     bc.ReceiveArea   = dt.Rows[i][4].ToString();
                     bc.CONTACT       = dt.Rows[i][5].ToString();
                     bc.MOBILE        = dt.Rows[i][6].ToString();
                     bc.FAX           = dt.Rows[i][7].ToString();
                     bc.InvoiceName   = dt.Rows[i][8].ToString();
                     bc.InvoiceNumber = dt.Rows[i][9].ToString();
                     string result = wbi.SaveCust(bc);
                     if (!string.IsNullOrEmpty(result) && result != "OK")
                     {
                         Label1.Text = result;
                         return(false);
                     }
                 }
             }
             return(true);
         }
         else
         {
             Label1.Text = "上传完毕,但数据为空,保存失败!";
         }
         return(true);
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
         return(false);
     }
 }
コード例 #5
0
ファイル: WsWareHouse.cs プロジェクト: LiuDemin09/QzMes
    public void QueryBackUpMaterialDetail()
    {
        int count            = _bal.FindOnlineWOCount();
        IList <WorkOrder> wo = _bal.FindOnlineWOByKanBan("1000", "1");

        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;
                }
            }
        }

        string res           = "[{\"categories\":[{\"data\":";
        string strCategories = "[";
        string strPlanQty    = "["; //需求数量
        string strQty        = "["; //已发数量
        string strStockQty   = "["; //库存数量
        bool   bsub          = false;

        for (int i = 0; i < wo.Count; i++)
        {
            strCategories += "\"" + wo[i].PartsdrawingCode + "\",";
            strQty        += (wo[i].MaterialQty == null?0:wo[i].MaterialQty) + ",";
            strPlanQty    += (wo[i].PlanQuantity == null ? 0 : wo[i].PlanQuantity) + ",";
            strStockQty   += (wo[i].QUANTITY == null ? 0 : wo[i].QUANTITY) + ",";
            bsub           = true;
        }
        if (bsub)
        {
            strCategories = strCategories.Substring(0, strCategories.Length - 1);
            strQty        = strQty.Substring(0, strQty.Length - 1);
            strPlanQty    = strPlanQty.Substring(0, strPlanQty.Length - 1);
            strStockQty   = strStockQty.Substring(0, strStockQty.Length - 1);
        }
        strCategories += "]";
        strQty        += "]";
        strPlanQty    += "]";
        strStockQty   += "]";
        res           += strCategories + "}],\"planqty\":[{\"data\":" + strPlanQty + "}],\"qty\":[{\"data\":" + strQty + "}],\"qtyrate\":[{\"data\":" + strStockQty + "}]}]";

        Context.Response.Write(res);
    }
コード例 #6
0
ファイル: WsBasic.cs プロジェクト: LiuDemin09/QzMes
 public string SaveCust(BasCustom obj)
 {
     return(_bal.SaveCust(obj));
 }