Пример #1
0
        public InterfaceRet DelTrainman(string data)
        {
            _ret.Clear();
            try
            {
                //反序列化传入的参数
                Get_InDelTrainmanMgr input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InDelTrainmanMgr>(data);



                DBTrainman db = new DBTrainman();
                if (!db.CheckIsCanUpdata(input.TrainmanGUID))
                {
                    throw new Exception("请将该人员移除名牌后,再进行修改操作!");
                }

                if (!db.CheckIsCanUpdataByPlan(input.TrainmanGUID))
                {
                    throw new Exception("该司机有出勤计划,不能删除!");
                }

                if (!db.CheckIsCanDelUnRun(input.TrainmanGUID))
                {
                    throw new Exception("该司机处于请假状态,不能删除");
                }

                //获取待删除人员的所有信息
                _ret.result    = 1;
                _ret.resultStr = "未找到要修改的人员,刷新后再试!";
                DBTrainman.Tm tm = db.getTmByID(input.TrainmanGUID);
                if (db.DelTrainman(input.TrainmanGUID))
                {
                    _ret.result    = 0;
                    _ret.resultStr = "返回成功";
                    AddLog(3, "", input.TrainmanGUID, strIdentifier_user);
                    //添加名牌变动日志
                    db.addLog4DelTrainMan(tm, input.DutyUserGUID, input.DutyUserNumber, input.DutyUserName);
                }
            }
            catch (Exception ex)
            {
                _ret.result    = 1;
                _ret.resultStr = "提交失败:" + ex.Message;
            }
            return(_ret);
        }
Пример #2
0
        public void UpdateTrainJiaoLu(TmOrg input, DBTrainman.Tm tm)
        {
            if (string.IsNullOrEmpty(input.TrainmanNumber))
            {
                throw new Exception("传入人员工号为空,无法修改");
            }
            DBTrainman db = new DBTrainman();

            //判断是否在牌  如果在牌 则需要移除
            if (!db.CheckIsCanUpdata(tm.strTrainmanGUID))
            {
                throw new Exception("请将该人员移除名牌后,再进行修改操作!");
            }
            //执行修改操作
            if (!db.UpdateTrainJiaolu(tm.strTrainmanGUID, input.TrainJiaoluGUID))
            {
                throw new Exception("未找到待修改的人员!");
            }
            //添加名牌变动日志
            db.addLog4UpdateTrainmanJiaolu(tm, input.TrainJiaoluGUID, input.DutyUserGUID, input.DutyUserNumber, input.DutyUserName);
        }
Пример #3
0
        public InterfaceRet UpdateTMOrg(string data)
        {
            InterfaceRet _ret = new InterfaceRet();

            _ret.Clear();
            DBTrainman db    = new DBTrainman();
            TmOrg      input = Newtonsoft.Json.JsonConvert.DeserializeObject <TmOrg>(data);

            try
            {
                DBTrainman.Tm tm = db.getTm(input.TrainmanNumber);
                if (tm == null)
                {
                    throw new Exception("找不到该司机,请从新输入工号");
                }

                //判断所传机务段是否是空,如果是空直接停止修改
                //if (!string.IsNullOrEmpty(input.AreaGUID))
                //{
                //if (tm.strJiWuDuanGUID != input.AreaGUID) 暂时先不检测
                UpdateArea(input, tm);
                // }

                //判断所传车间是否是空
                if (!string.IsNullOrEmpty(input.WorkShopGUID))
                {
                    if (tm.strWorkShopGUID != input.WorkShopGUID)
                    {
                        UpdateWorkShop(input, tm);

                        ////判断车间是否位于机务段下
                        //if (db.checkWorkShopInArea(input.AreaGUID, input.WorkShopGUID))

                        //else
                        //    throw new Exception("所选车间不属于所选机务段内!");
                    }
                }
                else
                {
                    UpdateWorkShop(input, tm);
                }

                //判断所传区段是否是空,如果是空直接停止修改
                if (!string.IsNullOrEmpty(input.TrainJiaoluGUID))
                {
                    if (tm.strTrainJiaoluGUID != input.TrainJiaoluGUID)
                    {
                        //判断车间是否位于机务段下
                        if (db.checkJiaoluInWorkShop(input.WorkShopGUID, input.TrainJiaoluGUID))
                        {
                            UpdateTrainJiaoLu(input, tm);
                        }
                        else
                        {
                            throw new Exception("所选区段不在所选车间内!");
                        }
                    }
                }
                else
                {
                    UpdateTrainJiaoLu(input, tm);
                }
                return(_ret);
            }
            catch (Exception ex)
            {
                _ret.resultStr = ex.Message;
                _ret.result    = 1;
            }
            return(_ret);
        }