/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TQC_ROLL_COMMUTE GetModel_Interface_Trans(string C_MASTER_ID, string C_GP_BEFORE_ID, string C_GP_AFTER_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_ROLL_ID,C_STA_ID,C_STA_DESC,C_STOVE,C_BATCH_NO,C_TICK_NO,N_WGT,C_STL_GRD_BEFORE,C_STD_CODE_BEFORE,C_SPEC_BEFORE,C_MAT_CODE_BEFORE,C_MAT_DESC_BEFORE,D_COMMUTE_DATE,C_STL_GRD_AFTER,C_STD_CODE_AFTER,C_SPEC_AFTER,C_MAT_CODE_AFTER,C_MAT_DESC_AFTER,C_REASON_DEPMT_ID,C_REASON_DEPMT_DESC,C_GP_TYPE,C_SCUTCHEON,N_STATUS,C_REMARK,C_EMP_ID,D_MOD_DT,C_MASTER_ID,C_GP_BEFORE_ID,C_GP_AFTER_ID,C_ZYX1_BEFORE,C_ZYX2_BEFORE,C_ZYX1_AFTER,C_ZYX2_AFTER,C_JUDGE_LEV_BP_BEFORE,C_JUDGE_LEV_BP_AFTER,C_BZYQ_BEFORE,C_BZYQ_AFTER,C_COMMUTE_REASON from TQC_ROLL_COMMUTE "); strSql.Append(" where C_MASTER_ID=:C_MASTER_ID "); strSql.Append(" and C_GP_BEFORE_ID=:C_GP_BEFORE_ID "); strSql.Append(" and C_GP_AFTER_ID=:C_GP_AFTER_ID "); OracleParameter[] parameters = { new OracleParameter(":C_MASTER_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_GP_BEFORE_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_GP_AFTER_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_MASTER_ID; parameters[1].Value = C_GP_BEFORE_ID; parameters[2].Value = C_GP_AFTER_ID; Mod_TQC_ROLL_COMMUTE model = new Mod_TQC_ROLL_COMMUTE(); DataSet ds = TransactionHelper.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TQC_ROLL_COMMUTE DataRowToModel(DataRow row) { Mod_TQC_ROLL_COMMUTE model = new Mod_TQC_ROLL_COMMUTE(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_ROLL_ID"] != null) { model.C_ROLL_ID = row["C_ROLL_ID"].ToString(); } if (row["C_STA_ID"] != null) { model.C_STA_ID = row["C_STA_ID"].ToString(); } if (row["C_STA_DESC"] != null) { model.C_STA_DESC = row["C_STA_DESC"].ToString(); } if (row["C_STOVE"] != null) { model.C_STOVE = row["C_STOVE"].ToString(); } if (row["C_BATCH_NO"] != null) { model.C_BATCH_NO = row["C_BATCH_NO"].ToString(); } if (row["C_TICK_NO"] != null) { model.C_TICK_NO = row["C_TICK_NO"].ToString(); } if (row["N_WGT"] != null && row["N_WGT"].ToString() != "") { model.N_WGT = decimal.Parse(row["N_WGT"].ToString()); } if (row["C_STL_GRD_BEFORE"] != null) { model.C_STL_GRD_BEFORE = row["C_STL_GRD_BEFORE"].ToString(); } if (row["C_STD_CODE_BEFORE"] != null) { model.C_STD_CODE_BEFORE = row["C_STD_CODE_BEFORE"].ToString(); } if (row["C_SPEC_BEFORE"] != null) { model.C_SPEC_BEFORE = row["C_SPEC_BEFORE"].ToString(); } if (row["C_MAT_CODE_BEFORE"] != null) { model.C_MAT_CODE_BEFORE = row["C_MAT_CODE_BEFORE"].ToString(); } if (row["C_MAT_DESC_BEFORE"] != null) { model.C_MAT_DESC_BEFORE = row["C_MAT_DESC_BEFORE"].ToString(); } if (row["D_COMMUTE_DATE"] != null && row["D_COMMUTE_DATE"].ToString() != "") { model.D_COMMUTE_DATE = DateTime.Parse(row["D_COMMUTE_DATE"].ToString()); } if (row["C_STL_GRD_AFTER"] != null) { model.C_STL_GRD_AFTER = row["C_STL_GRD_AFTER"].ToString(); } if (row["C_STD_CODE_AFTER"] != null) { model.C_STD_CODE_AFTER = row["C_STD_CODE_AFTER"].ToString(); } if (row["C_SPEC_AFTER"] != null) { model.C_SPEC_AFTER = row["C_SPEC_AFTER"].ToString(); } if (row["C_MAT_CODE_AFTER"] != null) { model.C_MAT_CODE_AFTER = row["C_MAT_CODE_AFTER"].ToString(); } if (row["C_MAT_DESC_AFTER"] != null) { model.C_MAT_DESC_AFTER = row["C_MAT_DESC_AFTER"].ToString(); } if (row["C_REASON_DEPMT_ID"] != null) { model.C_REASON_DEPMT_ID = row["C_REASON_DEPMT_ID"].ToString(); } if (row["C_REASON_DEPMT_DESC"] != null) { model.C_REASON_DEPMT_DESC = row["C_REASON_DEPMT_DESC"].ToString(); } if (row["C_GP_TYPE"] != null) { model.C_GP_TYPE = row["C_GP_TYPE"].ToString(); } if (row["C_SCUTCHEON"] != null) { model.C_SCUTCHEON = row["C_SCUTCHEON"].ToString(); } if (row["N_STATUS"] != null && row["N_STATUS"].ToString() != "") { model.N_STATUS = decimal.Parse(row["N_STATUS"].ToString()); } if (row["C_REMARK"] != null) { model.C_REMARK = row["C_REMARK"].ToString(); } if (row["C_EMP_ID"] != null) { model.C_EMP_ID = row["C_EMP_ID"].ToString(); } if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "") { model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString()); } if (row["C_MASTER_ID"] != null) { model.C_MASTER_ID = row["C_MASTER_ID"].ToString(); } if (row["C_GP_BEFORE_ID"] != null) { model.C_GP_BEFORE_ID = row["C_GP_BEFORE_ID"].ToString(); } if (row["C_GP_AFTER_ID"] != null) { model.C_GP_AFTER_ID = row["C_GP_AFTER_ID"].ToString(); } if (row["C_ZYX1_BEFORE"] != null) { model.C_ZYX1_BEFORE = row["C_ZYX1_BEFORE"].ToString(); } if (row["C_ZYX2_BEFORE"] != null) { model.C_ZYX2_BEFORE = row["C_ZYX2_BEFORE"].ToString(); } if (row["C_ZYX1_AFTER"] != null) { model.C_ZYX1_AFTER = row["C_ZYX1_AFTER"].ToString(); } if (row["C_ZYX2_AFTER"] != null) { model.C_ZYX2_AFTER = row["C_ZYX2_AFTER"].ToString(); } if (row["C_JUDGE_LEV_BP_BEFORE"] != null) { model.C_JUDGE_LEV_BP_BEFORE = row["C_JUDGE_LEV_BP_BEFORE"].ToString(); } if (row["C_JUDGE_LEV_BP_AFTER"] != null) { model.C_JUDGE_LEV_BP_AFTER = row["C_JUDGE_LEV_BP_AFTER"].ToString(); } if (row["C_BZYQ_BEFORE"] != null) { model.C_BZYQ_BEFORE = row["C_BZYQ_BEFORE"].ToString(); } if (row["C_BZYQ_AFTER"] != null) { model.C_BZYQ_AFTER = row["C_BZYQ_AFTER"].ToString(); } if (row["C_COMMUTE_REASON"] != null) { model.C_COMMUTE_REASON = row["C_COMMUTE_REASON"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TQC_ROLL_COMMUTE model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TQC_ROLL_COMMUTE("); strSql.Append("C_ROLL_ID,C_STA_ID,C_STA_DESC,C_STOVE,C_BATCH_NO,C_TICK_NO,N_WGT,C_STL_GRD_BEFORE,C_STD_CODE_BEFORE,C_SPEC_BEFORE,C_MAT_CODE_BEFORE,C_MAT_DESC_BEFORE,D_COMMUTE_DATE,C_STL_GRD_AFTER,C_STD_CODE_AFTER,C_SPEC_AFTER,C_MAT_CODE_AFTER,C_MAT_DESC_AFTER,C_REASON_DEPMT_ID,C_REASON_DEPMT_DESC,C_GP_TYPE,C_SCUTCHEON,N_STATUS,C_REMARK,C_EMP_ID,D_MOD_DT,C_MASTER_ID,C_GP_BEFORE_ID,C_GP_AFTER_ID,C_ZYX1_BEFORE,C_ZYX2_BEFORE,C_ZYX1_AFTER,C_ZYX2_AFTER,C_JUDGE_LEV_BP_BEFORE,C_JUDGE_LEV_BP_AFTER,C_BZYQ_BEFORE,C_BZYQ_AFTER,C_COMMUTE_REASON)"); strSql.Append(" values ("); strSql.Append(":C_ROLL_ID,:C_STA_ID,:C_STA_DESC,:C_STOVE,:C_BATCH_NO,:C_TICK_NO,:N_WGT,:C_STL_GRD_BEFORE,:C_STD_CODE_BEFORE,:C_SPEC_BEFORE,:C_MAT_CODE_BEFORE,:C_MAT_DESC_BEFORE,:D_COMMUTE_DATE,:C_STL_GRD_AFTER,:C_STD_CODE_AFTER,:C_SPEC_AFTER,:C_MAT_CODE_AFTER,:C_MAT_DESC_AFTER,:C_REASON_DEPMT_ID,:C_REASON_DEPMT_DESC,:C_GP_TYPE,:C_SCUTCHEON,:N_STATUS,:C_REMARK,:C_EMP_ID,:D_MOD_DT,:C_MASTER_ID,:C_GP_BEFORE_ID,:C_GP_AFTER_ID,:C_ZYX1_BEFORE,:C_ZYX2_BEFORE,:C_ZYX1_AFTER,:C_ZYX2_AFTER,:C_JUDGE_LEV_BP_BEFORE,C_JUDGE_LEV_BP_AFTER,:C_BZYQ_BEFORE,:C_BZYQ_AFTER,:C_COMMUTE_REASON)"); OracleParameter[] parameters = { new OracleParameter(":C_ROLL_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_STA_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_STA_DESC", OracleDbType.Varchar2, 100), new OracleParameter(":C_STOVE", OracleDbType.Varchar2, 100), new OracleParameter(":C_BATCH_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_TICK_NO", OracleDbType.Varchar2, 100), new OracleParameter(":N_WGT", OracleDbType.Decimal, 15), new OracleParameter(":C_STL_GRD_BEFORE", OracleDbType.Varchar2, 100), new OracleParameter(":C_STD_CODE_BEFORE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SPEC_BEFORE", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_CODE_BEFORE", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_DESC_BEFORE", OracleDbType.Varchar2, 100), new OracleParameter(":D_COMMUTE_DATE", OracleDbType.Date), new OracleParameter(":C_STL_GRD_AFTER", OracleDbType.Varchar2, 100), new OracleParameter(":C_STD_CODE_AFTER", OracleDbType.Varchar2, 100), new OracleParameter(":C_SPEC_AFTER", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_CODE_AFTER", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_DESC_AFTER", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_DEPMT_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_DEPMT_DESC", OracleDbType.Varchar2, 100), new OracleParameter(":C_GP_TYPE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SCUTCHEON", OracleDbType.Varchar2, 100), new OracleParameter(":N_STATUS", OracleDbType.Decimal, 1), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_MASTER_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_GP_BEFORE_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_GP_AFTER_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_ZYX1_BEFORE", OracleDbType.Varchar2, 100), new OracleParameter(":C_ZYX2_BEFORE", OracleDbType.Varchar2, 100), new OracleParameter(":C_ZYX1_AFTER", OracleDbType.Varchar2, 100), new OracleParameter(":C_ZYX2_AFTER", OracleDbType.Varchar2, 100), new OracleParameter(":C_JUDGE_LEV_BP_BEFORE", OracleDbType.Varchar2, 100), new OracleParameter(":C_JUDGE_LEV_BP_AFTER", OracleDbType.Varchar2, 100), new OracleParameter(":C_BZYQ_BEFORE", OracleDbType.Varchar2, 100), new OracleParameter(":C_BZYQ_AFTER", OracleDbType.Varchar2, 100), new OracleParameter(":C_COMMUTE_REASON", OracleDbType.Varchar2, 200) }; parameters[0].Value = model.C_ROLL_ID; parameters[1].Value = model.C_STA_ID; parameters[2].Value = model.C_STA_DESC; parameters[3].Value = model.C_STOVE; parameters[4].Value = model.C_BATCH_NO; parameters[5].Value = model.C_TICK_NO; parameters[6].Value = model.N_WGT; parameters[7].Value = model.C_STL_GRD_BEFORE; parameters[8].Value = model.C_STD_CODE_BEFORE; parameters[9].Value = model.C_SPEC_BEFORE; parameters[10].Value = model.C_MAT_CODE_BEFORE; parameters[11].Value = model.C_MAT_DESC_BEFORE; parameters[12].Value = model.D_COMMUTE_DATE; parameters[13].Value = model.C_STL_GRD_AFTER; parameters[14].Value = model.C_STD_CODE_AFTER; parameters[15].Value = model.C_SPEC_AFTER; parameters[16].Value = model.C_MAT_CODE_AFTER; parameters[17].Value = model.C_MAT_DESC_AFTER; parameters[18].Value = model.C_REASON_DEPMT_ID; parameters[19].Value = model.C_REASON_DEPMT_DESC; parameters[20].Value = model.C_GP_TYPE; parameters[21].Value = model.C_SCUTCHEON; parameters[22].Value = model.N_STATUS; parameters[23].Value = model.C_REMARK; parameters[24].Value = model.C_EMP_ID; parameters[25].Value = model.D_MOD_DT; parameters[26].Value = model.C_MASTER_ID; parameters[27].Value = model.C_GP_BEFORE_ID; parameters[28].Value = model.C_GP_AFTER_ID; parameters[29].Value = model.C_ZYX1_BEFORE; parameters[30].Value = model.C_ZYX2_BEFORE; parameters[31].Value = model.C_ZYX1_AFTER; parameters[32].Value = model.C_ZYX2_AFTER; parameters[33].Value = model.C_JUDGE_LEV_BP_BEFORE; parameters[34].Value = model.C_JUDGE_LEV_BP_AFTER; parameters[35].Value = model.C_BZYQ_BEFORE; parameters[36].Value = model.C_BZYQ_AFTER; parameters[37].Value = model.C_COMMUTE_REASON; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 改判 /// </summary> /// <param name="strs">已选择的数据ID数组</param> /// <param name="strGrd">钢种</param> /// <param name="strStdCode">执行标准</param> /// <param name="strMatCode">物料编码</param> /// <param name="strMatName">物料名称</param> /// <param name="strZrdwID">责任单位代码</param> /// <param name="strZrdwName">责任单位描述</param> /// <param name="strRemark">备注</param> /// <param name="strUrl">NC接口地址</param> /// <param name="strPDDJ">判定等级</param> /// <param name="strZYX1">自由项1</param> /// <param name="strZYX2">自由项2</param> /// <param name="strBZYQ">包装要求</param> /// <param name="strGPYY">改判原因</param> /// <returns></returns> public string Gp_Roll_WW(string strs, string strGrd, string strStdCode, string strMatCode, string strMatName, string strZrdwID, string strZrdwName, string strRemark, string strUrl, string strPDDJ, string strZYX1, string strZYX2, string strBZYQ, string strGPYY) { string result = "1"; try { Dal_TRC_ROLL_PRODCUT dalTrcRollProduct = new Dal_TRC_ROLL_PRODCUT(); Dal_Interface_NC_Roll_KC4N dalInterface = new Dal_Interface_NC_Roll_KC4N(); Dal_TB_STD_CONFIG dalTbStdConfig = new Dal_TB_STD_CONFIG(); Dal_TQD_DESIGN dalDesign = new Dal_TQD_DESIGN(); TransactionHelper.BeginTransaction(); TransactionHelper_SQL.BeginTransaction(); string strUserID = RV.UI.UserInfo.userID; DateTime time = RV.UI.ServerTime.timeNow(); string strBatch = ""; string C_MASTER_ID = ""; string C_GP_BEFORE_ID = ""; string C_GP_AFTER_ID = ""; string strDesignNo = dalDesign.Get_Design_No(strStdCode, strGrd); if (string.IsNullOrEmpty(strDesignNo)) { return("改判失败,没有找到对应的执行标准信息!"); } DataTable dt = dal.GetList_max().Tables[0]; if (string.IsNullOrEmpty(dt.Rows[0]["C_MASTER_ID"].ToString())) { C_MASTER_ID = "XJ" + time.ToString("yyMMdd00001"); } else { C_MASTER_ID = "XJ" + (Convert.ToInt64(dt.Rows[0]["C_MASTER_ID"].ToString()) + 1).ToString(); } if (string.IsNullOrEmpty(dt.Rows[0]["C_GP_BEFORE_ID"].ToString())) { C_GP_BEFORE_ID = "XQ" + time.ToString("yyMMdd00001"); } else { C_GP_BEFORE_ID = "XQ" + (Convert.ToInt64(dt.Rows[0]["C_GP_BEFORE_ID"].ToString()) + 1).ToString(); } if (string.IsNullOrEmpty(dt.Rows[0]["C_GP_AFTER_ID"].ToString())) { C_GP_AFTER_ID = "XH" + time.ToString("yyMMdd00001"); } else { C_GP_AFTER_ID = "XH" + (Convert.ToInt64(dt.Rows[0]["C_GP_AFTER_ID"].ToString()) + 1).ToString(); } string[] strs_Product_ID = strs.Substring(0, strs.Length - 1).Split(','); if (strs_Product_ID.Length == 0) { return("改判失败,请选择需要改判的数据!"); } for (int i = 0; i < strs_Product_ID.Length; i++) { Mod_TRC_ROLL_PRODCUT modProduct = dalTrcRollProduct.GetModel(strs_Product_ID[i]); strBatch = modProduct.C_BATCH_NO; if (modProduct != null) { Mod_TQC_ROLL_COMMUTE modTqcRollCommute = new Mod_TQC_ROLL_COMMUTE(); modTqcRollCommute.C_ROLL_ID = modProduct.C_ID; modTqcRollCommute.C_STA_ID = modProduct.C_PLANT_ID; //modTqcRollCommute.C_STA_DESC = modProduct.C_PLANT_DESC; modTqcRollCommute.C_STOVE = modProduct.C_STOVE; modTqcRollCommute.C_BATCH_NO = modProduct.C_BATCH_NO; modTqcRollCommute.C_TICK_NO = modProduct.C_TICK_NO; modTqcRollCommute.N_WGT = Convert.ToDecimal(modProduct.N_WGT); modTqcRollCommute.C_STL_GRD_BEFORE = modProduct.C_STL_GRD; modTqcRollCommute.C_STA_ID = modProduct.C_STA_ID; modTqcRollCommute.C_STD_CODE_BEFORE = modProduct.C_STD_CODE; modTqcRollCommute.C_SPEC_BEFORE = modProduct.C_SPEC; modTqcRollCommute.C_MAT_CODE_BEFORE = modProduct.C_MAT_CODE; modTqcRollCommute.C_MAT_DESC_BEFORE = modProduct.C_MAT_DESC; modTqcRollCommute.C_ZYX1_BEFORE = modProduct.C_ZYX1; modTqcRollCommute.C_ZYX2_BEFORE = modProduct.C_ZYX2; modTqcRollCommute.C_JUDGE_LEV_BP_BEFORE = modProduct.C_JUDGE_LEV_ZH; modTqcRollCommute.D_COMMUTE_DATE = time; modTqcRollCommute.C_STL_GRD_AFTER = strGrd; modTqcRollCommute.C_STD_CODE_AFTER = strStdCode; modTqcRollCommute.C_SPEC_AFTER = modProduct.C_SPEC; modTqcRollCommute.C_MAT_CODE_AFTER = strMatCode; modTqcRollCommute.C_MAT_DESC_AFTER = strMatName; modTqcRollCommute.C_REASON_DEPMT_ID = strZrdwID; modTqcRollCommute.C_REASON_DEPMT_DESC = strZrdwName; modTqcRollCommute.C_ZYX1_AFTER = strZYX1; modTqcRollCommute.C_ZYX2_AFTER = strZYX2; modTqcRollCommute.C_EMP_ID = strUserID; modTqcRollCommute.C_REMARK = strRemark; modTqcRollCommute.C_MASTER_ID = C_MASTER_ID; modTqcRollCommute.C_GP_BEFORE_ID = C_GP_BEFORE_ID; modTqcRollCommute.C_GP_AFTER_ID = C_GP_AFTER_ID; modTqcRollCommute.C_JUDGE_LEV_BP_AFTER = strPDDJ; modTqcRollCommute.C_BZYQ_AFTER = strBZYQ; modTqcRollCommute.C_BZYQ_BEFORE = modProduct.C_BZYQ; modTqcRollCommute.C_COMMUTE_REASON = strGPYY; if (dal.Add_Trans(modTqcRollCommute)) { modProduct.C_STD_CODE = strStdCode; modProduct.C_STL_GRD = strGrd; modProduct.C_MAT_DESC = strMatName; modProduct.C_MAT_CODE = strMatCode; modProduct.C_MASTER_ID = C_MASTER_ID; modProduct.C_JUDGE_LEV_ZH = strPDDJ; modProduct.C_GP_BEFORE_ID = C_GP_BEFORE_ID; modProduct.C_GP_AFTER_ID = C_GP_AFTER_ID; modProduct.C_ZYX1 = strZYX1; modProduct.C_ZYX2 = strZYX2; modProduct.C_BZYQ = strBZYQ; modProduct.C_JUDGE_LEV_ZH = strPDDJ; modProduct.C_IS_PD = "N"; modProduct.C_IS_QR = "Y"; modProduct.C_QR_USER = strUserID; modProduct.D_QR_DATE = time; modProduct.C_DESIGN_NO = strDesignNo; modProduct.C_QGP_STATE = "Y"; modProduct.C_COMMUTE_REASON = strGPYY; if (!dalTrcRollProduct.Update_Trans(modProduct)) { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return("改判失败,请检查改判的信息!"); } } else { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return("改判失败,添加改判记录失败!"); } } } //综合判定需要 if (!dalTrcRollProduct.Update_Batch_No(strBatch)) { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return("改判失败,请检查批号!"); } string result_NC = dalInterface.SendXml_GP(strUrl, C_MASTER_ID, C_GP_BEFORE_ID, C_GP_AFTER_ID); if (result_NC != "1") { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return(result_NC); } TransactionHelper_SQL.Commit(); TransactionHelper.Commit(); } catch (Exception ex) { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return(ex.Message); } return(result); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TQC_ROLL_COMMUTE model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TQC_ROLL_COMMUTE model) { return(dal.Add(model)); }
/// <summary> /// 改判 /// </summary> /// <param name="strs">已选择的数据ID数组</param> /// <param name="strGrd">钢种</param> /// <param name="strStdCode">执行标准</param> /// <param name="strMatCode">物料编码</param> /// <param name="strMatName">物料名称</param> /// <param name="strZrdwID">责任单位代码</param> /// <param name="strZrdwName">责任单位描述</param> /// <param name="strRemark">备注</param> /// <param name="strUrl">NC接口地址</param> /// <param name="strPDDJ">判定等级</param> /// <param name="strZYX1">自由项1</param> /// <param name="strZYX2">自由项2</param> /// <param name="strBZYQ">包装要求</param> /// <param name="strGPYY">改判原因</param> /// <returns></returns> public string Gp_Roll(string strs, string strGrd, string strStdCode, string strMatCode, string strMatName, string strZrdwID, string strZrdwName, string strRemark, string strUrl, string strPDDJ, string strZYX1, string strZYX2, string strBZYQ, string strGPYY) { string result = "1"; try { Dal_TRC_ROLL_PRODCUT dalTrcRollProduct = new Dal_TRC_ROLL_PRODCUT(); Dal_Interface_NC_Roll_KC4N dalInterface = new Dal_Interface_NC_Roll_KC4N(); Dal_TB_STD_CONFIG dalTbStdConfig = new Dal_TB_STD_CONFIG(); Dal_TQD_DESIGN dalDesign = new Dal_TQD_DESIGN(); TransactionHelper.BeginTransaction(); TransactionHelper_SQL.BeginTransaction(); string strUserID = RV.UI.UserInfo.userID; DateTime time = RV.UI.ServerTime.timeNow(); string strBatch = ""; string C_MASTER_ID = ""; string C_GP_BEFORE_ID = ""; string C_GP_AFTER_ID = ""; string strDesignNo = dalDesign.Get_Design_No(strStdCode, strGrd); if (string.IsNullOrEmpty(strDesignNo)) { return("改判失败,没有找到对应的执行标准信息!"); } DataTable dt = dal.GetList_max().Tables[0]; if (string.IsNullOrEmpty(dt.Rows[0]["C_MASTER_ID"].ToString())) { C_MASTER_ID = "XJ" + time.ToString("yyMMdd00001"); } else { C_MASTER_ID = "XJ" + (Convert.ToInt64(dt.Rows[0]["C_MASTER_ID"].ToString()) + 1).ToString(); } if (string.IsNullOrEmpty(dt.Rows[0]["C_GP_BEFORE_ID"].ToString())) { C_GP_BEFORE_ID = "XQ" + time.ToString("yyMMdd00001"); } else { C_GP_BEFORE_ID = "XQ" + (Convert.ToInt64(dt.Rows[0]["C_GP_BEFORE_ID"].ToString()) + 1).ToString(); } if (string.IsNullOrEmpty(dt.Rows[0]["C_GP_AFTER_ID"].ToString())) { C_GP_AFTER_ID = "XH" + time.ToString("yyMMdd00001"); } else { C_GP_AFTER_ID = "XH" + (Convert.ToInt64(dt.Rows[0]["C_GP_AFTER_ID"].ToString()) + 1).ToString(); } string[] strs_Product_ID = strs.Substring(0, strs.Length - 1).Split(','); if (strs_Product_ID.Length == 0) { return("改判失败,请选择需要改判的数据!"); } for (int i = 0; i < strs_Product_ID.Length; i++) { Mod_TRC_ROLL_PRODCUT modProduct = dalTrcRollProduct.GetModel(strs_Product_ID[i]); strBatch = modProduct.C_BATCH_NO; string sql = ""; sql += "insert into ReZJB_GPD(Barcode,WGDH,CK,HW,PCH,WLH,WLMC,SX,PH,GG,BB,GH,ZL,BZ,RQ,RKType,RKRY,WeightRQ,ProduceData,PCInfo,vfree0,vfree3,GPTYPE,ZJBstatus,CAPPK,vfree1,vfree2,insertts) values('" + modProduct.C_BARCODE + "','" + modProduct.C_TRC_ROLL_MAIN_ID + "','" + modProduct.C_LINEWH_CODE + "','" + modProduct.C_LINEWH_LOC_CODE + "','" + modProduct.C_BATCH_NO + "','" + strMatCode + "','" + strMatName + "','" + strPDDJ + "','" + strGrd + "','" + modProduct.C_SPEC + "mm','" + modProduct.C_GROUP + "','" + modProduct.C_TICK_NO + "','" + modProduct.N_WGT + "','" + strStdCode + "','" + modProduct.D_RKRQ + "','" + modProduct.C_MOVE_DESC + "','" + modProduct.C_RKRY + "','" + modProduct.D_WEIGHT_DT + "','" + modProduct.D_PRODUCE_DATE + "','" + modProduct.C_PCINFO + "','" + modProduct.C_STOVE + "','" + strBZYQ + "','','0','" + modProduct.C_ID + "','" + strZYX1 + "','" + strZYX2 + "','" + time + "')"; if (TransactionHelper_SQL.ExecuteSql(sql) == 0) { TransactionHelper_SQL.RollBack(); return("改判失败,信息传到条码时出错!"); } if (modProduct != null) { Mod_TQC_ROLL_COMMUTE modTqcRollCommute = new Mod_TQC_ROLL_COMMUTE(); modTqcRollCommute.C_ROLL_ID = modProduct.C_ID; modTqcRollCommute.C_STA_ID = modProduct.C_PLANT_ID; //modTqcRollCommute.C_STA_DESC = modProduct.C_PLANT_DESC; modTqcRollCommute.C_STOVE = modProduct.C_STOVE; modTqcRollCommute.C_BATCH_NO = modProduct.C_BATCH_NO; modTqcRollCommute.C_TICK_NO = modProduct.C_TICK_NO; modTqcRollCommute.N_WGT = Convert.ToDecimal(modProduct.N_WGT); modTqcRollCommute.C_STL_GRD_BEFORE = modProduct.C_STL_GRD; modTqcRollCommute.C_STA_ID = modProduct.C_STA_ID; modTqcRollCommute.C_STD_CODE_BEFORE = modProduct.C_STD_CODE; modTqcRollCommute.C_SPEC_BEFORE = modProduct.C_SPEC; modTqcRollCommute.C_MAT_CODE_BEFORE = modProduct.C_MAT_CODE; modTqcRollCommute.C_MAT_DESC_BEFORE = modProduct.C_MAT_DESC; modTqcRollCommute.C_ZYX1_BEFORE = modProduct.C_ZYX1; modTqcRollCommute.C_ZYX2_BEFORE = modProduct.C_ZYX2; modTqcRollCommute.C_JUDGE_LEV_BP_BEFORE = modProduct.C_JUDGE_LEV_ZH; modTqcRollCommute.D_COMMUTE_DATE = time; modTqcRollCommute.C_STL_GRD_AFTER = strGrd; modTqcRollCommute.C_STD_CODE_AFTER = strStdCode; modTqcRollCommute.C_SPEC_AFTER = modProduct.C_SPEC; modTqcRollCommute.C_MAT_CODE_AFTER = strMatCode; modTqcRollCommute.C_MAT_DESC_AFTER = strMatName; modTqcRollCommute.C_REASON_DEPMT_ID = strZrdwID; modTqcRollCommute.C_REASON_DEPMT_DESC = strZrdwName; modTqcRollCommute.C_ZYX1_AFTER = strZYX1; modTqcRollCommute.C_ZYX2_AFTER = strZYX2; modTqcRollCommute.C_EMP_ID = strUserID; modTqcRollCommute.C_REMARK = strRemark; modTqcRollCommute.C_MASTER_ID = C_MASTER_ID; modTqcRollCommute.C_GP_BEFORE_ID = C_GP_BEFORE_ID; modTqcRollCommute.C_GP_AFTER_ID = C_GP_AFTER_ID; modTqcRollCommute.C_JUDGE_LEV_BP_AFTER = strPDDJ; modTqcRollCommute.C_BZYQ_AFTER = strBZYQ; modTqcRollCommute.C_BZYQ_BEFORE = modProduct.C_BZYQ; modTqcRollCommute.C_COMMUTE_REASON = strGPYY; if (dal.Add_Trans(modTqcRollCommute)) { modProduct.C_STD_CODE = strStdCode; modProduct.C_STL_GRD = strGrd; modProduct.C_MAT_DESC = strMatName; modProduct.C_MAT_CODE = strMatCode; modProduct.C_MASTER_ID = C_MASTER_ID; modProduct.C_JUDGE_LEV_ZH = strPDDJ; modProduct.C_GP_BEFORE_ID = C_GP_BEFORE_ID; modProduct.C_GP_AFTER_ID = C_GP_AFTER_ID; modProduct.C_ZYX1 = strZYX1; modProduct.C_ZYX2 = strZYX2; modProduct.C_BZYQ = strBZYQ; modProduct.C_JUDGE_LEV_ZH = strPDDJ; modProduct.C_IS_PD = "N"; modProduct.C_IS_QR = "Y"; modProduct.C_QR_USER = strUserID; modProduct.D_QR_DATE = time; modProduct.C_DESIGN_NO = strDesignNo; modProduct.C_QGP_STATE = "Y"; modProduct.C_COMMUTE_REASON = strGPYY; if (!dalTrcRollProduct.Update_Trans(modProduct)) { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return("改判失败,请检查改判的信息!"); } } else { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return("改判失败,添加改判记录失败!"); } } } //综合判定需要 if (!dalTrcRollProduct.Update_Batch_No(strBatch)) { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return("改判失败,请检查批号!"); } string result_NC = dalInterface.SendXml_GP(strUrl, C_MASTER_ID, C_GP_BEFORE_ID, C_GP_AFTER_ID); if (result_NC != "1") { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return(result_NC); } TransactionHelper_SQL.Commit(); TransactionHelper.Commit(); } catch (Exception ex) { TransactionHelper.RollBack(); TransactionHelper_SQL.RollBack(); return(ex.Message); } return(result); }
/// <summary> /// 修改标牌 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_XGBP_Click_1(object sender, EventArgs e) { try { int[] rownumber = gv_SJXX.GetSelectedRows();//获取选中行号数组; if (rownumber.Length == 0) { return; } DataRow dr = gv_SJXX.GetDataRow(rownumber[0]); for (int i = 0; i < rownumber.Length; i++) { DataRow row = gv_SJXX.GetDataRow(rownumber[i]); if (dr["C_BATCH_NO"].ToString() != row["C_BATCH_NO"].ToString() || dr["C_STD_CODE"].ToString() != row["C_STD_CODE"].ToString() || dr["C_STL_GRD"].ToString() != row["C_STL_GRD"].ToString() || dr["C_MAT_CODE"].ToString() != row["C_MAT_CODE"].ToString() || dr["C_MAT_DESC"].ToString() != row["C_MAT_DESC"].ToString()) { MessageBox.Show("数据类型不同,请重新选择!"); return; } } if (imgcbo_BPLX.EditValue == null) { MessageBox.Show("标牌类型不能为空!"); return; } if (DialogResult.No == MessageBox.Show("是否确认修改已选中的数据?", "提示")) { return; } for (int i = 0; i < rownumber.Length; i++) { int selectedHandle = rownumber[i]; string strID = gv_SJXX.GetRowCellValue(selectedHandle, "C_ID").ToString(); DataTable dt = bll_roll_product.GetList_ID(strID).Tables[0]; Mod_TQC_ROLL_COMMUTE mod = new Mod_TQC_ROLL_COMMUTE(); mod.C_ROLL_ID = dt.Rows[0]["C_ID"].ToString(); mod.C_STA_ID = dt.Rows[0]["C_PLANT_ID"].ToString(); mod.C_STA_DESC = dt.Rows[0]["C_PLANT_DESC"].ToString(); mod.C_STOVE = dt.Rows[0]["C_STOVE"].ToString(); mod.C_BATCH_NO = dt.Rows[0]["C_BATCH_NO"].ToString(); mod.C_TICK_NO = dt.Rows[0]["C_TICK_NO"].ToString(); mod.N_WGT = Convert.ToDecimal(dt.Rows[0]["N_WGT"]); mod.C_STL_GRD_BEFORE = dt.Rows[0]["C_STL_GRD"].ToString(); mod.C_STA_ID = dt.Rows[0]["C_STA_ID"].ToString(); mod.C_STD_CODE_BEFORE = dt.Rows[0]["C_STD_CODE"].ToString(); mod.C_SPEC_BEFORE = dt.Rows[0]["C_SPEC"].ToString(); mod.C_MAT_CODE_BEFORE = dt.Rows[0]["C_MAT_CODE"].ToString(); mod.C_MAT_DESC_BEFORE = dt.Rows[0]["C_MAT_DESC"].ToString(); mod.D_COMMUTE_DATE = RV.UI.ServerTime.timeNow(); mod.C_STL_GRD_AFTER = dt.Rows[0]["C_STL_GRD"].ToString(); mod.C_STD_CODE_AFTER = txt_Std.Text; mod.C_BZYQ_BEFORE = dt.Rows[0]["C_BZYQ"].ToString(); mod.C_BZYQ_AFTER = imgcbo_ZYX3.Text.Trim(); mod.C_SCUTCHEON = imgcbo_BPLX.Text; mod.C_GP_TYPE = "修改标牌"; mod.C_EMP_ID = RV.UI.UserInfo.UserID; mod.C_REMARK = txt_Remark.Text; if (bll_commute.Add(mod)) { Mod_TRC_ROLL_PRODCUT mod_roll_prodcut = bll_roll_product.GetModel(dt.Rows[0]["C_ID"].ToString()); mod_roll_prodcut.C_SCUTCHEON = imgcbo_BPLX.Text; mod_roll_prodcut.C_GP_TYPE = "修改标牌"; bll_roll_product.Update(mod_roll_prodcut); } } ClearContent.ClearFlowLayoutPanel(panelControl3.Controls); btn_Query_Main_Click(null, null); btn_Query_Click(null, null); MessageBox.Show("修改成功!"); Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "线材改判标牌");//添加操作日志 } catch (Exception ex) { MessageBox.Show(ex.Message); } }