コード例 #1
0
        public void GetProcedureComboTree_Base(HttpContext context, string btn)
        {
            string emptyComboTree = "[{\"id\":0,\"text\":\"\"}]";

            if (btn != "show")
            {
                context.Response.Write(emptyComboTree);
                return;
            }
            try
            {
                BLL.Base.base_Procedure bll      = new BLL.Base.base_Procedure();
                StringBuilder           strWhere = new StringBuilder();
                string NoHistory = RequestHelper.GetString("NoHistory").Trim();
                if (NoHistory != "")
                {
                    strWhere.Append(" and a.ID<>" + Utils.StrToInt(NoHistory, 0) + " and ','+a.SupList not like '%," + Utils.StrToInt(NoHistory, 0) + ",%' ");
                }
                string    fields                 = "NumType";
                string[]  extendField            = fields.Split(',');
                DataSet   ds                     = bll.GetList(strWhere.ToString());
                DataTable dt                     = ds.Tables[0];
                string    ProcedureComboTreeData = DtToTreeJson(dt, "ID", "ProcedureName", "SupId", "SupList", "0", "0", extendField);
                context.Response.Write(ProcedureComboTreeData);
            }
            catch
            {
                context.Response.Write(emptyComboTree);
            }
        }
コード例 #2
0
        public void GetProcedureComboTree(HttpContext context, string btn)
        {
            string emptyComboTree = "[{\"id\":0,\"text\":\"\"}]";

            if (btn != "show")
            {
                context.Response.Write(emptyComboTree);
                return;
            }
            try
            {
                string MachineModel     = RequestHelper.GetString("MachineModel");
                string NoHistory        = RequestHelper.GetString("NoHistory").Trim();
                string AssignmentIdList = RequestHelper.GetString("AssignmentIdList").Trim();
                string IsCommon         = RequestHelper.GetString("IsCommon").Trim();

                if (MachineModel == "")
                {
                    context.Response.Write(emptyComboTree);
                    return;
                }
                if (IsCommon == "1")
                {
                    AssignmentIdList = "";
                }
                BLL.Base.base_Procedure bll      = new BLL.Base.base_Procedure();
                StringBuilder           strWhere = new StringBuilder();
                string   fields      = "NumType,MachineLevelNat";
                string[] extendField = fields.Split(',');
                if (NoHistory != "")
                {
                    strWhere.Append(" and a.ID<>" + Utils.StrToInt(NoHistory, 0) + " and ','+a.SupList not like '%," + Utils.StrToInt(NoHistory, 0) + ",%' ");
                }
                if (AssignmentIdList != "")
                {
                    strWhere.Append(" and a.ID not in(select ProcedureId from Repair_Assignment_Procedure where FlagDel=0 and AssignmentId in(" + AssignmentIdList + "))");
                }
                //--------------
                strWhere.Append(" or a.ID in(179,176,177,178,165) ");
                //--------------
                DataSet   ds = bll.GetList(strWhere.ToString(), MachineModel);
                DataTable dt = ds.Tables[0];
                string    ProcedureComboTreeData = DtToTreeJson(dt, "ID", "ProcedureName", "SupId", "SupList", "0", "0", extendField);
                context.Response.Write(ProcedureComboTreeData);
            }
            catch
            {
                context.Response.Write(emptyComboTree);
            }
        }
コード例 #3
0
        private void SaveData(Model.Repair.repair_Schedule model, HttpContext context)
        {
            Model.System.sys_LoginUser      loginUserModel = BaseWeb.GetLoginInfo();
            SCZM.BLL.Repair.repair_Schedule bll            = new SCZM.BLL.Repair.repair_Schedule();
            string operaMessage = "";
            string status       = "0";
            string operaAction  = "";
            string operaMemo    = "";

            try
            {
                if (model.ID == -1)
                {
                    model.ID = bll.Add(model, out operaMessage);
                    if (model.ID > 0)
                    {
                        status      = "1";
                        operaAction = Enums.ActionEnum.Add.ToString();
                        operaMemo   = "新增进度反馈:" + model.ID;
                    }
                }
                else
                {
                    if (bll.Update(model, out operaMessage))
                    {
                        status      = "1";
                        operaAction = Enums.ActionEnum.Edit.ToString();
                        operaMemo   = "修改进度反馈:" + model.ID;
                    }
                }
                if (status == "1")
                {
                    //写入操作日志
                    BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo);
                }
                //if (status == "1") {
                //    BLL.WX.WX_GetLoginInfo bll_Wx = new BLL.WX.WX_GetLoginInfo();
                //    bll_Wx.getWxAccount_Procedure
                //}
                if (status == "1" && model.PauseReason == 5)
                {
                    //-----------------------------------------------------------
                    string PartDepId = "23";
                    BLL.WX.WX_GetLoginInfo bll_Wx = new BLL.WX.WX_GetLoginInfo();
                    DataSet wx_AccountDs          = bll_Wx.getWxAccount_Dep(PartDepId);
                    if (wx_AccountDs != null && wx_AccountDs.Tables[0].Rows.Count > 0)
                    {
                        string touser = "", touser_ds = "";
                        for (int i = 0; i < wx_AccountDs.Tables[0].Rows.Count; i++)
                        {
                            touser_ds = wx_AccountDs.Tables[0].Rows[i][0].ToString();
                            if (touser_ds != "")
                            {
                                touser += touser_ds + "|";
                            }
                        }
                        if (touser.Length > 0)
                        {
                            touser = touser.Remove(touser.Length - 1);

                            SCZM.BLL.Repair.Repair_Assignment bll_Assignment = new BLL.Repair.Repair_Assignment();
                            DataTable dt_CustMessage = bll_Assignment.GetComboList(" and a.ID=" + model.AssignmentId + " ").Tables[0];
                            SCZM.BLL.Base.base_Procedure bll_Procedure = new BLL.Base.base_Procedure();
                            DataTable dt_Procedure = bll_Procedure.GetComboList(" and a.ID=" + model.ProcedureId + " ").Tables[0];
                            WX_GetLoginInfo.GetMessage(touser, "", "客户:" + dt_CustMessage.Rows[0]["CustName"] + "\n机型:" + dt_CustMessage.Rows[0]["MachineModel"] + " \n机号:" + dt_CustMessage.Rows[0]["MachineCode"] + "\n工序:" + dt_Procedure.Rows[0]["ProcedureName"] + "\n维修担当:" + dt_CustMessage.Rows[0]["PerName"] + "\n因等件原因:" + model.Memo + "\n暂停维修,请及时沟通。", "Schedule");
                        }
                    }
                    //-----------------------------------------------------------
                }
                else if (status == "1" && model.ScheduleType == 3)
                {
                    BLL.Repair.Repair_Assignment bll_Assignment = new BLL.Repair.Repair_Assignment();
                    //model.AssignmentId; 派工ID
                    //model.AssignmentProcedureId 派工工序ID
                    //---------------------2018/6/26---取消审核(系统内默认审核同意,需手动审核时删掉此段+Wx_GetLoginInfo.ashx也有同样的设置,需同步修改)-----------------------------
                    Model.Repair.Repair_Assignment_Procedure model_AssignmentProcedure = null;
                    BLL.Repair.repair_Report bll_Report = new BLL.Repair.repair_Report();
                    DataTable dt = bll_Assignment.GetAssignmentProcedureList(" and a.ID=" + model.AssignmentProcedureId + " ").Tables[0];


                    DataRow[] dr = dt.Select("ID=" + model.AssignmentProcedureId);
                    if (dr.Length == 1)
                    {
                        model_AssignmentProcedure = new Model.Repair.Repair_Assignment_Procedure();
                        if (dr[0]["AllNat"].ToString() != "")
                        {
                            model_AssignmentProcedure.AllNat_Audit = Utils.StrToDecimal(dr[0]["AllNat"].ToString(), 0);
                        }
                        else
                        {
                            DataTable dt_Detail = bll_Report.GetRepairerRewardDetail(" and d.ID=" + model.AssignmentProcedureId + " ").Tables[0];
                            if (dt_Detail.Rows[0]["AllNat"].ToString() != "")
                            {
                                model_AssignmentProcedure.AllNat_Audit = Utils.StrToDecimal(dt_Detail.Rows[0]["AllNat"].ToString(), 0) * Utils.StrToDecimal(dr[0]["Num"].ToString(), 0);
                            }
                        }
                        model_AssignmentProcedure.AuditDate    = DateTime.Now;
                        model_AssignmentProcedure.AuditOpinion = "";
                        model_AssignmentProcedure.AuditState   = 1;
                        model_AssignmentProcedure.AuditorId    = loginUserModel.ID;
                        model_AssignmentProcedure.ID           = model.AssignmentProcedureId;
                        bll_Report.SaveRepairReward_Audit(model_AssignmentProcedure);
                    }

                    //----------------------------zhx----------------上箭头-------------------------------------------------------------------

                    BLL.WX.WX_GetLoginInfo bll_Wx = new BLL.WX.WX_GetLoginInfo();
                    DataSet wx_AccountDs          = bll_Wx.getWxAccount_Procedure(model.AssignmentProcedureId);
                    if (wx_AccountDs != null && wx_AccountDs.Tables[0].Rows.Count > 0)
                    {
                        string touser = "", touser_ds = "";
                        for (int i = 0; i < wx_AccountDs.Tables[0].Rows.Count; i++)
                        {
                            touser_ds = wx_AccountDs.Tables[0].Rows[i]["WXNo"].ToString();
                            if (touser_ds != "")
                            {
                                touser += touser_ds + "|";
                            }
                        }
                        if (touser.Length > 0)
                        {
                            touser = touser.Remove(touser.Length - 1);

                            //SCZM.BLL.Repair.Repair_Assignment bll_Assignment = new BLL.Repair.Repair_Assignment();
                            DataTable dt_CustMessage = bll_Assignment.GetComboList(" and a.ID=" + model.AssignmentId + " ").Tables[0];
                            SCZM.BLL.Base.base_Procedure bll_Procedure = new BLL.Base.base_Procedure();
                            DataTable dt_Procedure = bll_Procedure.GetComboList(" and a.ID=" + model.ProcedureId + " ").Tables[0];
                            WX_GetLoginInfo.GetMessage(touser, "", "客户:" + dt_CustMessage.Rows[0]["CustName"] + "\n机型:" + dt_CustMessage.Rows[0]["MachineModel"] + " \n机号:" + dt_CustMessage.Rows[0]["MachineCode"] + "\n维修担当:" + dt_CustMessage.Rows[0]["PerName"] + "\n工序:" + dt_Procedure.Rows[0]["ProcedureName"] + "\n维修已完成。" + model.Memo + "\n", "Schedule");
                        }
                    }
                    //---------------------------------------------
                }
                else if (status == "1" && (model.ScheduleType == 1 || model.ScheduleType == 2))
                {
                    BLL.Repair.Repair_Assignment bll_Assignment = new BLL.Repair.Repair_Assignment();
                    BLL.WX.WX_GetLoginInfo       bll_Wx         = new BLL.WX.WX_GetLoginInfo();
                    DataSet wx_AccountDs = bll_Wx.getWxAccount_Procedure_onlyGroup(model.AssignmentProcedureId);
                    if (wx_AccountDs != null && wx_AccountDs.Tables[0].Rows.Count > 0)
                    {
                        string touser = "", touser_ds = "";
                        for (int i = 0; i < wx_AccountDs.Tables[0].Rows.Count; i++)
                        {
                            touser_ds = wx_AccountDs.Tables[0].Rows[i]["WXNo"].ToString();
                            if (touser_ds != "")
                            {
                                touser += touser_ds + "|";
                            }
                        }
                        if (touser.Length > 0)
                        {
                            touser = touser.Remove(touser.Length - 1);

                            //SCZM.BLL.Repair.Repair_Assignment bll_Assignment = new BLL.Repair.Repair_Assignment();
                            DataTable dt_CustMessage = bll_Assignment.GetComboList(" and a.ID=" + model.AssignmentId + " ").Tables[0];
                            SCZM.BLL.Base.base_Procedure bll_Procedure = new BLL.Base.base_Procedure();
                            DataTable dt_Procedure = bll_Procedure.GetComboList(" and a.ID=" + model.ProcedureId + " ").Tables[0];
                            WX_GetLoginInfo.GetMessage(touser, "", "客户:" + dt_CustMessage.Rows[0]["CustName"] + "\n机型:" + dt_CustMessage.Rows[0]["MachineModel"] + " \n机号:" + dt_CustMessage.Rows[0]["MachineCode"] + "\n维修担当:" + dt_CustMessage.Rows[0]["PerName"] + "\n工序:" + dt_Procedure.Rows[0]["ProcedureName"] + "\n维修" + (model.ScheduleType == 1?"已开始":"已暂停") + "。" + model.Memo + "\n", "Schedule");
                        }
                    }
                }
                if (status == "1")
                {
                    if (bll.GetScheduleType(model.AssignmentProcedureId) == 3)
                    {
                        BLL.WX.WX_GetLoginInfo       bll_Wx         = new BLL.WX.WX_GetLoginInfo();
                        BLL.Repair.Repair_Assignment bll_Assignment = new BLL.Repair.Repair_Assignment();
                        DataTable dt_repairSecond        = bll.GetRepairSceond(model.AssignmentProcedureId).Tables[0];
                        DataSet   wx_AccountDs_onlyGroup = bll_Wx.getWxAccount_Procedure_onlyGroup(model.AssignmentProcedureId);
                        if (wx_AccountDs_onlyGroup != null && wx_AccountDs_onlyGroup.Tables[0].Rows.Count > 0)
                        {
                            string touser = "", touser_ds = "";
                            for (int i = 0; i < wx_AccountDs_onlyGroup.Tables[0].Rows.Count; i++)
                            {
                                touser_ds = wx_AccountDs_onlyGroup.Tables[0].Rows[i]["WXNo"].ToString();
                                if (touser_ds != "")
                                {
                                    touser += touser_ds + "|";
                                }
                            }
                            if (touser.Length > 0)
                            {
                                touser = touser.Remove(touser.Length - 1);
                                int AllSecond    = Convert.IsDBNull(dt_repairSecond.Rows[0]["AllSecond"]) == true ? 0 : Convert.ToInt32(dt_repairSecond.Rows[0]["AllSecond"]);
                                int RepairSecond = Convert.IsDBNull(dt_repairSecond.Rows[0]["RepairSecond"]) == true ? 0 : Convert.ToInt32(dt_repairSecond.Rows[0]["RepairSecond"]);
                                int PauseSecond  = Convert.IsDBNull(dt_repairSecond.Rows[0]["PauseSecond"]) == true ? 0 : Convert.ToInt32(dt_repairSecond.Rows[0]["PauseSecond"]);
                                WX_GetLoginInfo.GetMessage(touser, "", "本次派工工序总用时:" + WX_GetLoginInfo.GetDateTime(0, 0, 0, AllSecond) + "\n维修用时:" + WX_GetLoginInfo.GetDateTime(0, 0, 0, RepairSecond) + "\n暂停用时:" + WX_GetLoginInfo.GetDateTime(0, 0, 0, PauseSecond) + "", "Schedule");
                                bll_Assignment.UpdateRepairSecond(model.AssignmentProcedureId, AllSecond, RepairSecond, PauseSecond);
                            }
                        }
                    }
                }
                context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}");
                return;
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }