SystemModuleLogicPartial.cs 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391
  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 Dongke.IBOSS.PRD.Basics.DataAccess;
  11. using Dongke.IBOSS.PRD.Service.DataModels;
  12. using Dongke.IBOSS.PRD.WCF.DataModels;
  13. using Oracle.ManagedDataAccess.Client;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Data;
  17. using System.Text;
  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("planFlag",OracleDbType.NVarchar2,
  74. goodsEntity.PlanFlag,ParameterDirection.Input),
  75. new OracleParameter("rs_result",OracleDbType.RefCursor,ParameterDirection.Output),
  76. new OracleParameter("rs_result_img",OracleDbType.RefCursor,ParameterDirection.Output),
  77. };
  78. foreach (OracleParameter item in paras)
  79. {
  80. if (item.Value + "" == "")
  81. {
  82. item.Value = DBNull.Value;
  83. }
  84. }
  85. DataSet ds = con.ExecStoredProcedure("PRO_MST_SerachGoods", paras);
  86. return ds;
  87. }
  88. catch (Exception ex)
  89. {
  90. throw ex;
  91. }
  92. finally
  93. {
  94. if (con.ConnState == ConnectionState.Open)
  95. {
  96. con.Close();
  97. }
  98. }
  99. }
  100. /// <summary>
  101. /// 新建产品档案
  102. /// </summary>
  103. /// <param name="sUserInfo">用户基本信息</param>
  104. /// <param name="goodsEntity">产品实体</param>
  105. /// <param name="imgList">产品图片集合</param>
  106. /// <param name="attList">缺陷位置ID集合</param>
  107. /// <returns>int受影响行数</returns>
  108. /// <remarks>
  109. /// 庄天威 2014.09.04 新建
  110. /// </remarks>
  111. public static int AddGoods(SUserInfo sUserInfo, GoodsEntity goodsEntity
  112. , List<GoodsImageEntity> imgList, List<GoodsAttachmentEntity> attList)
  113. {
  114. int returnRows;
  115. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  116. if (goodsEntity.MudQuantity == null)
  117. {
  118. goodsEntity.MudQuantity = 0;
  119. }
  120. if (goodsEntity.GlazeQuantity == null)
  121. {
  122. goodsEntity.GlazeQuantity = 0;
  123. }
  124. if (goodsEntity.Remarks == null)
  125. {
  126. goodsEntity.Remarks = "";
  127. }
  128. if (goodsEntity.GoodsSpecification == null)
  129. {
  130. goodsEntity.GoodsSpecification = "";
  131. }
  132. if (goodsEntity.GoodsModel == null)
  133. {
  134. goodsEntity.GoodsModel = "";
  135. }
  136. try
  137. {
  138. oracleTrConn.Connect();
  139. // 物料编码重复验证 add by chenxy 2017-07-11 begin
  140. // 有不同编码,同物料编码的情况 delete by chenxy 2017-11-10
  141. //string sqlString = "SELECT g.goodscode \n" +
  142. //" FROM tp_mst_goods g\n" +
  143. //" WHERE g.materialcode = :materialcode";
  144. //OracleParameter[] checkParas = new OracleParameter[]{
  145. // new OracleParameter(":materialcode",goodsEntity.MaterialCode),
  146. //};
  147. //string goodscode = oracleTrConn.GetSqlResultToStr(sqlString, checkParas);
  148. //if (!string.IsNullOrWhiteSpace(goodscode))
  149. //{
  150. // return -10;
  151. //}
  152. // 物料编码重复验证 add by chenxy 2017-07-11 end
  153. //2021年11月18日09:28:072 by fy modify 产品档案增加防伪码绑定标识、防伪码验证标识
  154. StringBuilder sbSql = new StringBuilder();
  155. sbSql.Append("select SEQ_MST_Goods_GoodsID.nextval from dual");
  156. int id = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  157. sbSql.Clear();
  158. sbSql.Append(" INSERT INTO TP_MST_GOODS");
  159. sbSql.Append("(GoodsID,GoodsCode,GoodsName,GoodsSpecification,GoodsModel,GoodsTypeID,");
  160. sbSql.Append("GlazeTypeID,MudWeight,GlazeWeight,LusterwareWeight,ProductionCycle,CeaseFlag,Goods_Line_Type,Goods_Line_Code,");
  161. sbSql.Append("StartingDate,AutoLossCycle,DeliverLimitCycle,PlateLimitNum,PlateLimitNumNew,UnitPrice,ReservedDays,");
  162. sbSql.Append("PackageNum,OutletDistance,MaterialCode,MaterialRemark,printcopies,");
  163. sbSql.Append("MouldWeight,MouldCost,ScrapSumFlag,SEATCOVERCODE,");
  164. sbSql.Append("WaterLabelCode,CertificateCode,StandardGroutingNum,MouldMaterialCode,MouldOutputCount,logoid,STD_GNUM_MAX,");
  165. sbSql.Append("Remarks,AccountID,ValueFlag,CreateUserID,UpdateUserID,MudStoreType,SecurityCodeBindFlag,SecurityCodeCheckFlag,PlanFlag)");
  166. sbSql.Append("VALUES( :GoodsId, :GoodsCode, :GoodsName, :GoodsSpecification, :GoodsModel, :GoodsTypeID,");
  167. sbSql.Append(" :GlazeTypeID, :MudWeight, :GlazeWeight,:LusterwareWeight, :ProductionCycle, :CeaseFlag,:Goods_Line_Type,:Goods_Line_Code,");
  168. sbSql.Append(" :StartingDate, :AutoLossCycle, :DeliverLimitCycle,:PlateLimitNum,:PlateLimitNumNew,:UnitPrice,:ReservedDays,");
  169. sbSql.Append(" :PackageNum, :OutletDistance, :MaterialCode,:MaterialRemark,:printcopies,");
  170. sbSql.Append(" :MouldWeight, :MouldCost,:ScrapSumFlag,:SEATCOVERCODE,");
  171. sbSql.Append(" :WaterLabelCode, :CertificateCode, :StandardGroutingNum, :MouldMaterialCode, :MouldOutputCount,:logoid,:STD_GNUM_MAX,");
  172. sbSql.Append(" :Remarks, :AccountID, :ValueFlag, :CreateUserID, :UpdateUserID, :MudStoreType , :SecurityCodeBindFlag,:SecurityCodeCheckFlag,:PlanFlag)");
  173. OracleParameter[] paras = new OracleParameter[]{
  174. new OracleParameter(":GoodsId",id),
  175. new OracleParameter(":GoodsCode",goodsEntity.GoodsCode),
  176. new OracleParameter(":GoodsName",goodsEntity.GoodsName),
  177. new OracleParameter(":GoodsSpecification",goodsEntity.GoodsSpecification),
  178. new OracleParameter(":GoodsModel",goodsEntity.GoodsModel),
  179. new OracleParameter(":GoodsTypeID",goodsEntity.GoodsTypeID),
  180. new OracleParameter(":GlazeTypeID",goodsEntity.GlazeTypeID),
  181. new OracleParameter(":MudWeight",goodsEntity.MudQuantity),
  182. new OracleParameter(":GlazeWeight",goodsEntity.GlazeQuantity),
  183. new OracleParameter(":LusterwareWeight",goodsEntity.LusterwareWeight),
  184. new OracleParameter(":ProductionCycle",goodsEntity.ProductionCycle),
  185. new OracleParameter(":CeaseFlag",goodsEntity.CeaseFlag),
  186. new OracleParameter(":Goods_Line_Type",goodsEntity.GoodsLineType),
  187. new OracleParameter(":Goods_Line_Code",goodsEntity.GoodsLineCode),
  188. new OracleParameter(":StartingDate",goodsEntity.StartingDate),
  189. new OracleParameter(":AutoLossCycle",goodsEntity.AutoLossCycle),
  190. new OracleParameter(":DeliverLimitCycle",goodsEntity.DeliverLimitCycle),
  191. new OracleParameter(":PlateLimitNum",goodsEntity.PlateLimitNum),
  192. new OracleParameter(":PlateLimitNumNew",goodsEntity.PlateLimitNumNew),
  193. new OracleParameter(":ReservedDays",goodsEntity.ReservedDays),
  194. new OracleParameter(":UnitPrice",goodsEntity.UnitPrice),
  195. new OracleParameter(":PackageNum",goodsEntity.PackageNum),
  196. new OracleParameter(":OutletDistance",goodsEntity.OutletDistance),
  197. new OracleParameter(":MaterialCode",goodsEntity.MaterialCode),
  198. new OracleParameter(":MouldWeight",goodsEntity.MouldWeight),
  199. new OracleParameter(":MouldCost",goodsEntity.MouldCost),
  200. new OracleParameter(":ScrapSumFlag",goodsEntity.ScrapSumFlag),
  201. new OracleParameter(":MaterialRemark",goodsEntity.MaterialRemark),
  202. new OracleParameter(":printcopies",goodsEntity.PrintCopies),
  203. new OracleParameter(":SEATCOVERCODE", goodsEntity.SeatCoverCode),
  204. new OracleParameter(":WaterLabelCode", goodsEntity.WaterLabelCode),
  205. new OracleParameter(":CertificateCode", goodsEntity.CertificateCode),
  206. new OracleParameter(":StandardGroutingNum", goodsEntity.StandardGroutingNum),
  207. new OracleParameter(":STD_GNUM_MAX", goodsEntity.STD_GNUM_MAX),
  208. new OracleParameter(":MouldMaterialCode", goodsEntity.MouldMaterialCode),
  209. new OracleParameter(":MouldOutputCount", goodsEntity.MouldOutputCount),
  210. new OracleParameter(":logoid", goodsEntity.LogoID),
  211. new OracleParameter(":Remarks",goodsEntity.Remarks),
  212. new OracleParameter(":AccountID",sUserInfo.AccountID),
  213. new OracleParameter(":ValueFlag",goodsEntity.ValueFlag),
  214. //new OracleParameter(":CreateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  215. new OracleParameter(":CreateUserID",sUserInfo.UserID),
  216. //new OracleParameter(":UpdateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  217. new OracleParameter(":UpdateUserID",sUserInfo.UserID),
  218. new OracleParameter(":MudStoreType",goodsEntity.MudStoreType),
  219. new OracleParameter(":SecurityCodeBindFlag",goodsEntity.SecurityCodeBindFlag),
  220. new OracleParameter(":SecurityCodeCheckFlag",goodsEntity.SecurityCodeCheckFlag),
  221. new OracleParameter(":PlanFlag",goodsEntity.PlanFlag)
  222. //new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp,DateTime.Now,ParameterDirection.Input)
  223. };
  224. returnRows = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), paras);
  225. //张忠帅 产品属性表添加功能 add 2022-12-28
  226. #region 产品属性表添加
  227. string sq2;
  228. sq2 = @"INSERT INTO TP_MST_PRODUCTATTRIBUTES(GOODSID,GOODSCODE,PRODUCEDAYS,ATTENDANCE,DAYGROUTINGNUMBER,PROTECTDAMRATE,YEARS)
  229. VALUES (:GOODSID,:GOODSCODE,:PRODUCEDAYS,:ATTENDANCE,:DAYGROUTINGNUMBER,:PROTECTDAMRATE,TO_DATE(:YEARS,'YYYY--MM'))";
  230. paras = new OracleParameter[]{
  231. new OracleParameter(":GOODSID",id),
  232. new OracleParameter(":GOODSCODE",goodsEntity.GoodsCode),
  233. new OracleParameter(":PRODUCEDAYS",goodsEntity.ProductDays),
  234. new OracleParameter(":ATTENDANCE",goodsEntity.Attendance),
  235. new OracleParameter(":DAYGROUTINGNUMBER",goodsEntity.DaygroutingNumber),
  236. new OracleParameter(":PROTECTDAMRATE",goodsEntity.ProtectdaMrate),
  237. new OracleParameter(":YEARS",DateTime.Now.ToString("yyyy-MM"))
  238. };
  239. returnRows += oracleTrConn.ExecuteNonQuery(sq2, paras);
  240. #endregion
  241. //张忠帅 产品属性表添加功能 add 2022-12-28
  242. //SAP物料信息
  243. string sql = "delete from TP_MST_GoodsLogoSAP where goodsid = " + id;
  244. returnRows += oracleTrConn.ExecuteNonQuery(sql);
  245. sql = "insert into TP_MST_GOODSLOGOSAP\n" +
  246. " (GOODSID, LOGOID, GOODSCODE, MATERIALCODE, MATERIALREMARK, CREATEUSERID, WaterLabelCode, CertificateCode, PLATELIMITNUM, PLATELIMITNUMNew)\n" +
  247. "values\n" +
  248. " (:GOODSID, :LOGOID, :GOODSCODE, :MATERIALCODE, :MATERIALREMARK, :CREATEUSERID, :WaterLabelCode, :CertificateCode, :PlateLimitNum, :PLATELIMITNUMNew)";
  249. foreach (DataRow item in goodsEntity.SAPInfo.Rows)
  250. {
  251. string sapcode = item["MATERIALCODE"] + "";
  252. string sapremark = item["MATERIALREMARK"] + "";
  253. if (string.IsNullOrWhiteSpace(sapcode))
  254. {
  255. continue;
  256. }
  257. if (string.IsNullOrEmpty(sapremark))
  258. {
  259. sapremark = " ";
  260. }
  261. paras = new OracleParameter[]{
  262. new OracleParameter(":GOODSID",id),
  263. new OracleParameter(":LOGOID",item["LOGOID"]),
  264. new OracleParameter(":GOODSCODE",goodsEntity.GoodsCode),
  265. new OracleParameter(":MATERIALCODE",sapcode),
  266. new OracleParameter(":MATERIALREMARK",sapremark),
  267. new OracleParameter(":CREATEUSERID",sUserInfo.UserID),
  268. new OracleParameter(":WaterLabelCode",item["WaterLabelCode"]),
  269. new OracleParameter(":CertificateCode",item["CertificateCode"]),
  270. new OracleParameter(":PlateLimitNum",item["PlateLimitNum"]),
  271. new OracleParameter(":PLATELIMITNUMNew",item["PLATELIMITNUMNew"]),
  272. };
  273. returnRows += oracleTrConn.ExecuteNonQuery(sql, paras);
  274. }
  275. //此处添加图片信息
  276. foreach (GoodsImageEntity img in imgList)
  277. {
  278. int imgReturn = 0;
  279. sbSql.Clear();
  280. sbSql.Append("select SEQ_MST_GoodsImage_ID.nextval from dual");
  281. int imgId = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  282. sbSql.Clear();
  283. sbSql.Append("Insert into TP_MST_GoodsImage");
  284. sbSql.Append("(GoodsImageID,GoodsID,Thumbnail,Image,AccountID,ValueFlag,");
  285. sbSql.Append("CreateUserID,UpdateUserID)");
  286. sbSql.Append(" VALUES(:GoodsImageID,:GoodsID,:Thumbnail,:Image,:AccountID,:ValueFlag,");
  287. sbSql.Append(":CreateUserID,:UpdateUserID)");
  288. OracleParameter[] imgParas = new OracleParameter[] {
  289. new OracleParameter(":GoodsImageID",OracleDbType.Int32,imgId,ParameterDirection.Input),
  290. new OracleParameter(":GoodsID",OracleDbType.Int32,id,ParameterDirection.Input),
  291. new OracleParameter(":Thumbnail",OracleDbType.Blob,img.Thumbnail,ParameterDirection.Input),
  292. new OracleParameter(":Image",OracleDbType.Blob,img.Image,ParameterDirection.Input),
  293. new OracleParameter(":AccountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  294. new OracleParameter(":ValueFlag",OracleDbType.Int32,img.ValueFlag,ParameterDirection.Input),
  295. //new OracleParameter(":CreateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  296. new OracleParameter(":CreateUserID",OracleDbType.Int32,sUserInfo.UserID,ParameterDirection.Input),
  297. //new OracleParameter(":UpdateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  298. new OracleParameter(":UpdateUserID",OracleDbType.Int32,sUserInfo.UserID,ParameterDirection.Input),
  299. //new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp,DateTime.Now,ParameterDirection.Input)
  300. };
  301. imgReturn = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), imgParas);
  302. }
  303. //此处添加产品附件
  304. //int AttReturn = AddAttachment(oracleTrConn, attList, id, sUserInfo);
  305. //此处添加缺陷位置关联
  306. //int dpCount = SaveGoodsDefectPosition(oracleTrConn, dpList, id, sUserInfo);
  307. oracleTrConn.Commit();
  308. oracleTrConn.Disconnect();
  309. }
  310. catch (Exception ex)
  311. {
  312. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  313. {
  314. oracleTrConn.Rollback();
  315. oracleTrConn.Disconnect();
  316. }
  317. throw ex;
  318. }
  319. return returnRows;
  320. }
  321. /// <summary>
  322. /// 修改产品档案
  323. /// </summary>
  324. /// <param name="sUserInfo">用户基本信息</param>
  325. /// <param name="goodsEntity">产品实体</param>
  326. /// <param name="imgList">产品图片集合</param>
  327. /// <param name="attList">缺陷位置ID集合</param>
  328. /// <returns>int受影响行数</returns>
  329. /// <remarks>
  330. /// 庄天威 2014.09.04 新建
  331. /// </remarks>
  332. public static int updateGoods(SUserInfo sUserInfo, GoodsEntity goodsEntity
  333. , List<GoodsImageEntity> imgList, List<GoodsAttachmentEntity> attList)
  334. {
  335. int returnRows = 0;
  336. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  337. if (goodsEntity.MudQuantity == null)
  338. {
  339. goodsEntity.MudQuantity = 0;
  340. }
  341. if (goodsEntity.GlazeQuantity == null)
  342. {
  343. goodsEntity.GlazeQuantity = 0;
  344. }
  345. if (goodsEntity.Remarks == null)
  346. {
  347. goodsEntity.Remarks = "";
  348. }
  349. if (goodsEntity.GoodsSpecification == null)
  350. {
  351. goodsEntity.GoodsSpecification = "";
  352. }
  353. if (goodsEntity.GoodsModel == null)
  354. {
  355. goodsEntity.GoodsModel = "";
  356. }
  357. try
  358. {
  359. oracleTrConn.Connect();
  360. // 物料编码重复验证 add by chenxy 2017-07-11 begin
  361. // 有不同编码,同物料编码的情况 delete by chenxy 2017-11-10
  362. //string sqlString = "SELECT g.goodscode \n" +
  363. //" FROM tp_mst_goods g\n" +
  364. //" WHERE g.materialcode = :materialcode and g.goodsid <> :goodsid";
  365. //OracleParameter[] checkParas = new OracleParameter[]{
  366. // new OracleParameter(":materialcode",goodsEntity.MaterialCode),
  367. // new OracleParameter(":goodsid",goodsEntity.GoodsID),
  368. //};
  369. //string goodscode = oracleTrConn.GetSqlResultToStr(sqlString, checkParas);
  370. //if (!string.IsNullOrWhiteSpace(goodscode))
  371. //{
  372. // return -10;
  373. //}
  374. // 物料编码重复验证 add by chenxy 2017-07-11 end
  375. StringBuilder sbSql = new StringBuilder();
  376. sbSql.Append("update TP_MST_GOODS");
  377. //sbSql.Append(" set GoodsCode=:GoodsCode,GoodsName=:GoodsName,GoodsSpecification=:GoodsSpecification,");
  378. sbSql.Append(" set GoodsName=:GoodsName,GoodsSpecification=:GoodsSpecification,");
  379. sbSql.Append(" GoodsModel=:GoodsModel,GoodsTypeID=:GoodsTypeID,GlazeTypeID=:GlazeTypeID,MudWeight=:MudWeight,");
  380. sbSql.Append(" GlazeWeight=:GlazeWeight,LusterwareWeight=:LusterwareWeight,ProductionCycle=:ProductionCycle,CeaseFlag=:CeaseFlag,Goods_Line_Type=:Goods_Line_Type,Goods_Line_CODE=:Goods_Line_CODE,Remarks=:Remarks,");
  381. sbSql.Append(" StartingDate=:StartingDate, AutoLossCycle = :AutoLossCycle, DeliverLimitCycle=:DeliverLimitCycle, PlateLimitNum=:PlateLimitNum, PlateLimitNumNew=:PlateLimitNumNew,");
  382. sbSql.Append(" UnitPrice=:UnitPrice,PackageNum=:PackageNum,OutletDistance=:OutletDistance,MaterialCode=:MaterialCode,MaterialRemark=:MaterialRemark,printcopies=:printcopies,");
  383. sbSql.Append(" MouldWeight=:MouldWeight, MouldCost=:MouldCost,ScrapSumFlag=:ScrapSumFlag, ReservedDays=:ReservedDays,SEATCOVERCODE=:SEATCOVERCODE,");
  384. sbSql.Append(" WaterLabelCode=:WaterLabelCode, CertificateCode=:CertificateCode, StandardGroutingNum=:StandardGroutingNum, STD_GNUM_MAX=:STD_GNUM_MAX,MouldMaterialCode=:MouldMaterialCode, MouldOutputCount=:MouldOutputCount,");
  385. sbSql.Append(" AccountID=:AccountID,ValueFlag=:ValueFlag,UpdateUserID=:UpdateUserID,logoid=:logoid,");
  386. sbSql.Append(" MudStoreType=:MudStoreType,");
  387. sbSql.Append(" SecurityCodeBindFlag=:SecurityCodeBindFlag,");
  388. sbSql.Append(" SecurityCodeCheckFlag=:SecurityCodeCheckFlag,");
  389. sbSql.Append(" PlanFlag=:PlanFlag");
  390. //sbSql.Append(" CreateTime=:CreateTime,CreateUserID=:CreateUserID ");
  391. sbSql.Append(" where GoodsID=:GoodsID and OPTimeStamp=:OPTimeStamp");
  392. OracleParameter[] paras = new OracleParameter[]{
  393. // new OracleParameter(":GoodsCode",goodsEntity.GoodsCode),
  394. new OracleParameter(":GoodsName",goodsEntity.GoodsName),
  395. new OracleParameter(":GoodsSpecification",goodsEntity.GoodsSpecification),
  396. new OracleParameter(":GoodsModel",goodsEntity.GoodsModel),
  397. new OracleParameter(":GoodsTypeID",goodsEntity.GoodsTypeID),
  398. new OracleParameter(":GlazeTypeID",goodsEntity.GlazeTypeID),
  399. new OracleParameter(":MudWeight",goodsEntity.MudQuantity),
  400. new OracleParameter(":GlazeWeight",goodsEntity.GlazeQuantity),
  401. new OracleParameter(":LusterwareWeight",goodsEntity.LusterwareWeight),
  402. new OracleParameter(":ProductionCycle",goodsEntity.ProductionCycle),
  403. new OracleParameter(":CeaseFlag",goodsEntity.CeaseFlag),
  404. new OracleParameter(":Goods_Line_Type",goodsEntity.GoodsLineType),
  405. new OracleParameter(":Goods_Line_CODE",goodsEntity.GoodsLineCode),
  406. new OracleParameter(":StartingDate",goodsEntity.StartingDate),
  407. new OracleParameter(":AutoLossCycle",goodsEntity.AutoLossCycle),
  408. new OracleParameter(":DeliverLimitCycle",goodsEntity.DeliverLimitCycle),
  409. new OracleParameter(":PlateLimitNum",goodsEntity.PlateLimitNum),
  410. new OracleParameter(":PLATELIMITNUMNew",goodsEntity.PlateLimitNumNew),
  411. new OracleParameter(":ReservedDays",goodsEntity.ReservedDays),
  412. new OracleParameter(":UnitPrice",goodsEntity.UnitPrice),
  413. new OracleParameter(":PackageNum",goodsEntity.PackageNum),
  414. new OracleParameter(":OutletDistance",goodsEntity.OutletDistance),
  415. new OracleParameter(":MaterialCode",goodsEntity.MaterialCode),
  416. new OracleParameter(":MouldWeight",goodsEntity.MouldWeight),
  417. new OracleParameter(":MouldCost",goodsEntity.MouldCost),
  418. new OracleParameter(":ScrapSumFlag",goodsEntity.ScrapSumFlag),
  419. new OracleParameter(":MaterialRemark",goodsEntity.MaterialRemark),
  420. new OracleParameter(":printcopies",goodsEntity.PrintCopies),
  421. new OracleParameter(":Remarks",goodsEntity.Remarks),
  422. new OracleParameter(":SEATCOVERCODE",goodsEntity.SeatCoverCode),
  423. new OracleParameter(":WaterLabelCode",goodsEntity.WaterLabelCode),
  424. new OracleParameter(":CertificateCode",goodsEntity.CertificateCode),
  425. new OracleParameter(":StandardGroutingNum",goodsEntity.StandardGroutingNum),
  426. new OracleParameter(":STD_GNUM_MAX",goodsEntity.STD_GNUM_MAX),
  427. new OracleParameter(":MouldMaterialCode",goodsEntity.MouldMaterialCode),
  428. new OracleParameter(":MouldOutputCount",goodsEntity.MouldOutputCount),
  429. new OracleParameter(":logoid", goodsEntity.LogoID),
  430. new OracleParameter(":AccountID",goodsEntity.AccountID),
  431. new OracleParameter(":ValueFlag",goodsEntity.ValueFlag),
  432. //new OracleParameter(":UpdateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  433. new OracleParameter(":UpdateUserID",sUserInfo.UserID),
  434. //new OracleParameter(":CreateTime",OracleDbType.Date,goodsEntity.CreateTime,ParameterDirection.Input),
  435. //new OracleParameter(":CreateUserID",goodsEntity.CreateUserID),
  436. new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp,goodsEntity.OPTimeStamp,ParameterDirection.Input),
  437. new OracleParameter(":MudStoreType",goodsEntity.MudStoreType),
  438. new OracleParameter(":SecurityCodeBindFlag",goodsEntity.SecurityCodeBindFlag),
  439. new OracleParameter(":SecurityCodeCheckFlag",goodsEntity.SecurityCodeCheckFlag),
  440. new OracleParameter(":PlanFlag",goodsEntity.PlanFlag),
  441. new OracleParameter(":GoodsId",goodsEntity.GoodsID)
  442. };
  443. returnRows = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), paras);
  444. if (returnRows == 0)
  445. {
  446. oracleTrConn.Rollback();
  447. oracleTrConn.Disconnect();
  448. return -500;
  449. }
  450. //SAP物料信息
  451. string sql = "delete from TP_MST_GoodsLogoSAP where goodsid = " + goodsEntity.GoodsID;
  452. returnRows += oracleTrConn.ExecuteNonQuery(sql);
  453. sql = "insert into TP_MST_GOODSLOGOSAP\n" +
  454. " (GOODSID, LOGOID, GOODSCODE, MATERIALCODE, MATERIALREMARK, CREATEUSERID,WaterLabelCode, CertificateCode,PLATELIMITNUM,PLATELIMITNUMNew)\n" +
  455. "values\n" +
  456. " (:GOODSID, :LOGOID, :GOODSCODE, :MATERIALCODE, :MATERIALREMARK, :CREATEUSERID,:WaterLabelCode, :CertificateCode,:PlateLimitNum,:PlateLimitNumNew)";
  457. foreach (DataRow item in goodsEntity.SAPInfo.Rows)
  458. {
  459. string sapcode = item["MATERIALCODE"] + "";
  460. string sapremark = item["MATERIALREMARK"] + "";
  461. if (string.IsNullOrWhiteSpace(sapcode))
  462. {
  463. continue;
  464. }
  465. if (string.IsNullOrEmpty(sapremark))
  466. {
  467. sapremark = " ";
  468. }
  469. paras = new OracleParameter[]{
  470. new OracleParameter(":GOODSID",goodsEntity.GoodsID),
  471. new OracleParameter(":LOGOID",item["LOGOID"]),
  472. new OracleParameter(":GOODSCODE",goodsEntity.GoodsCode),
  473. new OracleParameter(":MATERIALCODE",sapcode),
  474. new OracleParameter(":MATERIALREMARK",sapremark),
  475. new OracleParameter(":CREATEUSERID",sUserInfo.UserID),
  476. new OracleParameter(":WaterLabelCode",item["WaterLabelCode"]),
  477. new OracleParameter(":CertificateCode",item["CertificateCode"]),
  478. new OracleParameter(":PlateLimitNum",item["PlateLimitNum"]),
  479. new OracleParameter(":PlateLimitNumNew",item["PlateLimitNumNew"]),
  480. };
  481. returnRows += oracleTrConn.ExecuteNonQuery(sql, paras);
  482. }
  483. //张忠帅 产品属性表修改 add 2022-12-28
  484. #region 产品属性表修改
  485. //查询本月是否存在数据
  486. string sq2 = string.Empty;
  487. string sqls = "SELECT * FROM TP_MST_PRODUCTATTRIBUTES WHERE GOODSID=:GOODSID AND GOODSCODE=:GOODSCODE AND YEARS=TO_DATE(:YEARS, 'YYYY--MM')";
  488. paras = new OracleParameter[]{
  489. new OracleParameter(":GOODSID",goodsEntity.GoodsID),
  490. new OracleParameter(":GOODSCODE",goodsEntity.GoodsCode),
  491. new OracleParameter(":YEARS",DateTime.Now.ToString("yyyy-MM"))
  492. };
  493. DataSet dsGoodsButes = oracleTrConn.GetSqlResultToDs(sqls, paras);
  494. //判断
  495. if (dsGoodsButes != null && dsGoodsButes.Tables != null && dsGoodsButes.Tables[0].Rows.Count > 0)
  496. {
  497. //修改
  498. sq2 = @"UPDATE TP_MST_PRODUCTATTRIBUTES SET PRODUCEDAYS=:PRODUCEDAYS,ATTENDANCE=:ATTENDANCE,
  499. DAYGROUTINGNUMBER=:DAYGROUTINGNUMBER,PROTECTDAMRATE=:PROTECTDAMRATE,YEARS=TO_DATE(:YEARS, 'YYYY--MM')
  500. WHERE GOODSID=:GOODSID AND YEARS=TO_DATE(:YEARS, 'YYYY--MM')";
  501. paras = new OracleParameter[]{
  502. new OracleParameter(":GOODSID",goodsEntity.GoodsID),
  503. new OracleParameter(":GOODSCODE",goodsEntity.GoodsCode),
  504. new OracleParameter(":PRODUCEDAYS",goodsEntity.ProductDays),
  505. new OracleParameter(":ATTENDANCE",goodsEntity.Attendance),
  506. new OracleParameter(":DAYGROUTINGNUMBER",goodsEntity.DaygroutingNumber),
  507. new OracleParameter(":PROTECTDAMRATE",goodsEntity.ProtectdaMrate),
  508. new OracleParameter(":YEARS",DateTime.Now.ToString("yyyy-MM"))
  509. };
  510. }
  511. else
  512. {
  513. //新建
  514. sq2 = @"INSERT INTO TP_MST_PRODUCTATTRIBUTES(GOODSID,GOODSCODE,PRODUCEDAYS,ATTENDANCE,DAYGROUTINGNUMBER,PROTECTDAMRATE,YEARS)
  515. VALUES (:GOODSID,:GOODSCODE,:PRODUCEDAYS,:ATTENDANCE,:DAYGROUTINGNUMBER,:PROTECTDAMRATE,TO_DATE(:YEARS,'YYYY--MM'))";
  516. paras = new OracleParameter[]{
  517. new OracleParameter(":GOODSID",goodsEntity.GoodsID),
  518. new OracleParameter(":GOODSCODE",goodsEntity.GoodsCode),
  519. new OracleParameter(":PRODUCEDAYS",goodsEntity.ProductDays),
  520. new OracleParameter(":ATTENDANCE",goodsEntity.Attendance),
  521. new OracleParameter(":DAYGROUTINGNUMBER",goodsEntity.DaygroutingNumber),
  522. new OracleParameter(":PROTECTDAMRATE",goodsEntity.ProtectdaMrate),
  523. new OracleParameter(":YEARS",DateTime.Now.ToString("yyyy-MM"))
  524. };
  525. }
  526. returnRows += oracleTrConn.ExecuteNonQuery(sq2, paras);
  527. #endregion
  528. //张忠帅 产品属性表修改 add 2022-12-28
  529. foreach (GoodsImageEntity imgEntity in imgList)
  530. {
  531. if (imgEntity.GoodsImageID == 0)
  532. {
  533. int imgReturn = 0;
  534. sbSql.Clear();
  535. sbSql.Append("select SEQ_MST_GoodsImage_ID.nextval from dual");
  536. int imgId = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  537. sbSql.Clear();
  538. sbSql.Append("Insert into TP_MST_GoodsImage");
  539. sbSql.Append("(GoodsImageID,GoodsID,Thumbnail,Image,AccountID,ValueFlag,");
  540. sbSql.Append("CreateUserID,UpdateUserID)");
  541. sbSql.Append(" VALUES(:GoodsImageID,:GoodsID,:Thumbnail,:Image,:AccountID,:ValueFlag,");
  542. sbSql.Append(":CreateUserID,:UpdateUserID)");
  543. OracleParameter[] imgParas = new OracleParameter[] {
  544. new OracleParameter(":GoodsImageID",OracleDbType.Int32,imgId,ParameterDirection.Input),
  545. new OracleParameter(":GoodsID",OracleDbType.Int32,goodsEntity.GoodsID,ParameterDirection.Input),
  546. new OracleParameter(":Thumbnail",OracleDbType.Blob,imgEntity.Thumbnail,ParameterDirection.Input),
  547. new OracleParameter(":Image",OracleDbType.Blob,imgEntity.Image,ParameterDirection.Input),
  548. new OracleParameter(":AccountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  549. new OracleParameter(":ValueFlag",OracleDbType.Int32,imgEntity.ValueFlag,ParameterDirection.Input),
  550. //new OracleParameter(":CreateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  551. new OracleParameter(":CreateUserID",OracleDbType.Int32,sUserInfo.UserID,ParameterDirection.Input),
  552. //new OracleParameter(":UpdateTime",OracleDbType.Date,DateTime.Now,ParameterDirection.Input),
  553. new OracleParameter(":UpdateUserID",OracleDbType.Int32,sUserInfo.UserID,ParameterDirection.Input),
  554. //new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp,DateTime.Now,ParameterDirection.Input)
  555. };
  556. imgReturn = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), imgParas);
  557. }
  558. else
  559. {
  560. int imgReturn = 0;
  561. sbSql.Clear();
  562. sbSql.Append(" update TP_MST_GoodsImage");
  563. sbSql.Append(" set GoodsID=:GoodsID,AccountID=:AccountID,ValueFlag=:ValueFlag,");
  564. sbSql.Append(" UpdateUserID=:UpdateUserID");
  565. //sbSql.Append(" where GoodsImageID=:GoodsImageID And OPTimeStamp=to_date(:OPTimeStamp,'yyyy-mm-dd HH24:mi:ss')");
  566. sbSql.Append(" where GoodsImageID=:GoodsImageID");
  567. OracleParameter[] imgParas = new OracleParameter[] {
  568. new OracleParameter(":GoodsID",OracleDbType.Int32,
  569. goodsEntity.GoodsID,ParameterDirection.Input),
  570. new OracleParameter(":AccountID",OracleDbType.Int32,
  571. imgEntity.AccountID,ParameterDirection.Input),
  572. new OracleParameter(":ValueFlag",OracleDbType.Int32,
  573. imgEntity.ValueFlag,ParameterDirection.Input),
  574. //new OracleParameter(":UpdateTime",OracleDbType.NVarchar2,
  575. // DateTime.Now.ToString(),ParameterDirection.Input),
  576. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  577. sUserInfo.UserID,ParameterDirection.Input),
  578. new OracleParameter(":GoodsImageID",OracleDbType.Int32,
  579. imgEntity.GoodsImageID,ParameterDirection.Input)
  580. //,new OracleParameter(":OPTimeStamp",OracleDbType.TimeStamp, imgEntity.OPTimeStamp,ParameterDirection.Input)
  581. };
  582. imgReturn = oracleTrConn.ExecuteNonQuery(sbSql.ToString(), imgParas);
  583. }
  584. }
  585. //修改产品附件
  586. //int AttReturn = UpdateAttachment(oracleTrConn, attList, Convert.ToInt32(goodsEntity.GoodsID), sUserInfo);
  587. oracleTrConn.Commit();
  588. oracleTrConn.Disconnect();
  589. }
  590. catch (Exception ex)
  591. {
  592. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  593. {
  594. oracleTrConn.Rollback();
  595. oracleTrConn.Disconnect();
  596. }
  597. throw ex;
  598. }
  599. return returnRows;
  600. }
  601. /// <summary>
  602. /// 查询产品物料信息
  603. /// </summary>
  604. /// <param name="sUserInfo"></param>
  605. /// <param name="goodsID"></param>
  606. /// <returns></returns>
  607. public static ServiceResultEntity GetGoodsSAP(SUserInfo sUserInfo, int goodsID)
  608. {
  609. IDBConnection conn = null;
  610. try
  611. {
  612. conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  613. string sqlString = @"
  614. SELECT
  615. '产品档案' LOGONAME,
  616. G.MATERIALCODE,
  617. G.MATERIALREMARK,
  618. G.WATERLABELCODE,
  619. G.CERTIFICATECODE,
  620. '1' VALUEFLAG, - 1 DISPLAYNO,
  621. G.PLATELIMITNUM,
  622. G.PLATELIMITNUMNew
  623. FROM
  624. TP_MST_GOODS G
  625. WHERE
  626. G.GOODSID = :goodsid
  627. UNION ALL
  628. SELECT
  629. TO_CHAR( L.LOGONAME ),
  630. GLS.MATERIALCODE,
  631. GLS.MATERIALREMARK,
  632. GLS.WATERLABELCODE,
  633. GLS.CERTIFICATECODE,
  634. L.VALUEFLAG,
  635. L.DISPLAYNO,
  636. GLS.PLATELIMITNUM,
  637. GLS.PLATELIMITNUMNew
  638. FROM
  639. TP_MST_GOODSLOGOSAP GLS
  640. INNER JOIN TP_MST_LOGO L ON L.LOGOID = GLS.LOGOID
  641. WHERE
  642. GLS.GOODSID = :goodsid
  643. ORDER BY
  644. VALUEFLAG DESC,
  645. DISPLAYNO
  646. ";
  647. OracleParameter[] paras = new OracleParameter[]{
  648. new OracleParameter(":goodsid",goodsID),
  649. };
  650. ServiceResultEntity sre = new ServiceResultEntity();
  651. sre.Data = conn.GetSqlResultToDs(sqlString, paras);
  652. return sre;
  653. }
  654. catch (Exception ex)
  655. {
  656. throw ex;
  657. }
  658. finally
  659. {
  660. if (conn != null &&
  661. conn.ConnState == ConnectionState.Open)
  662. {
  663. conn.Close();
  664. }
  665. }
  666. }
  667. /// <summary>
  668. /// 查询产品物料信息(编辑用)
  669. /// </summary>
  670. /// <param name="sUserInfo"></param>
  671. /// <param name="goodsID"></param>
  672. /// <returns></returns>
  673. public static ServiceResultEntity GetGoodsSAPByEdit(SUserInfo sUserInfo, int goodsID)
  674. {
  675. IDBConnection conn = null;
  676. try
  677. {
  678. conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  679. string sqlString = "select l.logoid\n" +
  680. " ,l.logoname\n" +
  681. " ,gls.materialcode\n" +
  682. " ,gls.materialremark\n" +
  683. " ,gls.WaterLabelCode\n" +
  684. " ,gls.CertificateCode\n" +
  685. " ,gls.goodsid\n" +
  686. " ,l.valueflag\n" +
  687. " ,gls.platelimitnum\n" +
  688. " ,gls.platelimitnumNew\n" +
  689. " from tp_mst_logo l\n" +
  690. " left join tp_mst_goodslogosap gls\n" +
  691. " on gls.goodsid = :goodsid\n" +
  692. " and l.logoid = gls.logoid\n" +
  693. " where (l.valueflag = '1' or gls.goodsid is not null)\n" +
  694. " order by gls.goodsid, l.valueflag desc, l.displayno";
  695. OracleParameter[] paras = new OracleParameter[]{
  696. new OracleParameter(":goodsid",goodsID),
  697. };
  698. ServiceResultEntity sre = new ServiceResultEntity();
  699. sre.Data = conn.GetSqlResultToDs(sqlString, paras);
  700. return sre;
  701. }
  702. catch (Exception ex)
  703. {
  704. throw ex;
  705. }
  706. finally
  707. {
  708. if (conn != null &&
  709. conn.ConnState == ConnectionState.Open)
  710. {
  711. conn.Close();
  712. }
  713. }
  714. }
  715. #endregion
  716. #region 获得生产工号集合
  717. /// <summary>
  718. /// 获得生产工号集合
  719. /// </summary>
  720. /// <param name="sUserInfo">用户基本信息</param>
  721. /// <returns>DataSet</returns>
  722. /// <remarks>
  723. /// 陈冰 2014.09.03 新建
  724. /// </remarks>
  725. public static DataSet GetWorker(SUserInfo sUserInfo)
  726. {
  727. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  728. try
  729. {
  730. con.Open();
  731. OracleParameter[] paras = new OracleParameter[]{
  732. new OracleParameter("accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  733. new OracleParameter("rs_worker",OracleDbType.RefCursor,ParameterDirection.Output),
  734. };
  735. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetWorker", paras);
  736. return ds;
  737. }
  738. catch (Exception ex)
  739. {
  740. throw ex;
  741. }
  742. finally
  743. {
  744. if (con.ConnState == ConnectionState.Open)
  745. {
  746. con.Close();
  747. }
  748. }
  749. }
  750. #endregion
  751. #region 获得工种集合
  752. /// <summary>
  753. /// 获得工种集合
  754. /// </summary>
  755. /// <param name="sUserInfo">用户基本信息</param>
  756. /// <returns>DataSet</returns>
  757. /// <remarks>
  758. /// 陈冰 2014.09.03 新建
  759. /// </remarks>
  760. public static DataSet GetJobs(SUserInfo sUserInfo)
  761. {
  762. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  763. try
  764. {
  765. con.Open();
  766. OracleParameter[] paras = new OracleParameter[]{
  767. new OracleParameter("accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  768. new OracleParameter("rs_jobs",OracleDbType.RefCursor,ParameterDirection.Output),
  769. };
  770. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetJobs", paras);
  771. return ds;
  772. }
  773. catch (Exception ex)
  774. {
  775. throw ex;
  776. }
  777. finally
  778. {
  779. if (con.ConnState == ConnectionState.Open)
  780. {
  781. con.Close();
  782. }
  783. }
  784. }
  785. #endregion
  786. #region 获得缺陷集合
  787. /// <summary>
  788. /// 获得缺陷集合
  789. /// </summary>
  790. /// <param name="sUserInfo">用户基本信息</param>
  791. /// <returns>DataSet</returns>
  792. /// <remarks>
  793. /// 陈冰 2014.09.03 新建
  794. /// </remarks>
  795. public static DataSet GetDefect(SUserInfo sUserInfo)
  796. {
  797. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  798. try
  799. {
  800. con.Open();
  801. OracleParameter[] paras = new OracleParameter[]{
  802. new OracleParameter("accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  803. new OracleParameter("rs_defect",OracleDbType.RefCursor,ParameterDirection.Output),
  804. };
  805. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetDefect", paras);
  806. return ds;
  807. }
  808. catch (Exception ex)
  809. {
  810. throw ex;
  811. }
  812. finally
  813. {
  814. if (con.ConnState == ConnectionState.Open)
  815. {
  816. con.Close();
  817. }
  818. }
  819. }
  820. #endregion
  821. #region 产品图片
  822. /// <summary>
  823. /// 根据产品ID获取产品图片
  824. /// </summary>
  825. /// <param name="sUserInfo">用户基本信息</param>
  826. /// <param name="goodsId">产品ID</param>
  827. /// <returns>DataSet</returns>
  828. /// <remarks>
  829. /// 庄天威 2014.09.04 新建
  830. /// </remarks>
  831. public static DataSet GetImageByGoodsId(SUserInfo sUserInfo, int goodsId)
  832. {
  833. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  834. try
  835. {
  836. con.Open();
  837. OracleParameter[] paras = new OracleParameter[]{
  838. new OracleParameter("in_accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  839. new OracleParameter("in_goodsID",OracleDbType.Int32,goodsId,ParameterDirection.Input),
  840. new OracleParameter("rs_result",OracleDbType.RefCursor,ParameterDirection.Output),
  841. };
  842. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetImageByGoodsId", paras);
  843. return ds;
  844. }
  845. catch (Exception ex)
  846. {
  847. throw ex;
  848. }
  849. finally
  850. {
  851. if (con.ConnState == ConnectionState.Open)
  852. {
  853. con.Close();
  854. }
  855. }
  856. }
  857. #endregion
  858. #region 附件
  859. /// <summary>
  860. /// 新建附件信息
  861. /// </summary>
  862. /// <param name="AttList">附件实体集合</param>
  863. /// <param name="mainId">产品ID</param>
  864. /// <param name="userInfo">用户基本信息</param>
  865. /// <returns>int影响结果行数</returns>
  866. public static int AddAttachment(List<GoodsAttachmentEntity> AttList, int mainId, SUserInfo userInfo)
  867. {
  868. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  869. try
  870. {
  871. oracleTrConn.Connect();
  872. int AttReturn = 0;
  873. int GAReturn = 0;
  874. StringBuilder sbSql = new StringBuilder();
  875. foreach (GoodsAttachmentEntity attFor in AttList)
  876. {
  877. sbSql.Clear();
  878. sbSql.Append("select SEQ_MST_Attachment_ID.nextval from dual");
  879. int id = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  880. sbSql.Clear();
  881. sbSql.Append(@"Insert into TP_MST_Attachment(AttachmentID,FileName,FilePath,AccountID,ValueFlag,
  882. CreateUserID,UpdateUserID)
  883. Values(:AttachmentID,:FileName,:FilePath,:AccountID,:ValueFlag,
  884. :CreateUserID,:UpdateUserID)");
  885. OracleParameter[] attParas = new OracleParameter[] {
  886. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  887. id,ParameterDirection.Input),
  888. new OracleParameter(":FileName",OracleDbType.NVarchar2,
  889. attFor.FileName,ParameterDirection.Input),
  890. new OracleParameter(":FilePath",OracleDbType.NVarchar2,
  891. attFor.FilePath,ParameterDirection.Input),
  892. new OracleParameter(":AccountID",OracleDbType.Int32,
  893. userInfo.AccountID,ParameterDirection.Input),
  894. new OracleParameter(":ValueFlag",OracleDbType.Int32,
  895. 1,ParameterDirection.Input),
  896. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  897. userInfo.UserID,ParameterDirection.Input),
  898. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  899. userInfo.UserID,ParameterDirection.Input)
  900. };
  901. AttReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), attParas);
  902. sbSql.Clear();
  903. sbSql.Append(@"Insert into TP_MST_GoodsAttachment(GoodsID,AttachmentID,CreateUserID,UpdateUserID)
  904. Values(:GoodsID,:AttachmentID,:CreateUserID,:UpdateUserID)");
  905. OracleParameter[] gaParas = new OracleParameter[] {
  906. new OracleParameter(":GoodsID",OracleDbType.Int32,
  907. mainId,ParameterDirection.Input),
  908. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  909. id,ParameterDirection.Input),
  910. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  911. userInfo.UserID,ParameterDirection.Input),
  912. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  913. userInfo.UserID,ParameterDirection.Input)
  914. };
  915. GAReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), gaParas);
  916. sbSql.Clear();
  917. }
  918. oracleTrConn.Commit();
  919. oracleTrConn.Disconnect();
  920. return AttReturn;
  921. }
  922. catch (Exception ex)
  923. {
  924. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  925. {
  926. oracleTrConn.Rollback();
  927. oracleTrConn.Disconnect();
  928. }
  929. throw ex;
  930. }
  931. }
  932. /// <summary>
  933. /// 修改附件信息
  934. /// </summary>
  935. /// <param name="AttList">附件实体集合</param>
  936. /// <param name="mainId">产品ID</param>
  937. /// <param name="userInfo">用户基本信息</param>
  938. /// <returns>int受影响行数</returns>
  939. public static int UpdateAttachment(List<GoodsAttachmentEntity> AttList, int mainId, SUserInfo userInfo)
  940. {
  941. IDBTransaction oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
  942. try
  943. {
  944. oracleTrConn.Connect();
  945. int AttReturn = 0;
  946. int GAReturn = 0;
  947. StringBuilder sbSql = new StringBuilder();
  948. foreach (GoodsAttachmentEntity attFor in AttList)
  949. {
  950. if (attFor.IsUpdateAdd == 0) //不是新建的
  951. {
  952. sbSql.Clear();
  953. sbSql.Append(@"Update TP_MST_Attachment set ValueFlag = :ValueFlag,UpdateUserID=:UpdateUserID
  954. Where AttachmentID = :AttachmentID");
  955. OracleParameter[] attParas = new OracleParameter[] {
  956. new OracleParameter(":ValueFlag",OracleDbType.Int32,
  957. attFor.ValueFlag,ParameterDirection.Input),
  958. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  959. userInfo.UserID,ParameterDirection.Input),
  960. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  961. attFor.AttachmentID,ParameterDirection.Input)
  962. };
  963. AttReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), attParas);
  964. sbSql.Clear();
  965. sbSql.Append(@"Update TP_MST_GoodsAttachment
  966. Set ValueFlag = :ValueFlag,UpdateUserID=:UpdateUserID
  967. Where AttachmentID = :AttachmentID");
  968. GAReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), attParas);
  969. sbSql.Clear();
  970. }
  971. else //新建的
  972. {
  973. sbSql.Clear();
  974. sbSql.Append("select SEQ_MST_Attachment_ID.nextval from dual");
  975. int id = Convert.ToInt32(oracleTrConn.GetSqlResultToStr(sbSql.ToString()));
  976. sbSql.Clear();
  977. sbSql.Append(@"Insert into TP_MST_Attachment(AttachmentID,FileName,FilePath,AccountID,ValueFlag,
  978. CreateUserID,UpdateUserID)
  979. Values(:AttachmentID,:FileName,:FilePath,:AccountID,:ValueFlag,
  980. :CreateUserID,:UpdateUserID)");
  981. OracleParameter[] attParas = new OracleParameter[] {
  982. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  983. id,ParameterDirection.Input),
  984. new OracleParameter(":FileName",OracleDbType.NVarchar2,
  985. attFor.FileName,ParameterDirection.Input),
  986. new OracleParameter(":FilePath",OracleDbType.NVarchar2,
  987. attFor.FilePath,ParameterDirection.Input),
  988. new OracleParameter(":AccountID",OracleDbType.Int32,
  989. userInfo.AccountID,ParameterDirection.Input),
  990. new OracleParameter(":ValueFlag",OracleDbType.Int32,
  991. 1,ParameterDirection.Input),
  992. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  993. userInfo.UserID,ParameterDirection.Input),
  994. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  995. userInfo.UserID,ParameterDirection.Input)
  996. };
  997. AttReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), attParas);
  998. sbSql.Clear();
  999. sbSql.Append(@"Insert into TP_MST_GoodsAttachment(GoodsID,AttachmentID,CreateUserID,UpdateUserID)
  1000. Values(:GoodsID,:AttachmentID,:CreateUserID,:UpdateUserID)");
  1001. OracleParameter[] gaParas = new OracleParameter[] {
  1002. new OracleParameter(":GoodsID",OracleDbType.Int32,
  1003. mainId,ParameterDirection.Input),
  1004. new OracleParameter(":AttachmentID",OracleDbType.Int32,
  1005. id,ParameterDirection.Input),
  1006. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  1007. userInfo.UserID,ParameterDirection.Input),
  1008. new OracleParameter(":UpdateUserID",OracleDbType.Int32,
  1009. userInfo.UserID,ParameterDirection.Input)
  1010. };
  1011. GAReturn += oracleTrConn.ExecuteNonQuery(sbSql.ToString(), gaParas);
  1012. sbSql.Clear();
  1013. }
  1014. }
  1015. oracleTrConn.Commit();
  1016. oracleTrConn.Disconnect();
  1017. return AttReturn;
  1018. }
  1019. catch (Exception ex)
  1020. {
  1021. if (oracleTrConn.ConnState == System.Data.ConnectionState.Open)
  1022. {
  1023. oracleTrConn.Rollback();
  1024. oracleTrConn.Disconnect();
  1025. }
  1026. throw ex;
  1027. }
  1028. }
  1029. /// <summary>
  1030. /// 根据产品ID获取附件
  1031. /// </summary>
  1032. /// <param name="goodsId">产品ID</param>
  1033. /// <returns>DataSet</returns>
  1034. public static DataSet GetAttachmentByGoodsId(int goodsId)
  1035. {
  1036. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1037. try
  1038. {
  1039. con.Open();
  1040. String strSql = @"Select goodsAtt.GoodsID,att.* from TP_MST_GoodsAttachment goodsAtt
  1041. Inner join TP_MST_Attachment att
  1042. On goodsAtt.AttachmentID = att.AttachmentID
  1043. Where goodsAtt.ValueFlag = 1 and goodsAtt.GoodsID = " + goodsId;
  1044. DataSet ds = con.GetSqlResultToDs(strSql, null);
  1045. return ds;
  1046. }
  1047. catch (Exception ex)
  1048. {
  1049. throw ex;
  1050. }
  1051. finally
  1052. {
  1053. if (con.ConnState == ConnectionState.Open)
  1054. {
  1055. con.Close();
  1056. }
  1057. }
  1058. }
  1059. #endregion
  1060. #region 缺陷位置
  1061. /// <summary>
  1062. /// 获取缺陷位置
  1063. /// </summary>
  1064. /// <param name="dpEntity">缺陷位置实体</param>
  1065. /// <param name="userInfo">用户基本信息</param>
  1066. /// <returns>DataSet</returns>
  1067. public static DataSet GetDefectPosition(DefectPositionEntity dpEntity, SUserInfo userInfo)
  1068. {
  1069. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1070. try
  1071. {
  1072. con.Open();
  1073. OracleParameter[] paras = new OracleParameter[]{
  1074. new OracleParameter("in_DefectPositionID",OracleDbType.Int32,
  1075. dpEntity.DefectPositionID,ParameterDirection.Input),
  1076. new OracleParameter("in_DefectPositionCode",OracleDbType.NVarchar2,
  1077. dpEntity.DefectPositionCode,ParameterDirection.Input),
  1078. new OracleParameter("in_DefectPositionName",OracleDbType.NVarchar2,
  1079. dpEntity.DefectPositionName,ParameterDirection.Input),
  1080. new OracleParameter("in_AccountID",OracleDbType.Int32,
  1081. userInfo.AccountID,ParameterDirection.Input),
  1082. new OracleParameter("out_rs_defect",OracleDbType.RefCursor,ParameterDirection.Output),
  1083. };
  1084. DataSet dsDefectPosition = con.ExecStoredProcedure("PRO_MST_GetDefectPosition", paras);
  1085. return dsDefectPosition;
  1086. }
  1087. catch (Exception ex)
  1088. {
  1089. throw ex;
  1090. }
  1091. finally
  1092. {
  1093. if (con.ConnState == ConnectionState.Open)
  1094. {
  1095. con.Close();
  1096. }
  1097. }
  1098. }
  1099. /// <summary>
  1100. /// 根据产品获得产品缺陷位置
  1101. /// </summary>
  1102. /// <param name="GoodsId">产品ID</param>
  1103. /// <returns>DataSet</returns>
  1104. public static DataSet getGoodsDefectPositionByGoodsId(int GoodsId)
  1105. {
  1106. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1107. try
  1108. {
  1109. con.Open();
  1110. string sql = @"select gdp.*,dp.DefectPositionCode,dp.DefectPositionName,dp.Remarks
  1111. from TP_MST_GoodsDefectPosition gdp
  1112. inner join TP_MST_DefectPosition dp
  1113. on gdp.DefectPositionID=dp.DefectPositionID
  1114. where gdp.GoodsID=" + GoodsId;
  1115. DataSet dsDefectPosition = con.GetSqlResultToDs(sql, null);
  1116. return dsDefectPosition;
  1117. }
  1118. catch (Exception ex)
  1119. {
  1120. throw ex;
  1121. }
  1122. finally
  1123. {
  1124. if (con.ConnState == ConnectionState.Open)
  1125. {
  1126. con.Close();
  1127. }
  1128. }
  1129. }
  1130. /// <summary>
  1131. /// 保存产品缺陷位置关联(依附在添加产品中)
  1132. /// </summary>
  1133. /// <param name="dpList">缺陷位置集</param>
  1134. /// <param name="GoodsId">产品ID</param>
  1135. /// <param name="userInfo">用户基本信息</param>
  1136. /// <returns>int</returns>
  1137. public static int SaveGoodsDefectPosition(IDBTransaction oracleTrConn, List<int> dpList, int GoodsId, SUserInfo userInfo)
  1138. {
  1139. try
  1140. {
  1141. int ReturnCount = 0;
  1142. string sql = "Delete from TP_MST_GoodsDefectPosition where GoodsId=" + GoodsId;
  1143. foreach (int dpFor in dpList)
  1144. {
  1145. string sqlAdd = @"Insert into TP_MST_GoodsDefectPosition(GoodsID,DefectPositionID,
  1146. CreateTime,CreateUserID) Values(:GoodsID,:DefectPositionID,sysdate,:CreateUserID)";
  1147. OracleParameter[] paras = new OracleParameter[]{
  1148. new OracleParameter(":GoodsID",OracleDbType.Int32,
  1149. GoodsId,ParameterDirection.Input),
  1150. new OracleParameter(":DefectPositionID",OracleDbType.Int32,
  1151. dpFor,ParameterDirection.Input),
  1152. new OracleParameter(":CreateUserID",OracleDbType.Int32,
  1153. userInfo.UserID,ParameterDirection.Input),
  1154. };
  1155. ReturnCount += oracleTrConn.ExecuteNonQuery(sqlAdd, paras);
  1156. }
  1157. return ReturnCount;
  1158. }
  1159. catch (Exception ex)
  1160. {
  1161. throw ex;
  1162. }
  1163. }
  1164. #endregion
  1165. #region 成型线类型
  1166. /// <summary>
  1167. /// 获取成型线类型
  1168. /// </summary>
  1169. /// <param name="userInfo">用户基本信息</param>
  1170. /// <returns>数据集</returns>
  1171. /// <remarks>
  1172. /// 庄天威 2014.09.04 新建
  1173. /// </remarks>
  1174. public static DataSet GetGMouldType(SUserInfo userInfo)
  1175. {
  1176. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1177. try
  1178. {
  1179. con.Open();
  1180. OracleParameter[] paras = new OracleParameter[]{
  1181. new OracleParameter("in_accountID",OracleDbType.Int32,
  1182. userInfo.AccountID,ParameterDirection.Input),
  1183. new OracleParameter("in_valueFlag",OracleDbType.Int32,
  1184. 1,ParameterDirection.Input),
  1185. new OracleParameter("out_result",OracleDbType.RefCursor,ParameterDirection.Output),
  1186. };
  1187. DataSet ds = con.ExecStoredProcedure("PRO_MST_GetMouldType", paras);
  1188. return ds;
  1189. }
  1190. catch (Exception ex)
  1191. {
  1192. throw ex;
  1193. }
  1194. finally
  1195. {
  1196. if (con.ConnState == ConnectionState.Open)
  1197. {
  1198. con.Close();
  1199. }
  1200. }
  1201. }
  1202. #endregion
  1203. #region 产品分级数据源
  1204. /// <summary>
  1205. /// 产品分级数据源
  1206. /// </summary>
  1207. /// <param name="type">1适用半成品2检验 2适用成品检验 3入窑前检验</param>
  1208. /// <param name="userInfo">用户基本信息</param>
  1209. /// <returns>DataSet</returns>
  1210. public static DataSet GetGoodsLevel(int type, SUserInfo userInfo)
  1211. {
  1212. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1213. try
  1214. {
  1215. con.Open();
  1216. string sqlString = "";
  1217. if (type == 1 || type == 3)
  1218. {
  1219. 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";
  1220. }
  1221. else if (type == 2)
  1222. {
  1223. 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";
  1224. }
  1225. OracleParameter[] paras = new OracleParameter[]{
  1226. new OracleParameter(":AccountID",userInfo.AccountID),
  1227. };
  1228. DataSet dsGoodsLevel = con.GetSqlResultToDs(sqlString, paras);
  1229. return dsGoodsLevel;
  1230. }
  1231. catch (Exception ex)
  1232. {
  1233. throw ex;
  1234. }
  1235. finally
  1236. {
  1237. if (con.ConnState == ConnectionState.Open)
  1238. {
  1239. con.Close();
  1240. }
  1241. }
  1242. }
  1243. #endregion
  1244. #region 审核状态
  1245. /// <summary>
  1246. /// 获取全部审核状态
  1247. /// </summary>
  1248. /// <returns>DataSet审核状态数据源</returns>
  1249. public static DataSet GetAuditStatus()
  1250. {
  1251. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1252. try
  1253. {
  1254. con.Open();
  1255. String strSql = "Select * from TP_SYS_AuditStatus Order by DisplayNo";
  1256. DataSet ds = con.GetSqlResultToDs(strSql, null);
  1257. return ds;
  1258. }
  1259. catch (Exception ex)
  1260. {
  1261. throw ex;
  1262. }
  1263. finally
  1264. {
  1265. if (con.ConnState == ConnectionState.Open)
  1266. {
  1267. con.Close();
  1268. }
  1269. }
  1270. }
  1271. #endregion
  1272. /// <summary>
  1273. /// 工序集合
  1274. /// </summary>
  1275. /// <param name="ProductionLineEntity">工序实体</param>
  1276. /// <param name="sUserInfo">用户<基本信息/param>
  1277. /// <returns>DataSet</returns>
  1278. /// <remarks>
  1279. /// 王鑫 2014.11.29 新建
  1280. /// </remarks>
  1281. public static DataSet GetProdureList(SearchProductionLineEntity productionLineEntity, SUserInfo sUserInfo)
  1282. {
  1283. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1284. try
  1285. {
  1286. con.Open();
  1287. OracleParameter[] paras = new OracleParameter[]{
  1288. new OracleParameter("in_procedureCode",OracleDbType.Varchar2,productionLineEntity.ProductionLineCode,ParameterDirection.Input),
  1289. new OracleParameter("in_procedureName",OracleDbType.Varchar2,productionLineEntity.ProductionLineName,ParameterDirection.Input),
  1290. new OracleParameter("in_procedureIDS",OracleDbType.Varchar2,productionLineEntity.ProcuteLineIDS,ParameterDirection.Input),
  1291. new OracleParameter("in_accountID",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
  1292. new OracleParameter("out_result",OracleDbType.RefCursor, ParameterDirection.Output),
  1293. };
  1294. DataSet dsSearchReport = con.ExecStoredProcedure("PRO_PC_GetProcedureList", paras);
  1295. return dsSearchReport;
  1296. }
  1297. catch (Exception ex)
  1298. {
  1299. throw ex;
  1300. }
  1301. finally
  1302. {
  1303. if (con.ConnState == ConnectionState.Open)
  1304. {
  1305. con.Close();
  1306. }
  1307. }
  1308. }
  1309. /// <summary>
  1310. /// 获取全部工种计件方式
  1311. /// </summary>
  1312. /// <returns>DataSet工种计件方式集合</returns>
  1313. public static DataSet GetJobsPriceType()
  1314. {
  1315. IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
  1316. try
  1317. {
  1318. con.Open();
  1319. String strSql = "Select * from TP_SYS_JobsPriceType Order by DisplayNo";
  1320. DataSet dsSearchReport = con.GetSqlResultToDs(strSql, null);
  1321. return dsSearchReport;
  1322. }
  1323. catch (Exception ex)
  1324. {
  1325. throw ex;
  1326. }
  1327. finally
  1328. {
  1329. if (con.ConnState == ConnectionState.Open)
  1330. {
  1331. con.Close();
  1332. }
  1333. }
  1334. }
  1335. }
  1336. }