Exemple #1
0
        /// <summary>
        /// 根据资源的有效时间更新资源状态和合同状态
        /// </summary>
        public void UpdateResAndHtStateByEndTime()
        {
            var curTime = DateTime.Now.ToString("yyyy-MM-dd");
            //状态为正常状态且超期的合同
            var sql = "select htnm from ResContract where htzsstate in ({0},{1}) and htjsrq<{2}";
            var dt  = Utility.CurDatabase.ExecuteDataSet(sql, HtState.Editing, HtState.HasConfirm, curTime);

            if (DataSetValidator.IsDatasetValid(dt) == false)
            {
                return;
            }
            //修改资源
            var resSql = @"update fqres set resstate={0},resstatename={1} where resnm in(
                           select resnm from ResContract where htzsstate in({2},{3}) and htjsrq<{4})";

            Utility.CurDatabase.ExecuteSqlStatement(
                resSql,
                ResourceState.HasConfirm,
                ResStateDictionary.ConvertToString(ResourceState.HasConfirm),
                HtState.Editing,
                HtState.HasConfirm,
                curTime);
            //修改合同
            var htSql = @"update ResContract set htzsstate={0},htzsstatemc={1} where htzsstate in({2},{3}) and htjsrq<{4}";

            Utility.CurDatabase.ExecuteSqlStatement(
                htSql,
                HtState.OutDay,
                HtStateDictionary.ConvertToString(HtState.OutDay),
                HtState.Editing,
                HtState.HasConfirm,
                curTime);
        }
Exemple #2
0
 public void SetHtStateWhenAdd()
 {
     //保存走的是卡片,所以要卡片
     GetCurRow()[HtZsState]   = (int)HtState.Editing;
     GetCurRow()[HtZsStateMc] = HtStateDictionary.ConvertToString(HtState.Editing);
     //右边同步显示
     GetRightCardDataTable()[HtZsState]   = (int)HtState.Editing;
     GetRightCardDataTable()[HtZsStateMc] = HtStateDictionary.ConvertToString(HtState.Editing);
 }
Exemple #3
0
        /// <summary>
        /// 更新合同状态
        /// </summary>
        /// <param name="value"></param>
        /// <param name="htId"></param>
        public void SaveHtState(string value, string htId)
        {
            var htStateCode = Convert.ToInt32(value);
            var htStateName = HtStateDictionary.ConvertToString((HtState)htStateCode);
            var htSql       = "update ResContract set htzsstate={0},htzsstatemc={1} where htnm={2}";

            Utility.CurDatabase.ExecuteSqlStatement(
                htSql,
                htStateCode,
                htStateName,
                htId);
        }
Exemple #4
0
        public void HtConfirm()
        {
            var index = ListGrid.SelectedIndex;

            if (index < 0)
            {
                MessageBox.Show("请选择合同行数据!", "合同选择提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var curHtState = GetCurRowState();

            if (curHtState == HtState.HasConfirm)
            {
                MessageBox.Show("该合同已经被确认,无需再次确认!", "合同选择提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (curHtState == HtState.Stop)
            {
                MessageBox.Show("该合同已经被终止,无法确认!", "合同选择提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (curHtState == HtState.OutDay)
            {
                MessageBox.Show("该合同已经结束,无法确认!", "合同选择提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            var question = MessageBox.Show("合同确认后将不可修改,是否确认合同?", "合同确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            //取消
            if (question == DialogResult.Cancel)
            {
                return;
            }

            //合同确认
            var state = (int)HtState.HasConfirm;
            var htId  = GetCurRow()[Htnm].ToString();

            GetCurRow()[HtZsState] = state;
            ResourceRestFul.GetClient().SaveHtState(state, htId);
            GetCurRow()[HtZsStateMc]             = HtStateDictionary.ConvertToString(HtState.HasConfirm);
            GetRightCardDataTable()[HtZsStateMc] = HtStateDictionary.ConvertToString(HtState.HasConfirm);
            MessageBox.Show("合同确认成功!", "合同确认提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //成功后触发一下当前按钮状态
            SelectRowChanged(this, null);
        }
Exemple #5
0
        public void InitFormState()
        {
            //焦点行切换后
            ListGrid.Repeat_SelectRowChanged += SelectRowChanged;
            var actionId = this.CompContext.FormUri.InitialActionID;

            //通过是否新增来判断是否有相应的合同,不同的表单可能不一定是Create
            //非新增会传递过来DataId显示合同并进入编辑动作
            //判断是否联查,有问题,框架上打开了会直接调到框架
            if (CompContext.FormUri.Parameters.AllKeys.Contains("isLc"))
            {
                //联查进来只有新增的界面或者后期在处理
                HtAddEditFromLc();
                //联查新增
                if (string.Compare(actionId.Trim(), "Add", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var rescourceCode = CompContext.FormUri.Parameters["ResZybh"];
                    var rescourceId   = CompContext.FormUri.Parameters["ResNm"];
                    var rescourceName = CompContext.FormUri.Parameters["ResZymc"];
                    //默认带过来编号和名称
                    CompContext.DefaultInstanceData.DataSet.Tables[0].Rows[0]["Resnm"] = rescourceId;
                    CompContext.DefaultInstanceData.DataSet.Tables[0].Rows[0]["ResBh"] = rescourceCode;
                    CompContext.DefaultInstanceData.DataSet.Tables[0].Rows[0]["ResMc"] = rescourceName;

                    //保存走的是卡片,所以要卡片,合同状态
                    GetCurRow()[HtZsState]   = (int)HtState.Editing;
                    GetCurRow()[HtZsStateMc] = HtStateDictionary.ConvertToString(HtState.Editing);
                    //右边同步显示
                    GetRightCardDataTable()[HtZsState]   = (int)HtState.Editing;
                    GetRightCardDataTable()[HtZsStateMc] = HtStateDictionary.ConvertToString(HtState.Editing);
                }
                else//联查有对应合同
                {
                }
                //联查编辑
            }
            else //框架菜单进入
            {
                UpdataUIByFuncId();
            }

            SelectRowChanged(this, null);
        }
Exemple #6
0
        /// <summary>
        /// 终止合同
        /// </summary>
        /// <param name="htNm"></param>
        public void StopHt(string htNm)
        {
            //1.先终止合同
            var htSql = "update ResContract set htzsstate={0},htzsstatemc={1} where htnm={2}";

            Utility.CurDatabase.ExecuteSqlStatement(
                htSql,
                HtState.Stop,
                HtStateDictionary.ConvertToString(HtState.Stop),
                htNm);
            //2.更新当前合同对应的资源为已确认状态
            var resSql = @"update fqres set resstate={0},resstatename={1} where resnm in(
            select resnm from ResContract where htnm={2})";

            Utility.CurDatabase.ExecuteSqlStatement(
                resSql,
                ResourceState.HasConfirm,
                ResStateDictionary.ConvertToString(ResourceState.HasConfirm),
                htNm);
        }
Exemple #7
0
        public void AfterSave()
        {
            //保存后必须设定对应的资源状态为已生成合同状态
            //可能会有问题,比如再次编辑呢。。。。。应该也没事
            //要判断是否联查进来的
            if (CompContext.FormUri.Parameters.AllKeys.Contains("isLc"))
            {
                //保存走的是卡片,所以要卡片
                GetCurRow()[HtZsState]   = (int)HtState.Editing;
                GetCurRow()[HtZsStateMc] = HtStateDictionary.ConvertToString(HtState.Editing);
                //右边同步显示
                GetRightCardDataTable()[HtZsState]   = (int)HtState.Editing;
                GetRightCardDataTable()[HtZsStateMc] = HtStateDictionary.ConvertToString(HtState.Editing);
                //联查进来的要单独保存一下
                var htnm = GetCurRow()["htnm"].ToString();
                ResourceRestFul.GetClient().SaveHtState((int)HtState.Editing, htnm);
            }

            ResourceRestFul.GetClient().SaveResState((int)ResourceState.HasBuildHt, GetCurCardResId());
            this.BarBtnChange.VisualComponent.Enabled = true;
        }
Exemple #8
0
        public void HtStop()
        {
            var index = ListGrid.SelectedIndex;

            if (index < 0)
            {
                MessageBox.Show("请选择合同行数据!", "合同选择提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var curHtState = GetCurRowState();

            if (curHtState != HtState.HasConfirm)
            {
                MessageBox.Show("只有已确认状态的合同允许终止!", "合同选择提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            var question = MessageBox.Show("合同终止后将不可恢复,是否终止合同?", "合同终止提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            //取消
            if (question == DialogResult.Cancel)
            {
                return;
            }
            var htId = GetCurRow()[Htnm].ToString();

            ResourceRestFul.GetClient().StopHt(htId);

            var stopState = (int)HtState.Stop;

            GetCurRow()[HtZsState]               = stopState;
            GetCurRow()[HtZsStateMc]             = HtStateDictionary.ConvertToString(HtState.Stop);
            GetRightCardDataTable()[HtZsStateMc] = HtStateDictionary.ConvertToString(HtState.Stop);
            //没有刷新,可能会有问题
            MessageBox.Show("合同终止成功");
        }