Пример #1
0
        private static string UpdateSalesOrderPO(SalesOrderViewModel model)
        {
            var sqlParameter = new List <SqlParameter>()
            {
                new SqlParameter("@PhoneNumber", model.phoneNumber),
                new SqlParameter("@BillNo", model.billNo),
                new SqlParameter("@Reason", model.reason),
                new SqlParameter {
                    ParameterName = "@Msg", Value = "", Direction = ParameterDirection.Output, Size = 100, SqlDbType = SqlDbType.NVarChar
                }
            };

            string cmdText = "tm_p_UpdateSalesOrderPO";

            var res = SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, cmdText, sqlParameter.ToArray());
            var msg = sqlParameter.Last().Value.ToString();

            if (msg == "OK")
            {
                string toUser = GetUserIdByUserGroup("004", "008");; //生产组,制单人组
                toUser += GetSeOrderUserId(model.billNo);            //业务员消息只发当前订单
                string noticeDetailUrl = WebConfig.WebHost + "/#/salesOrderDetail?billNo=" + model.billNo;
                model.reason = ComposeMessageContent(model.billNo, model.reason);

                WechatService.Send(toUser, "销售订单[" + model.billNo + "]供应已回复", model.reason, noticeDetailUrl);
            }
            LoggerHelper.Info("销售订单[" + model.billNo + "]供应已回复:" + msg);

            return(msg);
        }
Пример #2
0
        /// <summary>
        /// 退货通知单,销售总监消息通知
        /// </summary>
        private static void SendNoticeToCSO()
        {
            string cmdText = "select top 1 FBillNo from tm_v_SalesReturnNotice where FISCSOSendMessage=0";
            var    fBillNo = SqlHelper.ExecuteScalar(CommandType.Text, cmdText);

            if (fBillNo != null)
            {
                // 更新消息状态
                string sql = "update SEOutStock set FHeadSelfs1256=1 where FBillNo=@FBillNo";
                SqlHelper.ExecuteNonQuery(CommandType.Text, sql, new SqlParameter("@FBillNo", fBillNo));

                string toUser          = GetUserIdByUserGroup("001"); // 销售总监组
                string title           = "您有退货通知单[" + fBillNo + "]需要审核";
                string noticeDetailUrl = WebConfig.WebHost + "/#/salesReturnNoticeDetail?billNo=" + fBillNo;
                WechatService.Send(toUser, title, "", noticeDetailUrl);
            }
        }
Пример #3
0
        /// <summary>
        /// 销售单 - 不需要总经理审核的订单,通知生产
        /// </summary>
        private static void SendNoticeToPD()
        {
            string cmdText = "select top 1 FBillNo from tm_v_SeOrderList where FISGM=0 and FISPDSendMessage=0";
            var    fBillNo = SqlHelper.ExecuteScalar(CommandType.Text, cmdText);

            if (fBillNo != null)
            {
                // 更新消息状态
                string sql = "update seorder set FHeadSelfs0166=1 where FBillNo=@FBillNo";
                SqlHelper.ExecuteNonQuery(CommandType.Text, sql, new SqlParameter("@FBillNo", fBillNo));

                string toUser          = GetUserIdByUserGroup("004"); // 生产组
                string title           = "您有销售订单[" + fBillNo + "]需要确认";
                string noticeDetailUrl = WebConfig.WebHost + "/#/salesOrderDetail?billNo=" + fBillNo;
                string content         = ComposeMessageContent(fBillNo.ToString(), null);

                WechatService.Send(toUser, title, content, noticeDetailUrl);
            }
        }
Пример #4
0
        /// <summary>
        /// 总经理审核
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private static string UpdateSalesOrderGM(SalesOrderViewModel model)
        {
            var sqlParameter = new List <SqlParameter>()
            {
                new SqlParameter("@PhoneNumber", model.phoneNumber),
                new SqlParameter("@BillNo", model.billNo),
                new SqlParameter("@Reason", model.reason),
                new SqlParameter("@Result", model.result),
                new SqlParameter {
                    ParameterName = "@Msg", Value = "", Direction = ParameterDirection.Output, Size = 100, SqlDbType = SqlDbType.NVarChar
                }
            };

            SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "tm_p_UpdateSalesOrderGM", sqlParameter.ToArray());
            var msg = sqlParameter.Last().Value.ToString();

            if (msg == "OK")
            {
                string toUser = GetUserIdByUserGroup("008"); //制单人组
                toUser += GetSeOrderUserId(model.billNo);    //业务员消息只发当前订单
                string title           = "销售订单[" + model.billNo + "]已特批";
                string noticeDetailUrl = WebConfig.WebHost + "/#/salesOrderDetail?billNo=" + model.billNo;

                model.reason = ComposeMessageContent(model.billNo, model.reason);

                WechatService.Send(toUser, title, model.reason, noticeDetailUrl);

                if (model.result == "Y")
                {
                    toUser = GetUserIdByUserGroup("004"); //通知生产组
                    title  = "您有销售订单[" + model.billNo + "]需要确认";
                    WechatService.Send(toUser, title, model.reason, noticeDetailUrl);
                }
            }

            LoggerHelper.Info("销售单审核,总经理审核更新【" + model.billNo + ":" + model.phoneNumber + "】" + msg);
            return(msg);
        }
Пример #5
0
        /// <summary>
        /// 销售订单 - 通知总经理
        /// </summary>
        private static void SendNoticeToGM()
        {
            string cmdText = "select top 1 FBillNo,FGMCheckCause from tm_v_SeOrderList where FISGM=1 and FISGMSendMessage=0";
            var    dt      = SqlHelper.ExecuteDataTable(CommandType.Text, cmdText);
            var    res     = dt.AsEnumerable()
                             .Select(o => new { FBillNo = o["FBillNo"], FGMCheckCause = o["FGMCheckCause"] })
                             .SingleOrDefault();

            if (res != null)
            {
                // 更新消息状态
                string sql = "update seorder set FHeadSelfs0165=1 where FBillNo=@FBillNo";
                SqlHelper.ExecuteNonQuery(CommandType.Text, sql, new SqlParameter("@FBillNo", res.FBillNo));

                string toUser          = GetUserIdByUserGroup("002"); // 总经理组
                string title           = "您有销售订单[" + res.FBillNo + "]需要审核";
                string desc            = "由于" + res.FGMCheckCause + "需要审核";
                string noticeDetailUrl = WebConfig.WebHost + "/#/salesOrderDetail?billNo=" + res.FBillNo;
                string content         = ComposeMessageContent(res.FBillNo.ToString(), desc);

                WechatService.Send(toUser, title, content, noticeDetailUrl);
            }
        }
Пример #6
0
        private static string UpdateSalesOrderPD(SalesOrderViewModel model)
        {
            var sqlParameter = new List <SqlParameter>()
            {
                new SqlParameter("@PhoneNumber", model.phoneNumber),
                new SqlParameter("@BillNo", model.billNo)
            };

            string cmdText = "";

            if (model.result == "Y") //生产确认通过更新
            {
                cmdText = "tm_p_UpdateSalesOrderPDC";
                sqlParameter.Add(new SqlParameter("@DeliveryDate", model.deliveryDate));
                sqlParameter.Add(new SqlParameter("@Result", model.result));
            }

            if (model.result == "N") //生产不通过更新
            {
                cmdText = "tm_p_UpdateSalesOrderPDD";
                sqlParameter.Add(new SqlParameter("@Result", model.result));
                sqlParameter.Add(new SqlParameter("@Reason", model.reason));
                sqlParameter.Add(new SqlParameter("@ISME", model.isMe));
                sqlParameter.Add(new SqlParameter("@ISPO", model.isPo));
            }

            sqlParameter.Add(new SqlParameter {
                ParameterName = "@Msg", Value = "", Direction = ParameterDirection.Output, Size = 100, SqlDbType = SqlDbType.NVarChar
            });

            var res = SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, cmdText, sqlParameter.ToArray());
            var msg = sqlParameter.Last().Value.ToString();

            if (msg == "OK")
            {
                string toUser          = "";
                string title           = "";
                string noticeDetailUrl = WebConfig.WebHost + "/#/salesOrderDetail?billNo=" + model.billNo;

                model.reason = ComposeMessageContent(model.billNo, model.reason);

                if (model.result == "Y")
                {
                    toUser  = GetUserIdByUserGroup("008");    //制单人组
                    toUser += GetSeOrderUserId(model.billNo); //业务员消息只发当前订单
                    title   = "销售订单[" + model.billNo + "]已通过生产确认";
                    WechatService.Send(toUser, title, model.reason, noticeDetailUrl);
                }
                else
                {
                    toUser  = GetUserIdByUserGroup("008");    //制单人组
                    toUser += GetSeOrderUserId(model.billNo); //业务员消息只发当前订单
                    title   = "销售订单[" + model.billNo + "]生产未确认";
                    WechatService.Send(toUser, title, model.reason, noticeDetailUrl);

                    if (model.isMe == "1")
                    {
                        toUser = GetUserIdByUserGroup("005");//工艺通知
                        title  = "您有销售订单[" + model.billNo + "]需要回复";
                        WechatService.Send(toUser, title, model.reason, noticeDetailUrl);
                    }

                    if (model.isPo == "1")
                    {
                        toUser = GetUserIdByUserGroup("006"); //供应通知
                        title  = "您有销售订单[" + model.billNo + "]需要回复";
                        WechatService.Send(toUser, title, model.reason, noticeDetailUrl);
                    }
                }
            }
            LoggerHelper.Info("销售生产审核更新【" + model.billNo + ":" + model.phoneNumber + "】" + msg);

            return(msg);
        }
Пример #7
0
        /// <summary>
        /// 退货通知单审核
        /// </summary>
        /// <param name="userGroupNumber"></param>
        /// <param name="phoneNumber"></param>
        /// <param name="billNo"></param>
        /// <param name="result"></param>
        /// <param name="reason"></param>
        /// <returns></returns>
        public string UpdateSalesReturn(string userGroupNumber, string phoneNumber, string billNo, string result, string reason)
        {
            try
            {
                SqlParameter[] sqlParameter = new SqlParameter[]
                {
                    new SqlParameter("@PhoneNumber", phoneNumber),
                    new SqlParameter("@BillNo", billNo),
                    new SqlParameter("@Result", result),
                    new SqlParameter("@Reason", reason),
                    new SqlParameter {
                        ParameterName = "@Msg", Value = "", Direction = ParameterDirection.Output, Size = 100, SqlDbType = SqlDbType.NVarChar
                    }
                };

                string cmdText         = "";
                string toUser          = "";
                string title           = "";
                string noticeDetailUrl = WebConfig.WebHost + "/#/salesReturnNoticeDetail?billNo=" + billNo;

                if (userGroupNumber == "001") //销售总监组审核更新
                {
                    cmdText = "tm_p_UpdateSalesReturnCSO";
                }
                if (userGroupNumber == "009") //质检组审核更新
                {
                    cmdText = "tm_p_UpdateSalesReturnQC";
                }

                if (cmdText == "")
                {
                    return("用户分组未找到!");
                }

                SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, cmdText, sqlParameter);
                var msg = sqlParameter.Last().Value.ToString();
                if (msg == "OK")
                {
                    if (userGroupNumber == "001")
                    {
                        toUser = GetUserIdByUserGroup("002", "008"); // 总经理,制单人
                        title  = "退货通知单[" + billNo + "]" + (result == "Y" ? " 销售总监已审核通过" : " 销售总监未审核通过");
                        WechatService.Send(toUser, title, reason, noticeDetailUrl);
                        // 如果同意,发送微信通知给质检组
                        if (result == "Y")
                        {
                            toUser = GetUserIdByUserGroup("009");
                            title  = "您有退通知单[" + billNo + "]需要审核";
                            WechatService.Send(toUser, title, reason, noticeDetailUrl);
                        }
                    }
                    if (userGroupNumber == "009")
                    {
                        toUser = GetUserIdByUserGroup("001", "002", "008");//销售总监、总经理和制单人
                        title  = "退货通知单[" + billNo + "]" + (result == "Y" ? " 已通过质检审核" : " 未通过质检审核");
                        WechatService.Send(toUser, title, reason, noticeDetailUrl);
                    }
                }
                LoggerHelper.Info("退货通知单[" + billNo + "]:" + msg);
                return(msg);
            }
            catch (Exception e)
            {
                LoggerHelper.Info("退货通知单审核[" + userGroupNumber + "]:" + phoneNumber + e);
                return("退货通知单审核失败");
            }
        }