SystemModuleLogicPartial.cs 56 KB

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