zhuyiyi 7 kuukautta sitten
vanhempi
sitoutus
d9980336cc

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

@@ -603,6 +603,12 @@ namespace SiteCore.Handler
                 if (eid != "") entity = CeErpTradeCell.GetByCtid(eid);
                 if (entity != null)
                 {
+                    double prices = commonHelper.calculationPrice(entity);
+                    if (prices <= 100)
+                    {
+                        returnErrorMsg("此订单金额不足100元,无法加急。");
+                        return;
+                    }
                     string utime = GetPostString("urgencytime");
                     if (utime.Length > 0)
                     {
@@ -2688,8 +2694,11 @@ namespace SiteCore.Handler
             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));
-
-            if (CurrentUser.UserPost.Post.Code == "Director" || CurrentUser.UserPost.Post.Code == "CustomerMr")
+            if (CurrentUser.UserPost.Post.Code == "SysAdmin")
+            {
+                lw.Add(string.Format("CusOrgID = 94"));
+            }
+            else if (CurrentUser.UserPost.Post.Code == "Director" || CurrentUser.UserPost.Post.Code == "CustomerMr")
             {
                 lw.Add(string.Format("ShopId in ({0})", CurrentUser.User.pemShop));
             }
@@ -6175,14 +6184,14 @@ namespace SiteCore.Handler
                     }
                     else if (!string.IsNullOrEmpty(isTogether) && Convert.ToInt32(isTogether) == 2)
                     {
-
+                        string ctids = GetPostString("ctids");
                         DataTable dt = getSameOrderList(entity, mainEn);
                         List<string> list = new List<string>();
                         List<string> send_list = new List<string>();
                         CeErpTradeCell ceErpTradeCell = new CeErpTradeCell();
                         CeErpTrade ceErpTrade = new CeErpTrade();
                         //可合包的合并一起发货
-                        if (dt == null)
+                        if (dt == null && string.IsNullOrEmpty(ctids))
                         {
                             var res_objz = new
                             {
@@ -6193,6 +6202,13 @@ namespace SiteCore.Handler
                             returnSuccess(ro_jsonz);
                             return;
                         }
+                        if (!string.IsNullOrEmpty(ctids))
+                        {
+                            StringBuilder sql = new StringBuilder();
+                            sql.AppendFormat("select ctid,IsSF,seller_memo,OtherMemo,productId,FinishPlaceTime,ProductCount from view_ErpTradeCell where ctid in ({0})", "'" + ctids.Replace(",", "','") + "'");
+
+                            dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
+                        }
                         foreach (DataRow row in dt.Rows)
                         {
                             list.Add("'" + row["ctid"] + "'");
@@ -12791,6 +12807,12 @@ namespace SiteCore.Handler
                 CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCtid(ctid);
                 if (ceErpTradeCell != null)
                 {
+                    double prices = commonHelper.calculationPrice(ceErpTradeCell);
+                    if (prices <= 100)
+                    {
+                        returnErrorMsg("此订单金额不足100元,无法加急。");
+                        return;
+                    }
                     double price = GetPostDouble("price");
                     CeErpTradeCellExtend ceErpTradeCellExtend = CeErpTradeCellExtend.getByTid(ceErpTradeCell.ctid);
                     if (ceErpTradeCellExtend == null)
@@ -12807,6 +12829,7 @@ namespace SiteCore.Handler
                     {
                         ceErpTradeCellExtend.Save();
                     }
+                    LogHelper.addLog(ceErpTradeCell.ctid, CurrentUser.UserID, "手动订单加急", 0, 1);
                     returnSuccessMsg("修改成功!");
                     return;
                 }
@@ -13088,7 +13111,7 @@ namespace SiteCore.Handler
                 string shopid = CurrentUser.User.pemShop;
                 lw.Add(string.Format("shopId in ({0})", shopid));
             }
-            if ("AfterSale".Equals(poscode) || "AfterSaleMaster".Equals(poscode))
+            if ("AfterSale".Equals(poscode) || "AfterSaleMaster".Equals(poscode) || "CustomerMr".Equals(poscode))
             {
                 lw.Add("IssueState = 1");
             }
@@ -13183,7 +13206,7 @@ namespace SiteCore.Handler
                         }
                         ceErpTrade.Attachments = atta;
                         ceErpTrade.Update();
-                        LogHelper.addLog(tid, CurrentUser.UserID, "上传文件地址", 6);
+                        LogHelper.addLog(tid, CurrentUser.UserID, "上传文件地址:" + atta, 6);
                         returnSuccessMsg("上传成功!");
                         return;
                     }
@@ -13270,6 +13293,7 @@ namespace SiteCore.Handler
                                 if (dr["ctid"].ToString().Equals(row["ctid"].ToString()))
                                 {
                                     dr["dstate"] = 2;
+                                    //dr["default"] = 1;
                                     dr["dnumber"] = Convert.ToInt32(row["markNumber"]);
                                 }
 
@@ -13277,7 +13301,9 @@ namespace SiteCore.Handler
                             if (eid.Equals(dr["ctid"].ToString()))
                             {
                                 dr["dstate"] = 1;
+                                //dr["default"] = 1;
                             }
+
                         }
                         ReturnSuccess("{" + string.Format("\"data\":{0}", Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt)) + "}");
                         return;
@@ -13317,8 +13343,10 @@ namespace SiteCore.Handler
                 {
                     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"]))
                     {
@@ -13328,6 +13356,7 @@ namespace SiteCore.Handler
                     CeErpDeliverMark ceErpDeliverMark = CeErpDeliverMark.GetByCtid(dr["ctid"].ToString());
                     if (ceErpDeliverMark != null)
                     {
+                        dr["default"] = 1;
                         continue;
                     }
                     string[] productIds = null;
@@ -13339,12 +13368,10 @@ namespace SiteCore.Handler
                     //没有品类
                     if (string.IsNullOrEmpty(productId) || "0".Equals(productId))
                     {
-                        dr.Delete();//标记删除
                         continue;
                     }
                     if (string.IsNullOrEmpty(finishPlaceTime))
                     {
-                        dr.Delete();//标记删除
                         continue;
                     }
                     placeTime = DateTime.Parse(finishPlaceTime);
@@ -13399,12 +13426,14 @@ namespace SiteCore.Handler
                             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)
+                            /*if (deadLine.Hour > 0 && deadLine.Hour > placeTime.Hour)
                             {
                                 sendDay = Math.Max(1, sendDay - 1);
                             }
@@ -13412,13 +13441,11 @@ namespace SiteCore.Handler
                             //判断有没有到发货日期
                             if (DateTime.Compare(sendtime.Date, DateTime.Now.Date) > 0)
                             {
-                                dr.Delete();//标记删除
                                 break;
-                            }
+                            }*/
                         }
                     }
                 }
-                dt.AcceptChanges();//把标记的都删除
             }
             catch (Exception ex)
             {

+ 6 - 6
SiteCore/taobao/apiDesign.cs

@@ -661,15 +661,15 @@ namespace SiteCore.Handler
                             }
                         }
                         List<string> sqlList = new List<string>();
-                        sqlList.Add("set DesignUserId=" + ceErpUser.ID);
-                        sqlList.Add("set OrderState=" + orderState);
+                        sqlList.Add(" DesignUserId=" + ceErpUser.ID);
+                        sqlList.Add(" OrderState=" + orderState);
                         if (orderState == 4)
                         {
-                            sqlList.Add("set WaitDesignTime= GETDATE()");
-                            sqlList.Add("set StartDesignTime= GETDATE()");
+                            sqlList.Add(" WaitDesignTime= GETDATE()");
+                            sqlList.Add(" StartDesignTime= GETDATE()");
                         }
-                        sqlList.Add("set UpdateTime= GETDATE()");
-                        CeErpTradeCell.ExecuteNonQuery(string.Format("UPDATE CE_ErpTradeCell {0} WHERE ctid = '{1}'", string.Join(",", sqlList), ceErpTradeCell.ctid));
+                        sqlList.Add(" UpdateTime= GETDATE()");
+                        CeErpTradeCell.ExecuteNonQuery(string.Format("UPDATE CE_ErpTradeCell set {0} WHERE ctid = '{1}'", string.Join(",", sqlList), ceErpTradeCell.ctid));
                         LogHelper.addLog(ceErpTradeCell.ctid, 3542, "接口请求:" + orderState, ceErpTradeCell.OrderState);
                         commonHelper.UpdateRelationOrder(tid);
                         return;

+ 26 - 0
SiteCore/taobao/commonHelper.cs

@@ -2760,5 +2760,31 @@ namespace SiteCore
                 CeErpTradeCell.ExecuteNonQuery(sql_pay.ToString());
             }
         }
+
+        public static double calculationPrice(CeErpTradeCell ceErpTradeCell)
+        {
+            double price = 0;
+            return 200;
+            List<string> list = new List<string>();
+            //查补差订单
+            DataTable dt = DbHelper.DbConn.ExecuteDataset(string.Format("select tid from CE_ErpTradeCell where ptid = '{0}' and IsSample =2", ceErpTradeCell.tid)).Tables[0];
+            list.Add("'" + ceErpTradeCell.tid + "'");
+            if (dt != null && dt.Rows.Count > 0)
+            {
+                foreach (DataRow dr in dt.Rows)
+                {
+                    list.Add("'" + dr["tid"].ToString() + "'");
+                }
+            }
+            DataTable tradeTables = DbHelper.DbConn.ExecuteDataset(string.Format("select payment from CE_ErpTrade where tid in ({0})", string.Join(",", list))).Tables[0];
+            if (tradeTables != null && tradeTables.Rows.Count > 0)
+            {
+                foreach (DataRow dr in tradeTables.Rows)
+                {
+                    price += Convert.ToDouble(dr["payment"]);
+                }
+            }
+            return price;
+        }
     }
 }

+ 6 - 7
ecomServer/MainForm.cs

@@ -269,18 +269,17 @@ namespace ErpServer
                 {
                     string sql = "select top 100 * from s_buchajia order by addtime asc";
                     DataTable dt = SqlHelper.ExecuteDataset(sql).Tables[0];
-                    if (dt == null || dt.Rows.Count < 1) return;
+                    if (dt == null || dt.Rows.Count < 1)
+                    {
+                        buchaPop = false;
+                        return;
+                    }
                     List<string> idLst = new List<string>();
                     foreach (DataRow dr in dt.Rows)
                     {
                         idLst.Add(dr["id"].ToString());
                         while (true)
                         {
-                            if (bu_err >= 15)
-                            {
-                                Environment.Exit(0);
-                                return;
-                            }
                             try
                             {
                                 switch (dr["dotype"].ToString().ToLower().Trim())
@@ -753,7 +752,7 @@ namespace ErpServer
                     if (isStart)
                     {
 
-                        string sql = "select tid,ctid,IsOldCustomer,shopid,payment,ProductId,isDianziOrder from view_ErpTradeCell where orderstate=2 and productid<>0 and designuserid=0  and payment>0 and isrefund=0 order by IsUrgency desc,pay_time asc;";
+                        string sql = "select tid,ctid,IsOldCustomer,shopid,payment,ProductId,isDianziOrder from view_ErpTradeCell where orderstate=2 and productid<>0 and designuserid=0  and payment>0 and isrefund=0 order by IsUrgency DESC, YEAR ( pay_time ), MONTH ( pay_time ), DAY ( pay_time ), payment DESC;";
                         DataTable dt = SqlHelper.ExecuteDataset(sql).Tables[0];
                         //object result = SqlHelper.ExecuteScalar(sql);
                         if (dt != null && dt.Rows.Count > 0)