SystemModuleLogicPartial.cs 54 KB

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