Esempio n. 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ALineScrewDB.dbModel GetModel(string 二维码)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  ");
            strSql.Append(" 测试时间,二维码,螺丝1马头结果,螺丝1马头扭矩,螺丝1马头角度,螺丝1图片路径,螺丝2马头结果,螺丝2马头扭矩,螺丝2马头角度,螺丝2图片路径,螺丝3马头结果,螺丝3马头扭矩,螺丝3马头角度,螺丝3图片路径,螺丝4马头结果,螺丝4马头扭矩,螺丝4马头角度,螺丝4图片路径 ");
            strSql.Append(" from db ");
            strSql.Append(" where 二维码='" + 二维码 + "' ");
            ALineScrewDB.dbModel model = new ALineScrewDB.dbModel();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        protected bool ExeBindA(ref string reStr)
        {
            if (!nodeEnabled)
            {
                return(true);
            }
            if (!ExeBusinessAB(ref reStr))
            {
                return(false);
            }
            switch (currentTaskPhase)
            {
            case 1:
            {
                if (!RfidReadAB())
                {
                    break;
                }
                this.screwNgHandler = new ScrewNGHandler(this.plcRW, this.plcRW2, this.channelIndex, this.logRecorder);

                bool needReparid = false;
                if (this.repairProcess.GetNeedRepairALine(this.rfidUID, this.NodeID, ref needReparid, ref reStr) == false)
                {
                    this.logRecorder.AddDebugLog(this.nodeName, "获取返修状态失败:" + reStr);
                    break;
                }
                this.logRecorder.AddDebugLog(this.nodeName, "获取返修状态成功:" + needReparid + "," + reStr);
                if (needReparid == false)
                {
                    currentTaskPhase = 9;        //直接放行
                    this.TxtLogRecorder.WriteLog("工艺流程当前工位不需要加工,直接放行,工装板号:" + this.rfidUID);
                    this.repairProcess.ReportToMesByProcessStationID(this.nodeID, this.rfidUID);
                    break;
                }

                this.currentTask.TaskParam = rfidUID;
                this.currentTask.TaskPhase = this.currentTaskPhase;
                this.ctlTaskBll.Update(this.currentTask);
                //db1ValsToSnd[1] = 2;//


                if (!ProductTraceRecord())
                {
                    break;
                }
                currentTaskPhase++;
                this.TxtLogRecorder.WriteLog("工位流程开始加工!");
                this.currentTask.TaskPhase = this.currentTaskPhase;
                this.ctlTaskBll.Update(this.currentTask);
                break;
            }

            case 2:
            {
                List <DBAccess.Model.BatteryModuleModel> modList = modBll.GetModelList(string.Format("palletID='{0}' and palletBinded=1", this.rfidUID));

                if (!PreMech(modList, ref reStr))
                {
                    Console.WriteLine(string.Format("{0},{1}", nodeName, reStr));
                    break;
                }
                if (modList.Count() < 1)
                {
                    currentTaskPhase = 6;
                    break;
                }
                currentTaskPhase++;
                this.currentTask.TaskPhase = this.currentTaskPhase;
                this.ctlTaskBll.Update(this.currentTask);
                break;
            }

            case 3:
            {
                //发送启动加工命令
                //int channelIndex = 1;
                //if (this.db2Vals[0] == 1 || this.db2Vals[0] == 2)
                //{
                //    channelIndex = this.db2Vals[0];
                //}
                //else
                //{
                //    this.currentTaskDescribe = "通道号无效!";
                //    break;
                //}
                List <DBAccess.Model.BatteryModuleModel> modList = modBll.GetModelList(string.Format("palletID='{0}' and palletBinded=1", this.rfidUID));
                if (modList.Count() < 1)
                {
                    this.db1ValsToSnd[channelIndex - 1] = 4;
                    currentTaskPhase = 5;
                    break;
                }
                List <string> products = new List <string>();
                Thread.Sleep(2000);        //延时10秒等待下边设备
                foreach (DBAccess.Model.BatteryModuleModel m in modList)
                {
                    products.Add(m.batModuleID);
                }
                if (!SysCfgModel.SimMode)
                {
                    if (products.Count() > 0)
                    {
                        if (ccdDevAcc != null)
                        {
                            if (!ccdDevAcc.StartDev(products, ccdDevName, ref reStr))
                            {
                                this.currentTaskDescribe = "发送设备加工启动命令失败:" + reStr;
                                //Console.WriteLine(string.Format("{0}发送设备加工启动命令失败,{1}", nodeName, reStr));
                                break;
                            }
                            else
                            {
                                logRecorder.AddDebugLog(nodeName, "发送设备加工启动命令成功");
                            }
                        }
                    }
                }
                devOpenSt = System.DateTime.Now;
                currentTaskPhase++;
                this.currentTask.TaskPhase = this.currentTaskPhase;
                this.ctlTaskBll.Update(this.currentTask);
                break;
            }

            case 4:
            {
                #region 原来上传MES逻辑
                //System.DateTime cur = System.DateTime.Now;
                //TimeSpan ts = cur - devOpenSt;
                //if (ts.TotalSeconds < 30)
                //{
                //    break;
                //}
                //IDictionary<string, string> ccdDataDic = ccdDevAcc.GetData(ccdDevName, ref reStr);
                //if (ccdDataDic == null || ccdDataDic.Keys.Count() < 1)
                //{
                //    //Console.WriteLine(string.Format("{0}获取CCD{1}数据失败,{2}",nodeName,ccdDevName,reStr));
                //    this.currentTaskDescribe = string.Format("获取CCD{0}数据失败,{1}", ccdDevName, reStr);
                //    break;
                //}
                //foreach (string keyStr in ccdDataDic.Keys)
                //{
                //    string str = string.Format("CCD数据,产品ID:{0},数据:{1}", keyStr, ccdDataDic[keyStr]);
                //    logRecorder.AddDebugLog(nodeName, str);
                //    AddProcessRecord(keyStr, "模块", "检测数据", string.Format("读取到{0}检测数据", ccdDevName), ccdDataDic[keyStr]);
                //    string upLoadMesScrewData = "";
                //    if (GetScrewData(ccdDataDic[keyStr], ref upLoadMesScrewData) == false)
                //    {

                //        logRecorder.AddDebugLog(nodeName, "CCD数据格式错误!无法转换为MES需要格式!");
                //        continue;
                //    }
                //    if (UploadMesScrewData(keyStr, upLoadMesScrewData) == false)
                //    {
                //        logRecorder.AddDebugLog(nodeName, "上传MES锁螺丝数据失败!");
                //        continue;
                //    }
                //    logRecorder.AddDebugLog(nodeName, "上传MES锁螺丝数据成功!");
                //}
                #endregion
                //==更改为读取数据库形式,根据模块条码获取数据,判断所有条码的数据上传成功后执行下一步======//
                int readDataApply = 0;
                Console.WriteLine("sd1");
                bool isScrewCpt = false;                                                                          //所有螺丝加工完成标识
                List <DBAccess.Model.BatteryModuleModel> modList       = modBll.GetModelList(string.Format("palletID='{0}' and palletBinded=1", this.rfidUID));
                List <DBAccess.Model.BatteryModuleModel> uploadModList = modList.FindAll(mod => mod.tag3 == "1"); //查询已经上传的条码,上传的为1,没有的为0或为空
                if (uploadModList != null && uploadModList.Count == modList.Count)
                {
                    isScrewCpt = true;
                }

                Console.WriteLine("sd2");
                if (isScrewCpt == true)
                {
                    currentTaskPhase++;
                    this.currentTask.TaskPhase = this.currentTaskPhase;
                    this.ctlTaskBll.Update(this.currentTask);
                    break;
                }
                Console.WriteLine("sd3");
                if (this.plcRW2.ReadDB("D9000", ref readDataApply) == false)
                {
                    break;
                }
                Console.WriteLine("sd4");
                if (readDataApply != 1)
                {
                    break;
                }

                Console.WriteLine("sd5");
                List <DBAccess.Model.BatteryModuleModel> unUploadModList = modList.FindAll(mod => mod.tag3 != "1");       //
                foreach (DBAccess.Model.BatteryModuleModel module in unUploadModList)
                {
                    ALineScrewDB.dbModel screwModel = bllScrewDb.GetModelByModuleID(module.batModuleID);

                    if (screwModel == null)
                    {
                        continue;
                    }

                    string mesScrewData = "";
                    if (GetScrewData(screwModel, ref mesScrewData, ref reStr) == false)
                    {
                        Console.WriteLine("模块:" + screwModel.二维码 + ",获取螺丝数据失败:" + reStr);
                        continue;
                    }

                    int status = UploadMesScrewData(module.batModuleID, mesScrewData, ref reStr);
                    if (status == 0)
                    {
                        if (this.plcRW2.WriteDB("D9000", 2) == false)
                        {
                            break;
                        }
                        logRecorder.AddDebugLog(nodeName, "上传MES锁螺丝数据成功!数据:" + module.batModuleID + ":" + mesScrewData + "返回:" + reStr);
                    }
                    else if (status == 1)
                    {
                        ScrewNGModule screwNgMod = new ScrewNGModule();
                        screwNgMod.ChannelIndex = this.channelIndex;
                        screwNgMod.ModPos       = int.Parse(module.tag2);
                        Console.WriteLine("tag2:" + module.tag2);
                        this.screwNgHandler.AddNgModule(screwNgMod);
                        module.palletBinded = false;   //NG解绑
                        module.checkResult  = 2;       //NG
                        modBll.Update(module);
                        logRecorder.AddDebugLog(nodeName, "上传MES锁螺丝数据成功,但返回NG!" + module.batModuleID + ":" + reStr);
                        if (this.plcRW2.WriteDB("D9000", 3) == false)
                        {
                            break;
                        }
                    }
                    else
                    {
                        //Console.WriteLine();
                        logRecorder.AddDebugLog(nodeName, "上传MES锁螺丝数据失败!" + reStr);
                        this.TxtLogRecorder.WriteLog("上传MES锁螺丝数据失败!" + reStr);
                        continue;
                    }
                    this.TxtLogRecorder.WriteLog("上传MES锁螺丝数据成功!数据:" + module.batModuleID + ":" + mesScrewData);
                    module.tag3 = "1";
                    modBll.Update(module);
                    //screwModel.UpLoad = "是";

                    //bllScrewDb.Update(screwModel);
                }
                //========================================================================================//
                if (isScrewCpt == false)
                {
                    break;
                }
                // Console.WriteLine("sd6");
                currentTaskPhase++;
                this.currentTask.TaskPhase = this.currentTaskPhase;
                this.ctlTaskBll.Update(this.currentTask);
                break;
            }

            case 5:
            {
                //发送停止加工命令
                if (!ccdDevAcc.EndDev(this.ccdDevName, ref reStr))
                {
                    //logRecorder.AddDebugLog(nodeName, "发送设备停止命令失败");
                    //  Console.WriteLine(nodeName + "发送设备停止命令失败");
                    this.currentTaskDescribe = "发送设备停止命令失败";
                    break;
                }
                else
                {
                    logRecorder.AddDebugLog(nodeName, "发送设备停止命令成功");
                }
                currentTaskPhase++;
                this.currentTask.TaskPhase = this.currentTaskPhase;
                this.ctlTaskBll.Update(this.currentTask);
                this.TxtLogRecorder.WriteLog("停止设备成功!");
                break;
            }

            case 6:
            {
                currentTaskDescribe = "发送有料字";
                List <DBAccess.Model.BatteryModuleModel> modList = modBll.GetModelList(string.Format("palletID='{0}' and palletBinded=1", this.rfidUID));

                if (!AfterMech(modList, ref reStr))
                {
                    // Console.WriteLine(string.Format("{0},{1}", nodeName, reStr));
                    currentTaskDescribe = reStr;
                    break;
                }
                currentTaskPhase++;
                this.currentTask.TaskPhase = this.currentTaskPhase;
                this.ctlTaskBll.Update(this.currentTask);
                logRecorder.AddDebugLog(nodeName, "发送有料字");
                break;
            }

            case 7:
            {
                db1ValsToSnd[2 + this.channelIndex - 1] = 3;

                currentStat.StatDescribe = "工装板放行";
                this.currentTaskPhase++;
                this.currentTask.TaskPhase = this.currentTaskPhase;
                this.ctlTaskBll.Update(this.currentTask);
                break;
            }

            case 8:
            {
                currentStat.StatDescribe = "NG流程处理";
                Console.WriteLine("sd7");
                if (this.screwNgHandler.Execute() == false)
                {
                    break;
                }
                List <DBAccess.Model.BatteryModuleModel> modList = modBll.GetModelList(string.Format("palletID='{0}'", this.rfidUID));
                foreach (DBAccess.Model.BatteryModuleModel mod in modList)       //锁螺丝工位有拍出流程 不需要记录NG
                {
                    mod.checkResult = 0;
                    modBll.Update(mod);
                }

                currentStat.StatDescribe = "流程完成";
                // Console.WriteLine("sd8");
                this.TxtLogRecorder.WriteLog("此工位流程处理完成!");
                this.currentTask.TaskPhase = this.currentTaskPhase;
                this.ctlTaskBll.Update(this.currentTask);
                break;
            }

            case 9:    //返修流程不要返修的直接放行
            {
                db1ValsToSnd[2 + this.channelIndex - 1] = 3;
                if (this.repairProcess.NeedRepair == false)
                {
                    string chennelAddr = this.screwNgHandler.addrChannelCfg[this.channelIndex];
                    if (this.PlcRW.WriteDB(chennelAddr, 2) == false)
                    {
                        break;
                    }
                }
                this.TxtLogRecorder.WriteLog("此工位流程处理完成!");
                break;
            }

            default:
                break;
            }
            return(true);
        }
Esempio n. 3
0
        //private bool MesNGHandler(List<DBAccess.Model.BatteryModuleModel> modList, ref string reStr)
        //{
        //    try
        //    {
        //        bool NoNg = true;

        //        foreach (DBAccess.Model.BatteryModuleModel module in modList)
        //        {
        //            ALineScrewDB.dbModel screwModel = bllScrewDb.GetModelByModuleID(module.batModuleID);
        //            if (screwModel == null)
        //            {
        //                continue;
        //            }

        //            if (screwModel.UpLoad == "是")
        //            {
        //                continue;
        //            }

        //            string mesScrewData = "";
        //            if (GetScrewData(screwModel, ref mesScrewData, ref reStr) == false)
        //            {
        //                Console.WriteLine("模块:" + screwModel.二维码 + ",获取螺丝数据失败:" + reStr);
        //                continue;
        //            }

        //            int status = UploadMesScrewData(module.batModuleID, mesScrewData, ref reStr);
        //            if (status == 0)
        //            {

        //                if (this.plcRW2.WriteDB("D9000", 2) == false)
        //                {
        //                    break;
        //                }
        //                logRecorder.AddDebugLog(nodeName, "上传MES锁螺丝数据成功!数据:" + mesScrewData + "返回:" + reStr);
        //            }
        //            else if (status == 1)
        //            {
        //                NoNg = false;
        //                if(this.channelIndex==1)//A通道
        //                {

        //                }
        //                else  //B通道
        //                {

        //                }
        //                logRecorder.AddDebugLog(nodeName, "上传MES锁螺丝数据成功,但返回NG!" + reStr);
        //                if (this.plcRW2.WriteDB("D9000", 3) == false)
        //                {
        //                    break;
        //                }
        //            }
        //            else
        //            {
        //                //Console.WriteLine();
        //                logRecorder.AddDebugLog(nodeName, "上传MES锁螺丝数据失败!" + reStr);
        //                continue;
        //            }
        //            screwModel.UpLoad = "是";
        //            bllScrewDb.Update(screwModel);
        //            if(NoNg==true)//没有ng的处理
        //            { }

        //        }
        //        return true;
        //    }
        //    catch(Exception ex)
        //    {
        //        reStr = ex.Message;
        //        return false;
        //    }
        //}
        private bool GetScrewData(ALineScrewDB.dbModel screwModel, ref string screwdata, ref string restr)
        {
            try
            {
                if (screwModel == null)
                {
                    restr = "传入对象为空";
                    return(false);
                }
                if (screwModel.螺丝1马头扭矩.ToLower().Trim() == "null")
                {
                    restr = "螺丝1码头扭矩为空!";
                    return(false);
                }
                else if (screwModel.螺丝2马头扭矩.ToLower().Trim() == "null")
                {
                    restr = "螺丝2码头扭矩为空!";
                    return(false);
                }
                else if (screwModel.螺丝3马头扭矩.ToLower().Trim() == "null")
                {
                    restr = "螺丝3码头扭矩为空!";
                    return(false);
                }
                else if (screwModel.螺丝4马头扭矩.ToLower().Trim() == "null")
                {
                    restr = "螺丝4码头扭矩为空!";
                    return(false);
                }
                else if (screwModel.螺丝1马头角度.ToLower().Trim() == "null")
                {
                    restr = "螺丝1马头角度为空!";
                    return(false);
                }
                else if (screwModel.螺丝2马头角度.ToLower().Trim() == "null")
                {
                    restr = "螺丝2马头角度为空!";
                    return(false);
                }
                else if (screwModel.螺丝3马头角度.ToLower().Trim() == "null")
                {
                    restr = "螺丝3马头角度为空!";
                    return(false);
                }
                else if (screwModel.螺丝4马头角度.ToLower().Trim() == "null")
                {
                    restr = "螺丝4马头角度为空!";
                    return(false);
                }

                string mesScrewData = "螺丝1扭矩:" + screwModel.螺丝1马头扭矩 + ":Nm|螺丝2扭矩:" + screwModel.螺丝2马头扭矩 + ":Nm|螺丝3扭矩:"
                                      + screwModel.螺丝3马头扭矩 + ":Nm|螺丝4扭矩:" + screwModel.螺丝4马头扭矩 + ":Nm|螺丝1角度:" + screwModel.螺丝1马头角度
                                      + ":°|螺丝2角度:" + screwModel.螺丝2马头角度 + ":°|螺丝3角度:" + screwModel.螺丝3马头角度 + ":°|螺丝4角度:"
                                      + screwModel.螺丝4马头角度 + ":°";

                screwdata    = mesScrewData;
                mesScrewData = "获取螺丝数据成功!";
                return(true);
            }
            catch (Exception ex)
            {
                restr = ex.Message;

                return(false);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ALineScrewDB.dbModel model)
 {
     return(dal.Update(model));
 }
Esempio n. 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(ALineScrewDB.dbModel model)
 {
     return(dal.Add(model));
 }
Esempio n. 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ALineScrewDB.dbModel DataRowToModel(DataRow row)
 {
     ALineScrewDB.dbModel model = new ALineScrewDB.dbModel();
     if (row != null)
     {
         if (row["测试时间"] != null)
         {
             model.测试时间 = row["测试时间"].ToString();
         }
         if (row["二维码"] != null)
         {
             model.二维码 = row["二维码"].ToString();
         }
         if (row["螺丝1马头结果"] != null)
         {
             model.螺丝1马头结果 = row["螺丝1马头结果"].ToString();
         }
         if (row["螺丝1马头扭矩"] != null)
         {
             model.螺丝1马头扭矩 = row["螺丝1马头扭矩"].ToString();
         }
         if (row["螺丝1马头角度"] != null)
         {
             model.螺丝1马头角度 = row["螺丝1马头角度"].ToString();
         }
         if (row["螺丝1图片路径"] != null)
         {
             model.螺丝1图片路径 = row["螺丝1图片路径"].ToString();
         }
         if (row["螺丝2马头结果"] != null)
         {
             model.螺丝2马头结果 = row["螺丝2马头结果"].ToString();
         }
         if (row["螺丝2马头扭矩"] != null)
         {
             model.螺丝2马头扭矩 = row["螺丝2马头扭矩"].ToString();
         }
         if (row["螺丝2马头角度"] != null)
         {
             model.螺丝2马头角度 = row["螺丝2马头角度"].ToString();
         }
         if (row["螺丝2图片路径"] != null)
         {
             model.螺丝2图片路径 = row["螺丝2图片路径"].ToString();
         }
         if (row["螺丝3马头结果"] != null)
         {
             model.螺丝3马头结果 = row["螺丝3马头结果"].ToString();
         }
         if (row["螺丝3马头扭矩"] != null)
         {
             model.螺丝3马头扭矩 = row["螺丝3马头扭矩"].ToString();
         }
         if (row["螺丝3马头角度"] != null)
         {
             model.螺丝3马头角度 = row["螺丝3马头角度"].ToString();
         }
         if (row["螺丝3图片路径"] != null)
         {
             model.螺丝3图片路径 = row["螺丝3图片路径"].ToString();
         }
         if (row["螺丝4马头结果"] != null)
         {
             model.螺丝4马头结果 = row["螺丝4马头结果"].ToString();
         }
         if (row["螺丝4马头扭矩"] != null)
         {
             model.螺丝4马头扭矩 = row["螺丝4马头扭矩"].ToString();
         }
         if (row["螺丝4马头角度"] != null)
         {
             model.螺丝4马头角度 = row["螺丝4马头角度"].ToString();
         }
         if (row["螺丝4图片路径"] != null)
         {
             model.螺丝4图片路径 = row["螺丝4图片路径"].ToString();
         }
     }
     return(model);
 }
Esempio n. 7
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(ALineScrewDB.dbModel model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.测试时间 != null)
            {
                strSql1.Append("测试时间,");
                strSql2.Append("'" + model.测试时间 + "',");
            }
            if (model.二维码 != null)
            {
                strSql1.Append("二维码,");
                strSql2.Append("'" + model.二维码 + "',");
            }
            if (model.螺丝1马头结果 != null)
            {
                strSql1.Append("螺丝1马头结果,");
                strSql2.Append("'" + model.螺丝1马头结果 + "',");
            }
            if (model.螺丝1马头扭矩 != null)
            {
                strSql1.Append("螺丝1马头扭矩,");
                strSql2.Append("'" + model.螺丝1马头扭矩 + "',");
            }
            if (model.螺丝1马头角度 != null)
            {
                strSql1.Append("螺丝1马头角度,");
                strSql2.Append("'" + model.螺丝1马头角度 + "',");
            }
            if (model.螺丝1图片路径 != null)
            {
                strSql1.Append("螺丝1图片路径,");
                strSql2.Append("'" + model.螺丝1图片路径 + "',");
            }
            if (model.螺丝2马头结果 != null)
            {
                strSql1.Append("螺丝2马头结果,");
                strSql2.Append("'" + model.螺丝2马头结果 + "',");
            }
            if (model.螺丝2马头扭矩 != null)
            {
                strSql1.Append("螺丝2马头扭矩,");
                strSql2.Append("'" + model.螺丝2马头扭矩 + "',");
            }
            if (model.螺丝2马头角度 != null)
            {
                strSql1.Append("螺丝2马头角度,");
                strSql2.Append("'" + model.螺丝2马头角度 + "',");
            }
            if (model.螺丝2图片路径 != null)
            {
                strSql1.Append("螺丝2图片路径,");
                strSql2.Append("'" + model.螺丝2图片路径 + "',");
            }
            if (model.螺丝3马头结果 != null)
            {
                strSql1.Append("螺丝3马头结果,");
                strSql2.Append("'" + model.螺丝3马头结果 + "',");
            }
            if (model.螺丝3马头扭矩 != null)
            {
                strSql1.Append("螺丝3马头扭矩,");
                strSql2.Append("'" + model.螺丝3马头扭矩 + "',");
            }
            if (model.螺丝3马头角度 != null)
            {
                strSql1.Append("螺丝3马头角度,");
                strSql2.Append("'" + model.螺丝3马头角度 + "',");
            }
            if (model.螺丝3图片路径 != null)
            {
                strSql1.Append("螺丝3图片路径,");
                strSql2.Append("'" + model.螺丝3图片路径 + "',");
            }
            if (model.螺丝4马头结果 != null)
            {
                strSql1.Append("螺丝4马头结果,");
                strSql2.Append("'" + model.螺丝4马头结果 + "',");
            }
            if (model.螺丝4马头扭矩 != null)
            {
                strSql1.Append("螺丝4马头扭矩,");
                strSql2.Append("'" + model.螺丝4马头扭矩 + "',");
            }
            if (model.螺丝4马头角度 != null)
            {
                strSql1.Append("螺丝4马头角度,");
                strSql2.Append("'" + model.螺丝4马头角度 + "',");
            }
            if (model.螺丝4图片路径 != null)
            {
                strSql1.Append("螺丝4图片路径,");
                strSql2.Append("'" + model.螺丝4图片路径 + "',");
            }
            strSql.Append("insert into db(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            int rows = DbHelperOleDb.ExecuteSql(strSql.ToString());

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ALineScrewDB.dbModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update db set ");
            if (model.测试时间 != null)
            {
                strSql.Append("测试时间='" + model.测试时间 + "',");
            }
            else
            {
                strSql.Append("测试时间= null ,");
            }
            if (model.螺丝1马头结果 != null)
            {
                strSql.Append("螺丝1马头结果='" + model.螺丝1马头结果 + "',");
            }
            else
            {
                strSql.Append("螺丝1马头结果= null ,");
            }
            if (model.螺丝1马头扭矩 != null)
            {
                strSql.Append("螺丝1马头扭矩='" + model.螺丝1马头扭矩 + "',");
            }
            else
            {
                strSql.Append("螺丝1马头扭矩= null ,");
            }
            if (model.螺丝1马头角度 != null)
            {
                strSql.Append("螺丝1马头角度='" + model.螺丝1马头角度 + "',");
            }
            else
            {
                strSql.Append("螺丝1马头角度= null ,");
            }
            if (model.螺丝1图片路径 != null)
            {
                strSql.Append("螺丝1图片路径='" + model.螺丝1图片路径 + "',");
            }
            else
            {
                strSql.Append("螺丝1图片路径= null ,");
            }
            if (model.螺丝2马头结果 != null)
            {
                strSql.Append("螺丝2马头结果='" + model.螺丝2马头结果 + "',");
            }
            else
            {
                strSql.Append("螺丝2马头结果= null ,");
            }
            if (model.螺丝2马头扭矩 != null)
            {
                strSql.Append("螺丝2马头扭矩='" + model.螺丝2马头扭矩 + "',");
            }
            else
            {
                strSql.Append("螺丝2马头扭矩= null ,");
            }
            if (model.螺丝2马头角度 != null)
            {
                strSql.Append("螺丝2马头角度='" + model.螺丝2马头角度 + "',");
            }
            else
            {
                strSql.Append("螺丝2马头角度= null ,");
            }
            if (model.螺丝2图片路径 != null)
            {
                strSql.Append("螺丝2图片路径='" + model.螺丝2图片路径 + "',");
            }
            else
            {
                strSql.Append("螺丝2图片路径= null ,");
            }
            if (model.螺丝3马头结果 != null)
            {
                strSql.Append("螺丝3马头结果='" + model.螺丝3马头结果 + "',");
            }
            else
            {
                strSql.Append("螺丝3马头结果= null ,");
            }
            if (model.螺丝3马头扭矩 != null)
            {
                strSql.Append("螺丝3马头扭矩='" + model.螺丝3马头扭矩 + "',");
            }
            else
            {
                strSql.Append("螺丝3马头扭矩= null ,");
            }
            if (model.螺丝3马头角度 != null)
            {
                strSql.Append("螺丝3马头角度='" + model.螺丝3马头角度 + "',");
            }
            else
            {
                strSql.Append("螺丝3马头角度= null ,");
            }
            if (model.螺丝3图片路径 != null)
            {
                strSql.Append("螺丝3图片路径='" + model.螺丝3图片路径 + "',");
            }
            else
            {
                strSql.Append("螺丝3图片路径= null ,");
            }
            if (model.螺丝4马头结果 != null)
            {
                strSql.Append("螺丝4马头结果='" + model.螺丝4马头结果 + "',");
            }
            else
            {
                strSql.Append("螺丝4马头结果= null ,");
            }
            if (model.螺丝4马头扭矩 != null)
            {
                strSql.Append("螺丝4马头扭矩='" + model.螺丝4马头扭矩 + "',");
            }
            else
            {
                strSql.Append("螺丝4马头扭矩= null ,");
            }
            if (model.螺丝4马头角度 != null)
            {
                strSql.Append("螺丝4马头角度='" + model.螺丝4马头角度 + "',");
            }
            else
            {
                strSql.Append("螺丝4马头角度= null ,");
            }
            if (model.螺丝4图片路径 != null)
            {
                strSql.Append("螺丝4图片路径='" + model.螺丝4图片路径 + "',");
            }
            else
            {
                strSql.Append("螺丝4图片路径= null ,");
            }
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where 二维码='" + model.二维码 + "' ");
            int rowsAffected = DbHelperOleDb.ExecuteSql(strSql.ToString());

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }