using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using cuidian.Sql;
using System.Data;
namespace TempDbToUfida.Sql
{
///
/// 下载仓库
///
public class DownLoadWarehouse : BaseDataDownLoad
{
#region 变量定义
private string __dupSql,__insertSql,__updSql;
#endregion
protected override void _InitSourceData()
{
string sql = "select * from wtu..Warehouse where processflag = 0";
Dictionary ars = new Dictionary();
ars.Add(_mainTable, sql);
_sourceData = DbUtils.Fill(ars, ConnectionUtils.Instance.GetConnection());
}
protected override void _Init()
{
base._Init();
_mainTable = "Warehouse";
__dupSql = "select count(1) from Warehouse where cWhCode = '{0}'";
__insertSql = "insert into Warehouse(cWhCode,cWhName,cWhValueStyle) values('{0}','{1}','全月平均法')";
__updSql = "update wtu..Warehouse set processdate=getdate(),processflag =1 where sysid={0}";
_operType = "插入用友仓库数据";
}
protected override string _buildCheckSql(DataRow dr)
{
return string.Format(__dupSql, dr["cWhCode"]);
}
protected override string _buildInsertSql(DataRow dr)
{
return string.Format(__insertSql,dr["cWhCode"],dr["cWhName"]);
}
protected override string _buildUpdSql(DataRow dr)
{
return string.Format(__updSql,dr["sysid"]);
}
}
}