using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using cuidian.OpenApi.Api; using cuidian.OpenApi.Utils; using cuidian.OpenApi.Model; using cuidian.Common; using cuidian.Sql; namespace TempDbToUfida.OpenApi { /// /// 从中间库将仓库资料下载到U8数据库 /// public class DownLoadWarehouse : BaseDataDownLoad { protected override void _Init() { _loadSql = "select * from warehouse where processflag=0"; base._Init(); } protected override BusinessObject _ImportData(DataRow row) { WarehouseApi api = new WarehouseApi(); WarehouseRoot wr = new WarehouseRoot(); Warehouse w = new Warehouse(); w.code = row["cwhcode"].ToString(); w.name = row["cwhname"].ToString(); wr.warehouse = w; BusinessObject result = api.Add(JsonUtils.GetJsonString(wr)); return result; } protected override void _LogError(int id, string msg) { OperationLog.Utils.WriteErrorLog("向U8导入仓库资料", "sysid = " + id.ToString() + " " + msg); } protected override void _LogSucess(int id, string newCode) { string sql = "update Warehouse set processflag = 1,processdate = getdate() where sysid = {0} "; sql += string.Format(@" update {0}..Warehouse set cWhValueStyle='{1}',bMRP='1',bROP='1',bControlSerial='1',bInCost='1',bInAvailCalcu='1',bCheckSubitemCost='1' where cwhCode='{2}' ", ConnectionUtils.Instance.GetConnection().Database,"移动平均法",newCode); OperationLog.Utils.UpdateTempRecord(string.Format(sql,id)); } } }