CraftOrdDesignBLL.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. using Core.Mes.Client.Comm.Format;
  8. using Core.Mes.Client.Comm.Server;
  9. using Core.Mes.Client.Comm.Tool;
  10. using CoreFS.CA06;
  11. using System.Net;
  12. using Core.StlMes.Client.SaleOrder.Control;
  13. using CoreFS.SA06;
  14. using Core.Mes.Client.Comm.Control;
  15. namespace Core.StlMes.Client.SaleOrder.BLL
  16. {
  17. public class CraftOrdDesignBLL
  18. {
  19. private OpeBase _ob;
  20. public CraftOrdDesignBLL(OpeBase ob)
  21. {
  22. _ob = ob;
  23. }
  24. /// <summary>
  25. /// 查询工艺评审主表
  26. /// </summary>
  27. /// <param name="craftOrdDesignEntity"></param>
  28. /// <returns></returns>
  29. public List<CraftOrdDesignEntity> Query(CraftOrdDesignEntity craftOrdDesignEntity, string[] DataPurviewIds, string userId)
  30. {
  31. List<CraftOrdDesignEntity> listCraftOrdDesignEntity = EntityHelper.GetData<CraftOrdDesignEntity>(
  32. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.query", new object[] {
  33. JSONFormat.Format(craftOrdDesignEntity), DataPurviewIds, userId}, _ob);
  34. return listCraftOrdDesignEntity;
  35. }
  36. /// <summary>
  37. /// 查询工艺评审主表(审核审批专用)
  38. /// </summary>
  39. /// <param name="craftOrdDesignEntity"></param>
  40. /// <returns></returns>
  41. public List<CraftOrdDesignAuditEntity> QueryAudit(CraftOrdDesignEntity craftOrdDesignEntity, string[] DataPurviewIds, string userId)
  42. {
  43. List<CraftOrdDesignAuditEntity> listCraftOrdDesignEntity = EntityHelper.GetData<CraftOrdDesignAuditEntity>(
  44. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.queryAudit", new object[] {
  45. JSONFormat.Format(craftOrdDesignEntity), DataPurviewIds, userId}, _ob);
  46. return listCraftOrdDesignEntity;
  47. }
  48. public List<CraftOrdDesignEntityChoiceCraftLv2> QueryCraftLv2(string craftNo, string orderNo,
  49. string planStatus, string maintenanceStatus, string customInfo)
  50. {
  51. List<CraftOrdDesignEntityChoiceCraftLv2> listCraftOrdDesignEntity = EntityHelper.GetData<CraftOrdDesignEntityChoiceCraftLv2>(
  52. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.queryCraftLv2",
  53. new object[] { craftNo, orderNo, planStatus, maintenanceStatus, customInfo }, _ob);
  54. return listCraftOrdDesignEntity;
  55. }
  56. public List<ChoiceCraftFileLv2Entity> QueryCraftLv2New(string craftNo, string orderNo,
  57. string planStatus, string maintenanceStatus, string customInfo, string exeStatus,List<String> AllPline )
  58. {
  59. List<ChoiceCraftFileLv2Entity> listCraftOrdDesignEntity = EntityHelper.GetData<ChoiceCraftFileLv2Entity>(
  60. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.queryCraftLv2New",
  61. new object[] { craftNo, orderNo, planStatus, maintenanceStatus, customInfo, exeStatus, AllPline }, _ob);
  62. return listCraftOrdDesignEntity;
  63. }
  64. public List<ChoiceCraftFileLv2Entity> QueryCraftLv2New(string craftNo, string orderNo,
  65. string planStatus, string maintenanceStatus, string customInfo, string[] exeStatus, List<String> AllPline)
  66. {
  67. List<ChoiceCraftFileLv2Entity> listCraftOrdDesignEntity = EntityHelper.GetData<ChoiceCraftFileLv2Entity>(
  68. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.queryCraftLv2New",
  69. new object[] { craftNo, orderNo, planStatus, maintenanceStatus, customInfo, exeStatus, AllPline }, _ob);
  70. return listCraftOrdDesignEntity;
  71. }
  72. /// <summary>
  73. /// 获取工艺评审工序点类型
  74. /// </summary>
  75. /// <param name="designKey"></param>
  76. /// <param name="processCode"></param>
  77. /// <returns></returns>
  78. public DataTable GetCraftStationType(string designKey, string processCode)
  79. {
  80. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftStationType",
  81. new object[] { designKey, processCode }, _ob);
  82. return dt;
  83. }
  84. public DataTable QueryUnfinishTimeZg()
  85. {
  86. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.queryUnfinishTimeZg",
  87. new object[]{ }, _ob);
  88. return dt;
  89. }
  90. /// <summary>
  91. /// 通过主键查询工艺评审主表
  92. /// </summary>
  93. /// <param name="craftOrdDesignEntity"></param>
  94. /// <returns></returns>
  95. public CraftOrdDesignEntity QueryByPk(CraftOrdDesignEntity craftOrdDesignEntity)
  96. {
  97. List<CraftOrdDesignEntity> listCraftOrdDesignEntity = EntityHelper.GetData<CraftOrdDesignEntity>(
  98. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.queryByPk", new object[] { JSONFormat.Format(craftOrdDesignEntity) }, _ob);
  99. if (listCraftOrdDesignEntity.Count > 0)
  100. {
  101. return listCraftOrdDesignEntity[0];
  102. }
  103. else
  104. {
  105. return null;
  106. }
  107. }
  108. /// <summary>
  109. /// 科室审核
  110. /// </summary>
  111. /// <param name="craftOrdDesignEntity"></param>
  112. public void Audit(List<CraftOrdDesignEntity> craftOrdDesignList)
  113. {
  114. ArrayList list = new ArrayList();
  115. foreach (CraftOrdDesignEntity craftOrdDesgin in craftOrdDesignList)
  116. {
  117. list.Add(JSONFormat.Format(craftOrdDesgin));
  118. }
  119. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.audit",
  120. new object[] { list }, _ob);
  121. }
  122. /// <summary>
  123. /// 相关科室审核
  124. /// </summary>
  125. /// <param name="craftOrdDesignEntity"></param>
  126. public void Audit1(List<CraftOrdDesignEntity> craftOrdDesignList)
  127. {
  128. ArrayList list = new ArrayList();
  129. foreach (CraftOrdDesignEntity craftOrdDesgin in craftOrdDesignList)
  130. {
  131. list.Add(JSONFormat.Format(craftOrdDesgin));
  132. }
  133. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.audit1",
  134. new object[] { list }, _ob);
  135. }
  136. /// <summary>
  137. /// 审批
  138. /// </summary>
  139. /// <param name="craftOrdDesignEntity"></param>
  140. public void Approval(List<CraftOrdDesignEntity> craftOrdDesignList)
  141. {
  142. ArrayList list = new ArrayList();
  143. foreach (CraftOrdDesignEntity craftOrdDesgin in craftOrdDesignList)
  144. {
  145. list.Add(JSONFormat.Format(craftOrdDesgin));
  146. }
  147. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.approval",
  148. new object[] { list }, _ob);
  149. }
  150. /// <summary>
  151. /// 人工创建工艺文件
  152. /// </summary>
  153. /// <param name="craftOrdDesignEntity"></param>
  154. public void CreateCraft(List<CraftOrdDesignEntity> craftOrdDesignList, bool autoBacklog,
  155. bool autoMaterial, string userId)
  156. {
  157. ArrayList list = new ArrayList();
  158. foreach (CraftOrdDesignEntity craftOrdDesgin in craftOrdDesignList)
  159. {
  160. list.Add(JSONFormat.Format(craftOrdDesgin));
  161. }
  162. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.createCraft",
  163. new object[] { list, autoBacklog, autoMaterial, userId }, _ob);
  164. }
  165. /// <summary>
  166. /// 修改审批人
  167. /// </summary>
  168. /// <param name="craftOrdDesignEntity"></param>
  169. public void UpdateApproveName(List<CraftOrdDesignEntity> craftOrdDesignList)
  170. {
  171. ArrayList list = new ArrayList();
  172. foreach (CraftOrdDesignEntity craftOrdDesgin in craftOrdDesignList)
  173. {
  174. list.Add(JSONFormat.Format(craftOrdDesgin));
  175. }
  176. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.updateApproveName",
  177. new object[] { list }, _ob);
  178. }
  179. /// <summary>
  180. /// 修改批准人
  181. /// </summary>
  182. /// <param name="craftOrdDesignEntity"></param>
  183. public void UpdateApprove1Name(List<CraftOrdDesignEntity> craftOrdDesignList)
  184. {
  185. ArrayList list = new ArrayList();
  186. foreach (CraftOrdDesignEntity craftOrdDesgin in craftOrdDesignList)
  187. {
  188. list.Add(JSONFormat.Format(craftOrdDesgin));
  189. }
  190. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.updateApprove1Name",
  191. new object[] { list }, _ob);
  192. }
  193. /// <summary>
  194. /// 批准
  195. /// </summary>
  196. /// <param name="craftOrdDesignEntity"></param>
  197. public void Approval1(List<CraftOrdDesignEntity> craftOrdDesignList)
  198. {
  199. ArrayList list = new ArrayList();
  200. foreach (CraftOrdDesignEntity craftOrdDesgin in craftOrdDesignList)
  201. {
  202. list.Add(JSONFormat.Format(craftOrdDesgin));
  203. }
  204. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.approval1",
  205. new object[] { list }, _ob);
  206. }
  207. /// <summary>
  208. /// 解锁
  209. /// </summary>
  210. /// <param name="craftOrdDesignEntity"></param>
  211. public void UnLock(List<CraftOrdDesignEntity> craftOrdDesignList)
  212. {
  213. ArrayList list = new ArrayList();
  214. foreach (CraftOrdDesignEntity craftOrdDesign in craftOrdDesignList)
  215. {
  216. list.Add(JSONFormat.Format(craftOrdDesign));
  217. }
  218. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.unLock",
  219. new object[] { list }, _ob);
  220. }
  221. /// <summary>
  222. /// 封锁
  223. /// </summary>
  224. /// <param name="craftOrdDesignEntity"></param>
  225. public void Lock(List<CraftOrdDesignEntity> craftOrdDesignList)
  226. {
  227. ArrayList list = new ArrayList();
  228. foreach (CraftOrdDesignEntity craftOrdDesign in craftOrdDesignList)
  229. {
  230. list.Add(JSONFormat.Format(craftOrdDesign));
  231. }
  232. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.lock",
  233. new object[] { list }, _ob);
  234. }
  235. /// <summary>
  236. /// 修改备注
  237. /// </summary>
  238. /// <param name="craftOrdDesignList"></param>
  239. public void SetMemo(List<CraftOrdDesignEntity> craftOrdDesignList)
  240. {
  241. ArrayList list = new ArrayList();
  242. foreach (CraftOrdDesignEntity craftOrdDesign in craftOrdDesignList)
  243. {
  244. list.Add(JSONFormat.Format(craftOrdDesign));
  245. }
  246. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.setMemo",
  247. new object[] { list }, _ob);
  248. }
  249. /// <summary>
  250. /// 保存二级工艺文件
  251. /// </summary>
  252. /// <param name="craftOrdDesign"></param>
  253. public void SaveCraftLv2(List<CraftOrdDesignEntity> craftOrdDesignList)
  254. {
  255. ArrayList parms = new ArrayList();
  256. foreach (CraftOrdDesignEntity craftOrdDesignEntity in craftOrdDesignList)
  257. {
  258. parms.Add(JSONFormat.Format(craftOrdDesignEntity));
  259. }
  260. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SaveCraftLv2",
  261. new object[] { parms }, _ob);
  262. }
  263. /// <summary>
  264. /// 修改有效标志
  265. /// </summary>
  266. /// <param name="craftOrdDesignEntity"></param>
  267. public void UpdateCraftNo(List<CraftOrdDesignEntity> craftOrdDesignList, ArrayList list)
  268. {
  269. ArrayList Craftlist = new ArrayList();
  270. foreach (CraftOrdDesignEntity craftOrdDesignEntity in craftOrdDesignList)
  271. {
  272. Craftlist.Add(JSONFormat.Format(craftOrdDesignEntity));
  273. }
  274. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.updateCraftNo",
  275. new object[] { Craftlist, list }, _ob);
  276. }
  277. /// <summary>
  278. /// 通过合同行主键查询工艺评审记录
  279. /// </summary>
  280. /// <param name="craftOrdDesignEntity"></param>
  281. /// <returns></returns>
  282. public CraftOrdDesignEntity QueryCraftByOrLnPk(CraftOrdDesignEntity craftOrdDesignEntity)
  283. {
  284. List<CraftOrdDesignEntity> craftOrdDesingList = EntityHelper.GetData<CraftOrdDesignEntity>(
  285. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.queryCraftByOrLnPk"
  286. , new object[] { JSONFormat.Format(craftOrdDesignEntity) }, _ob);
  287. if(craftOrdDesingList.Count > 0)
  288. {
  289. return craftOrdDesingList[0];
  290. }
  291. else
  292. {
  293. return null;
  294. }
  295. }
  296. /// <summary>
  297. /// 修改工艺文件路径
  298. /// </summary>
  299. /// <param name="craftOrdDesignEntity"></param>
  300. public void UpdateCraftPath(CraftOrdDesignEntity craftOrdDesignEntity, string isMultiUse, string isCraftPath)
  301. {
  302. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.updateCraftPath",
  303. new object[] { JSONFormat.Format(craftOrdDesignEntity), isMultiUse, isCraftPath }, _ob);
  304. }
  305. /// <summary>
  306. /// 获取工艺主表中的工艺文件号数目
  307. /// </summary>
  308. /// <param name="craftNo"></param>
  309. /// <returns></returns>
  310. public int GetCraftCraftNoCnt(string craftNo)
  311. {
  312. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftNoCnt",
  313. new object[] { craftNo }, _ob);
  314. return int.Parse(dt.Rows[0][0].ToString());
  315. }
  316. /// <summary>
  317. /// 获取工艺主表中的引用工艺文件号数目
  318. /// </summary>
  319. /// <param name="craftNo"></param>
  320. /// <returns></returns>
  321. public int GetRefCraftCraftNoCnt(string craftNo, string ordLnPk, string craftSeq)
  322. {
  323. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getRefCraftNoCnt",
  324. new object[] { craftNo, ordLnPk, craftSeq }, _ob);
  325. return int.Parse(dt.Rows[0][0].ToString());
  326. }
  327. /// <summary>
  328. /// 获取工艺主表中的最大工艺版本号。
  329. /// </summary>
  330. /// <param name="craftNo"></param>
  331. /// <returns></returns>
  332. public string GetCraftMaxCraftNoV(string craftNo)
  333. {
  334. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftMaxCraftNoV",
  335. new object[] { craftNo }, _ob);
  336. return dt.Rows[0][0].ToString();
  337. }
  338. /// <summary>
  339. /// 通过合同行主键查询有效数目
  340. /// </summary>
  341. /// <param name="ordLnPk"></param>
  342. /// <returns></returns>
  343. public int GetCraftValidCntByOrdLnPk(string ordLnPk)
  344. {
  345. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftValidCntByOrLnPk",
  346. new object[] { ordLnPk }, _ob);
  347. return int.Parse(dt.Rows[0][0].ToString());
  348. }
  349. /// <summary>
  350. /// 匹配工艺文件
  351. /// </summary>
  352. public void MatchCraftFile(List<CraftOrdDesignEntity> craftOrdDesignList)
  353. {
  354. ArrayList list = new ArrayList();
  355. foreach (CraftOrdDesignEntity craftOrdDesign in craftOrdDesignList)
  356. {
  357. list.Add(JSONFormat.Format(craftOrdDesign));
  358. }
  359. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.matchCraftFile",
  360. new object[] { list }, _ob);
  361. }
  362. /// <summary>
  363. /// 查询最大的工艺号并且有效的。
  364. /// </summary>
  365. /// <param name="ordLnPk"></param>
  366. /// <returns></returns>
  367. public CraftOrdDesignEntity GetNewValidCraft(string ordLnPk)
  368. {
  369. List<CraftOrdDesignEntity> list = EntityHelper.GetData<CraftOrdDesignEntity>(
  370. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getNewValidCraft",
  371. new object[] { ordLnPk }, _ob);
  372. if (list.Count > 0)
  373. {
  374. return list[0];
  375. }
  376. else
  377. {
  378. return null;
  379. }
  380. }
  381. /// <summary>
  382. /// 设置最大的工艺序号生效
  383. /// </summary>
  384. /// <param name="ordLnPk"></param>
  385. public void SetCraftOrDesignValid(string ordLnPk)
  386. {
  387. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.setCraftOrDesignValid",
  388. new object[] { ordLnPk }, _ob);
  389. }
  390. /// <summary>
  391. /// 获取排除合同行的工艺文件数目
  392. /// </summary>
  393. /// <param name="craftNo"></param>
  394. /// <param name="craftNoV"></param>
  395. /// <param name="ordLnPk"></param>
  396. /// <returns></returns>
  397. public int GetCraftNoCntOutLn(string craftNo, string craftNoV, string ordLnPk)
  398. {
  399. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftNoCntOutLn",
  400. new object[]{ craftNo, craftNoV, ordLnPk}, _ob);
  401. return int.Parse(dt.Rows[0][0].ToString());
  402. }
  403. /// <summary>
  404. /// 获取DESIGN_KEY数目
  405. /// </summary>
  406. /// <returns></returns>
  407. public int GetDesignKeyCnt(string designKey)
  408. {
  409. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getDesignKeyCnt",
  410. new object[] { designKey }, _ob);
  411. return int.Parse(dt.Rows[0][0].ToString());
  412. }
  413. public int GetCntByDesignKeyProcess(string designKey, string processCode)
  414. {
  415. DataTable dt = ServerHelper.GetData(
  416. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCntByDesignKeyProcess",
  417. new object[] { designKey, processCode }, _ob);
  418. return int.Parse(dt.Rows[0][0].ToString());
  419. }
  420. /// <summary>
  421. /// 复制二级工艺文件
  422. /// </summary>
  423. /// <param name="ordLnPk"></param>
  424. /// <param name="craftSeq"></param>
  425. public void CopyCraftFileLv2(string ordLnPk, string craftSeq, string craftSeq2)
  426. {
  427. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.CopyCraftFileLv2",
  428. new object[] { ordLnPk, craftSeq, craftSeq2 }, _ob);
  429. }
  430. /// <summary>
  431. /// 获取上一个二级工艺文件
  432. /// </summary>
  433. /// <param name="ordLnPk"></param>
  434. /// <param name="craftSeq"></param>
  435. public DataTable GetPreviousCraftLv2(string ordLnPk, string craftSeq)
  436. {
  437. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.GetPreviousCraftLv2",
  438. new object[]{ordLnPk, craftSeq}, _ob);
  439. return dt;
  440. }
  441. /// <summary>
  442. /// 删除工艺文件
  443. /// </summary>
  444. /// <param name="craftOrdDesignList"></param>
  445. public void DeleteCraftFile(List<CraftOrdDesignEntity> craftOrdDesignList)
  446. {
  447. ArrayList list = new ArrayList();
  448. foreach (CraftOrdDesignEntity craftOrdDesign in craftOrdDesignList)
  449. {
  450. list.Add(JSONFormat.Format(craftOrdDesign));
  451. }
  452. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.DeleteCraftFile",
  453. new object[] { list }, _ob);
  454. }
  455. public string GetMaxCraftSeq(string ordLnPk)
  456. {
  457. return ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.GetMaxCraftSeq",
  458. new object[] { ordLnPk }, _ob).Rows[0][0].ToString();
  459. }
  460. public bool GetMaterialAutoCraft(string ordLnPk)
  461. {
  462. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.GetMaterialAutoCraft",
  463. new object[] { ordLnPk }, _ob);
  464. if (dt.Rows[0][0].ToString() == "1")
  465. {
  466. return true;
  467. }
  468. else
  469. {
  470. return false;
  471. }
  472. }
  473. public bool GetBacklogAutoCraft(string ordLnPk)
  474. {
  475. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.GetBacklogAutoCraft",
  476. new object[] { ordLnPk }, _ob);
  477. if (dt.Rows[0][0].ToString() == "0")
  478. {
  479. return true;
  480. }
  481. else
  482. {
  483. return false;
  484. }
  485. }
  486. public bool AutoCreateCraft(string ordLnPk, string designStyle)
  487. {
  488. string[] results = (string[])ServerHelper.SetDataReturnObj(
  489. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.GetAutoCreateCraftParms",
  490. new object[] { ordLnPk }, _ob);
  491. if (designStyle != "2" && (!GetMaterialAutoCraft(ordLnPk) || !GetBacklogAutoCraft(ordLnPk)))//只有物料和所有制程都为自动生成,才进行自动生成工艺文件。
  492. {
  493. return false;
  494. }
  495. WaitingForm2 wf;
  496. if (designStyle == "2") //备料处理
  497. {
  498. wf = new WaitingForm2("正在生成工艺文件....");
  499. }
  500. else
  501. {
  502. wf = new WaitingForm2("正在自动生成工艺文件....");
  503. }
  504. CraftOrdDesignEntity craftOrdDesign = new CraftOrdDesignEntity();
  505. craftOrdDesign.OrdLnPk = ordLnPk;
  506. craftOrdDesign.CraftSeq = decimal.Parse(results[0]);
  507. craftOrdDesign.CraftNo = results[1];
  508. craftOrdDesign.DesginKey = results[2];
  509. string craftPath = "Qcm/Craft/" + craftOrdDesign.OrdLnPk + "/" +
  510. craftOrdDesign.CraftSeq + "/" + results[3] + ".pdf";
  511. ServerHelper.SetDataReturnObj(
  512. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.AutoCreateCraft",
  513. new object[] { ordLnPk, results[0], results[1], craftPath, CoreUserInfo.UserInfo.GetUserName(), designStyle }, _ob);
  514. if (!CreatePdfToFtp(craftOrdDesign, results[3]))
  515. {
  516. MessageUtil.ShowError("系统生成PDF失败,请稍后再试!");
  517. return false;
  518. }
  519. string validflag = "1";
  520. if (craftOrdDesign.CraftSeq > 1)
  521. {
  522. validflag = "8";
  523. }
  524. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SetValidflagByPk",
  525. new object[] { validflag, ordLnPk, results[0] }, _ob);
  526. wf.Close();
  527. return true;
  528. }
  529. public void SetMaterialAutoCraft(string ordLnPk)
  530. {
  531. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SetMaterialAutoCraft",
  532. new object[]{ordLnPk}, _ob);
  533. }
  534. public void SetBacklogAutoCraft(string ordLnPk)
  535. {
  536. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SetBacklogAutoCraft",
  537. new object[] { ordLnPk }, _ob);
  538. }
  539. public void SetCraftOrdDesignMaterial(string ordLnPk)
  540. {
  541. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SetCraftOrdDesignMaterial",
  542. new object[] { ordLnPk }, _ob);
  543. }
  544. public void SetCraftOrdDesignBacklog(string ordLnPk)
  545. {
  546. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SetCraftOrdDesignBacklog",
  547. new object[] { ordLnPk }, _ob);
  548. }
  549. public DataRow GetMscByOrdLnPk(string ordLnPk)
  550. {
  551. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.GetMscByOrdLnPk",
  552. new object[] { ordLnPk }, _ob);
  553. if (dt.Rows.Count > 0)
  554. {
  555. return dt.Rows[0];
  556. }
  557. else
  558. {
  559. return null;
  560. }
  561. }
  562. public DataRow GetCraftDesignSts(string ordLnPk)
  563. {
  564. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.ReviewForm.CoreOrderReviewTechnology.getCraftDesignSts",
  565. new object[] { ordLnPk }, _ob);
  566. if (dt.Rows.Count > 0)
  567. {
  568. return dt.Rows[0];
  569. }
  570. else
  571. {
  572. return null;
  573. }
  574. }
  575. /// <summary>
  576. /// 调用报表服务器生成PDF并上传到FTP服务器。
  577. /// </summary>
  578. /// <param name="craftOrdDesignList"></param>
  579. /// <returns></returns>
  580. public bool CreatePdfToFtp(CraftOrdDesignEntity craftOrdDesign, string pdfName)
  581. {
  582. WebClient webClient = new WebClient();
  583. List<FileBean> listPdf = new List<FileBean>();
  584. string filePathNew = "Qcm/Craft/" + craftOrdDesign.OrdLnPk + "/" + craftOrdDesign.CraftSeq + "/";
  585. craftOrdDesign.CraftPath = filePathNew + pdfName + ".pdf";
  586. DataTable dtComMsc = CraftOrdDesignCtrl.GetComMscByOrdLnPk(craftOrdDesign.OrdLnPk, _ob);
  587. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepTechOrderLineCraft.cpt&bypagesize=false&format=pdf&embed=true"
  588. + "&desgin_key=" + craftOrdDesign.DesginKey + "&lnpk=" + craftOrdDesign.OrdLnPk;
  589. if (dtComMsc.Rows[0]["DEPARTMENT_CODE"].ToString() == "002001007")
  590. {
  591. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepTechOrderLineCraftCenter.cpt&bypagesize=false&format=pdf&embed=true"
  592. + "&desgin_key=" + craftOrdDesign.DesginKey + "&lnpk=" + craftOrdDesign.OrdLnPk;
  593. }
  594. byte[] pdf = webClient.DownloadData(strurl);
  595. if (pdf.Length <= 10000)
  596. {
  597. MessageUtil.ShowError("生成PDF出错,请重新生成!");
  598. return false;
  599. }
  600. FileBean fileBean = new FileBean();
  601. fileBean.setFile(pdf);
  602. fileBean.setFileName(pdfName + ".pdf");
  603. fileBean.setPathName(filePathNew);
  604. listPdf.Add(fileBean);
  605. webClient.Dispose();
  606. return FileHelper.Upload(listPdf);
  607. }
  608. public void SetProcessFlag(string processCode, string flag,
  609. string ordLnPk, string craftSeq)
  610. {
  611. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SetProcessFlag",
  612. new object[] { processCode, flag, ordLnPk, craftSeq }, _ob);
  613. }
  614. public void SetProcessFlag(List<object> para, string flag)
  615. {
  616. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SetProcessFlag",
  617. new object[] { para, flag }, _ob);
  618. }
  619. public void SetProcessJhFlag(List<object> para, string flag)
  620. {
  621. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SetProcessJhFlag",
  622. new object[] { para, flag }, _ob);
  623. }
  624. public void SetProcessFlag(string processCode, string flag,string craftno)
  625. {
  626. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SetProcessFlag",
  627. new object[] { processCode, flag, craftno }, _ob);
  628. }
  629. /// <summary>
  630. /// 获取工艺评审取样要求
  631. /// </summary>
  632. /// <param name="designKey"></param>
  633. /// <param name="processCode"></param>
  634. /// <returns></returns>
  635. public DataTable GetCraftPicSmp(string designKey, string processCode)
  636. {
  637. return ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftPicSmp",
  638. new object[] { designKey, processCode }, _ob);
  639. }
  640. /// <summary>
  641. /// 获取工艺评审取样要求分组
  642. /// </summary>
  643. /// <param name="designKey"></param>
  644. /// <param name="processCode"></param>
  645. /// <returns></returns>
  646. public DataTable GetCraftPicSmpGroup(string designKey, string processCode)
  647. {
  648. return ServerHelper.GetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftPicSmpGroup",
  649. new object[] { designKey, processCode }, _ob);
  650. }
  651. /// <summary>
  652. /// 获取工艺评审取样要求分组
  653. /// </summary>
  654. /// <param name="designKey"></param>
  655. /// <param name="processCode"></param>
  656. /// <returns></returns>
  657. public List<CraftOrdDesignStdPicSmpDetailEntity> GetCraftPicSmpGroup(string LnPk, string CraftSeq, string CraftNo, string designKey, string Msc, string processCode, string Cic,int Cut)
  658. {
  659. List<CraftOrdDesignStdPicSmpDetailEntity> listCraftOrdDesignStdPicSmpDetailEntity = EntityHelper.GetData<CraftOrdDesignStdPicSmpDetailEntity>(
  660. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftSamplingDetaill",
  661. new object[] { LnPk, CraftSeq, processCode }, _ob);
  662. if (!listCraftOrdDesignStdPicSmpDetailEntity.Any())
  663. {
  664. listCraftOrdDesignStdPicSmpDetailEntity = EntityHelper
  665. .GetData<CraftOrdDesignStdPicSmpDetailEntity>(
  666. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftPicSmpGroup",
  667. new object[] {designKey, Msc, processCode, Cic, CraftNo}, _ob);
  668. listCraftOrdDesignStdPicSmpDetailEntity.ForEach(p =>
  669. {
  670. p.OrdLnPk = LnPk;
  671. p.CraftSeq = CraftSeq;
  672. if (p.BatchCnt.TryParseInt())
  673. {
  674. p.BatchCnt = int.Parse(p.BatchCnt)*Cut + "";
  675. }
  676. });
  677. }
  678. return listCraftOrdDesignStdPicSmpDetailEntity;
  679. }
  680. /// <summary>
  681. /// 获取工艺评审取样要求汇总
  682. /// </summary>
  683. /// <param name="designKey"></param>
  684. /// <param name="processCode"></param>
  685. /// <returns></returns>
  686. public List<CraftOrdDesignStdPicSmpTotalEntity> GetCraftSamplingTotal(string LnPk, string CraftSeq, string CraftNo, string processCode)
  687. {
  688. List<CraftOrdDesignStdPicSmpTotalEntity> CraftOrdDesignStdPicSmpTotalEntity = EntityHelper.GetData<CraftOrdDesignStdPicSmpTotalEntity>(
  689. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getCraftSamplingTotal",
  690. new object[] { LnPk,CraftSeq, processCode }, _ob);
  691. return CraftOrdDesignStdPicSmpTotalEntity;
  692. }
  693. /// <summary>
  694. /// 获取工艺评审取样要求汇总
  695. /// </summary>
  696. /// <param name="designKey"></param>
  697. /// <param name="processCode"></param>
  698. /// <returns></returns>
  699. public void SaveCraftSampling(List<CraftOrdDesignStdPicSmpTotalEntity> CraftOrdDesignStdPicSmpTotalEntity, List<CraftOrdDesignStdPicSmpDetailEntity> CraftOrdDesignStdPicSmpDetailEntity)
  700. {
  701. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.SaveCraftSampling",
  702. new object[] { CraftOrdDesignStdPicSmpTotalEntity.Select(JSONFormat.Format).ToList(), CraftOrdDesignStdPicSmpDetailEntity.Select(JSONFormat.Format).ToList() }, _ob);
  703. }
  704. /// <summary>
  705. /// 获取工艺评审取样要求汇总
  706. /// </summary>
  707. /// <param name="designKey"></param>
  708. /// <param name="processCode"></param>
  709. /// <returns></returns>
  710. public void CancelCraftSampling(CraftOrdDesignStdPicSmpTotalEntity CraftOrdDesignStdPicSmpTotalEntity)
  711. {
  712. ServerHelper.SetData("com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.DeleteCraftSampling",
  713. new object[] { JSONFormat.Format(CraftOrdDesignStdPicSmpTotalEntity) }, _ob);
  714. }
  715. /// <summary>
  716. /// 获取工艺评审取样要求汇总
  717. /// </summary>
  718. /// <param name="designKey"></param>
  719. /// <param name="processCode"></param>
  720. /// <returns></returns>
  721. public List<CraftOrdDesignStdPicEntity> getSampleDetail(string designKey, string processCode)
  722. {
  723. List<CraftOrdDesignStdPicEntity> CraftOrdDesignStdPicEntity = EntityHelper.GetData<CraftOrdDesignStdPicEntity>(
  724. "com.steering.pss.sale.order.DAL.CraftOrdDesignDAL.getSampleDetail",
  725. new object[] { designKey, processCode }, _ob);
  726. return CraftOrdDesignStdPicEntity;
  727. }
  728. }
  729. }