123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using cuidian.Common;
- using cuidian.OpenApi.Api;
- using cuidian.OpenApi.Model;
- using cuidian.OpenApi.Utils;
- using OperationLog;
- using cuidian.Sql;
- namespace TempDbToUfida.OpenApi
- {
- /// <summary>
- /// 从中间库将存货资料下载到U8数据库
- /// </summary>
- public class DownLoadInventory : BaseDataDownLoad
- {
- protected override void _Init()
- {
- _loadSql = "select * from Inventory where processflag=0";
- base._Init();
- }
- protected override BusinessObject _ImportData(DataRow row)
- {
- InventoryApi api = new InventoryApi();
- Inventory v = new Inventory();
- v.code = row["cInvCode"].ToString();
- v.name = row["cInvName"].ToString();
- v.specs = row["cInvStd"].ToString();
- v.bsuitretail = "0";
- v.purchase_flag = "1";
- v.sale_flag = "1";
- v.bexpsale = "0";
- v.selfmake_flag = "1";
- v.bbommain = "1";
- v.bbomsub = "1";
- v.bProxyForeign = "1";
- v.prod_consu_flag = "1";
- v.iimptaxrate = "13";//进项税率
- v.tax_rate = "13";//销项税率
- v.pricetype = "移动平均";
- //v.tax_rate = row["iTaxRate"].ToString();
- //存货分类编码默认01
- v.sort_code = AppSeting.Instance.GetValue("sort_code");
- //计量单位组默认00
- v.unitgroup_code = AppSeting.Instance.GetValue("unitgroup_code");
- v.unitgroup_type = "0";
- //计量单位编码默认J
- v.main_measure = AppSeting.Instance.GetValue("measureUnit");
- v.self_define7= row["cInvDefine7"].ToString();
- v.self_define5 = row["cInvDefine5"].ToString();
- v.self_define6 = row["cInvDefine6"].ToString();
- v.self_define8 = row["cInvDefine8"].ToString().Length<=60?row["cInvDefine8"].ToString(): row["cInvDefine8"].ToString().Substring(0,60);
- v.ref_sale_price = row["cInvDefine13"].ToString();
- v.self_define10= row["cInvDefine10"].ToString();
- v.barcode= row["cInvDefine9"].ToString().Replace("'", "''");
- v.fRetailPrice = row["fRetailPrice"].ToString();
- v.self_define1= row["cInvDefine1"].ToString();
- v.self_define2 = row["cInvDefine2"].ToString();
- v.self_define3 = row["cInvDefine3"].ToString();
- v.self_define4 = row["cInvDefine14"].ToString();
- v.self_define9 = v.ref_sale_price;
- v.pricetype = "移动平均法";
- Entry e = new Entry();
- e.invcode = row["cInvCode"].ToString();
- Entry[] ey = new Entry[1];
- ey[0] = e;
- InventoryRoot vr = new InventoryRoot();
- vr.inventory = v;
- vr.inventory.entry = ey;
- BusinessObject result = api.Add(JsonUtils.GetJsonString(vr));
- 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 Inventory set processflag = 1,processdate = getdate() where sysid = " + id.ToString();
- OperationLog.Utils.UpdateTempRecord(sql);
- }
- }
- }
|