zhuyiyi 6 місяців тому
батько
коміт
09ce87afee

+ 11 - 99
SiteCore/Handler/noti.cs

@@ -582,111 +582,23 @@ namespace SiteCore.Handler
             if (tid != null && tid != "0")
             {
                 tid = tid.Trim();
-                CeErpTradeCell tradeCell = CeErpTradeCell.GetByCtid(tid);
-                if (tradeCell == null)
-                {
-                    returnErrorMsg("单号查无订单");
-                    return;
-                }
-                string info_sql = string.Format("SELECT ctid FROM [dbo].[CE_ErpTradeCell] WHERE tid ='{0}'", tradeCell.tid);
-                if (tradeCell.ctid.Contains("S_"))
-                {
-                    info_sql = string.Format("SELECT ctid FROM [dbo].[CE_ErpTradeCell] WHERE ctid ='{0}'", tradeCell.ctid);
-                }
-                DataTable data = DbHelper.DbConn.ExecuteDataset(info_sql).Tables[0];
                 string content = GetPostString("content");
                 int eid = GetPostInt("id");
-                CeErpOrderFormData formData = null;
-                if (data.Rows.Count > 0)
-                {
-                    List<CeErpTradeCell> cell_list = new List<CeErpTradeCell>();
-                    foreach (DataRow row in data.Rows)
-                    {
-                        string ctid = row["ctid"].ToString();
-                        CeErpTradeCell cell = CeErpTradeCell.GetByCtid(ctid);
-                        cell_list.Add(cell);
-                        formData = CeErpOrderFormData.GetByTid(ctid);
-                        if (formData == null)
-                        {
-                            formData = new CeErpOrderFormData();
-                        }
 
-                        formData.tid = ctid;
-                        formData.content = content;
-                        if (formData.ID > 0)
-                        {
-                            formData.Update();
-                        }
-                        else
-                        {
-                            formData.userId = GetPostInt("userId");
-                            formData.Create();
-                        }
-
-                    }
-                    if (tradeCell.OrderState >= 5)
+                try
+                {
+                    bool result = commonHelper.setFromDataInfo(tid, content, eid);
+                    if (!result)
                     {
-                        LogHelper.addLog(tradeCell.ctid, formData.userId > 0 ? formData.userId : 3542, "外链派单:订单状态不正确!", tradeCell.OrderState);
-                        returnSuccessMsg("保存成功!");
+                        returnErrorMsg("保存信息出错");
                         return;
-
-                    }
-                    //能进来并且没有设计师
-
-                    foreach (CeErpTradeCell entity in cell_list)
-                    {
-                        try
-                        {
-                            if (entity != null && entity.seller_memo.Length > 0)
-                            {
-                                if (entity.OrderState >= 5)
-                                {
-                                    LogHelper.addLog(entity.ctid, formData.userId > 0 ? formData.userId : 3542, "外链派单:订单状态不正确!", entity.OrderState);
-                                    continue;
-
-                                }
-                                //判断能不能推送
-                                designApiResponseVo result = commonHelper.checkOrderListDesignInfo(entity.tid, entity.ctid);
-                                if (result != null && result.code == 200)
-                                {
-                                    designApiResponseVo response = designHelper.API_GetPrintData_CreateOrder(entity, "SysAdmin");
-                                    if (response.code == 200)
-                                    {
-
-                                        if (response.msg == "设计共创:成功")
-                                        {
-                                            if (entity.ctid.IndexOf("S_") == -1)
-                                            {
-                                                int suid = commonHelper.autoDistributeToSupplier(entity); //自动分配供应商
-                                                entity.SupplierId = suid;
-                                                string suname = commonHelper.getSupplierNameById(entity.SupplierId);
-                                                LogHelper.addLog(entity.ctid, 0, "匹配供应商:" + suname, entity.OrderState);
-                                            }
-
-                                            entity.OrderState = Convert.ToInt32(OrderState.待设计);
-                                            entity.DesignUserId = 3542;
-                                            entity.WaitDesignTime = DateTime.Now;
-                                            entity.DispatchSort = 2;
-                                            entity.UpdateTime = DateTime.Now;
-                                            entity.Update();
-
-                                        }
-                                    }
-                                    LogHelper.addLog(entity.ctid, formData.userId > 0 ? formData.userId : 3542, "外链派单:" + response.msg, Convert.ToInt32(OrderState.待设计));
-                                }
-                                else
-                                {
-                                    LogHelper.addLog(entity.ctid, formData.userId > 0 ? formData.userId : 3542, "外链派单:" + result.msg, Convert.ToInt32(OrderState.待设计));
-                                }
-
-                            }
-                        }
-                        catch (Exception ex)
-                        {
-                            XLog.SaveLog(0, "外链派单:" + ex.Message);
-                        }
                     }
-
+                }
+                catch (Exception ex)
+                {
+                    XLog.SaveLog(0, "外链派单:" + ex.Message);
+                    returnErrorMsg("保存信息出错");
+                    return;
                 }
                 returnSuccessMsg("保存成功!");
             }

+ 2 - 2
SiteCore/Handler/sync.order.cs

@@ -58,7 +58,7 @@ namespace SiteCore.Handler
 
             string poscode = CurrentUser.UserPost.Post.Code;
             DataStruct dStruct = GetPostStruct();
-            //jiemiUtils.ossFileDecrypt("C:\\Users\\231010\\Downloads\\特种纸打码烫金.xls");
+            //jiemiUtils.ossFileDecrypt("C:\\Users\\231010\\Downloads\\特种纸打码烫金(1).xls");
             //apiHelper.Api_SyncOrderByTime("598825");
             //apiHelper.API_GetWaybill("ZTO-CAINIAO-TZJK", "4233447147588233939");
             //apiHelper.Api_SyacOrder("2460143282114312263", "yujia");
@@ -13794,7 +13794,7 @@ namespace SiteCore.Handler
                 }
                 if (list.Count > 0)
                 {
-
+                    DbHelper.DbConn.ExecuteNonQuery(string.Format("insert into CE_ErpTradeLog(tid,orderstate,userid,operatetime,con) select ctid,{1},{2},getdate(),'{3}' from ce_erptradecell where ctid in ({0}) ;", "'" + ctids.Replace(",", "','") + "'", (int)OrderState.下单完成, CurrentUser.UserID, "点击下载按钮"));
                     ReturnSuccess("{" + string.Format("\"data\":{0}", JsonConvert.SerializeObject(list)) + "}");
                     return;
                 }

+ 25 - 0
SiteCore/taoObj/api_trade_info.cs

@@ -126,6 +126,31 @@ namespace SiteCore.taoObj
             ///确认时间
             /// </summary>
             public string confirmTime { get; set; }
+            /// <summary>
+            /// 微信号
+            /// </summary>
+            public string weChatId { get; set; }
+            /// <summary>
+            /// 手机号
+            /// </summary>
+            public string phone { get; set; }
+            /// <summary>
+            /// 设计内容
+            /// </summary>
+            public string designContent { get; set; }
+            /// <summary>
+            /// 修改地址
+            /// </summary>
+            public string addressFileUrl { get; set; }
+            /// <summary>
+            /// 设计图片
+            /// </summary>
+            public string designPics { get; set; }
+            /// <summary>
+            /// 二维码
+            /// </summary>
+            public string weChatQrPics { get; set; }
+
 
             public List<TradeItemOrder> bizOrderItems { get; set; }
             public List<bizOrderSplit> bizOrderSplits { get; set; }

+ 109 - 1
SiteCore/taobao/commonHelper.cs

@@ -2123,7 +2123,8 @@ namespace SiteCore
                                 { "RefundType", refund_type },
                                 { "ReprintReasons", after },
                                 { "ReasonsImgUrls", entity.AfterSaleSupplierImg },
-                                { "ReasonRemarks", ceErpTradeAfterSaleExtend.supplierResponsible }
+                                { "ReasonRemarks", ceErpTradeAfterSaleExtend.supplierResponsible },
+                                { "RefundAmount", entity.DeductFee }
                             };
                 /**JObject jsonObject12 = new JObject
                                 {
@@ -3037,5 +3038,112 @@ namespace SiteCore
             }
             return true;
         }
+
+        public static bool setFromDataInfo(string tid, string content, int userId)
+        {
+            CeErpTradeCell tradeCell = CeErpTradeCell.GetByCtid(tid);
+            if (tradeCell == null)
+            {
+                return false;
+            }
+            string info_sql = string.Format("SELECT ctid FROM [dbo].[CE_ErpTradeCell] WHERE tid ='{0}'", tradeCell.tid);
+            if (tradeCell.ctid.Contains("S_"))
+            {
+                info_sql = string.Format("SELECT ctid FROM [dbo].[CE_ErpTradeCell] WHERE ctid ='{0}'", tradeCell.ctid);
+            }
+            DataTable data = DbHelper.DbConn.ExecuteDataset(info_sql).Tables[0];
+
+            CeErpOrderFormData formData = null;
+            if (data.Rows.Count > 0)
+            {
+                List<CeErpTradeCell> cell_list = new List<CeErpTradeCell>();
+                foreach (DataRow row in data.Rows)
+                {
+                    string ctid = row["ctid"].ToString();
+                    CeErpTradeCell cell = CeErpTradeCell.GetByCtid(ctid);
+                    cell_list.Add(cell);
+                    formData = CeErpOrderFormData.GetByTid(ctid);
+                    if (formData == null)
+                    {
+                        formData = new CeErpOrderFormData();
+                    }
+
+                    formData.tid = ctid;
+                    formData.content = content;
+                    if (formData.ID > 0)
+                    {
+                        formData.Update();
+                    }
+                    else
+                    {
+                        formData.userId = userId;
+                        formData.Create();
+                    }
+
+                }
+                if (tradeCell.OrderState >= 5)
+                {
+                    LogHelper.addLog(tradeCell.ctid, formData.userId > 0 ? formData.userId : 3542, "外链派单:订单状态不正确!", tradeCell.OrderState);
+                    return false;
+
+                }
+                //能进来并且没有设计师
+
+                foreach (CeErpTradeCell entity in cell_list)
+                {
+                    try
+                    {
+                        if (entity != null && entity.seller_memo.Length > 0)
+                        {
+                            if (entity.OrderState >= 5)
+                            {
+                                LogHelper.addLog(entity.ctid, formData.userId > 0 ? formData.userId : 3542, "外链派单:订单状态不正确!", entity.OrderState);
+                                continue;
+
+                            }
+                            //判断能不能推送
+                            designApiResponseVo result = commonHelper.checkOrderListDesignInfo(entity.tid, entity.ctid);
+                            if (result != null && result.code == 200)
+                            {
+                                designApiResponseVo response = designHelper.API_GetPrintData_CreateOrder(entity, "SysAdmin");
+                                if (response.code == 200)
+                                {
+
+                                    if (response.msg == "设计共创:成功")
+                                    {
+                                        if (entity.ctid.IndexOf("S_") == -1)
+                                        {
+                                            int suid = commonHelper.autoDistributeToSupplier(entity); //自动分配供应商
+                                            entity.SupplierId = suid;
+                                            string suname = commonHelper.getSupplierNameById(entity.SupplierId);
+                                            LogHelper.addLog(entity.ctid, 0, "匹配供应商:" + suname, entity.OrderState);
+                                        }
+
+                                        entity.OrderState = Convert.ToInt32(OrderState.待设计);
+                                        entity.DesignUserId = 3542;
+                                        entity.WaitDesignTime = DateTime.Now;
+                                        entity.DispatchSort = 2;
+                                        entity.UpdateTime = DateTime.Now;
+                                        entity.Update();
+
+                                    }
+                                }
+                                LogHelper.addLog(entity.ctid, formData.userId > 0 ? formData.userId : 3542, "外链派单:" + response.msg, Convert.ToInt32(OrderState.待设计));
+                            }
+                            else
+                            {
+                                LogHelper.addLog(entity.ctid, formData.userId > 0 ? formData.userId : 3542, "外链派单:" + result.msg, Convert.ToInt32(OrderState.待设计));
+                            }
+
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        XLog.SaveLog(0, "外链派单:" + ex.Message);
+                    }
+                }
+            }
+            return true;
+        }
     }
 }

+ 17 - 0
SiteCore/taobao/preSalesHelper.cs

@@ -1591,6 +1591,19 @@ namespace SiteCore.Handler
                 createItemOrder(orderList, trade);
                 List<Api_trade_info.bizOrderSplit> bizOrderSplit = bizOrder.bizOrderSplits;
                 callResult = createCellOrder(bizOrderSplit, trade, isCreate);
+
+                if (!string.IsNullOrEmpty(bizOrder.weChatId) && !string.IsNullOrEmpty(bizOrder.phone))
+                {
+                    string content = "[{\"title\":\"logo文件上传/模板截图/设计素材上传等等~\",\"type\":\"upload\",\"content\":" + bizOrder.designPics + "},{\"title\":\"需要设计的内容\",\"type\":\"input\",\"content\":\"" + bizOrder.designContent + "\"},{\"title\":\"手机号\",\"type\":\"input\",\"content\":\"" + bizOrder.phone + "\"},{\"title\":\"微信号\",\"type\":\"input\",\"content\":\"" + bizOrder.weChatId + "\"},{\"title\":\"请上传微信二维码\",\"type\":\"upload\",\"content\":" + bizOrder.weChatQrPics + "}]";
+                    foreach (bizOrderSplit item in bizOrderSplit)
+                    {
+                        try
+                        {
+                            commonHelper.setFromDataInfo(item.splitNo, content, 0);
+                        }
+                        catch (Exception e) { }
+                    }
+                }
             }
             catch (Exception ex)
             {
@@ -2360,6 +2373,10 @@ namespace SiteCore.Handler
             trade.seller_memo = bizOrder.sellerRemark;
             trade.buyer_id = bizOrder.openBuyerId;
             trade.posCode = bizOrder.shopCode;
+            if (!string.IsNullOrEmpty(bizOrder.addressFileUrl))
+            {
+                trade.Attachments = "https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/" + bizOrder.addressFileUrl;
+            }
             if (isCreate)
             {
                 trade.IsNew = bizOrder.IsNew;