123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624 |
- 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 delegate bool DelHanderTwo();
- public class DownLoadSellReturn : BaseDataDownLoad
- {
- protected override void _Init()
- {
- //_loadSql = "select * from DispatchList where processflag=0 and bReturnFlag=1 ";
- //base._Init();
- }
- private int ___bReturnFlag;
- protected override void _downLoad()
- {
- _loadSql = "select * from DispatchList where processflag=0 and bReturnFlag=1 ";
- _data = DbUtils.Fill(_loadSql, ConnectionUtils.Instance.GetConnection("TempDB"));
- List<string> ids = new List<string>();
- int i = 0;
- DataSet temp = null;
- int num = 0;
- //设定开关
- bool flag = false;
- //获取零售平台订单个数
- //int sum = GetCount();
- ////获取最后一单数量
- //int counts = GetCounts();
- //if (_data.Rows.Count > 0)
- //{
- // temp = __GetTempData(_data.Rows[0]);
- // temp.Tables[0].Clear();
- // temp.Tables[1].Clear();
- //}
- #region 不合并订单
- foreach (DataRow row in _data.Rows)
- {
- BusinessObject result = null;
- DataSet dd = __GetTempData(row);
- Consignment v = new Consignment();
- DataTable dt = dd.Tables["DispatchList"];
- v.define3 = dt.Rows[0]["cDefine3"].ToString();//平台,用于区分是否为阿里巴巴店铺
- v.define1 = dt.Rows[0]["cDefine1"].ToString();//订单类型 1网店销售 2线下零售 3售后换货 4批发业务 5保修换新 6保修完成 7订单补发
- string str = dt.Rows[0]["bReturnFlag"].ToString();
- v.bReturnFlag = Convert.ToBoolean(dt.Rows[0]["bReturnFlag"]) ? "1" : "0";//退货标识
- ___bReturnFlag = Convert.ToInt32(v.bReturnFlag);
- #region
- if (!v.define3.Equals("9") && v.define1.Equals("1") && v.bReturnFlag.Equals("0")) //(((v.define3.Equals("9") && v.define1.Equals("1")) || (v.define1.Equals("7")) || (!v.define1.Equals("1") && !v.define1.Equals("7")))||v.bReturnFlag.Equals("0")||v.bReturnFlag.Equals("1"))//不合并
- {
- #region 注释
- //if (sum - (99 * num) < 99)
- //{
- // flag = true;
- //}
- //if (flag)
- //{
- // NewMethod(ids, ref i, temp, ref num, row, () => i == counts - 1);
- //}
- //else
- //{
- // NewMethod(ids, ref i, temp, ref num, row, () => i == 99);
- //}
- // i = Convert.ToInt32(DbUtils.ExecuteScalar(string.Format("select count(1) from DispatchList where cDefine3<>'9' and cDefine1<>'1' and cDefine2='{0}' ", dt.Rows[0]["cDefine2"].ToString()), ConnectionUtils.Instance.GetConnection("TempDB")));
- #endregion
- }
- else
- {
- BasicApi api = null;
- if (___bReturnFlag == 0)
- {
- api = new ConsignmentApi();
- }
- else
- {
- api = new ReturnorderApi();
- }
- result = _ImportData(row);
- api.Audit(result.Id);
- string newcode = null;
- //记录日志
- _Log(result, Convert.ToInt32(row["sysid"]), out newcode);
- }
- #endregion
- }
- #endregion
- //Merge();
- }
- #region 注释
- /// <summary>
- /// 合并单专用
- /// </summary>
- /// <returns></returns>
- private void NewMethod(List<string> ids, ref int i, DataSet temp, ref int num, DataRow row, DelHanderTwo del)
- {
- DataSet ds = __GetTempData(row);
- //存300单的第一单
- if (i == 0)
- {
- temp.Tables["DispatchList"].ImportRow(row);
- }
- if (del())//合并无退货单
- {
- //把最后一单加上
- ids.Add(row["sysid"].ToString());
- foreach (DataRow item in ds.Tables["DispatchLists"].Rows)
- {
- temp.Tables["DispatchLists"].ImportRow(item);
- }
- //要修改的300单业务ID数据
- string[] b = new string[ids.Count];
- ids.CopyTo(b);
- //String.Join(",", b);
- //result = _ImportData(temp[0]);
- ConsignmentApi apiTwo = new ConsignmentApi();
- Consignment vv = __GetHead(temp);
- vv.entry = __GetDetails(temp);
- ReturnorderRoot vr = new ReturnorderRoot();
- vr.consignment = vv;
- BusinessObject resultTwo = apiTwo.Add(JsonUtils.GetJsonString(vr));
- //记录日志
- string newcode = null;
- _Log(resultTwo, Convert.ToInt32(temp.Tables[0].Rows[0]["sysid"]), out newcode);
- if (_logFlag)
- {
- ConsignmentApi api = new ConsignmentApi();
- api.Audit(newcode);
- _LogSucessTwo(______id, String.Join(",", b));
- }
- else
- {
- //跳过第一条
- //for (int k = 1; k < b.Length; k++)
- //{
- // OperationLog.Utils.WriteErrorLog("向U8导入销售出库资料", "sysid = " + b[k] + " " + ______msg);
- //}
- }
- //清空业务表数据
- temp.Tables[0].Clear();
- temp.Tables[1].Clear();
- i = 0;
- ids.Clear();
- ______id = null;
- //300单加一次
- num += 1;
- }
- else
- {
- ids.Add(row["sysid"].ToString());
- foreach (DataRow item in ds.Tables["DispatchLists"].Rows)
- {
- temp.Tables["DispatchLists"].ImportRow(item);
- }
- i++;
- }
- }
- #endregion
- //合并单专用方法
- public void Merge()
- {
- DataTable dtMg = DbUtils.Fill("select distinct cDefine2 from DispatchList where cDefine3<>'9' and cDefine1='1' and bReturnFlag='0' and processflag='0' ",
- ConnectionUtils.Instance.GetConnection("TempDB"));
- if (dtMg.Rows.Count <= 0)
- {
- return;
- }
- foreach (DataRow mgRow in dtMg.Rows)
- {
- List<string> ids = new List<string>();
- int i = 0;
- DataSet temp = null;
- int num = 0;
- //设定开关
- bool flag = false;
- DataTable mgTb = null;
- mgTb = __GetTempDataMerge(mgRow[0].ToString()).Tables["DispatchList"];
- if (dtMg.Rows.Count > 0)
- {
- temp = __GetTempDataMerge(mgRow[0].ToString());
- temp.Tables[0].Clear();
- temp.Tables[1].Clear();
- }
- //获取零售平台订单个数
- int sum = GetCount(mgRow[0].ToString());
- //获取最后一单数量
- int counts = 0; //GetCounts(mgRow[0].ToString());
- if (sum % 100 == 0 && sum != 0)
- {
- counts = 100;
- }
- else
- {
- counts = sum % 100;
- }
- foreach (DataRow mgSingle in mgTb.Rows)
- {
- if (sum - (99 * num) < 99)
- {
- flag = true;
- }
- if (flag)
- {
- NewMethod(ids, ref i, temp, ref num, mgSingle, () => i == counts - 1);
- }
- else
- {
- NewMethod(ids, ref i, temp, ref num, mgSingle, () => i == 99);
- }
- }
- }
- }
- //合并单专用
- private DataSet __GetTempDataMerge(string cDefine2)
- {
- Dictionary<string, string> args = new Dictionary<string, string>();
- args.Add("DispatchList", string.Format("select * from DispatchList where cDefine2 = '{0}' and cDefine3 <> '9' and cDefine1 = '1' and bReturnFlag = '0' and processflag = '0'", cDefine2));
- args.Add("DispatchLists", string.Format(@"select *from DispatchLists where dlid in(select dlid from DispatchList where cDefine2='{0}' and cDefine3<>'9' and cDefine1='1' and bReturnFlag='0' and processflag='0')
- ", cDefine2));
- DataSet ds = DbUtils.Fill(args, ConnectionUtils.Instance.GetConnection("TempDB"));
- args.Remove("DispatchList");
- args.Remove("DispatchLists");
- return ds;
- }
- private int GetCount(string cDefine2)
- {
- return Convert.ToInt32(DbUtils.ExecuteScalar(string.Format("select count(1) from DispatchList where cDefine2='{0}' and cDefine3<>'9' and cDefine1='1' and bReturnFlag='0' and processflag='0' ", cDefine2), ConnectionUtils.Instance.GetConnection("TempDB")));
- }
- //获取最后一单(小于300)
- private int GetCounts(string lastCDefine2)
- {
- return Convert.ToInt32(DbUtils.ExecuteScalar(string.Format("select count(1)%100 from DispatchList where cDefine2='{0}' and cDefine3<>'9' and cDefine1='1' and bReturnFlag='0' and processflag='0' ", lastCDefine2), ConnectionUtils.Instance.GetConnection("TempDB")));
- }
- private DataSet __GetTempData(DataRow row)
- {
- Dictionary<string, string> args = new Dictionary<string, string>();
- string id = row["DLID"].ToString();
- args.Add("DispatchList", "select * from wtu..DispatchList where DLID=" + id);
- args.Add("DispatchLists", "select * from wtu..DispatchLists where DLID=" + id);
- DataSet ds = DbUtils.Fill(args, ConnectionUtils.Instance.GetConnection());
- return ds;
- }
- /// <summary>
- /// 不合并单据
- /// </summary>
- /// <param name="row"></param>
- /// <returns></returns>
- protected override BusinessObject _ImportData(DataRow row)
- {
- BasicApi api = null;
- if (___bReturnFlag == 0)
- {
- api = new ConsignmentApi();
- }
- else
- {
- api = new ReturnorderApi();
- }
- Dictionary<string, string> args = new Dictionary<string, string>();
- string id = row["DLID"].ToString();
- args.Add("DispatchList", "select * from wtu..DispatchList where DLID=" + id);
- args.Add("DispatchLists", "select * from wtu..DispatchLists where DLID=" + id);
- DataSet ds = DbUtils.Fill(args, ConnectionUtils.Instance.GetConnection());
- BusinessObject result = null;
- if (___bReturnFlag == 0)
- {
- Consignment v = __GetHead(ds);
- v.entry = __GetDetails(ds);
- ReturnorderRoot vr = new ReturnorderRoot();
- vr.consignment = v;
- result = api.Add(JsonUtils.GetJsonString(vr));
- }
- else
- {
- Returnorder v = __GetHeadTwo(ds);
- v.entry = __GetDetails(ds);
- ReturnorderRoot vr = new ReturnorderRoot();
- vr.returnorder = v;
- result = api.Add(JsonUtils.GetJsonString(vr));
- }
- return result;
- }
- /// <summary>
- /// 发货
- /// </summary>
- /// <param name="ds"></param>
- /// <returns></returns>
- private Consignment __GetHead(DataSet ds)//(v.plat_id.Equals("9")&& v.define1.Equals("1")) || (v.define1.Equals("7")) || (!v.define1.Equals("1")&&!v.define1.Equals("7"))
- {
- Consignment v = new Consignment();
- DataTable dt = ds.Tables["DispatchList"];
- v.code = dt.Rows[0]["cDLCode"].ToString();
- v.define3 = dt.Rows[0]["cDefine3"].ToString();//平台,用于区分是否为阿里巴巴店铺
- v.define1 = dt.Rows[0]["cDefine1"].ToString();//订单类型 1网店销售 2线下零售 3售后换货 4批发业务 5保修换新 6保修完成 7订单补发
- #region 备注平台和销售类型
- v.remark = v.define3.Equals("9") ? "阿里巴巴" : "非阿里巴巴" + ",";
- if (v.define1.Equals("1"))
- {
- v.remark += "网店销售";
- }
- else if (v.define1.Equals("2"))
- {
- v.remark += "线下零售";
- }
- else if (v.define1.Equals("3"))
- {
- v.remark += "售后换货";
- }
- else if (v.define1.Equals("4"))
- {
- v.remark += "批发业务";
- }
- else if (v.define1.Equals("5"))
- {
- v.remark += "保修换新";
- }
- else if (v.define1.Equals("6"))
- {
- v.remark += "保修完成";
- }
- else if (v.define1.Equals("7"))
- {
- v.remark += "订单补发";
- }
- #endregion
- v.bReturnFlag = Convert.ToBoolean(dt.Rows[0]["bReturnFlag"]) ? "1" : "0";
- if (!v.define3.Equals("9") && v.define1.Equals("1") && v.bReturnFlag.Equals("0"))//合并订单不带业务员 //((v.define3.Equals("9") && v.define1.Equals("1")) || (v.define1.Equals("7")) || (!v.define1.Equals("1") && !v.define1.Equals("7")))
- {
- // v.custcode = AppSeting.Instance.GetValue("clientRetail");//零售(其他)平台客户编码KN02
- v.custcode = dt.Rows[0]["cDefine2"].ToString();//客户编号==店铺编号
- v.cusname = dt.Rows[0]["cDefine11"].ToString();//客户名称==店铺名称
- v.cusabbname = dt.Rows[0]["cDefine11"].ToString();//客户名称==店铺名称
- }
- else
- {
- //if(!v.define1.Equals("1") && !v.define1.Equals("7") && !v.bReturnFlag.Equals("1"))//手工建单
- //{
- // v.custcode = dt.Rows[0]["cCusCode"].ToString();//客户编号==店铺编号
- // v.cusname = dt.Rows[0]["cCusName"].ToString();//客户名称==店铺名称
- // v.cusabbname = dt.Rows[0]["cCusName"].ToString();//客户名称==店铺名称
- //}
- //else
- //{
- v.custcode = dt.Rows[0]["cDefine2"].ToString();//客户编号==店铺编号
- v.cusname = dt.Rows[0]["cDefine11"].ToString();//客户名称==店铺名称
- v.cusabbname = dt.Rows[0]["cDefine11"].ToString();//客户名称==店铺名称
- //}
- //v.custcode = AppSeting.Instance.GetValue("clientOff");//线下平台客户编码KN01
- //v.define10 = dt.Rows[0]["cCusName"].ToString();
- v.define10 = dt.Rows[0]["cCusName"].ToString();
- v.define11 = dt.Rows[0]["cCusCode"].ToString();
- if (v.bReturnFlag.Equals("0"))
- {
- //v.personname = dt.Rows[0]["cDefine12"].ToString();//业务员名称
- //v.define12 = dt.Rows[0]["cDefine12"].ToString();//业务员名称
- v.personcode = dt.Rows[0]["cPersonCode"].ToString();//业务员编号
- }
- else
- {
- v.personcode = DbUtils.ExecuteScalar(string.Format(@" select cpersoncode from {0}..person where cPersonName='{1}' ",
- ConnectionUtils.Instance.GetConnection().Database, dt.Rows[0]["cDefine12"].ToString()),
- ConnectionUtils.Instance.GetConnection("TempDB")).ToString();
- }
- //v.bReturnFlag.Equals("0");
- //v.deptcode = DbUtils.ExecuteScalar(string.Format(@" select cDepCode from {0}..person where cpersoncode='{1}' ",
- // ConnectionUtils.Instance.GetConnection().Database, "salesman_no"),
- // ConnectionUtils.Instance.GetConnection("TempDB")).ToString();
- //------------------------------------------
- }
- //v.deptcode = dt.Rows[0]["cDepCode"].ToString();//部门编码
- //v.code = dt.Rows[0]["cSOCode"].ToString();//订单号
- //v.operation_type = dt.Rows[0]["cBusType"].ToString();//业务类型//dt.Rows[0]["cSTCode"].ToString();//销售类型编码
- //string bReturnFlag = dt.Rows[0]["bReturnFlag"].ToString();
- //if (bReturnFlag.Equals("0"))
- //{
- v.operation_type = "普通销售";
- v.saletype = "MX";
- //}
- //else
- //{
- // v.saletypename = "退货入库";
- //}
- //DateTime date = DateTime.Parse(dt.Rows[0]["dDate"].ToString());
- //v.date = date.ToString("yyyy-MM-dd");
- v.define5 = dt.Rows[0]["DLID"].ToString();
- v.deptcode = dt.Rows[0]["cDepCode"].ToString();
- //v.personname=dt.Rows[0]["ccontactname"].ToString();//业务员名称
- //v.personcode=dt.Rows[0]["cpersoncode"].ToString();//业务员编号
- //v.define6 = dt.Rows[0]["cCusName"].ToString();
- return v;
- }
- /// <summary>
- /// 退货
- /// </summary>
- /// <param name="ds"></param>
- /// <returns></returns>
- private Returnorder __GetHeadTwo(DataSet ds)//(v.plat_id.Equals("9")&& v.define1.Equals("1")) || (v.define1.Equals("7")) || (!v.define1.Equals("1")&&!v.define1.Equals("7"))
- {
- Returnorder v = new Returnorder();
- DataTable dt = ds.Tables["DispatchList"];
- v.define3 = dt.Rows[0]["cDefine3"].ToString();//平台,用于区分是否为阿里巴巴店铺
- v.define1 = dt.Rows[0]["cDefine1"].ToString();//订单类型 1网店销售 2线下零售 3售后换货 4批发业务 5保修换新 6保修完成 7订单补发
- v.code = dt.Rows[0]["cDLCode"].ToString();
- #region 备注平台和销售类型
- v.remark = v.define3.Equals("9") ? "阿里巴巴" : "非阿里巴巴" + ",";
- if (v.define1.Equals("1"))
- {
- v.remark += "网店销售";
- }
- else if (v.define1.Equals("2"))
- {
- v.remark += "线下零售";
- }
- else if (v.define1.Equals("3"))
- {
- v.remark += "售后换货";
- }
- else if (v.define1.Equals("4"))
- {
- v.remark += "批发业务";
- }
- else if (v.define1.Equals("5"))
- {
- v.remark += "保修换新";
- }
- else if (v.define1.Equals("6"))
- {
- v.remark += "保修完成";
- }
- else if (v.define1.Equals("7"))
- {
- v.remark += "订单补发";
- }
- #endregion
- v.bReturnFlag = Convert.ToBoolean(dt.Rows[0]["bReturnFlag"]) ? "1" : "0";
- if (!v.define3.Equals("9") && v.define1.Equals("1") && v.bReturnFlag.Equals("0"))//合并订单不带业务员 //((v.define3.Equals("9") && v.define1.Equals("1")) || (v.define1.Equals("7")) || (!v.define1.Equals("1") && !v.define1.Equals("7")))
- {
- // v.custcode = AppSeting.Instance.GetValue("clientRetail");//零售(其他)平台客户编码KN02
- v.custcode = dt.Rows[0]["cDefine2"].ToString();//客户编号==店铺编号
- v.cusname = dt.Rows[0]["cDefine11"].ToString();//客户名称==店铺名称
- v.cusabbname = dt.Rows[0]["cDefine11"].ToString();//客户名称==店铺名称
- }
- else
- {
- //v.custcode = AppSeting.Instance.GetValue("clientOff");//线下平台客户编码KN01
- //v.define10 = dt.Rows[0]["cCusName"].ToString();
- v.custcode = dt.Rows[0]["cDefine2"].ToString();//客户编号==店铺编号custcode
- v.cusname = dt.Rows[0]["cDefine11"].ToString();//客户名称==店铺名称
- v.cusabbname = dt.Rows[0]["cDefine11"].ToString();//客户名称==店铺名称cusname
- v.define10 = dt.Rows[0]["cCusName"].ToString();
- v.define11 = dt.Rows[0]["cCusCode"].ToString();
- if (v.bReturnFlag.Equals("0"))
- {
- // v.personname = dt.Rows[0]["cDefine12"].ToString();//业务员名称
- //v.define12 = dt.Rows[0]["cDefine12"].ToString();//业务员名称
- v.personcode = dt.Rows[0]["cPersonCode"].ToString();//业务员编号
- }
- else
- {
- // v.personcode = DbUtils.ExecuteScalar(string.Format(@" select cpersoncode from {0}..person where cPersonName='{1}' ",
- //ConnectionUtils.Instance.GetConnection().Database, dt.Rows[0]["cDefine12"].ToString()),
- //ConnectionUtils.Instance.GetConnection("TempDB")).ToString();
- }
- v.state = "Approved";
- v.deptcode = dt.Rows[0]["cDepCode"].ToString();
- //v.bReturnFlag.Equals("0");
- //v.deptcode = DbUtils.ExecuteScalar(string.Format(@" select cDepCode from {0}..person where cpersoncode='{1}' ",
- // ConnectionUtils.Instance.GetConnection().Database, "salesman_no"),
- // ConnectionUtils.Instance.GetConnection("TempDB")).ToString();
- //------------------------------------------
- }
- //v.deptcode = dt.Rows[0]["cDepCode"].ToString();//部门编码
- //v.code = dt.Rows[0]["cSOCode"].ToString();//订单号
- //v.operation_type = dt.Rows[0]["cBusType"].ToString();//业务类型//dt.Rows[0]["cSTCode"].ToString();//销售类型编码
- string bReturnFlag = dt.Rows[0]["bReturnFlag"].ToString();
- //if (bReturnFlag.Equals("0"))
- //{
- v.operation_type = "普通销售";
- v.saletype = AppSeting.Instance.GetValue("cSTCode");
- //}
- //else
- //{
- // v.saletypename = "退货入库";
- //}
- //DateTime date = DateTime.Parse(dt.Rows[0]["dDate"].ToString());
- //v.date = date.ToString("yyyy-MM-dd");
- v.define5 = dt.Rows[0]["DLID"].ToString();
- //v.personname=dt.Rows[0]["ccontactname"].ToString();//业务员名称
- //v.personcode=dt.Rows[0]["cpersoncode"].ToString();//业务员编号
- //v.define6 = dt.Rows[0]["cCusName"].ToString();
- return v;
- }
- private Entry[] __GetDetails(DataSet ds)
- {
- int cnt = ds.Tables["DispatchLists"].Rows.Count;
- DataTable dt = ds.Tables["DispatchLists"];
- Entry[] rtn = new Entry[cnt];
- for (int i = 0; i < cnt; i++)
- {
- Entry e = new Entry();
- e.inventory_code = dt.Rows[i]["cInvCode"].ToString().Replace(" ", "");//存货编码
- if (___bReturnFlag == 0)
- {
- e.quantity = dt.Rows[i]["iQuantity"].ToString();//数量
- //e.price = dt.Rows[i]["iQuotedPrice"].ToString();//单价
- e.taxprice = dt.Rows[i]["iQuotedPrice"].ToString();//含税单价
- }
- else
- {
- e.quantity = (Convert.ToInt32(dt.Rows[i]["iQuantity"]) * (-1)).ToString();
- //e.price = dt.Rows[i]["iQuotedPrice"].ToString();
- e.taxprice = dt.Rows[i]["iQuotedPrice"].ToString();//含税单价
- }
- e.define29 = dt.Rows[i]["cDefine29"].ToString();
- e.define28 = dt.Rows[i]["cDefine28"].ToString();//销售订单单号
- //e.quotedprice = dt.Rows[i]["iQuotedPrice"].ToString();//报价
- //e.money = dt.Rows[i]["iNatMoney"].ToString();//原币无税金额
- //e.bgift = dt.Rows[i]["bgift"].ToString();//赠品
- //e.rowno = dt.Rows[i]["iRowNo"].ToString();//行号
- e.taxrate = AppSeting.Instance.GetValue("taxrate"); //dt.Rows[i]["iTaxRate"].ToString();//税率
- e.warehouse_code = dt.Rows[i]["cCusInvCode"].ToString();
- e.define27 = dt.Rows[i]["DLID"].ToString();
- e.rowno = (i + 1).ToString();
- rtn[i] = e;
- }
- return rtn;
- }
- private bool _logFlag;
- private string ______id;
- private string ______msg;
- protected override void _LogError(int id, string msg)
- {
- _logFlag = false;
- ______msg = msg;
- OperationLog.Utils.WriteErrorLog("向U8导入销售出库资料", "sysid = " + id.ToString() + " " + msg);
- }
- protected override void _LogSucess(int id, string newCode)
- {
- _logFlag = true;
- ______id = newCode;
- //string sql = "update PU_ArrivalVouch set processflag = 1,processdate = getdate() where sysid = " + id.ToString();
- string sql = "update DispatchList set processflag = 1,processdate = getdate(),newcode='" + newCode + "'" + " where sysid = " + id.ToString();
- OperationLog.Utils.UpdateTempRecord(sql);
- }
- protected override string _GetReturnCode(BusinessObject result)
- {
- //string ID = DbUtils.ExecuteScalar(string.Format("select ID from DispatchList where cSOCode='{0}' ", result.Id), ConnectionUtils.Instance.GetConnection("003")).ToString();
- return result.Id;
- }
- private void _LogSucessTwo(string id, string ids)
- {
- //string sql = "update PU_ArrivalVouch set processflag = 1,processdate = getdate() where sysid = " + id.ToString();
- string sql = "update DispatchList set processflag = 1,processdate = getdate(),newcode='" + id + "' where sysid in (" + ids + ")";
- OperationLog.Utils.UpdateTempRecord(sql);
- }
- }
- }
|