Browse Source

复检以前条码

姜永辉 9 tháng trước cách đây
mục cha
commit
fbce8617d1

+ 157 - 0
DK.Service/PDAModuleLogic/PDAModuleLogic.cs

@@ -1171,6 +1171,163 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
             }
         }
 
+
+        /// <summary>
+        /// 根据所选生产数据ID,显示成检数据信息--复检专用
+        /// </summary>
+        /// <param name="productionDataID">生产数据ID</param>
+        /// <returns>DataSet</returns>
+        public static DataSet GetProductionDataByIDSemiCheck(int productionDataID)
+        {
+            IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
+            try
+            {
+                con.Open();
+                DataSet dsReturn = new DataSet();
+                string sqlString = @"select 
+                                    TP_PM_ProductionData.Barcode as BarCode,
+                                    TP_PM_ProductionData.Goodsid as GoodsID,
+                                    TP_PM_ProductionData.Goodscode as GoodsCode,
+                                    TP_PM_ProductionData.Goodsname as GoodsName,
+                                    TP_PM_ProductionData.GoodsLevelID as DefectFlagID,
+                                    TP_PM_ProductionData.Reworkprocedureid as ReworkProcedureID,
+                                    TP_PM_ProductionData.Remarks as Remarks,
+                                    TP_PM_ProductionData.Userid as UserID,
+                                    TP_PM_ProductionData.UserCode as UserCode,
+                                    TP_PM_ProductionData.UserName as UserName,
+                                    TP_PM_ProductionData.Goodsleveltypeid as GoodsLevelTypeID,
+                                    TP_PM_ProductionData.SpecialRepairflag,
+                                    TP_PM_ProductionData.IsReFire,
+                                    TP_PM_ProductionData.KilnCode,
+                                    TP_PM_ProductionData.KilnCarCode,
+                                    TP_PM_ProductionData.GroutingUserCode,
+                                    TP_PM_ProductionData.GroutingMouldCode as MouldCode,
+                                    TP_PM_ProductionData.GroutingNum,
+                                    TP_PM_ProductionData.GroutingDate,
+                                    TP_PM_ProductionData.IsPublicBody,
+                                    TP_MST_Logo.logoid,
+                                    TP_MST_Logo.logocode,
+                                    TP_MST_Logo.logoname,
+                                    TP_PM_ProductionData.CreateTime,
+                                    TP_PM_ProductionData.CheckTime,
+									dd.DICTIONARYVALUE as GLAZEName
+                                    from TP_PM_ProductionData
+									INNER JOIN TP_PM_GROUTINGDAILYDETAIL gdd
+									on gdd.BARCODE = TP_PM_ProductionData.BARCODE
+									left join TP_MST_DATADICTIONARY dd on dd.DICTIONARYID = gdd.GLAZETYPEID
+                                    left join TP_MST_Logo
+                                    on gdd.logoid=TP_MST_Logo.logoid
+                                    where 
+                                    TP_PM_ProductionData.Productiondataid=:ProductionDataID
+                                    ";
+                string sqlString2 = @"
+                                    select 
+                                    TP_PM_Defect.ProductionDefectID as ProductionDefectID,
+                                    TP_PM_Defect.Barcode as BarCode,
+                                    TP_PM_Defect.DefectID as DefectID,
+                                    TP_PM_Defect.Defectname as DefectName,
+                                    TP_PM_Defect.Defectcode as DefectCode,
+                                    TP_PM_Defect.Defectpositionid as DefectPositionID,
+                                    TP_PM_Defect.Defectpositionname as DefectPositionName,
+                                    TP_PM_Defect.Defectpositioncode as DefectPositionCode,
+                                    TP_PM_Defect.Defectprocedureid as DefectProcedureID,
+                                    TP_PM_Defect.Defectprocedurename as DefectProcedureName,
+                                    TP_PM_Defect.Defectprocedurecode as DefectProcedureCode,
+                                    TP_PM_Defect.Defectuserid as DefectUserID,
+                                    TP_PM_Defect.Defectusername as DefectUserName,
+                                    TP_PM_Defect.Defectusercode as DefectUserCode,
+                                    TP_PM_Defect.DefectJobs as Jobs,
+                                    nvl(TP_PM_Defect.MissedUserID,-1) as MissedUserID,
+                                    TP_PM_Defect.MissedUserCode,
+                                    TP_PM_Defect.MissedUserName,
+                                    TP_MST_Jobs.Jobsname as JobsText,
+                                    TP_PM_Defect.Remarks as DefectRemarks,
+                                    TP_PM_Defect.Productiondataid as ProductionDataID,
+                                    nvl(TP_PM_Defect.DefectProductionDataID,0) as DefectProductionDataID,
+                                    TP_PM_Defect.Defectfine as DefectFineID,
+                                    TP_MST_DefectFine.DefectFineCode as DefectFineValue,
+                                    TP_PM_Defect.SpecialDefect,
+                                    TP_PM_Defect.DefectDeductionNum,
+                                    TP_PM_Defect.CheckTime
+                                    from TP_PM_Defect
+                                    left join TP_MST_Jobs
+                                    on TP_PM_Defect.Defectjobs=TP_MST_Jobs.JobsID
+                                    left join TP_MST_DefectFine
+                                    on TP_PM_Defect.Defectfine= TP_MST_DefectFine.DefectFineid
+                                    where TP_PM_Defect.Productiondataid =:ProductionDataID";
+                string sqlString3 = @"select 
+                               TP_PM_DefectResponsible.ProductionDefectID as ProductionDefectID,
+                               TP_PM_DefectResponsible.Staffid as StaffID,
+                               TP_HR_Staff.Staffcode as StaffCode,
+                               TP_HR_Staff.Staffname as StaffName,
+                               TP_PM_DefectResponsible.Staffstatus as StaffStatus,
+                               TP_PM_DefectResponsible.UJobsID,
+                               TP_PM_DefectResponsible.SJobsID
+                               from TP_PM_DefectResponsible
+                               left join TP_HR_Staff
+                               on TP_PM_DefectResponsible.StaffID=TP_HR_Staff.Staffid
+                               where TP_PM_DefectResponsible.Productiondefectid in
+                               (
+                                select ProductionDefectID from TP_PM_Defect where TP_PM_Defect.Productiondataid=:ProductionDataID
+                               )";
+                string sqlString4 = @" select
+                               TP_PM_DefectImage.ProductionDefectID,
+                               TP_PM_DefectImage.Thumbnailpath,
+                               TP_PM_DefectImage.Imagepath
+                               from TP_PM_DefectImage
+                               where TP_PM_DefectImage.Productiondefectid in
+                               (
+                                select ProductionDefectID from TP_PM_Defect where TP_PM_Defect.Productiondataid=:ProductionDataID
+                                 )";
+                string sqlString5 = @"select 
+                               TP_PM_DefectMissedResponsible.ProductionDefectID as ProductionDefectID,
+                               TP_PM_DefectMissedResponsible.Staffid as StaffID,
+                               TP_HR_Staff.Staffcode as StaffCode,
+                               TP_HR_Staff.Staffname as StaffName,
+                               TP_PM_DefectMissedResponsible.Staffstatus as StaffStatus,
+                               TP_PM_DefectMissedResponsible.UJobsID,
+                               TP_PM_DefectMissedResponsible.SJobsID
+                               from TP_PM_DefectMissedResponsible
+                               left join TP_HR_Staff
+                               on TP_PM_DefectMissedResponsible.StaffID=TP_HR_Staff.Staffid
+                               where TP_PM_DefectMissedResponsible.Productiondefectid in
+                               (
+                                select ProductionDefectID from TP_PM_Defect where TP_PM_Defect.Productiondataid=:ProductionDataID
+                               )";
+                OracleParameter[] paras = new OracleParameter[]{
+                    new OracleParameter(":ProductionDataID",OracleDbType.Int32, productionDataID,ParameterDirection.Input),
+                };
+                DataSet ds = con.GetSqlResultToDs(sqlString, paras);
+                ds.Tables[0].TableName = "TP_PM_ProductionData";
+                DataSet ds2 = con.GetSqlResultToDs(sqlString2, paras);
+                ds2.Tables[0].TableName = "TP_PM_Defect";
+                DataSet ds3 = con.GetSqlResultToDs(sqlString3, paras);
+                ds3.Tables[0].TableName = "TP_PM_DefectResponsible";
+                DataSet ds4 = con.GetSqlResultToDs(sqlString4, paras);
+                ds4.Tables[0].TableName = "TP_PM_DefectImage";
+                DataSet ds5 = con.GetSqlResultToDs(sqlString5, paras);
+                ds5.Tables[0].TableName = "TP_PM_DefectMissedResponsible";
+                dsReturn.Tables.Add(ds.Tables[0].Copy());
+                dsReturn.Tables.Add(ds2.Tables[0].Copy());
+                dsReturn.Tables.Add(ds3.Tables[0].Copy());
+                dsReturn.Tables.Add(ds4.Tables[0].Copy());
+                dsReturn.Tables.Add(ds5.Tables[0].Copy());
+                return dsReturn;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            finally
+            {
+                if (con.ConnState == ConnectionState.Open)
+                {
+                    con.Close();
+                }
+            }
+        }
+
+
         /// <summary>
         /// 绑定图片
         /// </summary>

+ 11 - 0
WCF.Service/WCF.Contracts/IPDAModule.cs

@@ -731,6 +731,17 @@ namespace Dongke.IBOSS.PRD.WCF.Contracts
         ActionResult GetProductionDataByID(string accountCode, string userCode, string userPassword, string sessionKey, int productionDataID);
 
         /// <summary>
+        /// 根据所选生产数据ID,显示成检数据信息--复检专用
+        /// </summary>
+        /// <param name="productionDataID">生产数据ID</param>
+        /// <returns>DataSet</returns>
+        [OperationContract]
+        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest
+            , ResponseFormat = WebMessageFormat.Json
+            , RequestFormat = WebMessageFormat.Json)]
+        ActionResult GetProductionDataByIDSemiCheck(string accountCode, string userCode, string userPassword, string sessionKey, int productionDataID);
+
+        /// <summary>
         /// 编辑后删除生产数据
         /// </summary>
         /// <param name="productionDataID">生产数据ID</param>

+ 258 - 0
WCF.Service/WCF.Services/PDAModuleService.cs

@@ -2658,6 +2658,264 @@ namespace Dongke.IBOSS.PRD.WCF.Services
 			return actionResult;
 		}
 
+
+		/// <summary>
+		/// 根据所选生产数据ID,显示成检数据信息--复检专用
+		/// </summary>
+		/// <param name="productionDataID">生产数据ID</param>
+		/// <returns>DataSet</returns>
+		public ActionResult GetProductionDataByIDSemiCheck(string accountCode, string userCode, string userPassword, string sessionKey, int productionDataID)
+		{
+			ActionResult actionResult = new ActionResult();
+			try
+			{
+				// 验证请求头信息
+				actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
+
+				// 验证失败
+				if (actionResult.Status != (int)Constant.PDAResult.Success)
+				{
+					return actionResult;
+				}
+
+				DataSet reworkDs = ServiceInvoker.Invoke<DataSet>(this,
+				   () => PDAModuleLogic.GetProductionDataByIDSemiCheck(productionDataID));
+				PDAProductionDataResult productionDatas = new PDAProductionDataResult();
+				if (reworkDs != null && reworkDs.Tables.Count > Constant.INT_IS_ZERO)
+				{
+					if (reworkDs != null && reworkDs.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
+					{
+						for (int i = 0; i < reworkDs.Tables[0].Rows.Count; i++)
+						{
+							PDAProductionDataResult productionData = new PDAProductionDataResult();
+							productionData.BarCode = reworkDs.Tables[0].Rows[i]["BarCode"].ToString();
+							if (reworkDs.Tables[0].Rows[i]["GoodsID"].ToString() != "")
+							{
+								productionData.GoodsID = Convert.ToInt32(reworkDs.Tables[0].Rows[i]["GoodsID"].ToString());
+							}
+							productionData.GoodsCode = reworkDs.Tables[0].Rows[i]["GoodsCode"].ToString();
+							productionData.GoodsName = reworkDs.Tables[0].Rows[i]["GoodsName"].ToString();
+							if (reworkDs.Tables[0].Rows[0]["DefectFlagID"].ToString() != "")
+							{
+								productionData.DefectFlagID = Convert.ToInt32(reworkDs.Tables[0].Rows[i]["DefectFlagID"].ToString());
+							}
+							if (reworkDs.Tables[0].Rows[i]["ReworkProcedureID"].ToString() != "")
+							{
+								productionData.ReworkProcedureID = Convert.ToInt32(reworkDs.Tables[0].Rows[i]["ReworkProcedureID"].ToString());
+							}
+							productionData.Remarks = reworkDs.Tables[0].Rows[i]["Remarks"].ToString();
+							if (reworkDs.Tables[0].Rows[i]["UserID"].ToString() != "")
+							{
+								productionData.UserID = Convert.ToInt32(reworkDs.Tables[0].Rows[i]["UserID"].ToString());
+							}
+							if (reworkDs.Tables[0].Rows[i]["GoodsLevelTypeID"].ToString() != "")
+							{
+								productionData.GoodsLevelTypeID = Convert.ToInt32(reworkDs.Tables[0].Rows[i]["GoodsLevelTypeID"].ToString());
+							}
+							productionData.UserCode = reworkDs.Tables[0].Rows[i]["UserCode"].ToString();
+							productionData.UserName = reworkDs.Tables[0].Rows[i]["UserName"].ToString();
+							productionData.SpecialRepairflag = Convert.ToInt32(reworkDs.Tables[0].Rows[i]["SpecialRepairflag"]);
+							productionData.IsReFire = Convert.ToInt32(reworkDs.Tables[0].Rows[i]["IsReFire"]);
+							productionData.KilnCarCode = reworkDs.Tables[0].Rows[i]["KilnCarCode"].ToString();
+							productionData.KilnCode = reworkDs.Tables[0].Rows[i]["KilnCode"].ToString();
+							productionData.GlazeName = reworkDs.Tables[0].Rows[i]["GlazeName"].ToString();
+							if (reworkDs.Tables[0].Rows[i]["logoid"].ToString() != "")
+							{
+								productionData.LogoID = Convert.ToInt32(reworkDs.Tables[0].Rows[i]["logoid"]);
+								productionData.LogoCode = reworkDs.Tables[0].Rows[i]["LogoCode"].ToString();
+								productionData.LogoName = reworkDs.Tables[0].Rows[i]["LogoName"].ToString();
+							}
+							productionData.CreateTime = Convert.ToDateTime(reworkDs.Tables[0].Rows[i]["CreateTime"]);
+							if (reworkDs.Tables[0].Rows[i]["CheckTime"].ToString() != "")
+							{
+								productionData.CheckTime = Convert.ToDateTime(reworkDs.Tables[0].Rows[i]["CheckTime"].ToString());
+							}
+							DataView dvDefect = reworkDs.Tables[1].DefaultView;
+							dvDefect.RowFilter = "BarCode=" + reworkDs.Tables[0].Rows[i]["BarCode"].ToString();
+							DataTable dtDefect = dvDefect.ToTable();
+							for (int row = 0; row < dtDefect.Rows.Count; row++)
+							{
+								// 产品缺陷
+								PDADefectResult defect = new PDADefectResult();
+								defect.SpecialDefect = dtDefect.Rows[row]["SpecialDefect"].ToString();
+								defect.DefectDeductionNum = Convert.ToDecimal(dtDefect.Rows[row]["DefectDeductionNum"].ToString());
+								if (dtDefect.Rows[row]["ProductionDefectID"].ToString() != "")
+								{
+									defect.ProductionDefectID = Convert.ToInt32(dtDefect.Rows[row]["ProductionDefectID"].ToString());
+								}
+								defect.BarCode = dtDefect.Rows[row]["BarCode"].ToString();
+								if (dtDefect.Rows[row]["DefectID"].ToString() != "")
+								{
+									defect.DefectID = Convert.ToInt32(dtDefect.Rows[row]["DefectID"].ToString());
+								}
+								defect.DefectName = dtDefect.Rows[row]["DefectName"].ToString();
+								defect.DefectCode = dtDefect.Rows[row]["DefectCode"].ToString();
+								if (dtDefect.Rows[row]["DefectPositionID"].ToString() != "")
+								{
+									defect.DefectPositionID = Convert.ToInt32(dtDefect.Rows[row]["DefectPositionID"].ToString());
+								}
+								defect.DefectPositionName = dtDefect.Rows[row]["DefectPositionName"].ToString();
+								defect.DefectPositionCode = dtDefect.Rows[row]["DefectPositionCode"].ToString();
+								if (dtDefect.Rows[row]["DefectProcedureID"].ToString() != "")
+								{
+									defect.DefectProcedureID = Convert.ToInt32(dtDefect.Rows[row]["DefectProcedureID"].ToString());
+								}
+								defect.DefectProcedureName = dtDefect.Rows[row]["DefectProcedureName"].ToString();
+								defect.DefectProcedureCode = dtDefect.Rows[row]["DefectProcedureCode"].ToString();
+								if (dtDefect.Rows[row]["DefectUserID"].ToString() != "")
+								{
+									defect.DefectUserID = Convert.ToInt32(dtDefect.Rows[row]["DefectUserID"].ToString());
+								}
+								defect.DefectUserName = dtDefect.Rows[row]["DefectUserName"].ToString();
+								defect.DefectUserCode = dtDefect.Rows[row]["DefectUserCode"].ToString();
+								if (dtDefect.Rows[row]["Jobs"].ToString() != "")
+								{
+									defect.Jobs = Convert.ToInt32(dtDefect.Rows[row]["Jobs"].ToString());
+								}
+								if (dtDefect.Rows[row]["MissedUserID"].ToString() != "")
+								{
+									defect.MissedUserID = Convert.ToInt32(dtDefect.Rows[row]["MissedUserID"].ToString());
+								}
+								defect.MissedUserCode = dtDefect.Rows[row]["MissedUserCode"].ToString();
+								defect.MissedUserName = dtDefect.Rows[row]["MissedUserName"].ToString();
+								defect.JobsText = dtDefect.Rows[row]["JobsText"].ToString();
+								defect.DefectRemarks = dtDefect.Rows[row]["DefectRemarks"].ToString();
+
+								if (dtDefect.Rows[row]["ProductionDataID"].ToString() != "")
+								{
+									defect.ProductionDataID = Convert.ToInt32(dtDefect.Rows[row]["ProductionDataID"].ToString());
+								}
+
+								if (dtDefect.Rows[row]["DefectProductionDataID"].ToString() != "")
+								{
+									defect.DefectProductionDataID = Convert.ToInt32(dtDefect.Rows[row]["DefectProductionDataID"].ToString());
+								}
+
+								if (dtDefect.Rows[row]["DefectFineID"].ToString() != "")
+								{
+									defect.DefectFineID = Convert.ToInt32(dtDefect.Rows[row]["DefectFineID"].ToString());
+								}
+								defect.DefectFineValue = dtDefect.Rows[row]["DefectFineValue"].ToString();
+								defect.CheckTime = Convert.ToDateTime(dtDefect.Rows[row]["CheckTime"]);
+								//--------责任员工-------------------
+								DataRow[] drRow = reworkDs.Tables[2].Select("ProductionDefectID=" + reworkDs.Tables[1].Rows[row]["ProductionDefectID"]);
+								if (drRow.Length > Constant.INT_IS_ZERO)
+								{
+									foreach (DataRow r in drRow)
+									{
+										PDADefectResponsibleResult defectResponsible = new PDADefectResponsibleResult();
+										if (r["ProductionDefectID"].ToString() != "")
+										{
+											defectResponsible.ProductionDefectID = Convert.ToInt32(r["ProductionDefectID"]);
+										}
+										if (r["StaffID"].ToString() != "")
+										{
+											defectResponsible.StaffID = Convert.ToInt32(r["StaffID"]);
+										}
+										defectResponsible.StaffCode = r["StaffCode"].ToString();
+										defectResponsible.StaffName = r["StaffName"].ToString();
+										if (r["StaffStatus"].ToString() != "")
+										{
+											defectResponsible.StaffStatus = Convert.ToInt32(r["StaffStatus"]);
+										}
+										if (r["UJobsID"].ToString() != "")
+										{
+											defectResponsible.UJobsID = Convert.ToInt32(r["UJobsID"]);
+										}
+										if (r["SJobsID"].ToString() != "")
+										{
+											defectResponsible.SJobsID = Convert.ToInt32(r["SJobsID"]);
+										}
+										defect.PDADefectResponsibles.Add(defectResponsible);
+									}
+								}
+								//------------------------------
+
+								//--------漏检员工-------------------
+								DataRow[] drMissedRow = reworkDs.Tables[4].Select("ProductionDefectID=" + reworkDs.Tables[1].Rows[i]["ProductionDefectID"]);
+								if (drMissedRow.Length > Constant.INT_IS_ZERO)
+								{
+									foreach (DataRow r in drMissedRow)
+									{
+										PDADefectMissedResponsibleResult defectMissedResponsible = new PDADefectMissedResponsibleResult();
+										if (r["ProductionDefectID"].ToString() != "")
+										{
+											defectMissedResponsible.ProductionDefectID = Convert.ToInt32(r["ProductionDefectID"]);
+										}
+										if (r["StaffID"].ToString() != "")
+										{
+											defectMissedResponsible.StaffID = Convert.ToInt32(r["StaffID"]);
+										}
+										defectMissedResponsible.StaffCode = r["StaffCode"].ToString();
+										defectMissedResponsible.StaffName = r["StaffName"].ToString();
+										if (r["StaffStatus"].ToString() != "")
+										{
+											defectMissedResponsible.StaffStatus = Convert.ToInt32(r["StaffStatus"]);
+										}
+										if (r["UJobsID"].ToString() != "")
+										{
+											defectMissedResponsible.UJobsID = Convert.ToInt32(r["UJobsID"]);
+										}
+										if (r["SJobsID"].ToString() != "")
+										{
+											defectMissedResponsible.SJobsID = Convert.ToInt32(r["SJobsID"]);
+										}
+										defect.PDADefectMissedResponsibles.Add(defectMissedResponsible);
+									}
+								}
+								//------------------------------
+								DataRow[] drImageRow = reworkDs.Tables[3].Select("ProductionDefectID=" + reworkDs.Tables[1].Rows[row]["ProductionDefectID"]);
+								if (drImageRow.Length > Constant.INT_IS_ZERO)
+								{
+									foreach (DataRow r in drImageRow)
+									{
+										PDADefectImageResult defectImage = new PDADefectImageResult();
+										if (r["ProductionDefectID"].ToString() != "")
+										{
+											defectImage.ProductionDefectID = Convert.ToInt32(r["ProductionDefectID"]);
+										}
+										defectImage.Thumbnailpath = r["Thumbnailpath"].ToString();
+										//if (File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + r["Imagepath"].ToString()))
+										//{
+										defectImage.Imagepath = r["Imagepath"].ToString();// r["Imagepath"].ToString();
+																						  //}
+										defect.PDADefectImageResults.Add(defectImage);
+									}
+								}
+								productionData.PDADefects.Add(defect);
+							}
+							if (productionDatas.PDAProductionData == null)
+							{
+								productionDatas.PDAProductionData = new System.Collections.Generic.List<PDAProductionDataResult>();
+							}
+							productionDatas.PDAProductionData.Add(productionData);
+							//---------------------------------------------------------------------------------
+						}
+					}
+					actionResult.Result = JsonHelper.ToJson(productionDatas);
+					actionResult.Status = (int)Constant.PDAResult.Success;
+				}
+				else
+				{
+					actionResult.Status = (int)Constant.PDAResult.Fail;
+					actionResult.Message = Constant.PDA_RESULT_UNKNOWN_ERR;
+				}
+			}
+			catch (Exception ex)
+			{
+				//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
+				OutputLog.TraceLog(LogPriority.Error,
+								this.ToString(),
+								System.Reflection.MethodBase.GetCurrentMethod().Name,
+								ex.ToString(),
+								LocalPath.LogExePath);
+				actionResult.Status = (int)Constant.PDAResult.Exception;
+				actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
+			}
+			return actionResult;
+		}
+
+
 		/// <summary>
 		/// 编辑后删除生产数据
 		/// </summary>