| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- using BizCom;
- using System;
- using System.Collections.Generic;
- using System.Data;
- namespace SiteCore.Handler
- {
- public partial class sync
- {
- //订单-原始订单 接口---------------------------------------------
- public void get_erp_initorderlist()
- {
- DataStruct dStruct = GetPostStruct();
- List<string> lw = new List<string>();
- string tid = GetPostString("tid");
- string date1 = GetPostString("date1");
- string date2 = GetPostString("date2");
- string buyernick = GetPostString("buyer_nick");
- if (tid.Length > 0)
- {
- lw.Add(string.Format("tid = '{0}'", tid));
- }
- if (date1.Length > 0)
- {
- string dw = GetDateMinuteWhere("pay_time", date1, date2);
- if (dw.Length > 0) lw.Add(dw);
- }
- if (buyernick.Length > 0)
- {
- lw.Add(string.Format("buyer_nick like '%{0}%'", buyernick));
- }
- if (tid.Length == 0 && date1.Length == 0 && buyernick.Length == 0)
- {
- lw.Add(string.Format("datediff(d,pay_time,getdate())<=91 "));
- }
- string shopname = GetPostString("shopname");
- if (shopname.Length > 0) lw.Add(string.Format("seller_nick like '%{0}%'", shopname));
- string address = GetPostString("address");
- if (address.Length > 0) lw.Add(string.Format("address like '%{0}%'", address));
- string sellermemo = GetPostString("seller_memo");
- if (sellermemo.Length > 0) lw.Add(string.Format("seller_memo like '%{0}%'", sellermemo));
- string price1 = GetPostString("price1");
- if (price1.Length > 0) lw.Add(string.Format("payment >= '{0}'", price1));
- string price2 = GetPostString("price2");
- if (price2.Length > 0) lw.Add(string.Format("payment <= '{0}'", price2));
- dStruct.Order = "pay_time desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- DataTable dt = WebCache.GetData("ce_erptrade", dStruct);
- writeGridDataTableJson(dStruct.TotalCount, dt);
- }
- //订单管理-备注 接口---------------------------------------------
- public void save_erp_initsellermemo()
- {
- if (UrlPostParmsCheck("seller_memo"))
- {
- string tid = GetPostString("tid");
- CeErpTrade entity = null;
- if (tid != "") entity = CeErpTrade.Get(tid);
- if (entity != null)
- {
- entity.seller_memo = GetPostString("seller_memo");
- entity.Update();
- returnSuccessMsg("保存成功!");
- return;
- }
- returnErrorMsg("找不到记录");
- }
- }
- //手动拆分原订单到订单列表 ,备注只有一个的就一个,2个的就拆分
- public void set_erp_splitorder()
- {
- if (UrlPostParmsCheck("tid"))
- {
- string tid = GetPostString("tid");
- CeErpTrade entity = null;
- if (tid != "") entity = CeErpTrade.Get(tid);
- if (entity != null)
- {
- LogHelper.addLog(entity.tid, CurrentUser.UserID, "点击强制生成", 0);
- tmcHelper.createCellOrder(entity, entity.tid, entity.seller_memo, entity.buyer_nick, true);//最后加上true跳过阻止直接拆分创建cell子单
- returnSuccessMsg("保存成功!");
- return;
- }
- returnErrorMsg("找不到记录");
- }
- }
- //订单-老系统数据---------------------------------------------
- public void get_erp_olddatalist()
- {
- DataStruct dStruct = GetPostStruct();
- List<string> lw = new List<string>();
- string tid = GetPostString("tid");
- string date1 = GetPostString("date1");
- string date2 = GetPostString("date2");
- if (tid.Length > 0 || date1.Length > 0)
- {
- lw.Add(string.Format("order_no like '%{0}%'", tid));
- string dw = GetDateMinuteWhere("pay_time", date1, date2);
- if (dw.Length > 0) lw.Add(dw);
- }
- //else
- //{
- // lw.Add(string.Format("datediff(d,pay_time,getdate())<=91 "));
- //}
- string shopname = GetPostString("shopname");
- if (shopname.Length > 0) lw.Add(string.Format("company_name like '%{0}%'", shopname));
- string buyernick = GetPostString("buyer_nick");
- if (buyernick.Length > 0) lw.Add(string.Format("customer_name like '%{0}%'", buyernick));
- string sellermemo = GetPostString("seller_memo");
- if (sellermemo.Length > 0) lw.Add(string.Format("seller_memo like '%{0}%'", sellermemo));
- string price1 = GetPostString("price1");
- if (price1.Length > 0) lw.Add(string.Format("payment >= '{0}'", price1));
- string price2 = GetPostString("price2");
- if (price2.Length > 0) lw.Add(string.Format("payment <= '{0}'", price2));
- dStruct.Order = "pay_time desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- DataTable dt = WebCache.GetData("Sheet2$", dStruct);
- writeGridDataTableJson(dStruct.TotalCount, dt);
- }
- //订单-手提袋列表接口---------------------------------------------
- public void get_erp_bagorderlist()
- {
- DataStruct dStruct = GetPostStruct();
- List<string> lw = new List<string>();
- string tid = GetPostString("tid");
- string date1 = GetPostString("date1");
- string date2 = GetPostString("date2");
- if (tid.Length > 0 || date1.Length > 0)
- {
- lw.Add(string.Format("tid like '%{0}%'", tid));
- string dw = GetDateMinuteWhere("pay_time", date1, date2);
- if (dw.Length > 0) lw.Add(dw);
- }
- else
- {
- lw.Add(string.Format("datediff(d,pay_time,getdate())<=91 "));
- }
- string shopname = GetPostString("shopname");
- if (shopname.Length > 0) lw.Add(string.Format("seller_nick like '%{0}%'", shopname));
- string buyernick = GetPostString("buyer_nick");
- if (buyernick.Length > 0) lw.Add(string.Format("buyer_nick like '%{0}%'", buyernick));
- string address = GetPostString("address");
- if (address.Length > 0) lw.Add(string.Format("address like '%{0}%'", address));
- string sellermemo = GetPostString("seller_memo");
- if (sellermemo.Length > 0) lw.Add(string.Format("seller_memo like '%{0}%'", sellermemo));
- string price1 = GetPostString("price1");
- if (price1.Length > 0) lw.Add(string.Format("payment >= '{0}'", price1));
- string price2 = GetPostString("price2");
- if (price2.Length > 0) lw.Add(string.Format("payment <= '{0}'", price2));
- lw.Add(string.Format("isBagOrder=1"));
- dStruct.Order = "pay_time desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- DataTable dt = WebCache.GetData("view_erptradeorder", dStruct);
- writeGridDataTableJson(dStruct.TotalCount, dt);
- }
- //订单-商品列表接口---------------------------------------------
- public void get_erp_goodslist()
- {
- DataStruct dStruct = GetPostStruct();
- List<string> lw = new List<string>();
- string tid = GetPostString("tid");
- string date1 = GetPostString("date1");
- string date2 = GetPostString("date2");
- string end_time1 = GetPostString("end_time1");
- string end_time2 = GetPostString("end_time2");
- if (tid.Length > 0)
- {
- lw.Add(string.Format("tid = '{0}'", tid));
- }
- if (tid.Length == 0 && date1.Length == 0 && end_time1.Length == 0)
- {
- lw.Add(string.Format("datediff(d,pay_time,getdate())<=91 "));
- }
- if (date1.Length > 0)
- {
- lw.Add(string.Format("pay_time > '{0}'", date1));
- }
- if (date2.Length > 0)
- {
- lw.Add(string.Format("pay_time < '{0}'", date2));
- }
- if (end_time1.Length > 0)
- {
- lw.Add(string.Format("end_time > '{0}'", end_time1));
- }
- if (end_time2.Length > 0)
- {
- lw.Add(string.Format("end_time < '{0}'", end_time2));
- }
- string shopname = GetPostString("shopname");
- if (shopname.Length > 0) lw.Add(string.Format("seller_nick like '%{0}%'", shopname));
- string buyernick = GetPostString("buyer_nick");
- if (buyernick.Length > 0) lw.Add(string.Format("buyer_nick like '%{0}%'", buyernick));
- string address = GetPostString("address");
- if (address.Length > 0) lw.Add(string.Format("address like '%{0}%'", address));
- //string sellermemo = GetPostString("seller_memo");
- //if (sellermemo.Length > 0) lw.Add(string.Format("seller_memo like '%{0}%'", sellermemo));
- string price1 = GetPostString("price1");
- if (price1.Length > 0) lw.Add(string.Format("payment >= '{0}'", price1));
- string price2 = GetPostString("price2");
- if (price2.Length > 0) lw.Add(string.Format("payment <= '{0}'", price2));
- string goodsId = GetPostString("goodsId");
- bool tradeOrder = false;
- if (goodsId.Length > 0)
- {
- lw.Add(string.Format("spu_id like '%{0}%'", goodsId));
- tradeOrder = true;
- }
- //lw.Add(string.Format("isBagOrder=1"));
- dStruct.Order = "pay_time desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- string tableName = "view_ErpTradeOrder_trade";
- if (tradeOrder)
- {
- tableName = "view_ErpTradeOrder";
- }
- DataTable dt = WebCache.GetData(tableName, dStruct);
- writeGridDataTableJson(dStruct.TotalCount, dt);
- }
- //修改地址
- public void ins_erp_modifyaddress()
- {
- if (UrlPostParmsCheck("tid"))
- {
- string eid = GetPostString("tid");
- CeErpTrade entity = null;
- if (eid != "") entity = CeErpTrade.Get(eid);
- if (entity != null)
- {
- entity.receiver_name = GetPostString("receiver_name");
- entity.receiver_mobile = GetPostString("receiver_mobile");
- entity.receiver_state = GetPostString("receiver_state");
- entity.receiver_city = GetPostString("receiver_city");
- entity.receiver_district = GetPostString("receiver_district");
- entity.receiver_address = GetPostString("receiver_address");
- if (entity.receiver_state == "" || entity.receiver_city == "" || entity.receiver_name == "" || entity.receiver_mobile == "" || entity.receiver_address == "")
- {
- returnErrorMsg("不能为空");
- return;
- }
- entity.Update();
- returnSuccessMsg("修改成功!");
- return;
- }
- returnErrorMsg("找不到记录");
- }
- }
- //管理员强制修改数据接口
- public void save_admin_info()
- {
- string optype = GetPostString("optype");
- if (optype == "1")
- {
- string orderstate = GetPostString("orderstate");
- string eid = GetPostString("ctid");
- CeErpTradeCell entity = null;
- if (eid != "") entity = CeErpTradeCell.GetByCtid(eid);
- if (entity != null)
- {
- entity.OrderState = Convert.ToInt32(orderstate);
- entity.Update();
- returnSuccessMsg("操作成功!");
- LogHelper.addLog(entity.ctid, CurrentUser.UserID, "强制修改状态为:" + orderstate, entity.OrderState, 0);
- return;
- }
- returnErrorMsg("找不到订单记录");
- }
- else if (optype == "2")
- {
- string isdianzi = GetPostString("isdianzi");
- string eid = GetPostString("ctid");
- CeErpTradeCell entity = null;
- if (eid != "") entity = CeErpTradeCell.GetByCtid(eid);
- if (entity != null)
- {
- entity.isDianziOrder = Convert.ToInt32(isdianzi);
- entity.Update();
- returnSuccessMsg("操作成功!");
- LogHelper.addLog(entity.ctid, CurrentUser.UserID, "强制修改是否电子稿:" + isdianzi, entity.OrderState, 0);
- return;
- }
- returnErrorMsg("找不到订单记录");
- }
- else if (optype == "3")
- {
- string issample = GetPostString("issample");
- string eid = GetPostString("ctid");
- CeErpTradeCell entity = null;
- if (eid != "") entity = CeErpTradeCell.GetByCtid(eid);
- if (entity != null)
- {
- entity.IsSample = Convert.ToInt32(issample);
- entity.Update();
- returnSuccessMsg("操作成功!");
- LogHelper.addLog(entity.ctid, CurrentUser.UserID, "强制修改是否补差价:" + issample, entity.OrderState, 0);
- return;
- }
- returnErrorMsg("找不到订单记录");
- }
- else if (optype == "4")
- {
- string eid = GetPostString("ctid");
- CeErpTradeCell entity = null;
- if (eid != "") entity = CeErpTradeCell.GetByCtid(eid);
- if (entity != null)
- {
- string outsid = entity.OutSid;
- string[] outList = outsid.Split(',');
- if (outList.Length > 0)
- {
- if (outList[outList.Length - 1] != "")
- {
- entity.OutSid = outList[outList.Length - 1];
- }
- }
- entity.Update();
- returnSuccessMsg("操作成功!");
- LogHelper.addLog(entity.ctid, CurrentUser.UserID, "强制修改快递单号记录outsid:" + entity.OutSid, entity.OrderState, 0);
- return;
- }
- returnErrorMsg("找不到订单记录");
- }
- else if (optype == "5")
- {
- string eid = GetPostString("ctid");
- string productId = GetPostString("productId");
- CeErpTradeCell entity = null;
- if (eid != "") entity = CeErpTradeCell.GetByCtid(eid);
- if (entity != null)
- {
- entity.ProductId = Convert.ToInt32(productId);
- entity.Update();
- returnSuccessMsg("操作成功!");
- LogHelper.addLog(entity.ctid, CurrentUser.UserID, "强制修改商品ProductId:" + entity.ProductId, entity.OrderState, 0);
- return;
- }
- returnErrorMsg("找不到订单记录");
- }
- }
- }
- }
|