Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MesWeb.Model.T_MaterialOutput model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_MaterialOutput set ");
            strSql.Append("MaterialRFID=SQL2012MaterialRFID,");
            strSql.Append("MaterialType=SQL2012MaterialType,");
            strSql.Append("GnerateTime=SQL2012GnerateTime,");
            strSql.Append("MaterialName=SQL2012MaterialName,");
            strSql.Append("Weight=SQL2012Weight,");
            strSql.Append("Color=SQL2012Color,");
            strSql.Append("Certificate=SQL2012Certificate,");
            strSql.Append("ContractNo=SQL2012ContractNo,");
            strSql.Append("BatchNo=SQL2012BatchNo,");
            strSql.Append("SupplyCompany=SQL2012SupplyCompany,");
            strSql.Append("workshift=SQL2012workshift");
            strSql.Append(" where MaterialOutputID=SQL2012MaterialOutputID");
            SqlParameter[] parameters =
            {
                new SqlParameter("SQL2012MaterialRFID",     SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012MaterialType",     SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012GnerateTime",      SqlDbType.DateTime),
                new SqlParameter("SQL2012MaterialName",     SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012Weight",           SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012Color",            SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012Certificate",      SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012ContractNo",       SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012BatchNo",          SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012SupplyCompany",    SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012workshift",        SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012MaterialOutputID", SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.MaterialRFID;
            parameters[1].Value  = model.MaterialType;
            parameters[2].Value  = model.GnerateTime;
            parameters[3].Value  = model.MaterialName;
            parameters[4].Value  = model.Weight;
            parameters[5].Value  = model.Color;
            parameters[6].Value  = model.Certificate;
            parameters[7].Value  = model.ContractNo;
            parameters[8].Value  = model.BatchNo;
            parameters[9].Value  = model.SupplyCompany;
            parameters[10].Value = model.workshift;
            parameters[11].Value = model.MaterialOutputID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_MaterialOutput DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_MaterialOutput model = new MesWeb.Model.T_MaterialOutput();
     if (row != null)
     {
         if (row["MaterialOutputID"] != null && row["MaterialOutputID"].ToString() != "")
         {
             model.MaterialOutputID = int.Parse(row["MaterialOutputID"].ToString());
         }
         if (row["MaterialRFID"] != null)
         {
             model.MaterialRFID = row["MaterialRFID"].ToString();
         }
         if (row["MaterialType"] != null)
         {
             model.MaterialType = row["MaterialType"].ToString();
         }
         if (row["GnerateTime"] != null && row["GnerateTime"].ToString() != "")
         {
             model.GnerateTime = DateTime.Parse(row["GnerateTime"].ToString());
         }
         if (row["MaterialName"] != null)
         {
             model.MaterialName = row["MaterialName"].ToString();
         }
         if (row["Weight"] != null)
         {
             model.Weight = row["Weight"].ToString();
         }
         if (row["Color"] != null)
         {
             model.Color = row["Color"].ToString();
         }
         if (row["Certificate"] != null)
         {
             model.Certificate = row["Certificate"].ToString();
         }
         if (row["ContractNo"] != null)
         {
             model.ContractNo = row["ContractNo"].ToString();
         }
         if (row["BatchNo"] != null)
         {
             model.BatchNo = row["BatchNo"].ToString();
         }
         if (row["SupplyCompany"] != null)
         {
             model.SupplyCompany = row["SupplyCompany"].ToString();
         }
         if (row["workshift"] != null)
         {
             model.workshift = row["workshift"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_MaterialOutput model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_MaterialOutput(");
            strSql.Append("MaterialRFID,MaterialType,GnerateTime,MaterialName,Weight,Color,Certificate,ContractNo,BatchNo,SupplyCompany,workshift)");
            strSql.Append(" values (");
            strSql.Append("SQL2012MaterialRFID,SQL2012MaterialType,SQL2012GnerateTime,SQL2012MaterialName,SQL2012Weight,SQL2012Color,SQL2012Certificate,SQL2012ContractNo,SQL2012BatchNo,SQL2012SupplyCompany,SQL2012workshift)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("SQL2012MaterialRFID",  SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012MaterialType",  SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012GnerateTime",   SqlDbType.DateTime),
                new SqlParameter("SQL2012MaterialName",  SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012Weight",        SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012Color",         SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012Certificate",   SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012ContractNo",    SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012BatchNo",       SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012SupplyCompany", SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012workshift",     SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.MaterialRFID;
            parameters[1].Value  = model.MaterialType;
            parameters[2].Value  = model.GnerateTime;
            parameters[3].Value  = model.MaterialName;
            parameters[4].Value  = model.Weight;
            parameters[5].Value  = model.Color;
            parameters[6].Value  = model.Certificate;
            parameters[7].Value  = model.ContractNo;
            parameters[8].Value  = model.BatchNo;
            parameters[9].Value  = model.SupplyCompany;
            parameters[10].Value = model.workshift;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_MaterialOutput GetModel(int MaterialOutputID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 MaterialOutputID,MaterialRFID,MaterialType,GnerateTime,MaterialName,Weight,Color,Certificate,ContractNo,BatchNo,SupplyCompany,workshift from T_MaterialOutput ");
            strSql.Append(" where MaterialOutputID=SQL2012MaterialOutputID");
            SqlParameter[] parameters =
            {
                new SqlParameter("SQL2012MaterialOutputID", SqlDbType.Int, 4)
            };
            parameters[0].Value = MaterialOutputID;

            MesWeb.Model.T_MaterialOutput model = new MesWeb.Model.T_MaterialOutput();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        public VM_JSMind genMindStruct(string axisNumStr, string id, ref VM_JSMind mind, string parentId = "", bool isRoot = false)
        {
            if (string.IsNullOrEmpty(axisNumStr) || !HisMain.IsAxisNum(axisNumStr))
            {
                return(null);
            }
            var     bllMachine     = new MesWeb.BLL.T_Machine();
            var     bllMachineType = new MesWeb.BLL.T_MachineType();
            var     bllEmployee    = new MesWeb.BLL.T_Employee();
            var     bllMaterial    = new MesWeb.BLL.T_MaterialOutput();
            HisMain axisNum        = new HisMain();

            if (axisNumStr.StartsWith("ZD"))
            {
                axisNum.Year          = axisNumStr.Substring(2, 4);
                axisNum.Month         = axisNumStr.Substring(6, 2);
                axisNum.MachineTypeID = "5";
            }
            else if (axisNumStr.StartsWith("CP"))
            {
                axisNum = new HisMain(axisNumStr);
            }
            var hisTabName = "HISMAIN" + axisNum.Year + axisNum.Month + axisNum.MachineTypeID.Trim();
            var bllHisMain = new MesWeb.BLL.T_HisMain(hisTabName);
            var hisMain    = bllHisMain.GetModelList("Axis_No like '%" + axisNumStr + "%'").FirstOrDefault();

            if (hisMain == null)
            {
                return(null);
            }
            var machineType = bllMachineType.GetModel(int.Parse(axisNum.MachineTypeID));

            MesWeb.Model.T_MaterialOutput material = null;
            if (hisMain != null)
            {
                material = bllMaterial.GetModelList("MaterialRFID = '" + hisMain.MaterialRFID + "'").FirstOrDefault();
            }
            if (material != null)
            {
                hisMain.SpecColor = material.Color;
                hisMain.SpecName  = material.MaterialType;
                hisMain.Supplier  = material.SupplyCompany;
                hisMain.BatchNo   = material.BatchNo;
            }


            var employeeCode = hisMain.EmployeeID_Main;
            var employee     = bllEmployee.GetModelList("EmployeeCode = '" + employeeCode + "'").FirstOrDefault();

            if (employee != null)
            {
                hisMain.EmployeeID_Main = employee.EmployeeName;
            }
            var machine = bllMachine.GetModel(hisMain.MachineID.Value);

            var node = new JSMind_Data();


            node.topic    = machineType.MachineType + machine.MachineName;
            node.id       = id;
            node.parentid = parentId;
            node.isroot   = isRoot;
            node.data     = hisMain;
            mind.data.Add(node);
            if (hisMain != null)
            {
                var startAxisNums = ("" + hisMain.Start_Axis_No).Split(',');
                foreach (var stNum in startAxisNums)
                {
                    genMindStruct(stNum, stNum, ref mind, id);
                }
            }

            return(mind);
        }