SystemModuleLogicPartial.cs 55 KB

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