zhuyiyi 7 months ago
parent
commit
ec0a8e760e

+ 12 - 139
SiteCore/Handler/sync.order.cs

@@ -57,7 +57,7 @@ namespace SiteCore.Handler
 
             string poscode = CurrentUser.UserPost.Post.Code;
             DataStruct dStruct = GetPostStruct();
-            //jiemiUtils.ossFileDecrypt("C:\\Users\\231010\\Downloads\\CE_ErpProduct(3).xlsx");
+            //jiemiUtils.ossFileDecrypt("C:\\Users\\231010\\Downloads\\即客4月无快递单号订单.xlsx");
             //apiHelper.Api_SyncOrderByTime("598825");
             //apiHelper.API_GetWaybill("ZTO-CAINIAO-TZJK", "4233447147588233939");
             //apiHelper.Api_SyacOrder("2460143282114312263", "yujia");
@@ -849,7 +849,10 @@ namespace SiteCore.Handler
                     {
                         dataHelper.api_orderBack(entity.ctid, "0", "");
                     }
-                    commonHelper.sendSpuData(entity, ceErpTradeCellExtend);
+                    if (entity.seller_memo.Contains("改稿"))
+                    {
+                        commonHelper.sendSpuData(entity, ceErpTradeCellExtend);
+                    }
                     apiDesign.API_GetPrintData_ModifyOrder(entity.ctid, memo, ismemoopt, false);
                     returnSuccessMsg("保存成功!");
                     return;
@@ -985,7 +988,10 @@ namespace SiteCore.Handler
                     returnSuccessMsg("保存成功!");
                     LogHelper.addLog(entity.ctid, CurrentUser.UserID, "额外:" + entity.OtherMemo, entity.OrderState);
                     CeErpTradeCellExtend ceErpTradeCellExtend = CeErpTradeCellExtend.getByTid(ctid);
-                    ceErpTradeCellExtend = commonHelper.sendSpuData(entity, ceErpTradeCellExtend);
+                    if (entity.OtherMemo.Contains("改稿"))
+                    {
+                        commonHelper.sendSpuData(entity, ceErpTradeCellExtend);
+                    }
                     return;
                 }
 
@@ -6202,7 +6208,7 @@ namespace SiteCore.Handler
                     else if (!string.IsNullOrEmpty(isTogether) && Convert.ToInt32(isTogether) == 2)
                     {
                         string ctids = GetPostString("ctids");
-                        DataTable dt = getSameOrderList(entity, mainEn);
+                        DataTable dt = commonHelper.getSameOrderList(entity, mainEn);
                         List<string> list = new List<string>();
                         List<string> send_list = new List<string>();
                         CeErpTradeCell ceErpTradeCell = new CeErpTradeCell();
@@ -13251,7 +13257,7 @@ namespace SiteCore.Handler
                         ReturnSuccess("{" + string.Format("\"data\":{0}", Utils.Serialization.JsonString.DataTable2MiniAjaxJson(new DataTable())) + "}");
                         return;
                     }
-                    DataTable dt = getSameOrderList(entity, ceErpTrade);
+                    DataTable dt = commonHelper.getSameOrderList(entity, ceErpTrade);
                     List<string> ids = new List<string>();
                     if (dt != null && dt.Rows.Count > 1)
                     {
@@ -13319,140 +13325,7 @@ namespace SiteCore.Handler
 
             returnErrorMsg("缺少必要的参数");
         }
-        private DataTable getSameOrderList(CeErpTradeCell entity, CeErpTrade ceErpTrade)
-        {
-            StringBuilder sql = new StringBuilder();
-            sql.AppendFormat("select ctid,IsSF,seller_memo,OtherMemo,productId,FinishPlaceTime,ProductCount from view_ErpTradeCell where SupplierId={0} and orderstate=6 and IsSample = 0", entity.SupplierId);
-            if (string.IsNullOrEmpty(ceErpTrade.receiverId))
-            {
-                sql.AppendFormat(" and (tid='{0}');", entity.tid);
-            }
-            else
-            {
-                sql.AppendFormat(" and (tid='{0}' or (receiverId = '{1}' and IsSF = '{2}'));", entity.tid, ceErpTrade.receiverId, entity.IsSF);
-            }
-            DataTable dt = null;
-            try
-            {
-                dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
-                StringBuilder timerSql = new StringBuilder();
-                timerSql.AppendFormat("SELECT * FROM CE_ErpSupplierProductTime WHERE supplierId={0}", entity.SupplierId);
-                DataTable timerTable = DbHelper.DbConn.ExecuteDataset(timerSql.ToString()).Tables[0];
-                //没有设置时间则不判断
-                if (timerTable == null || timerTable.Rows.Count == 0)
-                {
-                    return dt;
-                }
-                dt.Columns.Add(new DataColumn("default", typeof(int)));
-                foreach (DataRow dr in dt.Rows)
-                {
-                    dr["default"] = 0;
-                    //当前订单
-                    if (entity.ctid.Equals(dr["ctid"]))
-                    {
-                        continue;
-                    }
-                    //已经标记过发货
-                    CeErpDeliverMark ceErpDeliverMark = CeErpDeliverMark.GetByCtid(dr["ctid"].ToString());
-                    if (ceErpDeliverMark != null)
-                    {
-                        dr["default"] = 1;
-                        continue;
-                    }
-                    string[] productIds = null;
-                    string productId = dr["productId"].ToString();
-                    string finishPlaceTime = dr["FinishPlaceTime"].ToString();
-                    string sellmer_mome = dr["seller_memo"].ToString();
-                    string txtCount = dr["ProductCount"].ToString();
-                    DateTime placeTime = DateTime.Now;
-                    //没有品类
-                    if (string.IsNullOrEmpty(productId) || "0".Equals(productId))
-                    {
-                        continue;
-                    }
-                    if (string.IsNullOrEmpty(finishPlaceTime))
-                    {
-                        continue;
-                    }
-                    placeTime = DateTime.Parse(finishPlaceTime);
-                    foreach (DataRow row in timerTable.Rows)
-                    {
-                        string txtIds = row["productId"].ToString();
-                        string[] crafts = { };
-                        int count = Convert.ToUInt16(row["quantity"]);
-                        if (string.IsNullOrEmpty(txtIds))
-                        {
-                            continue;
-                        }
-                        if (count > 0)
-                        {
-                            int quantity = commonHelper.handleProductCount(txtCount, true);
-                            //订单数量大于写入的数量则跳过
-                            if (quantity > count)
-                            {
-                                continue;
-                            }
-                        }
-                        productIds = txtIds.Split(',');
-                        if (productIds.Contains(productId))
-                        {
-                            string textCraft = row["craft"].ToString();
-                            textCraft = textCraft.Replace(",", ",");//统一格式
-                            if (!string.IsNullOrEmpty(textCraft))
-                            {
-                                crafts = textCraft.Split(',');
-                            }
-                            if (crafts.Length > 0)
-                            {
-                                bool isinCraft = false;
-                                for (int i = 0; i < crafts.Length; i++)
-                                {
-                                    if (sellmer_mome.IndexOf(crafts[i]) >= 0)
-                                    {
-                                        isinCraft = true;
-                                        break;
-                                    }
-                                }
-                                //有写工艺并且备注中没匹配中则跳过
-                                if (!isinCraft)
-                                {
-                                    continue;
-                                }
-                            }
-
-                            DateTime deadLine = DateTime.Parse(row["deadLine"].ToString());
-                            DateTime dayDeadLine = DateTime.Parse(row["dayDeadLine"].ToString());
-
-                            int sendDay = Convert.ToInt16(row["sendDay"]);
 
-                            //下单时间小于当日发货时间则不用判断
-                            //当日发货必须发货
-                            if (dayDeadLine.Hour > 0 && dayDeadLine.Hour > placeTime.Hour)
-                            {
-                                dr["default"] = 1;
-                                break;
-                            }
-                            //在截稿时间之前下单的可以减去一天时间
-                            /*if (deadLine.Hour > 0 && deadLine.Hour > placeTime.Hour)
-                            {
-                                sendDay = Math.Max(1, sendDay - 1);
-                            }
-                            DateTime sendtime = placeTime.AddDays(sendDay);
-                            //判断有没有到发货日期
-                            if (DateTime.Compare(sendtime.Date, DateTime.Now.Date) > 0)
-                            {
-                                break;
-                            }*/
-                        }
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-
-            }
-            return dt;
-        }
         public void get_mark_number()
         {
             string eid = GetPostString("ctid");
@@ -13466,7 +13339,7 @@ namespace SiteCore.Handler
 
                 if (ceErpDeliverMark == null)
                 {
-                    DataTable dt = getSameOrderList(entity, ceErpTrade);
+                    DataTable dt = commonHelper.getSameOrderList(entity, ceErpTrade);
                     List<string> ids = new List<string>();
                     if (dt != null && dt.Rows.Count > 1)
                     {

+ 35 - 5
SiteCore/taobao/apiCaiYingTong.cs

@@ -221,14 +221,14 @@ namespace SiteCore.Handler
             string curUseWayBillCode = out_Sid;
             string cpCode = comCode;
             CeErpTradeCell entity = CeErpTradeCell.GetByCtid(tid);
+            if (entity == null)
+            {
+                entity = CeErpTradeCell.GetByCode(tid);
+            }
             if (entity != null)
             {
                 CeErpTrade mainEn = CeErpTrade.Get(entity.tid);
-                string sql = "select top 1 * from view_erptradecell where tid='" + tid + "';";
-                DataTable dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
-                if (dt.Rows.Count <= 0) return;
-                string posCode = dt.Rows[0]["posCode"].ToString();
-
+                string posCode = mainEn.posCode;
 
                 string apires = API_LogisticsOnlineSend(tid, posCode, comCode, out_Sid);
                 CeErpMessageAPI ceErpMessageAPI = new CeErpMessageAPI();
@@ -597,6 +597,36 @@ namespace SiteCore.Handler
             returnErrorMsg("找不到订单记录");
 
         }
+        //http://47.114.150.226:88/Handler/apiCaiYingTong.ashx?t=getMergeOrders    orderSn 
+        public void getMergeOrders()
+        {
+            string orderSn = GetPostString("orderSn");
+            CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCode(orderSn);
+            if (ceErpTradeCell == null)
+            {
+                ceErpTradeCell = CeErpTradeCell.GetByCtid(orderSn);
+            }
+            if (ceErpTradeCell == null)
+            {
+                returnErrorMsg("查无订单!");
+                return;
+            }
+            if (ceErpTradeCell.SupplierId != 64)
+            {
+                returnErrorMsg("查无订单!");
+                return;
+            }
+            CeErpTrade ceErpTrade = CeErpTrade.Get(ceErpTradeCell.tid);
+            DataTable dt = commonHelper.getSameOrderList(ceErpTradeCell, ceErpTrade);
+            if (dt != null && dt.Rows.Count > 1)
+            {
+                ReturnSuccess("{" + string.Format("\"data\":{0}", Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt)) + "}");
+                return;
+            }
+
+            ReturnSuccess("{" + string.Format("\"data\":{0}", Utils.Serialization.JsonString.DataTable2MiniAjaxJson(new DataTable())) + "}");
+            return;
+        }
 
         public static string API_LogisticsOnlineSend(string orderid, string pCode, string comCode, string out_Sid)
         {

+ 135 - 0
SiteCore/taobao/commonHelper.cs

@@ -2774,6 +2774,141 @@ namespace SiteCore
 
         }
 
+        public static DataTable getSameOrderList(CeErpTradeCell entity, CeErpTrade ceErpTrade)
+        {
+            StringBuilder sql = new StringBuilder();
+            sql.AppendFormat("select ctid,IsSF,seller_memo,OtherMemo,productId,FinishPlaceTime,ProductCount,OrderSn from view_ErpTradeCell where SupplierId={0} and orderstate=6 and IsSample = 0", entity.SupplierId);
+            if (string.IsNullOrEmpty(ceErpTrade.receiverId))
+            {
+                sql.AppendFormat(" and (tid='{0}');", entity.tid);
+            }
+            else
+            {
+                sql.AppendFormat(" and (tid='{0}' or (receiverId = '{1}' and IsSF = '{2}'));", entity.tid, ceErpTrade.receiverId, entity.IsSF);
+            }
+            DataTable dt = null;
+            try
+            {
+                dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
+                StringBuilder timerSql = new StringBuilder();
+                timerSql.AppendFormat("SELECT * FROM CE_ErpSupplierProductTime WHERE supplierId={0}", entity.SupplierId);
+                DataTable timerTable = DbHelper.DbConn.ExecuteDataset(timerSql.ToString()).Tables[0];
+                //没有设置时间则不判断
+                if (timerTable == null || timerTable.Rows.Count == 0)
+                {
+                    return dt;
+                }
+                dt.Columns.Add(new DataColumn("default", typeof(int)));
+                foreach (DataRow dr in dt.Rows)
+                {
+                    dr["default"] = 0;
+                    //当前订单
+                    if (entity.ctid.Equals(dr["ctid"]))
+                    {
+                        continue;
+                    }
+                    //已经标记过发货
+                    CeErpDeliverMark ceErpDeliverMark = CeErpDeliverMark.GetByCtid(dr["ctid"].ToString());
+                    if (ceErpDeliverMark != null)
+                    {
+                        dr["default"] = 1;
+                        continue;
+                    }
+                    string[] productIds = null;
+                    string productId = dr["productId"].ToString();
+                    string finishPlaceTime = dr["FinishPlaceTime"].ToString();
+                    string sellmer_mome = dr["seller_memo"].ToString();
+                    string txtCount = dr["ProductCount"].ToString();
+                    DateTime placeTime = DateTime.Now;
+                    //没有品类
+                    if (string.IsNullOrEmpty(productId) || "0".Equals(productId))
+                    {
+                        continue;
+                    }
+                    if (string.IsNullOrEmpty(finishPlaceTime))
+                    {
+                        continue;
+                    }
+                    placeTime = DateTime.Parse(finishPlaceTime);
+                    foreach (DataRow row in timerTable.Rows)
+                    {
+                        string txtIds = row["productId"].ToString();
+                        string[] crafts = { };
+                        int count = Convert.ToUInt16(row["quantity"]);
+                        if (string.IsNullOrEmpty(txtIds))
+                        {
+                            continue;
+                        }
+                        if (count > 0)
+                        {
+                            int quantity = commonHelper.handleProductCount(txtCount, true);
+                            //订单数量大于写入的数量则跳过
+                            if (quantity > count)
+                            {
+                                continue;
+                            }
+                        }
+                        productIds = txtIds.Split(',');
+                        if (productIds.Contains(productId))
+                        {
+                            string textCraft = row["craft"].ToString();
+                            textCraft = textCraft.Replace(",", ",");//统一格式
+                            if (!string.IsNullOrEmpty(textCraft))
+                            {
+                                crafts = textCraft.Split(',');
+                            }
+                            if (crafts.Length > 0)
+                            {
+                                bool isinCraft = false;
+                                for (int i = 0; i < crafts.Length; i++)
+                                {
+                                    if (sellmer_mome.IndexOf(crafts[i]) >= 0)
+                                    {
+                                        isinCraft = true;
+                                        break;
+                                    }
+                                }
+                                //有写工艺并且备注中没匹配中则跳过
+                                if (!isinCraft)
+                                {
+                                    continue;
+                                }
+                            }
+
+                            DateTime deadLine = DateTime.Parse(row["deadLine"].ToString());
+                            DateTime dayDeadLine = DateTime.Parse(row["dayDeadLine"].ToString());
+
+                            int sendDay = Convert.ToInt16(row["sendDay"]);
+
+                            //下单时间小于当日发货时间则不用判断
+                            //当日发货必须发货
+                            if (dayDeadLine.Hour > 0 && dayDeadLine.Hour > placeTime.Hour)
+                            {
+                                dr["default"] = 1;
+                                break;
+                            }
+                            //在截稿时间之前下单的可以减去一天时间
+                            /*if (deadLine.Hour > 0 && deadLine.Hour > placeTime.Hour)
+                            {
+                                sendDay = Math.Max(1, sendDay - 1);
+                            }
+                            DateTime sendtime = placeTime.AddDays(sendDay);
+                            //判断有没有到发货日期
+                            if (DateTime.Compare(sendtime.Date, DateTime.Now.Date) > 0)
+                            {
+                                break;
+                            }*/
+                        }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return dt;
+        }
+
         public static double calculationPrice(CeErpTradeCell ceErpTradeCell)
         {
             double price = 0;

+ 29 - 0
SiteCore/taobao/preSalesHelper.cs

@@ -2376,6 +2376,34 @@ namespace SiteCore.Handler
             return trade;
         }
 
+        public void checkOrderToWh()
+        {
+            string orderNumber = GetPostString("orderNumber");
+            string spuId = GetPostString("spuId");
+            string seller_memo = GetPostString("seller_memo");
+            string otherMemo = GetPostString("otherMemo");
+            int shopId = GetPostInt("shopId");
+            int productId = GetPostInt("productId");
+            if (productId == 0 || shopId == 0)
+            {
+                returnErrorMsg("商品id或者店铺id不全");
+                return;
+            }
+            int isDianziOrder = GetPostInt("isDianziOrder");
+            CeErpTradeCell ceErpTradeCell = new CeErpTradeCell();
+            CeErpTradeCellExtend ceErpTradeCellExtend = new CeErpTradeCellExtend();
+            ceErpTradeCell.ctid = orderNumber;
+            ceErpTradeCell.seller_memo = seller_memo;
+            ceErpTradeCell.OtherMemo = otherMemo;
+            ceErpTradeCell.ShopId = shopId;
+            ceErpTradeCell.ProductId = productId;
+            ceErpTradeCell.isDianziOrder = isDianziOrder;
+            ceErpTradeCellExtend.spu_id = spuId;
+            ceErpTradeCellExtend = commonHelper.sendSpuData(ceErpTradeCell, ceErpTradeCellExtend);
+            returnSuccess("'" + ceErpTradeCellExtend.ToType + "'");
+            return;
+        }
+
         public static apiUploaderResponse CopyDesignFile(string ctid, string oldCtid, int userId)
         {
 
@@ -2536,5 +2564,6 @@ namespace SiteCore.Handler
             }
             return 0;
         }
+
     }
 }

+ 2 - 2
Web/EDelivery/SupplierOrder.aspx

@@ -7,9 +7,9 @@
 <asp:Content ID="Content2" ContentPlaceHolderID="btn" runat="Server">
     <table style="width: 100%;">
         <tr>
-            <td style="width: 80%;">
+            <td style="width: 80%;display: flex;justify-content: space-between;">
                 <a class="mini-button mini-button-primary" style="padding: 2px 5px 2px 5px;" iconcls="icon-download" onclick="multiExport()">批量下载</a>
-                <a id="packBtn" runat="server" visible="false" class="mini-button mini-button-primary" style="padding: 2px 5px 2px 5px;" iconcls="icon-download" onclick="packOrder()">打包</a>
+                <a id="packBtn" class="mini-button mini-button-primary" style="padding: 2px 5px 2px 5px;" iconcls="icon-download" onclick="packOrder()">打包</a>
                 <%--<a class="mini-button mini-button-primary" style="padding: 2px 5px 2px 5px;" iconcls="icon-folder" onclick="returnOrderFn()">退单</a>--%>
             </td>
         </tr>

+ 1 - 5
Web/EDelivery/SupplierOrder.aspx.cs

@@ -26,11 +26,7 @@ public partial class EDelivery_SupplierOrder : BasePage
 
     protected void Page_Load(object sender, EventArgs e)
     {
-        if (CurrentUser.UserPost.Post.Code == "Supplier")
-        {
-            packBtn.Visible = false;
-        }
-        else { packBtn.Visible = true; }
+
         if (!IsPostBack)
         {
             //StringBuilder sql = new StringBuilder();

+ 1 - 4
Web/EDelivery/js/pddPrintBill.js

@@ -593,7 +593,7 @@ function checkOrderSplit(item, iTag) {
                     let item = data.data[i];
                     let sf = "";
                     let stateStr = "";
-                    let ischeck = false;
+                    let ischeck = true;
                     let isRead = false;
                     if (item.IsSF == 1) {
                         sf = "顺丰寄付";
@@ -605,14 +605,11 @@ function checkOrderSplit(item, iTag) {
                     } else if (item.dstate == 1) {
                         stateStr = "此件";
                         mome = item.seller_memo;
-                        ischeck = true;
                     } else if (item.dstate == 2) {
                         stateStr = "等待中";
                         isNumber = true;
-                        ischeck = true;
                     }
                     if (item.default == 1) {
-                        ischeck = true;
                         isRead = true;
                     }
                     let inputCheck = `<input type="checkbox" name="ctids" value="${item.ctid}" ${ischeck ? "checked" : ""} ${isRead ? "onclick='return false;'" : ""}/>`;

+ 1 - 4
Web/EDelivery/js/printBill.js

@@ -582,7 +582,7 @@ function checkOrderSplit(item, iTag) {
                     let item = data.data[i];
                     let sf = "";
                     let stateStr = "";
-                    let ischeck = false;
+                    let ischeck = true;
                     let isRead = false;
                     if (item.IsSF == 1) {
                         sf = "顺丰寄付";
@@ -595,14 +595,11 @@ function checkOrderSplit(item, iTag) {
                     } else if (item.dstate == 1) {
                         stateStr = "此件";
                         mome = item.seller_memo;
-                        ischeck = true;
                     } else if (item.dstate == 2) {
                         stateStr = "等待中";
                         isNumber = true;
-                        ischeck = true;
                     }
                     if (item.default == 1) {
-                        ischeck = true;
                         isRead = true;
                     }
                     let inputCheck = `<input type="checkbox" name="ctids" value="${item.ctid}" ${ischeck ? "checked" : ""} ${isRead ? "onclick='return false;'" : ""}/>`;

+ 7 - 3
ecomServer/MainForm.cs

@@ -279,7 +279,7 @@ namespace ErpServer
                     List<string> idLst = new List<string>();
                     foreach (DataRow dr in dt.Rows)
                     {
-                        idLst.Add(dr["id"].ToString());
+                        idLst.Add(dr["ID"].ToString());
                         while (true)
                         {
                             try
@@ -333,7 +333,11 @@ namespace ErpServer
                                     default:
                                         {
                                             DataTable dataTable = SqlHelper.ExecuteDataset(string.Format("SELECT orderFrom FROM [dbo].[Ce_ErpTradeCellExtend] WHERE ctid = '{0}'", dr["ctid"].ToString())).Tables[0];
-                                            int num = Convert.ToInt16(dataTable.Rows[0]["orderFrom"]);
+                                            int num = 0;
+                                            if (!Convert.IsDBNull(dataTable.Rows[0]["orderFrom"]))
+                                            {
+                                                num = Convert.ToInt16(dataTable.Rows[0]["orderFrom"]);
+                                            }
                                             SqlParameter[] sqlParameter ={
                                             new SqlParameter("@mainctids", SqlDbType.VarChar,200),
                                             new SqlParameter("@res", SqlDbType.VarChar, 4000) };
@@ -356,7 +360,7 @@ namespace ErpServer
                             }
                             catch (Exception ex)
                             {
-                                idLst.Remove(dr["id"].ToString());
+                                idLst.Remove(dr["ID"].ToString());
                                 if (ex.Message.IndexOf("死锁") != -1)
                                 {
                                     bu_err++;