SlmShipNoApplyResultInputBll.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. using System.Collections;
  7. using System.ComponentModel;
  8. using System.Drawing;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. using ColumnDefine = Core.StlMes.Client.Sale.Common.TbColumnDefine.TbColumnDefine;
  13. namespace Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Plan
  14. {
  15. public class SlmShipNoApplyResultInputBll : SaleBusinessMgt.BllBase.BaseBll
  16. {
  17. public SlmShipNoApplyResultInputBll(OpeBase ob)
  18. : base(ob)
  19. {
  20. }
  21. /// <summary>
  22. /// 查询合同行入口
  23. /// </summary>
  24. /// <param name="sqlCondition"></param>
  25. /// <returns></returns>
  26. private DataSet GetShipNoApplyResultInputInfo(string sqlCondition)
  27. {
  28. string sqlStr = string.Format(SqlCollection.Plan.QUERY_SHIPNOAPPLYRINPUT, sqlCondition , base.DateTimeTocharFormat);
  29. return base.ExecuteQuery(sqlStr);
  30. }
  31. public DataSet GetValidShipNoApplyResultInput()
  32. {
  33. string sqlCondition = " and validflag = '1' ";
  34. return GetShipNoApplyResultInputInfo(sqlCondition);
  35. }
  36. public DataSet GetValidShipNoApplyResultInputByTransmonth(DateTime transmonth)
  37. {
  38. string sqlCondition = " and transmonth = " + Util.ConverObject.ConvertDateTimeValueToDbLanguage(transmonth) + " and validflag = '1'";
  39. return GetShipNoApplyResultInputInfo(sqlCondition);
  40. }
  41. public void Insert(Hashtable hs,out string errMsg)
  42. {
  43. errMsg = "";
  44. hs.Add(ColumnDefine.SLM_DLIV_SHIPAPPLY_RESULT.TRANSPORT_NUM, GetdlivShipApplyResultInfoCode());
  45. CoreClientParam param = base.GetCoreClientParam(_ServerName, "insert", new object[] { hs });
  46. CoreClientParam result = base.fr.ExecuteNonQuery(param, CoreInvokeType.Internal);
  47. errMsg = base.GetReturnErrorInfo(result);
  48. }
  49. public void Update(Hashtable hs, out string errMsg)
  50. {
  51. errMsg = "";
  52. CoreClientParam param = base.GetCoreClientParam(_ServerName, "update", new object[] { hs });
  53. CoreClientParam result = base.fr.ExecuteNonQuery(param, CoreInvokeType.Internal);
  54. errMsg = base.GetReturnErrorInfo(result);
  55. }
  56. public void Delete(ArrayList list, out string errMsg)
  57. {
  58. errMsg = "";
  59. CoreClientParam param = base.GetCoreClientParam(_ServerName, "delete", new object[] { list });
  60. CoreClientParam result = base.fr.ExecuteNonQuery(param, CoreInvokeType.Internal);
  61. errMsg = base.GetReturnErrorInfo(result);
  62. }
  63. /// <summary>
  64. /// 获取数据行数
  65. /// </summary>
  66. /// <returns></returns>
  67. private double GetdlivShipApplyResultInfoCount()
  68. {
  69. string sqlStr = "select count(1) from slm_dliv_shipapply_result ";
  70. DataSet ds = base.ExecuteQuery(sqlStr);
  71. if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
  72. return 0;
  73. return Util.ConverObject.ConvertToDouble(ds.Tables[0].Rows[0][0]);
  74. }
  75. /// <summary>
  76. /// 自动生成客户编码
  77. /// </summary>
  78. /// <returns></returns>
  79. private string GetdlivShipApplyResultInfoCode()
  80. {
  81. string transport_num = "";
  82. string sqlStr = @"select *
  83. from (select lpad(l || '', 6, 0) customberno, a.transport_num, rownum rn
  84. from (select level - 1 l from dual connect by level < {0}) b
  85. left join slm_dliv_shipapply_result a on a.transport_num =
  86. lpad(b.l || '', 6, 0)
  87. where a.transport_num is null
  88. order by b.l)
  89. where rn = 1";
  90. sqlStr = string.Format(sqlStr, GetdlivShipApplyResultInfoCount() + 100);
  91. DataSet ds = base.ExecuteQuery(sqlStr);
  92. try
  93. {
  94. if (ds.Tables[0].Rows.Count == 0)
  95. transport_num = "000001";
  96. else
  97. transport_num = ds.Tables[0].Rows[0]["CUSTOMBERNO"].ToString();
  98. }
  99. catch
  100. {
  101. }
  102. return transport_num;
  103. }
  104. private string _ServerName = "core.stlmes.server.sale.service.plan.SlmShipNoApplyResultInput";
  105. }
  106. }