DownLoadWarehouse.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using cuidian.Sql;
  7. using System.Data;
  8. namespace TempDbToUfida.Sql
  9. {
  10. /// <summary>
  11. /// 下载仓库
  12. /// </summary>
  13. public class DownLoadWarehouse : BaseDataDownLoad
  14. {
  15. #region 变量定义
  16. private string __dupSql,__insertSql,__updSql;
  17. #endregion
  18. protected override void _InitSourceData()
  19. {
  20. string sql = "select * from wtu..Warehouse where processflag = 0";
  21. Dictionary<string, string> ars = new Dictionary<string, string>();
  22. ars.Add(_mainTable, sql);
  23. _sourceData = DbUtils.Fill(ars, ConnectionUtils.Instance.GetConnection());
  24. }
  25. protected override void _Init()
  26. {
  27. base._Init();
  28. _mainTable = "Warehouse";
  29. __dupSql = "select count(1) from Warehouse where cWhCode = '{0}'";
  30. __insertSql = "insert into Warehouse(cWhCode,cWhName,cWhValueStyle) values('{0}','{1}','全月平均法')";
  31. __updSql = "update wtu..Warehouse set processdate=getdate(),processflag =1 where sysid={0}";
  32. _operType = "插入用友仓库数据";
  33. }
  34. protected override string _buildCheckSql(DataRow dr)
  35. {
  36. return string.Format(__dupSql, dr["cWhCode"]);
  37. }
  38. protected override string _buildInsertSql(DataRow dr)
  39. {
  40. return string.Format(__insertSql,dr["cWhCode"],dr["cWhName"]);
  41. }
  42. protected override string _buildUpdSql(DataRow dr)
  43. {
  44. return string.Format(__updSql,dr["sysid"]);
  45. }
  46. }
  47. }