BasicInfoHelper.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using JLHHJSvr.BLL;
  2. using JLHHJSvr.Com.Model;
  3. using JLHHJSvr.LJException;
  4. using LJLib.DAL.SQL;
  5. using NPOI.SS.Formula;
  6. using NPOI.SS.Formula.Functions;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace JLHHJSvr.Helper
  13. {
  14. internal class BasicInfoHelper: HelperBase
  15. {
  16. /// <summary>
  17. /// 核价选配类型-保存
  18. /// </summary>
  19. /// <param name="configure"></param>
  20. public void SaveConfigureType(u_configure_type configure)
  21. {
  22. if (configure.contfigtypeid <= 0)
  23. {
  24. configure.contfigtypeid = BllHelper.GetID(cmd, "u_configure_type");
  25. var fields = @"contfigtypeid,contfigtype,contfigtypename,usechflag,flag";
  26. DbSqlHelper.Insert(cmd, "u_configure_type", null, configure, fields);
  27. }
  28. else
  29. {
  30. configure.moddate = context.opdate;
  31. configure.modemp = context.tokendata.username;
  32. //修改
  33. var fields = @"contfigtype,contfigtypename,usechflag,modemp,moddate";
  34. DbSqlHelper.Update(cmd, "u_configure_type", null, configure, "contfigtypeid", fields);
  35. }
  36. }
  37. /// <summary>
  38. /// 核价软床公式定义-保存
  39. /// </summary>
  40. /// <param name="formula"></param>
  41. public void SaveSoftBedFormula(u_softbed_formula formula)
  42. {
  43. if (formula == null)
  44. {
  45. throw new LJCommonException("未提交软床公式定义信息");
  46. }
  47. if (string.IsNullOrEmpty(formula.formulaname))
  48. {
  49. throw new LJCommonException($"公式名称不能为空,请检查!");
  50. }
  51. var fields = "formulaname,price_formula,use_formula";
  52. if (formula.formulaid <= 0)
  53. {
  54. // 新建
  55. fields += ",formulaid,create_date,create_emp";
  56. formula.formulaid = BllHelper.GetID(cmd, "u_softbed_formula");
  57. formula.create_date = context.opdate;
  58. formula.create_emp = context.tokendata.username;
  59. DbSqlHelper.Insert(cmd, "u_softbed_formula", null, formula, fields);
  60. }
  61. else
  62. {
  63. //修改
  64. fields += ",update_date,update_emp";
  65. formula.update_date = context.opdate;
  66. formula.update_emp = context.tokendata.username;
  67. DbSqlHelper.Update(cmd, "u_softbed_formula", null, formula, "formulaid", fields);
  68. }
  69. }
  70. public void SaveErpMtrlPrice(u_erpmtrl_price mtrl)
  71. {
  72. var fields = "";
  73. if(mtrl.mtrlid <= 0)
  74. {
  75. throw new LJCommonException("物料ID有误,请检查!");
  76. }
  77. mtrl.update_date = context.opdate;
  78. mtrl.update_emp = context.tokendata.username;
  79. if(DbSqlHelper.Update(cmd, "u_erpmtrl_price", null, mtrl, "mtrlid", "price,update_date,update_emp") == 0)
  80. {
  81. mtrl.create_date = context.opdate;
  82. mtrl.create_emp = context.tokendata.username;
  83. DbSqlHelper.Insert(cmd, "u_erpmtrl_price", null, mtrl, "mtrlid,price,create_date,create_emp");
  84. }
  85. }
  86. }
  87. }