/// <summary>
        /// 给工位设置装配用途
        /// </summary>
        /// <param name="workbench">工位号</param>
        /// <param name="purposeID">用途编号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>成功返回true, 失败返回false</returns>
        public bool UpdateWorkbenchPurpose(string workbench, int purposeID, out string error)
        {
            error = null;

            try
            {
                PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

                var result = from r in dataContxt.ZPX_WorkBenchConfig
                             where r.工位 == workbench
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("{0} 工位配置信息不存在,无法进行此设置", workbench);
                    return(false);
                }

                ZPX_WorkBenchConfig obj = result.Single();

                obj.用途编号 = purposeID;

                dataContxt.SubmitChanges();

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 删除CCD拍照防错的信息
        /// </summary>
        /// <param name="goodsCode">图号型号</param>
        /// <param name="goodsName">物品名称</param>
        /// <param name="spec">规格</param>
        /// <param name="bench">工位</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true 失败返回false</returns>
        public bool DeleteCCDConfig(string goodsCode, string goodsName, string spec, string bench, out string error)
        {
            error = "";

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            try
            {
                var result = from a in dataContxt.ZPX_CCDConfig
                             where a.工位 == bench && a.零件图号 == goodsCode &&
                             a.零件名称 == goodsName && a.零件规格 == spec
                             select a;

                if (result.Count() != 1)
                {
                    error = "数据错误,请检查!";
                    return(false);
                }
                else
                {
                    dataContxt.ZPX_CCDConfig.DeleteAllOnSubmit(result);
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 修改CCD零件的屏蔽时间
        /// </summary>
        /// <param name="workBench">工位</param>
        /// <param name="goodsCode">图号型号</param>
        /// <param name="goodsName">物品名称</param>
        /// <param name="spec">规格</param>
        /// <param name="starTime">屏蔽开始时间</param>
        /// <param name="endTime">屏蔽终止时间</param>
        /// <param name="error">错误信息</param>
        /// <returns>修改成功返回true,失败返回False</returns>
        public bool UpdateCCDConfigTime(string workBench, string goodsCode, string goodsName,
                                        string spec, DateTime starTime, DateTime endTime, out string error)
        {
            error = "";

            try
            {
                PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

                var result = from a in dataContxt.ZPX_CCDConfig
                             where a.工位 == workBench && a.零件图号 == goodsCode &&
                             a.零件名称 == goodsName && a.零件规格 == spec
                             select a;

                if (result.Count() == 1)
                {
                    ZPX_CCDConfig CCDConfig = result.Single();

                    CCDConfig.屏蔽开始时间 = starTime;
                    CCDConfig.屏蔽终止时间 = endTime;
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 添加CCD拍照防错的信息
        /// </summary>
        /// <param name="config">装配顺序防错数据对象</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true 失败返回false</returns>
        public bool InsertCCDConfig(ZPX_CCDConfig config, out string error)
        {
            error = "";

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            try
            {
                var result = from a in dataContxt.ZPX_CCDConfig
                             where a.工位 == config.工位 &&
                             a.零件图号 == config.零件图号 && a.零件名称 == config.零件名称 &&
                             a.零件规格 == config.零件规格
                             select a;

                if (result.Count() == 0)
                {
                    dataContxt.ZPX_CCDConfig.InsertOnSubmit(config);
                }
                else
                {
                    error = "数据重复,请检查!";
                    return(false);
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 添加装配顺序防错的信息
        /// </summary>
        /// <param name="workbenchConfig">装配顺序防错数据对象</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true 失败返回false</returns>
        public bool InsertWorkbenchConfig(ZPX_ProductWorkbenchConfig workbenchConfig, out string error)
        {
            error = "";

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            try
            {
                var result = from a in dataContxt.ZPX_ProductWorkbenchConfig
                             where a.产品类型 == workbenchConfig.产品类型 &&
                             a.当前工位 == workbenchConfig.当前工位
                             select a;

                if (result.Count() == 0)
                {
                    dataContxt.ZPX_ProductWorkbenchConfig.InsertOnSubmit(workbenchConfig);
                }
                else
                {
                    error = "数据重复,请检查!";
                    return(false);
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 删除装配顺序防错的信息
        /// </summary>
        /// <param name="product">产品类型</param>
        /// <param name="bench">当前工位</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true 失败返回false</returns>
        public bool DeleteWorkbenchConfig(string product, string bench, out string error)
        {
            error = "";

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            try
            {
                var result = from a in dataContxt.ZPX_ProductWorkbenchConfig
                             where a.产品类型 == product && a.当前工位 == bench
                             select a;

                if (result.Count() != 1)
                {
                    error = "数据错误,请检查!";
                    return(false);
                }
                else
                {
                    dataContxt.ZPX_ProductWorkbenchConfig.DeleteAllOnSubmit(result);
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Beispiel #7
0
        /// <summary>
        /// 修改装配顺序及工位间装配顺序的屏蔽时间
        /// </summary>
        /// <param name="workBench">当前工位</param>
        /// <param name="upWorkBench">上道工位</param>
        /// <param name="productCode">产品类型</param>
        /// <param name="name">分总成名称</param>
        /// <param name="starTime">屏蔽开始时间</param>
        /// <param name="endTime">屏蔽终止时间</param>
        /// <param name="error">错误信息</param>
        /// <returns>修改成功返回true,失败返回False</returns>
        public bool UpdateProductWorkbenchTime(string workBench, string upWorkBench, string productCode,
                                               string name, DateTime starTime, DateTime endTime, out string error)
        {
            error = "";

            try
            {
                PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

                var result = from a in dataContxt.ZPX_ProductWorkbenchConfig
                             where a.当前工位 == workBench && a.道工位 == upWorkBench &&
                             a.产品类型 == productCode && a.分总成名称 == name
                             select a;

                if (result.Count() == 1)
                {
                    ZPX_ProductWorkbenchConfig product = result.Single();

                    product.屏蔽开始时间 = starTime;
                    product.屏蔽终止时间 = endTime;
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Beispiel #8
0
        /// <summary>
        /// 删除零件电子称防错的信息
        /// </summary>
        /// <param name="id">序号</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true 失败返回false</returns>
        public bool DeleteLeakproofParts(int id, out string error)
        {
            error = "";

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            try
            {
                var result = from a in dataContxt.ZPX_LeakproofParts
                             where a.ID == id
                             select a;

                if (result.Count() != 1)
                {
                    error = "数据错误,请检查!";
                    return(false);
                }
                else
                {
                    dataContxt.ZPX_LeakproofParts.DeleteAllOnSubmit(result);
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Beispiel #9
0
        /// <summary>
        /// 添加零件电子称防错的信息
        /// </summary>
        /// <param name="leakproofParts">电子称防错数据对象</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true 失败返回false</returns>
        public bool InsertLeakproofParts(ZPX_LeakproofParts leakproofParts, out string error)
        {
            error = "";

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            try
            {
                var result = from a in dataContxt.ZPX_LeakproofParts
                             where a.工位 == leakproofParts.工位 &&
                             a.防漏装零件图号 == leakproofParts.防漏装零件图号 &&
                             a.防漏装零件名称 == leakproofParts.防漏装零件名称 &&
                             a.防漏装零件规格 == leakproofParts.防漏装零件规格
                             select a;

                if (result.Count() == 0)
                {
                    dataContxt.ZPX_LeakproofParts.InsertOnSubmit(leakproofParts);
                }
                else
                {
                    error = "数据重复,请检查!";
                    return(false);
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 获取所有工位用途信息
        /// </summary>
        /// <returns>获取到的工位用途信息</returns>
        public IQueryable <WorkbenchPurpose> GetWorkbenchPurpose()
        {
            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            var result = from r in dataContxt.View_ZPX_WorkBenchConfig
                         orderby r.工位
                         select new WorkbenchPurpose {
                工位 = r.工位, 装配用途编号 = r.用途编号, 装配用途名称 = r.用途
            };

            return(result);
        }
Beispiel #11
0
        /// <summary>
        /// 修改装配顺序防错的信息
        /// </summary>
        /// <param name="workbenchConfig">装配顺序防错数据对象</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true 失败返回false</returns>
        public bool UpdateWorkbenchConfig(ZPX_ProductWorkbenchConfig workbenchConfig, out string error)
        {
            error = "";

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            try
            {
                var result = from a in dataContxt.ZPX_ProductWorkbenchConfig
                             where a.当前工位 == workbenchConfig.当前工位 &&
                             a.产品类型 == workbenchConfig.产品类型
                             select a;

                if (result.Count() != 1)
                {
                    error = "数据错误,请检查!";
                    return(false);
                }
                else
                {
                    ZPX_ProductWorkbenchConfig lnqWorkbenchConfig = result.Single();

                    lnqWorkbenchConfig.序装配末道工序值  = workbenchConfig.序装配末道工序值;
                    lnqWorkbenchConfig.序装配端口号    = workbenchConfig.序装配端口号;
                    lnqWorkbenchConfig.道工位       = workbenchConfig.道工位;
                    lnqWorkbenchConfig.是按顺序流水号装配 = workbenchConfig.是按顺序流水号装配;
                    lnqWorkbenchConfig.是本阶段末工位   = workbenchConfig.是本阶段末工位;
                    lnqWorkbenchConfig.是本阶段起始工位  = workbenchConfig.是本阶段起始工位;
                    lnqWorkbenchConfig.是气密性检测工位  = workbenchConfig.是气密性检测工位;
                    lnqWorkbenchConfig.是所有产品通用工位 = workbenchConfig.是所有产品通用工位;
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 获取指定人员具有权限的工位用途信息
        /// </summary>
        /// <param name="workID">人员工号</param>
        /// <returns>获取到的工位用途信息</returns>
        public IQueryable <WorkbenchPurpose> GetWorkbenchPurpose(string workID)
        {
            IQueryable <View_ZPX_PersonnelAuthority> purposeAuthority = GetPurposeAuthority(workID);

            if (purposeAuthority.Count() == 0)
            {
                return(null);
            }

            List <int> lstPurposeID = (from r in purposeAuthority
                                       select r.装配用途编号).ToList();

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            var result = from r in dataContxt.View_ZPX_WorkBenchConfig
                         where lstPurposeID.Contains(r.用途编号)
                         select new WorkbenchPurpose {
                工位 = r.工位, 装配用途编号 = r.用途编号, 装配用途名称 = r.用途
            };

            return(result);
        }
Beispiel #13
0
        /// <summary>
        /// 修改零件打扭矩的信息
        /// </summary>
        /// <param name="leakproofParts">电子称防错数据对象</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true 失败返回false</returns>
        public bool UpdateLeakproofParts(ZPX_LeakproofParts leakproofParts, out string error)
        {
            error = "";

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            try
            {
                var result = from a in dataContxt.ZPX_LeakproofParts
                             where a.工位 == leakproofParts.工位 &&
                             a.防漏装零件图号 == leakproofParts.防漏装零件图号 &&
                             a.防漏装零件名称 == leakproofParts.防漏装零件名称 &&
                             a.防漏装零件规格 == leakproofParts.防漏装零件规格
                             select a;

                if (result.Count() != 1)
                {
                    error = "数据错误,请检查!";
                    return(false);
                }
                else
                {
                    ZPX_LeakproofParts lnqLeakproof = result.Single();

                    lnqLeakproof.电子秤端口号 = leakproofParts.电子秤端口号;
                    lnqLeakproof.防错模式   = leakproofParts.防错模式;
                    lnqLeakproof.零件单重   = leakproofParts.零件单重;
                    lnqLeakproof.公差     = leakproofParts.公差;
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Beispiel #14
0
        /// <summary>
        /// 修改CCD拍照防错的信息
        /// </summary>
        /// <param name="config">CCD拍照防错数据对象</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true 失败返回false</returns>
        public bool UpdateCCDConfig(ZPX_CCDConfig config, out string error)
        {
            error = "";

            PlatformServiceDataContext dataContxt = ParameterFactory.PlatformDataContext;

            try
            {
                var result = from a in dataContxt.ZPX_CCDConfig
                             where a.工位 == config.工位 &&
                             a.零件图号 == config.零件图号 && a.零件名称 == config.零件名称 &&
                             a.零件规格 == config.零件规格
                             select a;

                if (result.Count() != 1)
                {
                    error = "数据错误,请检查!";
                    return(false);
                }
                else
                {
                    ZPX_CCDConfig lnqCCD = result.Single();

                    lnqCCD.测点号    = config.测点号;
                    lnqCCD.适用产品类型 = config.适用产品类型;
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }