/// <summary> /// 保存CVT下线试验数据 /// </summary> /// <param name="testInfo">CVT下线试验信息</param> /// <returns>返回操作是否成功的标志</returns> public bool SaveCVTExpData(CvtTestInfo testInfo) { if (testInfo == null) { throw new ArgumentException("试验数据参数不允许为空"); } if (GlobalObject.GeneralFunction.IsNullOrEmpty(testInfo.CvtNumber)) { throw new Exception("CVT编号不允许为空"); } string[] cvtNumber = testInfo.CvtNumber.Split(new char[] { ' ' }); if (cvtNumber.Length != 2) { throw new Exception("CVT编号格式不正确"); } if (GlobalObject.GeneralFunction.IsNullOrEmpty(testInfo.OilType)) { throw new Exception("油品类型不允许为空"); } if (GlobalObject.GeneralFunction.IsNullOrEmpty(testInfo.TestDevice)) { throw new Exception("试验设备名称不允许为空"); } if (GlobalObject.GeneralFunction.IsNullOrEmpty(testInfo.TestResult)) { throw new Exception("试验结果不允许为空"); } if (GlobalObject.GeneralFunction.IsNullOrEmpty(testInfo.Tester)) { throw new Exception("实验员不允许为空"); } if (GlobalObject.GeneralFunction.IsNullOrEmpty(testInfo.PreassemblyPersonnel)) { throw new Exception("预装员不允许为空"); } if (testInfo.TestData == null || testInfo.TestData.Rows.Count == 0) { throw new Exception("试验项目表不允许为空"); } string error = null; Hashtable paramTable = new Hashtable(); paramTable.Add("@ProductType", cvtNumber[0]); paramTable.Add("@CvtNumber", cvtNumber[1]); paramTable.Add("@TestDevice", testInfo.TestDevice); paramTable.Add("@OilType", testInfo.OilType); paramTable.Add("@TestResult", testInfo.TestResult); paramTable.Add("@Tester", testInfo.Tester); paramTable.Add("@PreassemblyPersonnel", testInfo.PreassemblyPersonnel); paramTable.Add("@Remark", testInfo.Remark); IDBOperate dbOperate = AccessDB.GetIDBOperate("DepotManagement"); string[] lstCmd = new string[testInfo.TestData.Rows.Count + 1]; Hashtable[] lstParam = new Hashtable[testInfo.TestData.Rows.Count + 1]; Hashtable[] outParams = new Hashtable[testInfo.TestData.Rows.Count + 1]; lstCmd[0] = "ZPX_InsertCVTTestInfo"; lstParam[0] = paramTable; for (int i = 0; i < testInfo.TestData.Rows.Count; i++) { lstCmd[i + 1] = "ZPX_InsertCVTTestDataItems"; paramTable = new Hashtable(); paramTable.Add("@TestType", testInfo.TestData.Rows[i]["TestType"].ToString()); paramTable.Add("@TestItemName", testInfo.TestData.Rows[i]["TestItemName"].ToString()); paramTable.Add("@TestCondition", testInfo.TestData.Rows[i]["TestCondition"].ToString()); paramTable.Add("@TestRequirement", testInfo.TestData.Rows[i]["TestRequirement"].ToString()); paramTable.Add("@TestData", testInfo.TestData.Rows[i]["TestData"].ToString()); paramTable.Add("@TestResult", testInfo.TestData.Rows[i]["TestResult"].ToString()); lstParam[i + 1] = paramTable; } Dictionary <OperateCMD, object> dicOperateCMD = dbOperate.Transaction_CMD(lstCmd, lstParam, ref outParams); if (!AccessDB.GetResult(dicOperateCMD, out error)) { throw new Exception(error); } else { return(true); } }