GetMattressPackagMxExcutor.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.SqlClient;
  4. using System.Linq;
  5. using System.Text;
  6. using DirectService.Tools;
  7. using JLHHJSvr.BLL;
  8. using JLHHJSvr.Com;
  9. using JLHHJSvr.Com.Model;
  10. using JLHHJSvr.Helper;
  11. using JLHHJSvr.LJException;
  12. using JLHHJSvr.Tools;
  13. using LJLib.DAL.SQL;
  14. using LJLib.Net.SPI.Server;
  15. namespace JLHHJSvr.Excutor
  16. {
  17. internal sealed class GetMattressPackagMxExcutor : ExcutorBase<GetMattressPackagMxRequest, GetMattressPackagMxResponse>
  18. {
  19. protected override void ExcuteInternal(GetMattressPackagMxRequest request, object state, GetMattressPackagMxResponse rslt)
  20. {
  21. var tokendata = BllHelper.GetToken(request.token);
  22. if (tokendata == null)
  23. {
  24. rslt.ErrMsg = "会话已经中断,请重新登录";
  25. return;
  26. }
  27. if (request.mattresstypeid == 0)
  28. {
  29. rslt.ErrMsg = "床垫类别不能为0";
  30. return;
  31. }
  32. using (var con = new SqlConnection(GlobalVar.ConnectionString))
  33. using (var cmd = con.CreateCommand())
  34. {
  35. con.Open();
  36. using (cmd.Transaction = con.BeginTransaction())
  37. {
  38. var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
  39. var dw_2 = new List<u_mattress_mx_mtrl>();
  40. // 导入 2-按包装方式 的公式
  41. helper.wf_import_bz(request.packtype, ref dw_2);
  42. helper.wf_sort_mx(ref dw_2);
  43. helper.wf_default_mtrlid(request.pricelistid, ref dw_2);
  44. rslt.mattressMx = dw_2;
  45. }
  46. }
  47. }
  48. }
  49. }