SystemModuleLogicPartial.cs 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:SystemModuleLogic.cs
  5. * 2.功能描述:产品档案数据查询处理
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 张国印 2014/09/12 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Text;
  14. using Dongke.IBOSS.PRD.Basics.DataAccess;
  15. using Dongke.IBOSS.PRD.Service.DataModels;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Oracle.ManagedDataAccess.Client;
  18. namespace Dongke.IBOSS.PRD.Service.SystemModuleLogic
  19. {
  20. /// <summary>
  21. /// 产品档案数据查询处理
  22. /// </summary>
  23. public partial class SystemModuleLogic
  24. {
  25. #region 产品档案
  26. /// <summary>
  27. /// 查询产品信息
  28. /// </summary>
  29. /// <param name="sUserInfo">用户基本信息</param>
  30. /// <param name="goodsEntity">产品信息</param>
  31. /// <returns>DataSet</returns>
  32. /// <remarks>
  33. /// 陈冰 2014.09.01 新建
  34. /// </remarks>
  35. public static DataSet SerachGoods(SUserInfo sUserInfo, GoodsEntity goodsEntity)
  36. {
  37. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  38. try
  39. {
  40. con.Open();
  41. if (!string.IsNullOrWhiteSpace(goodsEntity.GoodsCodeOnly))
  42. {
  43. string sql = "select goodsid from tp_mst_goods g where g.goodscode = :goodscode";
  44. OracleParameter[] paras1 = new OracleParameter[]{
  45. new OracleParameter(":goodscode",OracleDbType.Varchar2,
  46. goodsEntity.GoodsCodeOnly,ParameterDirection.Input),
  47. };
  48. return con.GetSqlResultToDs(sql, paras1);
  49. }
  50. OracleParameter[] paras = new OracleParameter[]{
  51. new OracleParameter("account",OracleDbType.Int32,
  52. sUserInfo.AccountID,ParameterDirection.Input),
  53. new OracleParameter("goodsID",OracleDbType.Int32,
  54. goodsEntity.GoodsID,ParameterDirection.Input),
  55. new OracleParameter("goodsCode",OracleDbType.NVarchar2,
  56. goodsEntity.GoodsCode,ParameterDirection.Input),
  57. new OracleParameter("goodsName",OracleDbType.NVarchar2,
  58. goodsEntity.GoodsName,ParameterDirection.Input),
  59. new OracleParameter("goodsSpecification",OracleDbType.NVarchar2,
  60. goodsEntity.GoodsSpecification,ParameterDirection.Input),
  61. new OracleParameter("goodsModel",OracleDbType.NVarchar2,
  62. goodsEntity.GoodsModel,ParameterDirection.Input),
  63. new OracleParameter("goodsTypeCode",OracleDbType.NVarchar2,
  64. goodsEntity.GoodsTypeCode,ParameterDirection.Input),
  65. new OracleParameter("glazeTypeID",OracleDbType.Int32,
  66. goodsEntity.GlazeTypeID,ParameterDirection.Input),
  67. new OracleParameter("ceaseFlag",OracleDbType.NVarchar2,
  68. goodsEntity.CeaseFlag,ParameterDirection.Input),
  69. new OracleParameter("remarks",OracleDbType.NVarchar2,
  70. goodsEntity.Remarks,ParameterDirection.Input),
  71. new OracleParameter("valueFlag",OracleDbType.NVarchar2,
  72. goodsEntity.ValueFlag,ParameterDirection.Input),
  73. new OracleParameter("rs_result",OracleDbType.RefCursor,ParameterDirection.Output),
  74. new OracleParameter("rs_result_img",OracleDbType.RefCursor,ParameterDirection.Output),
  75. };
  76. foreach (OracleParameter item in paras)
  77. {
  78. if (item.Value + "" == "")
  79. {
  80. item.Value = DBNull.Value;
  81. }
  82. }
  83. DataSet ds = con.ExecStoredProcedure("PRO_MST_SerachGoods", paras);
  84. return ds;
  85. }
  86. catch (Exception ex)
  87. {
  88. throw ex;
  89. }
  90. finally
  91. {
  92. if (con.ConnState == ConnectionState.Open)
  93. {
  94. con.Close();
  95. }
  96. }
  97. }
  98. /// <summary>
  99. /// 新建产品档案
  100. /// </summary>
  101. /// <param name="sUserInfo">用户基本信息</param>
  102. /// <param name="goodsEntity">产品实体</param>
  103. /// <param name="imgList">产品图片集合</param>
  104. /// <param name="attList">缺陷位置ID集合</param>
  105. /// <returns>int受影响行数</returns>
  106. /// <remarks>
  107. /// 庄天威 2014.09.04 新建
  108. /// </remarks>
  109. public static int AddGoods(SUserInfo sUserInfo, GoodsEntity goodsEntity
  110. , List<GoodsImageEntity> imgList, List<GoodsAttachmentEntity> attList)
  111. {
  112. int returnRows;
  113. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  114. if (goodsEntity.MudQuantity == null)
  115. {
  116. goodsEntity.MudQuantity = 0;
  117. }
  118. if (goodsEntity.GlazeQuantity == null)
  119. {
  120. goodsEntity.GlazeQuantity = 0;
  121. }
  122. if (goodsEntity.Remarks == null)
  123. {
  124. goodsEntity.Remarks = "";
  125. }
  126. if (goodsEntity.GoodsSpecification == null)
  127. {
  128. goodsEntity.GoodsSpecification = "";
  129. }
  130. if (goodsEntity.GoodsModel == null)
  131. {
  132. goodsEntity.GoodsModel = "";
  133. }
  134. try
  135. {
  136. oracleTrConn.Connect();
  137. // 物料编码重复验证 add by chenxy 2017-07-11 begin
  138. // 有不同编码,同物料编码的情况 delete by chenxy 2017-11-10
  139. //string sqlString = "SELECT g.goodscode \n" +
  140. //" FROM tp_mst_goods g\n" +
  141. //" WHERE g.materialcode = :materialcode";
  142. //OracleParameter[] checkParas = new OracleParameter[]{
  143. // new OracleParameter(":materialcode",goodsEntity.MaterialCode),
  144. //};
  145. //string goodscode = oracleTrConn.GetSqlResultToStr(sqlString, checkParas);
  146. //if (!string.IsNullOrWhiteSpace(goodscode))
  147. //{
  148. // return -10;
  149. //}
  150. // 物料编码重复验证 add by chenxy 2017-07-11 end
  151. StringBuilder sbSql = new StringBuilder();
  152. sbSql.Append("select SEQ_MST_Goods_GoodsID.nextval from dual");
  153. int id = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  154. sbSql.Clear();
  155. sbSql.Append(" INSERT INTO TP_MST_GOODS");
  156. sbSql.Append("(GoodsID,GoodsCode,GoodsName,GoodsSpecification,GoodsModel,GoodsTypeID,");
  157. sbSql.Append("GlazeTypeID,MudWeight,GlazeWeight,LusterwareWeight,ProductionCycle,CeaseFlag,Goods_Line_Type,Goods_Line_Code,");
  158. sbSql.Append("StartingDate,AutoLossCycle,DeliverLimitCycle,PlateLimitNum,UnitPrice,ReservedDays,");
  159. sbSql.Append("PackageNum,OutletDistance,MaterialCode,MaterialRemark,printcopies,");
  160. sbSql.Append("MouldWeight,MouldCost,ScrapSumFlag,SEATCOVERCODE,");
  161. sbSql.Append("WaterLabelCode,StandardGroutingNum,MouldMaterialCode,MouldOutputCount,logoid,");
  162. sbSql.Append("Remarks,AccountID,ValueFlag,CreateUserID,UpdateUserID)");
  163. sbSql.Append("VALUES( :GoodsId, :GoodsCode, :GoodsName, :GoodsSpecification, :GoodsModel, :GoodsTypeID,");
  164. sbSql.Append(" :GlazeTypeID, :MudWeight, :GlazeWeight,:LusterwareWeight, :ProductionCycle, :CeaseFlag,:Goods_Line_Type,:Goods_Line_Code,");
  165. sbSql.Append(" :StartingDate, :AutoLossCycle, :DeliverLimitCycle,:PlateLimitNum,:UnitPrice,:ReservedDays,");
  166. sbSql.Append(" :PackageNum, :OutletDistance, :MaterialCode,:MaterialRemark,:printcopies,");
  167. sbSql.Append(" :MouldWeight, :MouldCost,:ScrapSumFlag,:SEATCOVERCODE,");
  168. sbSql.Append(" :WaterLabelCode, :StandardGroutingNum, :MouldMaterialCode, :MouldOutputCount,:logoid,");
  169. sbSql.Append(" :Remarks, :AccountID, :ValueFlag, :CreateUserID, :UpdateUserID)");
  170. OracleParameter[] paras = new OracleParameter[]{
  171. new OracleParameter(":GoodsId",id),
  172. new OracleParameter(":GoodsCode",goodsEntity.GoodsCode),
  173. new OracleParameter(":GoodsName",goodsEntity.GoodsName),
  174. new OracleParameter(":GoodsSpecification",goodsEntity.GoodsSpecification),
  175. new OracleParameter(":GoodsModel",goodsEntity.GoodsModel),
  176. new OracleParameter(":GoodsTypeID",goodsEntity.GoodsTypeID),
  177. new OracleParameter(":GlazeTypeID",goodsEntity.GlazeTypeID),
  178. new OracleParameter(":MudWeight",goodsEntity.MudQuantity),
  179. new OracleParameter(":GlazeWeight",goodsEntity.GlazeQuantity),
  180. new OracleParameter(":LusterwareWeight",goodsEntity.LusterwareWeight),
  181. new OracleParameter(":ProductionCycle",goodsEntity.ProductionCycle),
  182. new OracleParameter(":CeaseFlag",goodsEntity.CeaseFlag),
  183. new OracleParameter(":Goods_Line_Type",goodsEntity.GoodsLineType),
  184. new OracleParameter(":Goods_Line_Code",goodsEntity.GoodsLineCode),
  185. new OracleParameter(":StartingDate",goodsEntity.StartingDate),
  186. new OracleParameter(":AutoLossCycle",goodsEntity.AutoLossCycle),
  187. new OracleParameter(":DeliverLimitCycle",goodsEntity.DeliverLimitCycle),
  188. new OracleParameter(":PlateLimitNum",goodsEntity.PlateLimitNum),
  189. new OracleParameter(":ReservedDays",goodsEntity.ReservedDays),
  190. new OracleParameter(":UnitPrice",goodsEntity.UnitPrice),
  191. new OracleParameter(":PackageNum",goodsEntity.PackageNum),
  192. new OracleParameter(":OutletDistance",goodsEntity.OutletDistance),
  193. new OracleParameter(":MaterialCode",goodsEntity.MaterialCode),
  194. new OracleParameter(":MouldWeight",goodsEntity.MouldWeight),
  195. new OracleParameter(":MouldCost",goodsEntity.MouldCost),
  196. new OracleParameter(":ScrapSumFlag",goodsEntity.ScrapSumFlag),
  197. new OracleParameter(":MaterialRemark",goodsEntity.MaterialRemark),
  198. new OracleParameter(":printcopies",goodsEntity.PrintCopies),
  199. new OracleParameter(":SEATCOVERCODE", goodsEntity.SeatCoverCode),
  200. new OracleParameter(":WaterLabelCode", goodsEntity.WaterLabelCode),
  201. new OracleParameter(":StandardGroutingNum", goodsEntity.StandardGroutingNum),
  202. new OracleParameter(":MouldMaterialCode", goodsEntity.MouldMaterialCode),
  203. new OracleParameter(":MouldOutputCount", goodsEntity.MouldOutputCount),
  204. new OracleParameter(":logoid", goodsEntity.LogoID),
  205. new OracleParameter(":Remarks",goodsEntity.Remarks),
  206. new OracleParameter(":AccountID",sUserInfo.AccountID),
  207. new OracleParameter(":ValueFlag",goodsEntity.ValueFlag),
  208. //new OracleParameter(":CreateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  209. new OracleParameter(":CreateUserID",sUserInfo.UserID),
  210. //new OracleParameter(":UpdateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  211. new OracleParameter(":UpdateUserID",sUserInfo.UserID),
  212. //new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp,DateTime.Now,ParameterDirection.Input)
  213. };
  214. returnRows = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), paras);
  215. //SAP物料信息
  216. string sql = "delete from TP_MST_GoodsLogoSAP where goodsid = " + id;
  217. returnRows += oracleTrConn.ExecuteNonQuery(sql);
  218. sql = "insert into TP_MST_GOODSLOGOSAP\n" +
  219. " (GOODSID, LOGOID, GOODSCODE, MATERIALCODE, MATERIALREMARK, CREATEUSERID, WaterLabelCode)\n" +
  220. "values\n" +
  221. " (:GOODSID, :LOGOID, :GOODSCODE, :MATERIALCODE, :MATERIALREMARK, :CREATEUSERID, :WaterLabelCode)";
  222. foreach (DataRow item in goodsEntity.SAPInfo.Rows)
  223. {
  224. string sapcode = item["MATERIALCODE"] + "";
  225. string sapremark = item["MATERIALREMARK"] + "";
  226. if (string.IsNullOrWhiteSpace(sapcode))
  227. {
  228. continue;
  229. }
  230. if (string.IsNullOrEmpty(sapremark))
  231. {
  232. sapremark = " ";
  233. }
  234. paras = new OracleParameter[]{
  235. new OracleParameter(":GOODSID",id),
  236. new OracleParameter(":LOGOID",item["LOGOID"]),
  237. new OracleParameter(":GOODSCODE",goodsEntity.GoodsCode),
  238. new OracleParameter(":MATERIALCODE",sapcode),
  239. new OracleParameter(":MATERIALREMARK",sapremark),
  240. new OracleParameter(":CREATEUSERID",sUserInfo.UserID),
  241. new OracleParameter(":WaterLabelCode",item["WaterLabelCode"]),
  242. };
  243. returnRows += oracleTrConn.ExecuteNonQuery(sql, paras);
  244. }
  245. //此处添加图片信息
  246. foreach (GoodsImageEntity img in imgList)
  247. {
  248. int imgReturn = 0;
  249. sbSql.Clear();
  250. sbSql.Append("select SEQ_MST_GoodsImage_ID.nextval from dual");
  251. int imgId = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  252. sbSql.Clear();
  253. sbSql.Append("Insert into TP_MST_GoodsImage");
  254. sbSql.Append("(GoodsImageID,GoodsID,Thumbnail,Image,AccountID,ValueFlag,");
  255. sbSql.Append("CreateUserID,UpdateUserID)");
  256. sbSql.Append(" VALUES(:GoodsImageID,:GoodsID,:Thumbnail,:Image,:AccountID,:ValueFlag,");
  257. sbSql.Append(":CreateUserID,:UpdateUserID)");
  258. OracleParameter[] imgParas = new OracleParameter[] {
  259. new OracleParameter(":GoodsImageID",OracleDbType.Int32,imgId,ParameterDirection.Input),
  260. new OracleParameter(":GoodsID",OracleDbType.Int32,id,ParameterDirection.Input),
  261. new OracleParameter(":Thumbnail",OracleDbType.Blob,img.Thumbnail,ParameterDirection.Input),
  262. new OracleParameter(":Image",OracleDbType.Blob,img.Image,ParameterDirection.Input),
  263. new OracleParameter(":AccountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  264. new OracleParameter(":ValueFlag",OracleDbType.Int32,img.ValueFlag,ParameterDirection.Input),
  265. //new OracleParameter(":CreateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  266. new OracleParameter(":CreateUserID",OracleDbType.Int32,sUserInfo.UserID,ParameterDirection.Input),
  267. //new OracleParameter(":UpdateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  268. new OracleParameter(":UpdateUserID",OracleDbType.Int32,sUserInfo.UserID,ParameterDirection.Input),
  269. //new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp,DateTime.Now,ParameterDirection.Input)
  270. };
  271. imgReturn = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), imgParas);
  272. }
  273. //此处添加产品附件
  274. //int AttReturn = AddAttachment(oracleTrConn, attList, id, sUserInfo);
  275. //此处添加缺陷位置关联
  276. //int dpCount = SaveGoodsDefectPosition(oracleTrConn, dpList, id, sUserInfo);
  277. oracleTrConn.Commit();
  278. oracleTrConn.Disconnect();
  279. }
  280. catch (Exception ex)
  281. {
  282. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  283. {
  284. oracleTrConn.Rollback();
  285. oracleTrConn.Disconnect();
  286. }
  287. throw ex;
  288. }
  289. return returnRows;
  290. }
  291. /// <summary>
  292. /// 修改产品档案
  293. /// </summary>
  294. /// <param name="sUserInfo">用户基本信息</param>
  295. /// <param name="goodsEntity">产品实体</param>
  296. /// <param name="imgList">产品图片集合</param>
  297. /// <param name="attList">缺陷位置ID集合</param>
  298. /// <returns>int受影响行数</returns>
  299. /// <remarks>
  300. /// 庄天威 2014.09.04 新建
  301. /// </remarks>
  302. public static int updateGoods(SUserInfo sUserInfo, GoodsEntity goodsEntity
  303. , List<GoodsImageEntity> imgList, List<GoodsAttachmentEntity> attList)
  304. {
  305. int returnRows = 0;
  306. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  307. if (goodsEntity.MudQuantity == null)
  308. {
  309. goodsEntity.MudQuantity = 0;
  310. }
  311. if (goodsEntity.GlazeQuantity == null)
  312. {
  313. goodsEntity.GlazeQuantity = 0;
  314. }
  315. if (goodsEntity.Remarks == null)
  316. {
  317. goodsEntity.Remarks = "";
  318. }
  319. if (goodsEntity.GoodsSpecification == null)
  320. {
  321. goodsEntity.GoodsSpecification = "";
  322. }
  323. if (goodsEntity.GoodsModel == null)
  324. {
  325. goodsEntity.GoodsModel = "";
  326. }
  327. try
  328. {
  329. oracleTrConn.Connect();
  330. // 物料编码重复验证 add by chenxy 2017-07-11 begin
  331. // 有不同编码,同物料编码的情况 delete by chenxy 2017-11-10
  332. //string sqlString = "SELECT g.goodscode \n" +
  333. //" FROM tp_mst_goods g\n" +
  334. //" WHERE g.materialcode = :materialcode and g.goodsid <> :goodsid";
  335. //OracleParameter[] checkParas = new OracleParameter[]{
  336. // new OracleParameter(":materialcode",goodsEntity.MaterialCode),
  337. // new OracleParameter(":goodsid",goodsEntity.GoodsID),
  338. //};
  339. //string goodscode = oracleTrConn.GetSqlResultToStr(sqlString, checkParas);
  340. //if (!string.IsNullOrWhiteSpace(goodscode))
  341. //{
  342. // return -10;
  343. //}
  344. // 物料编码重复验证 add by chenxy 2017-07-11 end
  345. StringBuilder sbSql = new StringBuilder();
  346. sbSql.Append("update TP_MST_GOODS");
  347. //sbSql.Append(" set GoodsCode=:GoodsCode,GoodsName=:GoodsName,GoodsSpecification=:GoodsSpecification,");
  348. sbSql.Append(" set GoodsName=:GoodsName,GoodsSpecification=:GoodsSpecification,");
  349. sbSql.Append(" GoodsModel=:GoodsModel,GoodsTypeID=:GoodsTypeID,GlazeTypeID=:GlazeTypeID,MudWeight=:MudWeight,");
  350. sbSql.Append(" GlazeWeight=:GlazeWeight,LusterwareWeight=:LusterwareWeight,ProductionCycle=:ProductionCycle,CeaseFlag=:CeaseFlag,Goods_Line_Type=:Goods_Line_Type,Goods_Line_CODE=:Goods_Line_CODE,Remarks=:Remarks,");
  351. sbSql.Append(" StartingDate=:StartingDate, AutoLossCycle = :AutoLossCycle, DeliverLimitCycle=:DeliverLimitCycle, PlateLimitNum=:PlateLimitNum,");
  352. sbSql.Append(" UnitPrice=:UnitPrice,PackageNum=:PackageNum,OutletDistance=:OutletDistance,MaterialCode=:MaterialCode,MaterialRemark=:MaterialRemark,printcopies=:printcopies,");
  353. sbSql.Append(" MouldWeight=:MouldWeight, MouldCost=:MouldCost,ScrapSumFlag=:ScrapSumFlag, ReservedDays=:ReservedDays,SEATCOVERCODE=:SEATCOVERCODE,");
  354. sbSql.Append(" WaterLabelCode=:WaterLabelCode, StandardGroutingNum=:StandardGroutingNum,MouldMaterialCode=:MouldMaterialCode, MouldOutputCount=:MouldOutputCount,");
  355. sbSql.Append(" AccountID=:AccountID,ValueFlag=:ValueFlag,UpdateUserID=:UpdateUserID,logoid=:logoid");
  356. //sbSql.Append(" CreateTime=:CreateTime,CreateUserID=:CreateUserID ");
  357. sbSql.Append(" where GoodsID=:GoodsID and OPTimeStamp=:OPTimeStamp");
  358. OracleParameter[] paras = new OracleParameter[]{
  359. // new OracleParameter(":GoodsCode",goodsEntity.GoodsCode),
  360. new OracleParameter(":GoodsName",goodsEntity.GoodsName),
  361. new OracleParameter(":GoodsSpecification",goodsEntity.GoodsSpecification),
  362. new OracleParameter(":GoodsModel",goodsEntity.GoodsModel),
  363. new OracleParameter(":GoodsTypeID",goodsEntity.GoodsTypeID),
  364. new OracleParameter(":GlazeTypeID",goodsEntity.GlazeTypeID),
  365. new OracleParameter(":MudWeight",goodsEntity.MudQuantity),
  366. new OracleParameter(":GlazeWeight",goodsEntity.GlazeQuantity),
  367. new OracleParameter(":LusterwareWeight",goodsEntity.LusterwareWeight),
  368. new OracleParameter(":ProductionCycle",goodsEntity.ProductionCycle),
  369. new OracleParameter(":CeaseFlag",goodsEntity.CeaseFlag),
  370. new OracleParameter(":Goods_Line_Type",goodsEntity.GoodsLineType),
  371. new OracleParameter(":Goods_Line_CODE",goodsEntity.GoodsLineCode),
  372. new OracleParameter(":StartingDate",goodsEntity.StartingDate),
  373. new OracleParameter(":AutoLossCycle",goodsEntity.AutoLossCycle),
  374. new OracleParameter(":DeliverLimitCycle",goodsEntity.DeliverLimitCycle),
  375. new OracleParameter(":PlateLimitNum",goodsEntity.PlateLimitNum),
  376. new OracleParameter(":ReservedDays",goodsEntity.ReservedDays),
  377. new OracleParameter(":UnitPrice",goodsEntity.UnitPrice),
  378. new OracleParameter(":PackageNum",goodsEntity.PackageNum),
  379. new OracleParameter(":OutletDistance",goodsEntity.OutletDistance),
  380. new OracleParameter(":MaterialCode",goodsEntity.MaterialCode),
  381. new OracleParameter(":MouldWeight",goodsEntity.MouldWeight),
  382. new OracleParameter(":MouldCost",goodsEntity.MouldCost),
  383. new OracleParameter(":ScrapSumFlag",goodsEntity.ScrapSumFlag),
  384. new OracleParameter(":MaterialRemark",goodsEntity.MaterialRemark),
  385. new OracleParameter(":printcopies",goodsEntity.PrintCopies),
  386. new OracleParameter(":Remarks",goodsEntity.Remarks),
  387. new OracleParameter(":SEATCOVERCODE",goodsEntity.SeatCoverCode),
  388. new OracleParameter(":WaterLabelCode",goodsEntity.WaterLabelCode),
  389. new OracleParameter(":StandardGroutingNum",goodsEntity.StandardGroutingNum),
  390. new OracleParameter(":MouldMaterialCode",goodsEntity.MouldMaterialCode),
  391. new OracleParameter(":MouldOutputCount",goodsEntity.MouldOutputCount),
  392. new OracleParameter(":logoid", goodsEntity.LogoID),
  393. new OracleParameter(":AccountID",goodsEntity.AccountID),
  394. new OracleParameter(":ValueFlag",goodsEntity.ValueFlag),
  395. //new OracleParameter(":UpdateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  396. new OracleParameter(":UpdateUserID",sUserInfo.UserID),
  397. //new OracleParameter(":CreateTime",OracleDbType.Date,goodsEntity.CreateTime,ParameterDirection.Input),
  398. //new OracleParameter(":CreateUserID",goodsEntity.CreateUserID),
  399. new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp,goodsEntity.OPTimeStamp,ParameterDirection.Input),
  400. new OracleParameter(":GoodsId",goodsEntity.GoodsID)
  401. };
  402. returnRows = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), paras);
  403. if (returnRows == 0)
  404. {
  405. oracleTrConn.Rollback();
  406. oracleTrConn.Disconnect();
  407. return -500;
  408. }
  409. //SAP物料信息
  410. string sql = "delete from TP_MST_GoodsLogoSAP where goodsid = " + goodsEntity.GoodsID;
  411. returnRows += oracleTrConn.ExecuteNonQuery(sql);
  412. sql = "insert into TP_MST_GOODSLOGOSAP\n" +
  413. " (GOODSID, LOGOID, GOODSCODE, MATERIALCODE, MATERIALREMARK, CREATEUSERID,WaterLabelCode)\n" +
  414. "values\n" +
  415. " (:GOODSID, :LOGOID, :GOODSCODE, :MATERIALCODE, :MATERIALREMARK, :CREATEUSERID,:WaterLabelCode)";
  416. foreach (DataRow item in goodsEntity.SAPInfo.Rows)
  417. {
  418. string sapcode = item["MATERIALCODE"] + "";
  419. string sapremark = item["MATERIALREMARK"] + "";
  420. if (string.IsNullOrWhiteSpace(sapcode))
  421. {
  422. continue;
  423. }
  424. if (string.IsNullOrEmpty(sapremark))
  425. {
  426. sapremark = " ";
  427. }
  428. paras = new OracleParameter[]{
  429. new OracleParameter(":GOODSID",goodsEntity.GoodsID),
  430. new OracleParameter(":LOGOID",item["LOGOID"]),
  431. new OracleParameter(":GOODSCODE",goodsEntity.GoodsCode),
  432. new OracleParameter(":MATERIALCODE",sapcode),
  433. new OracleParameter(":MATERIALREMARK",sapremark),
  434. new OracleParameter(":CREATEUSERID",sUserInfo.UserID),
  435. new OracleParameter(":WaterLabelCode",item["WaterLabelCode"]),
  436. };
  437. returnRows += oracleTrConn.ExecuteNonQuery(sql, paras);
  438. }
  439. foreach (GoodsImageEntity imgEntity in imgList)
  440. {
  441. if (imgEntity.GoodsImageID == 0)
  442. {
  443. int imgReturn = 0;
  444. sbSql.Clear();
  445. sbSql.Append("select SEQ_MST_GoodsImage_ID.nextval from dual");
  446. int imgId = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  447. sbSql.Clear();
  448. sbSql.Append("Insert into TP_MST_GoodsImage");
  449. sbSql.Append("(GoodsImageID,GoodsID,Thumbnail,Image,AccountID,ValueFlag,");
  450. sbSql.Append("CreateUserID,UpdateUserID)");
  451. sbSql.Append(" VALUES(:GoodsImageID,:GoodsID,:Thumbnail,:Image,:AccountID,:ValueFlag,");
  452. sbSql.Append(":CreateUserID,:UpdateUserID)");
  453. OracleParameter[] imgParas = new OracleParameter[] {
  454. new OracleParameter(":GoodsImageID",OracleDbType.Int32,imgId,ParameterDirection.Input),
  455. new OracleParameter(":GoodsID",OracleDbType.Int32,goodsEntity.GoodsID,ParameterDirection.Input),
  456. new OracleParameter(":Thumbnail",OracleDbType.Blob,imgEntity.Thumbnail,ParameterDirection.Input),
  457. new OracleParameter(":Image",OracleDbType.Blob,imgEntity.Image,ParameterDirection.Input),
  458. new OracleParameter(":AccountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  459. new OracleParameter(":ValueFlag",OracleDbType.Int32,imgEntity.ValueFlag,ParameterDirection.Input),
  460. //new OracleParameter(":CreateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  461. new OracleParameter(":CreateUserID",OracleDbType.Int32,sUserInfo.UserID,ParameterDirection.Input),
  462. //new OracleParameter(":UpdateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  463. new OracleParameter(":UpdateUserID",OracleDbType.Int32,sUserInfo.UserID,ParameterDirection.Input),
  464. //new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp,DateTime.Now,ParameterDirection.Input)
  465. };
  466. imgReturn = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), imgParas);
  467. }
  468. else
  469. {
  470. int imgReturn = 0;
  471. sbSql.Clear();
  472. sbSql.Append(" update TP_MST_GoodsImage");
  473. sbSql.Append(" set GoodsID=:GoodsID,AccountID=:AccountID,ValueFlag=:ValueFlag,");
  474. sbSql.Append(" UpdateUserID=:UpdateUserID");
  475. //sbSql.Append(" where GoodsImageID=:GoodsImageID And OPTimeStamp=to_date(:OPTimeStamp,'yyyy-mm-dd HH24:mi:ss')");
  476. sbSql.Append(" where GoodsImageID=:GoodsImageID");
  477. OracleParameter[] imgParas = new OracleParameter[] {
  478. new OracleParameter(":GoodsID",OracleDbType.Int32,
  479. goodsEntity.GoodsID,ParameterDirection.Input),
  480. new OracleParameter(":AccountID",OracleDbType.Int32,
  481. imgEntity.AccountID,ParameterDirection.Input),
  482. new OracleParameter(":ValueFlag",OracleDbType.Int32,
  483. imgEntity.ValueFlag,ParameterDirection.Input),
  484. //new OracleParameter(":UpdateTime",OracleDbType.NVarchar2,
  485. // DateTime.Now.ToString(),ParameterDirection.Input),
  486. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  487. sUserInfo.UserID,ParameterDirection.Input),
  488. new OracleParameter(":GoodsImageID",OracleDbType.Int32,
  489. imgEntity.GoodsImageID,ParameterDirection.Input)
  490. //,new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp, imgEntity.OPTimeStamp,ParameterDirection.Input)
  491. };
  492. imgReturn = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), imgParas);
  493. }
  494. }
  495. //修改产品附件
  496. //int AttReturn = UpdateAttachment(oracleTrConn, attList, Convert.ToInt32(goodsEntity.GoodsID), sUserInfo);
  497. oracleTrConn.Commit();
  498. oracleTrConn.Disconnect();
  499. }
  500. catch (Exception ex)
  501. {
  502. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  503. {
  504. oracleTrConn.Rollback();
  505. oracleTrConn.Disconnect();
  506. }
  507. throw ex;
  508. }
  509. return returnRows;
  510. }
  511. /// <summary>
  512. /// 查询产品物料信息
  513. /// </summary>
  514. /// <param name="sUserInfo"></param>
  515. /// <param name="goodsID"></param>
  516. /// <returns></returns>
  517. public static ServiceResultEntity GetGoodsSAP(SUserInfo sUserInfo, int goodsID)
  518. {
  519. IDBConnection conn = null;
  520. try
  521. {
  522. conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  523. string sqlString = "\n" +
  524. "select '产品档案' logoname, g.materialcode, g.materialremark,g.WaterLabelCode, '1' valueflag, -1 displayno\n" +
  525. " from tp_mst_goods g\n" +
  526. " where g.goodsid = :goodsid\n" +
  527. "union all\n" +
  528. "select to_char(l.logoname)\n" +
  529. " ,gls.materialcode\n" +
  530. " ,gls.materialremark\n" +
  531. " ,gls.WaterLabelCode\n" +
  532. " ,l.valueflag\n" +
  533. " ,l.displayno\n" +
  534. " from tp_mst_goodslogosap gls\n" +
  535. " inner join tp_mst_logo l\n" +
  536. " on l.logoid = gls.logoid\n" +
  537. " where gls.goodsid = :goodsid\n" +
  538. " order by valueflag desc, displayno";
  539. OracleParameter[] paras = new OracleParameter[]{
  540. new OracleParameter(":goodsid",goodsID),
  541. };
  542. ServiceResultEntity sre = new ServiceResultEntity();
  543. sre.Data = conn.GetSqlResultToDs(sqlString, paras);
  544. return sre;
  545. }
  546. catch (Exception ex)
  547. {
  548. throw ex;
  549. }
  550. finally
  551. {
  552. if (conn != null &&
  553. conn.ConnState == ConnectionState.Open)
  554. {
  555. conn.Close();
  556. }
  557. }
  558. }
  559. /// <summary>
  560. /// 查询产品对应商标
  561. /// </summary>
  562. /// <param name="sUserInfo"></param>
  563. /// <param name="goodsID"></param>
  564. /// <returns></returns>
  565. public static ServiceResultEntity GetGoodsLogo(SUserInfo sUserInfo, int goodsID)
  566. {
  567. IDBConnection conn = null;
  568. try
  569. {
  570. conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  571. string sqlString = @" SELECT distinct t.LOGONAME,
  572. t.LOGOID FROM (
  573. SELECT
  574. TML.LOGONAME,
  575. TML.LOGOID
  576. FROM TP_MST_LOGO TML
  577. WHERE
  578. TML.LOGOID = 1
  579. union all
  580. SELECT
  581. TML.LOGONAME,
  582. TMGS.LOGOID
  583. FROM
  584. TP_MST_GOODSLOGOSAP TMGS
  585. LEFT JOIN TP_MST_LOGO TML ON TML.LOGOID = TMGS.LOGOID
  586. WHERE
  587. TMGS.goodsid = :goodsid
  588. )t ";
  589. OracleParameter[] paras = new OracleParameter[]{
  590. new OracleParameter(":goodsid",goodsID),
  591. };
  592. ServiceResultEntity sre = new ServiceResultEntity();
  593. sre.Data = conn.GetSqlResultToDs(sqlString, paras);
  594. return sre;
  595. }
  596. catch (Exception ex)
  597. {
  598. throw ex;
  599. }
  600. finally
  601. {
  602. if (conn != null &&
  603. conn.ConnState == ConnectionState.Open)
  604. {
  605. conn.Close();
  606. }
  607. }
  608. }
  609. /// <summary>
  610. /// 查询产品信息
  611. /// </summary>
  612. /// <param name="sUserInfo"></param>
  613. /// <param name="goodsID"></param>
  614. /// <returns></returns>
  615. public static ServiceResultEntity GetGoodsCode(SUserInfo sUserInfo)
  616. {
  617. IDBConnection conn = null;
  618. try
  619. {
  620. conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  621. string sqlString = @"SELECT GOODSID,GOODSCODE FROM TP_MST_GOODS WHERE VALUEFLAG = 1";
  622. OracleParameter[] paras = new OracleParameter[]{
  623. };
  624. ServiceResultEntity sre = new ServiceResultEntity();
  625. sre.Data = conn.GetSqlResultToDs(sqlString, paras);
  626. return sre;
  627. }
  628. catch (Exception ex)
  629. {
  630. throw ex;
  631. }
  632. finally
  633. {
  634. if (conn != null &&
  635. conn.ConnState == ConnectionState.Open)
  636. {
  637. conn.Close();
  638. }
  639. }
  640. }
  641. /// <summary>
  642. /// 查询辅件种类
  643. /// </summary>
  644. /// <param name="sUserInfo"></param>
  645. /// <param name="goodsID"></param>
  646. /// <returns></returns>
  647. public static ServiceResultEntity GetAccessoriesType(SUserInfo sUserInfo)
  648. {
  649. IDBConnection conn = null;
  650. try
  651. {
  652. conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  653. string sqlString = @"SELECT DICTIONARYID,DICTIONARYVALUE FROM TP_MST_DATADICTIONARY WHERE DICTIONARYTYPE = 'TPC010'";
  654. OracleParameter[] paras = new OracleParameter[]{
  655. };
  656. ServiceResultEntity sre = new ServiceResultEntity();
  657. sre.Data = conn.GetSqlResultToDs(sqlString, paras);
  658. return sre;
  659. }
  660. catch (Exception ex)
  661. {
  662. throw ex;
  663. }
  664. finally
  665. {
  666. if (conn != null &&
  667. conn.ConnState == ConnectionState.Open)
  668. {
  669. conn.Close();
  670. }
  671. }
  672. }
  673. /// <summary>
  674. /// 查询辅件编辑信息
  675. /// </summary>
  676. /// <param name="sUserInfo"></param>
  677. /// <param name="goodsID"></param>
  678. /// <returns></returns>
  679. public static ServiceResultEntity GetEditGoods(SUserInfo sUserInfo,ClientRequestEntity cre)
  680. {
  681. IDBConnection conn = null;
  682. try
  683. {
  684. conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  685. string sqlString = @"
  686. SELECT
  687. TMA.GOODSID,
  688. TMA.LOGOID,
  689. TMA.ACCESSORIESNAME,
  690. TMA.ACCESSORIESCODE,
  691. TMA.ACCESSORIESTYPEID
  692. FROM
  693. TP_MST_ACCESSORIES TMA
  694. WHERE
  695. TMA.VALUEFLAG = 1
  696. AND TMA.goodsid = :goodsid
  697. AND TMA.logoid = :logoid";
  698. string goodsid = cre.Data.Tables[0].Rows[0]["GoodsID"].ToString();
  699. string logoid = cre.Data.Tables[0].Rows[0]["logoid"].ToString();
  700. OracleParameter[] paras = new OracleParameter[]{
  701. new OracleParameter(":goodsid",goodsid),
  702. new OracleParameter(":logoid",logoid),
  703. };
  704. ServiceResultEntity sre = new ServiceResultEntity();
  705. sre.Data = conn.GetSqlResultToDs(sqlString, paras);
  706. return sre;
  707. }
  708. catch (Exception ex)
  709. {
  710. throw ex;
  711. }
  712. finally
  713. {
  714. if (conn != null &&
  715. conn.ConnState == ConnectionState.Open)
  716. {
  717. conn.Close();
  718. }
  719. }
  720. }
  721. /// <summary>
  722. /// 产品对应商标辅件编辑
  723. /// </summary>
  724. /// <param name="sUserInfo"></param>
  725. /// <param name="goodsID"></param>
  726. /// <returns></returns>
  727. public static ServiceResultEntity EditGoodsLogo(SUserInfo sUserInfo, ClientRequestEntity cre)
  728. {
  729. ServiceResultEntity sre = new ServiceResultEntity();
  730. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  731. try
  732. {
  733. string sqlString = string.Empty;
  734. string sqlString2 = string.Empty;
  735. OracleParameter[] paras = null;
  736. OracleParameter[] paras2 = null;
  737. //辅件
  738. DataTable dt1 = cre.Data.Tables[0];
  739. //产品id、商标id
  740. DataTable dt = cre.Data.Tables[1];
  741. int goodsid = Convert.ToInt32(dt.Rows[0]["GoodsID"]);
  742. int logoid = Convert.ToInt32(dt.Rows[0]["logoid"]);
  743. oracleTrConn.Connect();
  744. //删除对应辅件
  745. sqlString = @"DELETE FROM TP_MST_ACCESSORIES WHERE GOODSID = :GOODSID AND LOGOID = :LOGOID";
  746. paras = new OracleParameter[]
  747. {
  748. new OracleParameter(":GOODSID", goodsid),
  749. new OracleParameter(":LOGOID", logoid)
  750. };
  751. int count = dt1.Rows.Count;
  752. sre.OtherStatus += oracleTrConn.ExecuteNonQuery(sqlString, paras);
  753. if (dt1.Rows.Count > 0)
  754. {
  755. // 保存
  756. sqlString = @"
  757. INSERT INTO TP_MST_ACCESSORIES (GOODSID,LOGOID,VALUEFLAG,CREATEUSERID,UPDATEUSERID,ACCESSORIESNAME,ACCESSORIESTYPEID,ACCESSORIESCODE)
  758. VALUES(:GOODSID,:LOGOID,1,:UserID,:UserID,:ACCESSORIESNAME,:ACCESSORIESTYPEID,:ACCESSORIESCODE)
  759. ";
  760. for (int i = 0; i < count; i++)
  761. {
  762. //查询对应的辅件id
  763. sqlString2 = "SELECT DICTIONARYID FROM TP_MST_DATADICTIONARY WHERE DICTIONARYVALUE = :DICTIONARYVALUE";
  764. paras2 = new OracleParameter[]
  765. {
  766. new OracleParameter(":DICTIONARYVALUE", dt1.Rows[i]["DICTIONARYVALUE"]),
  767. };
  768. DataSet ds = oracleTrConn.GetSqlResultToDs(sqlString2, paras2);
  769. paras = new OracleParameter[]
  770. {
  771. new OracleParameter(":GOODSID", goodsid),
  772. new OracleParameter(":LOGOID", logoid),
  773. new OracleParameter(":ACCESSORIESNAME", dt1.Rows[i]["ACCESSORIESNAME"]),
  774. new OracleParameter(":ACCESSORIESTYPEID",ds.Tables[0].Rows[0]["DICTIONARYID"]),
  775. new OracleParameter(":ACCESSORIESCODE", dt1.Rows[i]["ACCESSORIESCODE"]),
  776. new OracleParameter(":UserID", sUserInfo.UserID),
  777. };
  778. sre.OtherStatus += oracleTrConn.ExecuteNonQuery(sqlString, paras);
  779. }
  780. }
  781. oracleTrConn.Commit();
  782. oracleTrConn.Disconnect();
  783. }
  784. catch (Exception ex)
  785. {
  786. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  787. {
  788. oracleTrConn.Rollback();
  789. oracleTrConn.Disconnect();
  790. }
  791. throw new Exception(ex.ToString(), ex);
  792. }
  793. finally
  794. {
  795. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  796. {
  797. oracleTrConn.Disconnect();
  798. }
  799. }
  800. return sre;
  801. }
  802. /// <summary>
  803. /// 查询附件
  804. /// </summary>
  805. /// <param name="sUserInfo"></param>
  806. /// <param name="goodsID"></param>
  807. /// <returns></returns>
  808. public static ServiceResultEntity GetAccessories(SUserInfo sUserInfo, ClientRequestEntity cre)
  809. {
  810. IDBConnection conn = null;
  811. try
  812. {
  813. conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  814. string sqlString = @"SELECT
  815. TMA.ACCESSORIESCODE,
  816. --TMA.ACCESSORIESTYPEID,
  817. TMA.ACCESSORIESNAME,
  818. TMD.DICTIONARYVALUE
  819. FROM
  820. TP_MST_ACCESSORIES TMA
  821. LEFT JOIN TP_MST_DATADICTIONARY TMD ON TMA.ACCESSORIESTYPEID = TMD.DICTIONARYID
  822. WHERE GOODSID = :goodsid AND LOGOID = :logoid";
  823. string goodsid = cre.Data.Tables[0].Rows[0]["GoodsID"].ToString();
  824. string logoid = cre.Data.Tables[0].Rows[0]["logoid"].ToString();
  825. OracleParameter[] paras = new OracleParameter[]{
  826. new OracleParameter(":goodsid",goodsid),
  827. new OracleParameter(":logoid",logoid),
  828. };
  829. ServiceResultEntity sre = new ServiceResultEntity();
  830. sre.Data = conn.GetSqlResultToDs(sqlString, paras);
  831. return sre;
  832. }
  833. catch (Exception ex)
  834. {
  835. throw ex;
  836. }
  837. finally
  838. {
  839. if (conn != null &&
  840. conn.ConnState == ConnectionState.Open)
  841. {
  842. conn.Close();
  843. }
  844. }
  845. }
  846. /// <summary>
  847. /// 保存产品商标辅件
  848. /// </summary>
  849. /// <param name="sUserInfo"></param>
  850. /// <param name="goodsID"></param>
  851. /// <returns></returns>
  852. public static ServiceResultEntity AddGoodsLogo(SUserInfo sUserInfo, ClientRequestEntity cre)
  853. {
  854. string sqlString = string.Empty;
  855. string sqlString2 = string.Empty;
  856. OracleParameter[] paras = null;
  857. OracleParameter[] paras2 = null;
  858. //辅件
  859. DataTable dt1 = cre.Data.Tables[1];
  860. //产品id、商标id
  861. DataTable dt = cre.Data.Tables[0];
  862. int goodsid = Convert.ToInt32(dt.Rows[0]["GoodsID"]);
  863. int logoid = Convert.ToInt32(dt.Rows[0]["logoid"]);
  864. //新增条数
  865. int count = dt1.Rows.Count;
  866. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  867. ServiceResultEntity sre = new ServiceResultEntity();
  868. try
  869. {
  870. oracleTrConn.Connect();
  871. // 保存
  872. sqlString = @"
  873. INSERT INTO TP_MST_ACCESSORIES (GOODSID,LOGOID,VALUEFLAG,CREATEUSERID,UPDATEUSERID,ACCESSORIESNAME,ACCESSORIESTYPEID,ACCESSORIESCODE)
  874. VALUES(:GOODSID,:LOGOID,1,:UserID,:UserID,:ACCESSORIESNAME,:ACCESSORIESTYPEID,:ACCESSORIESCODE)
  875. ";
  876. for (int i = 0; i < count; i++)
  877. {
  878. //查询对应的辅件id
  879. sqlString2 = "SELECT DICTIONARYID FROM TP_MST_DATADICTIONARY WHERE DICTIONARYVALUE = :DICTIONARYVALUE";
  880. paras2 = new OracleParameter[]
  881. {
  882. new OracleParameter(":DICTIONARYVALUE", dt1.Rows[i]["DICTIONARYVALUE"]),
  883. };
  884. DataSet ds = oracleTrConn.GetSqlResultToDs(sqlString2, paras2);
  885. paras = new OracleParameter[]
  886. {
  887. new OracleParameter(":GOODSID", goodsid),
  888. new OracleParameter(":LOGOID", logoid),
  889. new OracleParameter(":ACCESSORIESNAME", dt1.Rows[i]["ACCESSORIESNAME"]),
  890. new OracleParameter(":ACCESSORIESTYPEID",ds.Tables[0].Rows[0]["DICTIONARYID"]),
  891. new OracleParameter(":ACCESSORIESCODE", dt1.Rows[i]["ACCESSORIESCODE"]),
  892. new OracleParameter(":UserID", sUserInfo.UserID),
  893. };
  894. sre.OtherStatus += oracleTrConn.ExecuteNonQuery(sqlString, paras);
  895. }
  896. oracleTrConn.Commit();
  897. oracleTrConn.Disconnect();
  898. }
  899. catch (Exception ex)
  900. {
  901. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  902. {
  903. oracleTrConn.Rollback();
  904. oracleTrConn.Disconnect();
  905. }
  906. throw ex;
  907. }
  908. return sre;
  909. }
  910. /// <summary>
  911. /// 查询产品物料信息(编辑用)
  912. /// </summary>
  913. /// <param name="sUserInfo"></param>
  914. /// <param name="goodsID"></param>
  915. /// <returns></returns>
  916. public static ServiceResultEntity GetGoodsSAPByEdit(SUserInfo sUserInfo, int goodsID)
  917. {
  918. IDBConnection conn = null;
  919. try
  920. {
  921. conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  922. string sqlString = "select l.logoid\n" +
  923. " ,l.logoname\n" +
  924. " ,gls.materialcode\n" +
  925. " ,gls.materialremark\n" +
  926. " ,gls.WaterLabelCode\n" +
  927. " ,gls.goodsid\n" +
  928. " ,l.valueflag\n" +
  929. " from tp_mst_logo l\n" +
  930. " left join tp_mst_goodslogosap gls\n" +
  931. " on gls.goodsid = :goodsid\n" +
  932. " and l.logoid = gls.logoid\n" +
  933. " where (l.valueflag = '1' or gls.goodsid is not null)\n" +
  934. " order by gls.goodsid, l.valueflag desc, l.displayno";
  935. OracleParameter[] paras = new OracleParameter[]{
  936. new OracleParameter(":goodsid",goodsID),
  937. };
  938. ServiceResultEntity sre = new ServiceResultEntity();
  939. sre.Data = conn.GetSqlResultToDs(sqlString, paras);
  940. return sre;
  941. }
  942. catch (Exception ex)
  943. {
  944. throw ex;
  945. }
  946. finally
  947. {
  948. if (conn != null &&
  949. conn.ConnState == ConnectionState.Open)
  950. {
  951. conn.Close();
  952. }
  953. }
  954. }
  955. #endregion
  956. #region 获得生产工号集合
  957. /// <summary>
  958. /// 获得生产工号集合
  959. /// </summary>
  960. /// <param name="sUserInfo">用户基本信息</param>
  961. /// <returns>DataSet</returns>
  962. /// <remarks>
  963. /// 陈冰 2014.09.03 新建
  964. /// </remarks>
  965. public static DataSet GetWorker(SUserInfo sUserInfo)
  966. {
  967. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  968. try
  969. {
  970. con.Open();
  971. OracleParameter[] paras = new OracleParameter[]{
  972. new OracleParameter("accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  973. new OracleParameter("rs_worker",OracleDbType.RefCursor,ParameterDirection.Output),
  974. };
  975. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetWorker", paras);
  976. return ds;
  977. }
  978. catch (Exception ex)
  979. {
  980. throw ex;
  981. }
  982. finally
  983. {
  984. if (con.ConnState == ConnectionState.Open)
  985. {
  986. con.Close();
  987. }
  988. }
  989. }
  990. #endregion
  991. #region 获得工种集合
  992. /// <summary>
  993. /// 获得工种集合
  994. /// </summary>
  995. /// <param name="sUserInfo">用户基本信息</param>
  996. /// <returns>DataSet</returns>
  997. /// <remarks>
  998. /// 陈冰 2014.09.03 新建
  999. /// </remarks>
  1000. public static DataSet GetJobs(SUserInfo sUserInfo)
  1001. {
  1002. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1003. try
  1004. {
  1005. con.Open();
  1006. OracleParameter[] paras = new OracleParameter[]{
  1007. new OracleParameter("accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  1008. new OracleParameter("rs_jobs",OracleDbType.RefCursor,ParameterDirection.Output),
  1009. };
  1010. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetJobs", paras);
  1011. return ds;
  1012. }
  1013. catch (Exception ex)
  1014. {
  1015. throw ex;
  1016. }
  1017. finally
  1018. {
  1019. if (con.ConnState == ConnectionState.Open)
  1020. {
  1021. con.Close();
  1022. }
  1023. }
  1024. }
  1025. #endregion
  1026. #region 获得缺陷集合
  1027. /// <summary>
  1028. /// 获得缺陷集合
  1029. /// </summary>
  1030. /// <param name="sUserInfo">用户基本信息</param>
  1031. /// <returns>DataSet</returns>
  1032. /// <remarks>
  1033. /// 陈冰 2014.09.03 新建
  1034. /// </remarks>
  1035. public static DataSet GetDefect(SUserInfo sUserInfo)
  1036. {
  1037. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1038. try
  1039. {
  1040. con.Open();
  1041. OracleParameter[] paras = new OracleParameter[]{
  1042. new OracleParameter("accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  1043. new OracleParameter("rs_defect",OracleDbType.RefCursor,ParameterDirection.Output),
  1044. };
  1045. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetDefect", paras);
  1046. return ds;
  1047. }
  1048. catch (Exception ex)
  1049. {
  1050. throw ex;
  1051. }
  1052. finally
  1053. {
  1054. if (con.ConnState == ConnectionState.Open)
  1055. {
  1056. con.Close();
  1057. }
  1058. }
  1059. }
  1060. #endregion
  1061. #region 产品图片
  1062. /// <summary>
  1063. /// 根据产品ID获取产品图片
  1064. /// </summary>
  1065. /// <param name="sUserInfo">用户基本信息</param>
  1066. /// <param name="goodsId">产品ID</param>
  1067. /// <returns>DataSet</returns>
  1068. /// <remarks>
  1069. /// 庄天威 2014.09.04 新建
  1070. /// </remarks>
  1071. public static DataSet GetImageByGoodsId(SUserInfo sUserInfo, int goodsId)
  1072. {
  1073. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1074. try
  1075. {
  1076. con.Open();
  1077. OracleParameter[] paras = new OracleParameter[]{
  1078. new OracleParameter("in_accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  1079. new OracleParameter("in_goodsID",OracleDbType.Int32,goodsId,ParameterDirection.Input),
  1080. new OracleParameter("rs_result",OracleDbType.RefCursor,ParameterDirection.Output),
  1081. };
  1082. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetImageByGoodsId", paras);
  1083. return ds;
  1084. }
  1085. catch (Exception ex)
  1086. {
  1087. throw ex;
  1088. }
  1089. finally
  1090. {
  1091. if (con.ConnState == ConnectionState.Open)
  1092. {
  1093. con.Close();
  1094. }
  1095. }
  1096. }
  1097. #endregion
  1098. #region 附件
  1099. /// <summary>
  1100. /// 新建附件信息
  1101. /// </summary>
  1102. /// <param name="AttList">附件实体集合</param>
  1103. /// <param name="mainId">产品ID</param>
  1104. /// <param name="userInfo">用户基本信息</param>
  1105. /// <returns>int影响结果行数</returns>
  1106. public static int AddAttachment(List<GoodsAttachmentEntity> AttList, int mainId, SUserInfo userInfo)
  1107. {
  1108. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  1109. try
  1110. {
  1111. oracleTrConn.Connect();
  1112. int AttReturn = 0;
  1113. int GAReturn = 0;
  1114. StringBuilder sbSql = new StringBuilder();
  1115. foreach (GoodsAttachmentEntity attFor in AttList)
  1116. {
  1117. sbSql.Clear();
  1118. sbSql.Append("select SEQ_MST_Attachment_ID.nextval from dual");
  1119. int id = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  1120. sbSql.Clear();
  1121. sbSql.Append(@"Insert into TP_MST_Attachment(AttachmentID,FileName,FilePath,AccountID,ValueFlag,
  1122. CreateUserID,UpdateUserID)
  1123. Values(:AttachmentID,:FileName,:FilePath,:AccountID,:ValueFlag,
  1124. :CreateUserID,:UpdateUserID)");
  1125. OracleParameter[] attParas = new OracleParameter[] {
  1126. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  1127. id,ParameterDirection.Input),
  1128. new OracleParameter(":FileName",OracleDbType.NVarchar2,
  1129. attFor.FileName,ParameterDirection.Input),
  1130. new OracleParameter(":FilePath",OracleDbType.NVarchar2,
  1131. attFor.FilePath,ParameterDirection.Input),
  1132. new OracleParameter(":AccountID",OracleDbType.Int32,
  1133. userInfo.AccountID,ParameterDirection.Input),
  1134. new OracleParameter(":ValueFlag",OracleDbType.Int32,
  1135. 1,ParameterDirection.Input),
  1136. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  1137. userInfo.UserID,ParameterDirection.Input),
  1138. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  1139. userInfo.UserID,ParameterDirection.Input)
  1140. };
  1141. AttReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), attParas);
  1142. sbSql.Clear();
  1143. sbSql.Append(@"Insert into TP_MST_GoodsAttachment(GoodsID,AttachmentID,CreateUserID,UpdateUserID)
  1144. Values(:GoodsID,:AttachmentID,:CreateUserID,:UpdateUserID)");
  1145. OracleParameter[] gaParas = new OracleParameter[] {
  1146. new OracleParameter(":GoodsID",OracleDbType.Int32,
  1147. mainId,ParameterDirection.Input),
  1148. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  1149. id,ParameterDirection.Input),
  1150. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  1151. userInfo.UserID,ParameterDirection.Input),
  1152. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  1153. userInfo.UserID,ParameterDirection.Input)
  1154. };
  1155. GAReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), gaParas);
  1156. sbSql.Clear();
  1157. }
  1158. oracleTrConn.Commit();
  1159. oracleTrConn.Disconnect();
  1160. return AttReturn;
  1161. }
  1162. catch (Exception ex)
  1163. {
  1164. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  1165. {
  1166. oracleTrConn.Rollback();
  1167. oracleTrConn.Disconnect();
  1168. }
  1169. throw ex;
  1170. }
  1171. }
  1172. /// <summary>
  1173. /// 修改附件信息
  1174. /// </summary>
  1175. /// <param name="AttList">附件实体集合</param>
  1176. /// <param name="mainId">产品ID</param>
  1177. /// <param name="userInfo">用户基本信息</param>
  1178. /// <returns>int受影响行数</returns>
  1179. public static int UpdateAttachment(List<GoodsAttachmentEntity> AttList, int mainId, SUserInfo userInfo)
  1180. {
  1181. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  1182. try
  1183. {
  1184. oracleTrConn.Connect();
  1185. int AttReturn = 0;
  1186. int GAReturn = 0;
  1187. StringBuilder sbSql = new StringBuilder();
  1188. foreach (GoodsAttachmentEntity attFor in AttList)
  1189. {
  1190. if (attFor.IsUpdateAdd == 0) //不是新建的
  1191. {
  1192. sbSql.Clear();
  1193. sbSql.Append(@"Update TP_MST_Attachment set ValueFlag = :ValueFlag,UpdateUserID=:UpdateUserID
  1194. Where AttachmentID = :AttachmentID");
  1195. OracleParameter[] attParas = new OracleParameter[] {
  1196. new OracleParameter(":ValueFlag",OracleDbType.Int32,
  1197. attFor.ValueFlag,ParameterDirection.Input),
  1198. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  1199. userInfo.UserID,ParameterDirection.Input),
  1200. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  1201. attFor.AttachmentID,ParameterDirection.Input)
  1202. };
  1203. AttReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), attParas);
  1204. sbSql.Clear();
  1205. sbSql.Append(@"Update TP_MST_GoodsAttachment
  1206. Set ValueFlag = :ValueFlag,UpdateUserID=:UpdateUserID
  1207. Where AttachmentID = :AttachmentID");
  1208. GAReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), attParas);
  1209. sbSql.Clear();
  1210. }
  1211. else //新建的
  1212. {
  1213. sbSql.Clear();
  1214. sbSql.Append("select SEQ_MST_Attachment_ID.nextval from dual");
  1215. int id = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  1216. sbSql.Clear();
  1217. sbSql.Append(@"Insert into TP_MST_Attachment(AttachmentID,FileName,FilePath,AccountID,ValueFlag,
  1218. CreateUserID,UpdateUserID)
  1219. Values(:AttachmentID,:FileName,:FilePath,:AccountID,:ValueFlag,
  1220. :CreateUserID,:UpdateUserID)");
  1221. OracleParameter[] attParas = new OracleParameter[] {
  1222. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  1223. id,ParameterDirection.Input),
  1224. new OracleParameter(":FileName",OracleDbType.NVarchar2,
  1225. attFor.FileName,ParameterDirection.Input),
  1226. new OracleParameter(":FilePath",OracleDbType.NVarchar2,
  1227. attFor.FilePath,ParameterDirection.Input),
  1228. new OracleParameter(":AccountID",OracleDbType.Int32,
  1229. userInfo.AccountID,ParameterDirection.Input),
  1230. new OracleParameter(":ValueFlag",OracleDbType.Int32,
  1231. 1,ParameterDirection.Input),
  1232. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  1233. userInfo.UserID,ParameterDirection.Input),
  1234. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  1235. userInfo.UserID,ParameterDirection.Input)
  1236. };
  1237. AttReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), attParas);
  1238. sbSql.Clear();
  1239. sbSql.Append(@"Insert into TP_MST_GoodsAttachment(GoodsID,AttachmentID,CreateUserID,UpdateUserID)
  1240. Values(:GoodsID,:AttachmentID,:CreateUserID,:UpdateUserID)");
  1241. OracleParameter[] gaParas = new OracleParameter[] {
  1242. new OracleParameter(":GoodsID",OracleDbType.Int32,
  1243. mainId,ParameterDirection.Input),
  1244. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  1245. id,ParameterDirection.Input),
  1246. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  1247. userInfo.UserID,ParameterDirection.Input),
  1248. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  1249. userInfo.UserID,ParameterDirection.Input)
  1250. };
  1251. GAReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), gaParas);
  1252. sbSql.Clear();
  1253. }
  1254. }
  1255. oracleTrConn.Commit();
  1256. oracleTrConn.Disconnect();
  1257. return AttReturn;
  1258. }
  1259. catch (Exception ex)
  1260. {
  1261. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  1262. {
  1263. oracleTrConn.Rollback();
  1264. oracleTrConn.Disconnect();
  1265. }
  1266. throw ex;
  1267. }
  1268. }
  1269. /// <summary>
  1270. /// 根据产品ID获取附件
  1271. /// </summary>
  1272. /// <param name="goodsId">产品ID</param>
  1273. /// <returns>DataSet</returns>
  1274. public static DataSet GetAttachmentByGoodsId(int goodsId)
  1275. {
  1276. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1277. try
  1278. {
  1279. con.Open();
  1280. String strSql = @"Select goodsAtt.GoodsID,att.* from TP_MST_GoodsAttachment goodsAtt
  1281. Inner join TP_MST_Attachment att
  1282. On goodsAtt.AttachmentID = att.AttachmentID
  1283. Where goodsAtt.ValueFlag = 1 and goodsAtt.GoodsID = " + goodsId;
  1284. DataSet ds = con.GetSqlResultToDs(strSql, null);
  1285. return ds;
  1286. }
  1287. catch (Exception ex)
  1288. {
  1289. throw ex;
  1290. }
  1291. finally
  1292. {
  1293. if (con.ConnState == ConnectionState.Open)
  1294. {
  1295. con.Close();
  1296. }
  1297. }
  1298. }
  1299. #endregion
  1300. #region 缺陷位置
  1301. /// <summary>
  1302. /// 获取缺陷位置
  1303. /// </summary>
  1304. /// <param name="dpEntity">缺陷位置实体</param>
  1305. /// <param name="userInfo">用户基本信息</param>
  1306. /// <returns>DataSet</returns>
  1307. public static DataSet GetDefectPosition(DefectPositionEntity dpEntity, SUserInfo userInfo)
  1308. {
  1309. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1310. try
  1311. {
  1312. con.Open();
  1313. OracleParameter[] paras = new OracleParameter[]{
  1314. new OracleParameter("in_DefectPositionID",OracleDbType.Int32,
  1315. dpEntity.DefectPositionID,ParameterDirection.Input),
  1316. new OracleParameter("in_DefectPositionCode",OracleDbType.NVarchar2,
  1317. dpEntity.DefectPositionCode,ParameterDirection.Input),
  1318. new OracleParameter("in_DefectPositionName",OracleDbType.NVarchar2,
  1319. dpEntity.DefectPositionName,ParameterDirection.Input),
  1320. new OracleParameter("in_AccountID",OracleDbType.Int32,
  1321. userInfo.AccountID,ParameterDirection.Input),
  1322. new OracleParameter("out_rs_defect",OracleDbType.RefCursor,ParameterDirection.Output),
  1323. };
  1324. DataSet dsDefectPosition = con.ExecStoredProcedure("PRO_MST_GetDefectPosition", paras);
  1325. return dsDefectPosition;
  1326. }
  1327. catch (Exception ex)
  1328. {
  1329. throw ex;
  1330. }
  1331. finally
  1332. {
  1333. if (con.ConnState == ConnectionState.Open)
  1334. {
  1335. con.Close();
  1336. }
  1337. }
  1338. }
  1339. /// <summary>
  1340. /// 根据产品获得产品缺陷位置
  1341. /// </summary>
  1342. /// <param name="GoodsId">产品ID</param>
  1343. /// <returns>DataSet</returns>
  1344. public static DataSet getGoodsDefectPositionByGoodsId(int GoodsId)
  1345. {
  1346. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1347. try
  1348. {
  1349. con.Open();
  1350. string sql = @"select gdp.*,dp.DefectPositionCode,dp.DefectPositionName,dp.Remarks
  1351. from TP_MST_GoodsDefectPosition gdp
  1352. inner join TP_MST_DefectPosition dp
  1353. on gdp.DefectPositionID=dp.DefectPositionID
  1354. where gdp.GoodsID=" + GoodsId;
  1355. DataSet dsDefectPosition = con.GetSqlResultToDs(sql, null);
  1356. return dsDefectPosition;
  1357. }
  1358. catch (Exception ex)
  1359. {
  1360. throw ex;
  1361. }
  1362. finally
  1363. {
  1364. if (con.ConnState == ConnectionState.Open)
  1365. {
  1366. con.Close();
  1367. }
  1368. }
  1369. }
  1370. /// <summary>
  1371. /// 保存产品缺陷位置关联(依附在添加产品中)
  1372. /// </summary>
  1373. /// <param name="dpList">缺陷位置集</param>
  1374. /// <param name="GoodsId">产品ID</param>
  1375. /// <param name="userInfo">用户基本信息</param>
  1376. /// <returns>int</returns>
  1377. public static int SaveGoodsDefectPosition(IDBTransaction oracleTrConn, List<int> dpList, int GoodsId, SUserInfo userInfo)
  1378. {
  1379. try
  1380. {
  1381. int ReturnCount = 0;
  1382. string sql = "Delete from TP_MST_GoodsDefectPosition where GoodsId=" + GoodsId;
  1383. foreach (int dpFor in dpList)
  1384. {
  1385. string sqlAdd = @"Insert into TP_MST_GoodsDefectPosition(GoodsID,DefectPositionID,
  1386. CreateTime,CreateUserID) Values(:GoodsID,:DefectPositionID,sysdate,:CreateUserID)";
  1387. OracleParameter[] paras = new OracleParameter[]{
  1388. new OracleParameter(":GoodsID",OracleDbType.Int32,
  1389. GoodsId,ParameterDirection.Input),
  1390. new OracleParameter(":DefectPositionID",OracleDbType.Int32,
  1391. dpFor,ParameterDirection.Input),
  1392. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  1393. userInfo.UserID,ParameterDirection.Input),
  1394. };
  1395. ReturnCount += oracleTrConn.ExecuteNonQuery(sqlAdd, paras);
  1396. }
  1397. return ReturnCount;
  1398. }
  1399. catch (Exception ex)
  1400. {
  1401. throw ex;
  1402. }
  1403. }
  1404. #endregion
  1405. #region 成型线类型
  1406. /// <summary>
  1407. /// 获取成型线类型
  1408. /// </summary>
  1409. /// <param name="userInfo">用户基本信息</param>
  1410. /// <returns>数据集</returns>
  1411. /// <remarks>
  1412. /// 庄天威 2014.09.04 新建
  1413. /// </remarks>
  1414. public static DataSet GetGMouldType(SUserInfo userInfo)
  1415. {
  1416. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1417. try
  1418. {
  1419. con.Open();
  1420. OracleParameter[] paras = new OracleParameter[]{
  1421. new OracleParameter("in_accountID",OracleDbType.Int32,
  1422. userInfo.AccountID,ParameterDirection.Input),
  1423. new OracleParameter("in_valueFlag",OracleDbType.Int32,
  1424. 1,ParameterDirection.Input),
  1425. new OracleParameter("out_result",OracleDbType.RefCursor,ParameterDirection.Output),
  1426. };
  1427. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetMouldType", paras);
  1428. return ds;
  1429. }
  1430. catch (Exception ex)
  1431. {
  1432. throw ex;
  1433. }
  1434. finally
  1435. {
  1436. if (con.ConnState == ConnectionState.Open)
  1437. {
  1438. con.Close();
  1439. }
  1440. }
  1441. }
  1442. #endregion
  1443. #region 产品分级数据源
  1444. /// <summary>
  1445. /// 产品分级数据源
  1446. /// </summary>
  1447. /// <param name="type">1适用半成品2检验 2适用成品检验 3入窑前检验</param>
  1448. /// <param name="userInfo">用户基本信息</param>
  1449. /// <returns>DataSet</returns>
  1450. public static DataSet GetGoodsLevel(int type, SUserInfo userInfo)
  1451. {
  1452. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1453. try
  1454. {
  1455. con.Open();
  1456. string sqlString = "";
  1457. if (type == 1 || type == 3)
  1458. {
  1459. sqlString = "select GoodsLevelID as DefectFlagID,GoodsLevelName as DefectFlagName,GoodsLevelTypeID from TP_MST_GoodsLevel where IsSemiFinishedEx=1 and AccountID=:AccountID and ValueFlag=1 order by SFEDisplayNo";
  1460. }
  1461. else if (type == 2)
  1462. {
  1463. sqlString = "select GoodsLevelID as DefectFlagID,GoodsLevelName as DefectFlagName,GoodsLevelTypeID from TP_MST_GoodsLevel where IsFinishedEx=1 and AccountID=:AccountID and ValueFlag=1 order by FEDisplayNo";
  1464. }
  1465. OracleParameter[] paras = new OracleParameter[]{
  1466. new OracleParameter(":AccountID",userInfo.AccountID),
  1467. };
  1468. DataSet dsGoodsLevel = con.GetSqlResultToDs(sqlString, paras);
  1469. return dsGoodsLevel;
  1470. }
  1471. catch (Exception ex)
  1472. {
  1473. throw ex;
  1474. }
  1475. finally
  1476. {
  1477. if (con.ConnState == ConnectionState.Open)
  1478. {
  1479. con.Close();
  1480. }
  1481. }
  1482. }
  1483. #endregion
  1484. #region 审核状态
  1485. /// <summary>
  1486. /// 获取全部审核状态
  1487. /// </summary>
  1488. /// <returns>DataSet审核状态数据源</returns>
  1489. public static DataSet GetAuditStatus()
  1490. {
  1491. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1492. try
  1493. {
  1494. con.Open();
  1495. String strSql = "Select * from TP_SYS_AuditStatus Order by DisplayNo";
  1496. DataSet ds = con.GetSqlResultToDs(strSql, null);
  1497. return ds;
  1498. }
  1499. catch (Exception ex)
  1500. {
  1501. throw ex;
  1502. }
  1503. finally
  1504. {
  1505. if (con.ConnState == ConnectionState.Open)
  1506. {
  1507. con.Close();
  1508. }
  1509. }
  1510. }
  1511. #endregion
  1512. /// <summary>
  1513. /// 工序集合
  1514. /// </summary>
  1515. /// <param name="ProductionLineEntity">工序实体</param>
  1516. /// <param name="sUserInfo">用户<基本信息/param>
  1517. /// <returns>DataSet</returns>
  1518. /// <remarks>
  1519. /// 王鑫 2014.11.29 新建
  1520. /// </remarks>
  1521. public static DataSet GetProdureList(SearchProductionLineEntity productionLineEntity, SUserInfo sUserInfo)
  1522. {
  1523. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1524. try
  1525. {
  1526. con.Open();
  1527. OracleParameter[] paras = new OracleParameter[]{
  1528. new OracleParameter("in_procedureCode",OracleDbType.Varchar2,productionLineEntity.ProductionLineCode,ParameterDirection.Input),
  1529. new OracleParameter("in_procedureName",OracleDbType.Varchar2,productionLineEntity.ProductionLineName,ParameterDirection.Input),
  1530. new OracleParameter("in_procedureIDS",OracleDbType.Varchar2,productionLineEntity.ProcuteLineIDS,ParameterDirection.Input),
  1531. new OracleParameter("in_accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  1532. new OracleParameter("out_result",OracleDbType.RefCursor, ParameterDirection.Output),
  1533. };
  1534. DataSet dsSearchReport = con.ExecStoredProcedure("PRO_PC_GetProcedureList", paras);
  1535. return dsSearchReport;
  1536. }
  1537. catch (Exception ex)
  1538. {
  1539. throw ex;
  1540. }
  1541. finally
  1542. {
  1543. if (con.ConnState == ConnectionState.Open)
  1544. {
  1545. con.Close();
  1546. }
  1547. }
  1548. }
  1549. /// <summary>
  1550. /// 获取全部工种计件方式
  1551. /// </summary>
  1552. /// <returns>DataSet工种计件方式集合</returns>
  1553. public static DataSet GetJobsPriceType()
  1554. {
  1555. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1556. try
  1557. {
  1558. con.Open();
  1559. String strSql = "Select * from TP_SYS_JobsPriceType Order by DisplayNo";
  1560. DataSet dsSearchReport = con.GetSqlResultToDs(strSql, null);
  1561. return dsSearchReport;
  1562. }
  1563. catch (Exception ex)
  1564. {
  1565. throw ex;
  1566. }
  1567. finally
  1568. {
  1569. if (con.ConnState == ConnectionState.Open)
  1570. {
  1571. con.Close();
  1572. }
  1573. }
  1574. }
  1575. #region 工位
  1576. #region 工位配置
  1577. /// <summary>
  1578. /// 获取工位
  1579. /// </summary>
  1580. /// <param name="cre"></param>
  1581. /// <param name="sUserInfo"></param>
  1582. /// <returns></returns>
  1583. public static ServiceResultEntity GetWorkStation(ClientRequestEntity cre, SUserInfo sUserInfo)
  1584. {
  1585. ServiceResultEntity sre = new ServiceResultEntity();
  1586. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1587. try
  1588. {
  1589. string sqlString = string.Empty;
  1590. List<OracleParameter> paras = new List<OracleParameter>();
  1591. con.Open();
  1592. sqlString = "SELECT ws.workstationid\n" +
  1593. " ,ws.workstationname\n" +
  1594. " ,p.procedurename\n" +
  1595. " ,ws.remarks\n" +
  1596. " FROM tp_mst_workstation ws\n" +
  1597. " LEFT JOIN tp_pc_procedure p\n" +
  1598. " ON p.procedureid = ws.procedureid\n" +
  1599. " WHERE ws.valueflag = '1'\n" +
  1600. " AND ws.accountid = :accountid";
  1601. paras.Add(new OracleParameter(":accountid", sUserInfo.AccountID));
  1602. if (!string.IsNullOrEmpty(cre.Properties["workstationname"] + ""))
  1603. {
  1604. sqlString += " AND ws.workstationname LIKE :workstationname ";
  1605. paras.Add(new OracleParameter(":workstationname", "%" + cre.Properties["workstationname"] + "%"));
  1606. }
  1607. if (!string.IsNullOrEmpty(cre.Properties["remarks"] + ""))
  1608. {
  1609. sqlString += " AND ws.remarks LIKE :remarks ";
  1610. paras.Add(new OracleParameter(":remarks", "%" + cre.Properties["remarks"] + "%"));
  1611. }
  1612. sqlString += " ORDER BY ws.displayno";
  1613. sre.Data = con.GetSqlResultToDs(sqlString, paras.ToArray());
  1614. return sre;
  1615. }
  1616. catch (Exception ex)
  1617. {
  1618. throw ex;
  1619. }
  1620. finally
  1621. {
  1622. if (con.ConnState == ConnectionState.Open)
  1623. {
  1624. con.Close();
  1625. }
  1626. }
  1627. }
  1628. /// <summary>
  1629. /// 获取工位工号
  1630. /// </summary>
  1631. /// <param name="sUserInfo"></param>
  1632. /// <returns></returns>
  1633. public static ServiceResultEntity GetWorkStationUser(int workStationID)
  1634. {
  1635. ServiceResultEntity sre = new ServiceResultEntity();
  1636. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1637. try
  1638. {
  1639. string sqlString =
  1640. "SELECT u.userid\n" +
  1641. " ,u.usercode\n" +
  1642. " ,u.username\n" +
  1643. " ,o.organizationid\n" +
  1644. " ,o.organizationname\n" +
  1645. " ,o.organizationfullname\n" +
  1646. " ,o.telephone\n" +
  1647. " ,u.remarks\n" +
  1648. " ,0 as addflag\n" +
  1649. " FROM tp_mst_user u\n" +
  1650. " LEFT JOIN tp_mst_organization o\n" +
  1651. " ON o.organizationid = u.organizationid\n" +
  1652. " WHERE EXISTS (SELECT 1\n" +
  1653. " FROM tp_mst_workstationuser wsu\n" +
  1654. " WHERE wsu.userid = u.userid\n" +
  1655. " AND wsu.workstationid = :workstationid)\n" +
  1656. " ORDER BY u.usercode";
  1657. OracleParameter[] paras = new OracleParameter[]
  1658. {
  1659. new OracleParameter(":workstationid", workStationID)
  1660. };
  1661. con.Open();
  1662. sre.Data = con.GetSqlResultToDs(sqlString, paras);
  1663. return sre;
  1664. }
  1665. catch (Exception ex)
  1666. {
  1667. throw ex;
  1668. }
  1669. finally
  1670. {
  1671. if (con.ConnState == ConnectionState.Open)
  1672. {
  1673. con.Close();
  1674. }
  1675. }
  1676. }
  1677. /// <summary>
  1678. /// 保存工位工号
  1679. /// </summary>
  1680. /// <param name="SProductEntity"></param>
  1681. /// <param name="userInfo"></param>
  1682. /// <returns></returns>
  1683. public static ServiceResultEntity SaveWorkStationUser(ClientRequestEntity cre, SUserInfo sUserInfo)
  1684. {
  1685. ServiceResultEntity sre = new ServiceResultEntity();
  1686. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  1687. try
  1688. {
  1689. string sqlString = string.Empty;
  1690. OracleParameter[] paras = null;
  1691. int workstationid = Convert.ToInt32(cre.Properties["workststionid"]);
  1692. oracleTrConn.Connect();
  1693. // 校验当前工号是否配置该工位
  1694. sqlString = "SELECT 1\n" +
  1695. " FROM tp_mst_workstation w\n" +
  1696. " WHERE w.workstationid = :workstationid";
  1697. paras = new OracleParameter[]
  1698. {
  1699. new OracleParameter(":workstationid", workstationid)
  1700. };
  1701. object isExists = oracleTrConn.GetSqlResultToObj(sqlString, paras);
  1702. if (isExists == null)
  1703. {
  1704. sre.OtherStatus = -1;
  1705. sre.Message = "当前工位不存在";
  1706. return sre;
  1707. }
  1708. // 删除当前工位工号
  1709. sqlString = "DELETE FROM tp_mst_workstationuser wu WHERE wu.workstationid = :workstationid";
  1710. paras = new OracleParameter[]
  1711. {
  1712. new OracleParameter(":workstationid", workstationid)
  1713. };
  1714. sre.OtherStatus += oracleTrConn.ExecuteNonQuery(sqlString, paras);
  1715. // 保存工位工号
  1716. sqlString = "INSERT INTO tp_mst_workstationuser\n" +
  1717. " (workstationid\n" +
  1718. " ,userid\n" +
  1719. " ,usercode\n" +
  1720. " ,accountid\n" +
  1721. " ,createuserid\n" +
  1722. " ,updateuserid\n" +
  1723. " ,organizationid)\n" +
  1724. " SELECT :workstationid\n" +
  1725. " ,u.userid\n" +
  1726. " ,u.usercode\n" +
  1727. " ,:accountid\n" +
  1728. " ,:createuserid\n" +
  1729. " ,:createuserid\n" +
  1730. " ,u.organizationid\n" +
  1731. " FROM tp_mst_user u\n" +
  1732. " WHERE u.userid = :userid";
  1733. foreach (DataRow row in cre.Data.Tables[0].Rows)
  1734. {
  1735. paras = new OracleParameter[]
  1736. {
  1737. new OracleParameter(":workstationid", workstationid),
  1738. new OracleParameter(":userid", row["userid"]),
  1739. new OracleParameter(":accountid", sUserInfo.AccountID),
  1740. new OracleParameter(":createuserid", sUserInfo.UserID)
  1741. };
  1742. sre.OtherStatus += oracleTrConn.ExecuteNonQuery(sqlString, paras);
  1743. }
  1744. oracleTrConn.Commit();
  1745. oracleTrConn.Disconnect();
  1746. }
  1747. catch (Exception ex)
  1748. {
  1749. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  1750. {
  1751. oracleTrConn.Rollback();
  1752. oracleTrConn.Disconnect();
  1753. }
  1754. throw new Exception(ex.ToString(), ex);
  1755. }
  1756. finally
  1757. {
  1758. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  1759. {
  1760. oracleTrConn.Disconnect();
  1761. }
  1762. }
  1763. return sre;
  1764. }
  1765. #endregion
  1766. #region 工位打卡
  1767. /// <summary>
  1768. /// 获取工号工位
  1769. /// </summary>
  1770. /// <param name="sUserInfo"></param>
  1771. /// <returns></returns>
  1772. public static ServiceResultEntity GetUserWorkStation(SUserInfo sUserInfo)
  1773. {
  1774. ServiceResultEntity sre = new ServiceResultEntity();
  1775. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1776. try
  1777. {
  1778. string sqlString =
  1779. "SELECT w.workstationid\n" +
  1780. " ,w.workstationname\n" +
  1781. " FROM tp_mst_workstationuser wu\n" +
  1782. " INNER JOIN tp_mst_workstation w\n" +
  1783. " ON w.workstationid = wu.workstationid\n" +
  1784. " WHERE w.valueflag = '1'\n" +
  1785. " AND wu.usercode = :usercode\n" +
  1786. " ORDER BY w.displayno";
  1787. OracleParameter[] paras = new OracleParameter[]
  1788. {
  1789. new OracleParameter(":usercode", sUserInfo.UserCode)
  1790. };
  1791. con.Open();
  1792. sre.Data = con.GetSqlResultToDs(sqlString, paras);
  1793. if (sre.Data.Tables[0].Rows.Count == 0)
  1794. {
  1795. sre.Message = "当前工号未配置工位";
  1796. }
  1797. return sre;
  1798. }
  1799. catch (Exception ex)
  1800. {
  1801. throw ex;
  1802. }
  1803. finally
  1804. {
  1805. if (con.ConnState == ConnectionState.Open)
  1806. {
  1807. con.Close();
  1808. }
  1809. }
  1810. }
  1811. /// <summary>
  1812. /// 工号工位打卡
  1813. /// </summary>
  1814. /// <param name="SProductEntity"></param>
  1815. /// <param name="userInfo"></param>
  1816. /// <returns></returns>
  1817. public static ServiceResultEntity SaveUserWorkStation(int workStationID, SUserInfo userInfo)
  1818. {
  1819. ServiceResultEntity sre = new ServiceResultEntity();
  1820. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  1821. try
  1822. {
  1823. string sqlString = string.Empty;
  1824. OracleParameter[] paras = null;
  1825. oracleTrConn.Connect();
  1826. // 校验当前工号是否配置该工位
  1827. sqlString = "SELECT 1\n" +
  1828. " FROM tp_mst_workstationuser wu\n" +
  1829. " WHERE wu.userid = :userid\n" +
  1830. " AND wu.workstationid = :workstationid";
  1831. paras = new OracleParameter[]
  1832. {
  1833. new OracleParameter(":userid", userInfo.UserID),
  1834. new OracleParameter(":workstationid", workStationID)
  1835. };
  1836. object isExists = oracleTrConn.GetSqlResultToObj(sqlString, paras);
  1837. if (isExists == null)
  1838. {
  1839. sre.OtherStatus = -1;
  1840. sre.Message = "当前工号未配置该工位";
  1841. return sre;
  1842. }
  1843. // 删除当前工号在任何一个工位,以确保当前工号在工位中唯一
  1844. sqlString = "UPDATE tp_mst_workstation\n" +
  1845. " SET usercode = NULL\n" +
  1846. " WHERE usercode = :usercode";
  1847. paras = new OracleParameter[]
  1848. {
  1849. new OracleParameter(":usercode", userInfo.UserCode)
  1850. };
  1851. sre.OtherStatus += oracleTrConn.ExecuteNonQuery(sqlString, paras);
  1852. // 更新工位当前工号
  1853. sqlString = "UPDATE tp_mst_workstation\n" +
  1854. " SET usercode = :usercode\n" +
  1855. " ,updateuserid = :userid\n" +
  1856. " WHERE workstationid = :workstationid";
  1857. paras = new OracleParameter[]
  1858. {
  1859. new OracleParameter(":usercode", userInfo.UserCode),
  1860. new OracleParameter(":userid", userInfo.UserID),
  1861. new OracleParameter(":workstationid", workStationID)
  1862. };
  1863. sre.OtherStatus += oracleTrConn.ExecuteNonQuery(sqlString, paras);
  1864. oracleTrConn.Commit();
  1865. oracleTrConn.Disconnect();
  1866. }
  1867. catch (Exception ex)
  1868. {
  1869. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  1870. {
  1871. oracleTrConn.Rollback();
  1872. oracleTrConn.Disconnect();
  1873. }
  1874. throw new Exception(ex.ToString(), ex);
  1875. }
  1876. finally
  1877. {
  1878. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  1879. {
  1880. oracleTrConn.Disconnect();
  1881. }
  1882. }
  1883. return sre;
  1884. }
  1885. #endregion
  1886. #endregion
  1887. }
  1888. }