12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using cuidian.Sql;
- using System.Text;
- using WdtUtils;
- using WdtUtils.Load;
- using WdtUtils.Proxy;
- namespace WangToTempDb
- {
- /// <summary>
- /// 旺店通仓库上传中间库
- /// </summary>
- public class WarehouseUpLoad : BaseUpLoad
- {
- private string __sql = "if not exists (select 1 from Warehouse where cWhCode ='{0}') insert into Warehouse(cWhCode,cWhName) values('{0}','{1}')";
-
- protected override void _ImportData()
- {
- _operType = "插入仓库中间表数据";
- Warehouse[] entitys = ((WarehouseProxy)_proxy).warehouses;
- StringBuilder sb = new StringBuilder();
- foreach (Warehouse item in entitys)
- {
- //item.warehouse_no = (item.warehouse_no.Length > 10) ? item.warehouse_no.Substring(0, 10) : item.warehouse_no;
- //string code = item.warehouse_no;
- sb.AppendLine(string.Format(__sql, _ConvertStr(item.warehouse_no), _ConvertStr(item.name)));
- _InsertIntoTempDb(sb.ToString(), item.warehouse_no);
- }
-
- }
- protected override void _DeleteDup()
- {
- _operType = "删除仓库中间表重复数据";
- string sql = "delete a from {0}..Warehouse a,{1}..Warehouse b where a.cWhCode = b.cWhCode";
- DbUtils.ExecuteNonQuery(string.Format(sql,_tempDb.Database, _targetDb.Database), _tempDb);
- }
- protected override void _LoadNextPage()
- {
- _proxy = _load.Load<WarehouseProxy>(_args);
- }
- protected override void _SetLoader()
- {
- _load = new WarehouseLoad();
- }
- protected override Result _LoadFirstPage()
- {
- WarehouseProxy tmp = new WarehouseProxy();
- Result rtn = _load.Load<WarehouseProxy>(_args,ref tmp);
- _proxy = tmp;
- return rtn;
- }
-
- }
- }
|