Ejemplo n.º 1
0
        /// <summary>
        /// 刷新列表
        /// </summary>
        /// <param name="paramIsDelete">是否是删除操作</param>
        private void RefreshList(bool paramIsDelete = false)
        {
            if (paramIsDelete)
            {
                if (tabControlFull.Tabs[SysConst.EN_LIST].Selected)
                {
                    var removeList = _detailGridDS.Where(x => x.IsChecked == true).ToList();
                    foreach (var loopRemove in removeList)
                    {
                        _detailGridDS.Remove(loopRemove);
                    }
                }
                else
                {
                    var curHead = GridDS.FirstOrDefault(x => x.SI_ID == DetailDS.SI_ID);
                    if (curHead != null)
                    {
                        _detailGridDS.Remove(curHead);
                    }
                }
            }
            else
            {
                if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
                {
                    var curHead = _detailGridDS.FirstOrDefault(x => x.SI_ID == DetailDS.SI_ID);
                    if (curHead != null)
                    {
                        _bll.CopyModel(DetailDS, curHead);
                    }
                    else
                    {
                        _detailGridDS.Insert(0, DetailDS);
                    }
                }
            }

            gdGrid.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 【订阅作业结果】选中TreeView节点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tvUserJob_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (!_isCanAfterCheckOfJob)
            {
                return;
            }
            TreeNode checkNode = e.Node;

            if (checkNode == null)
            {
                return;
            }
            //if (checkNode.Level == 0)
            {
                if (checkNode.Checked)
                {
                    #region 新增用户作业授权

                    //过滤重复的[用户作业授权]
                    if (!_userJobAuthoritiyList.Any(x => x.UJA_User_ID == mcbUserName.SelectedValue &&
                                                    x.BJ_ID == checkNode.Tag.ToString()))
                    {
                        _userJobAuthoritiyList.Add(new UserJobAuthorityUIModel()
                        {
                            UJA_IsValid   = true,
                            UJA_User_ID   = mcbUserName.SelectedValue,
                            UJA_BJ_ID     = checkNode.Tag.ToString(),
                            UJA_CreatedBy = LoginInfoDAX.UserName,
                            UJA_UpdatedBy = LoginInfoDAX.UserName
                        });
                    }

                    #endregion
                }
                else
                {
                    #region  除用户作业授权

                    List <UserJobAuthorityUIModel> deleteUserJobList =
                        _userJobAuthoritiyList.Where(
                            p => p.UJA_User_ID == mcbUserName.SelectedValue && p.BJ_ID == checkNode.Tag.ToString())
                        .ToList();
                    if (deleteUserJobList.Count > 0)
                    {
                        _userJobAuthoritiyList.Remove(deleteUserJobList[0]);
                    }

                    #endregion
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 选中组织节点【只有一级】
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tvOrg_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (!_isCanAfterCheck)
            {
                return;
            }
            TreeNode checkNode = e.Node;

            if (checkNode == null)
            {
                return;
            }
            if (tvOrg.Nodes.Contains(checkNode))
            {
                if (checkNode.Checked)
                {
                    //过滤重复的[用户组织]
                    if (!_userOrgList.Any(x => x.UO_Org_ID == checkNode.Tag?.ToString() && x.UO_User_ID == txtUser_ID.Text.Trim()))
                    {
                        //添加
                        _userOrgList.Add(new UserOrgUIModel()
                        {
                            UO_Org_ID      = checkNode.Tag?.ToString(),
                            UO_User_ID     = txtUser_ID.Text.Trim(),
                            UO_IsValid     = true,
                            UO_CreatedBy   = LoginInfoDAX.UserName,
                            UO_CreatedTime = BLLCom.GetCurStdDatetime(),
                            UO_UpdatedBy   = LoginInfoDAX.UserName,
                            UO_UpdatedTime = BLLCom.GetCurStdDatetime(),
                        });
                    }
                }
                else
                {
                    //删除
                    List <UserOrgUIModel> deleteUserOrgList =
                        _userOrgList.Where(p => p.UO_Org_ID == checkNode.Tag?.ToString() &&
                                           p.UO_User_ID == txtUser_ID.Text.Trim())
                        .ToList();
                    if (deleteUserOrgList.Count > 0)
                    {
                        _userOrgList.Remove(deleteUserOrgList[0]);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 删除仓位
 /// </summary>
 private void DeleteWarehouseBin()
 {
     #region 从列表中删除
     gdGridWarehouseBin.UpdateData();
     //待删除的仓库明细列表
     var deleteWarehouseBinList = _warehouseBinList.Where(p => p.IsChecked == true).ToList();
     if (deleteWarehouseBinList.Count == 0)
     {
         //选择要删除的仓位
         MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0017, new object[] { SystemTableEnums.Name.PIS_WarehouseBin, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     //移除勾选项
     foreach (var loopSalesOrderDetail in deleteWarehouseBinList)
     {
         _warehouseBinList.Remove(loopSalesOrderDetail);
     }
     gdGridWarehouseBin.DataSource = _warehouseBinList;
     gdGridWarehouseBin.DataBind();
     #endregion
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 【菜单动作授权】选中TreeView节点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tvUserMenuAction_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (!_isCanAfterCheckOfMenu)
            {
                return;
            }
            //考虑三种情况 第一:点击菜单  第二:点击菜单明细 第三:点击菜单明细动作
            TreeNode checkNode = e.Node;

            if (checkNode == null)
            {
                return;
            }
            if (checkNode.Level == 0)
            {
                #region 点击菜单的场合

                //该[菜单]下所有[菜单明细]的勾选状态与该[菜单]一致
                foreach (TreeNode loopMenuDetailTreeNode in checkNode.Nodes)
                {
                    loopMenuDetailTreeNode.Checked = checkNode.Checked;
                }

                #endregion
            }
            else if (checkNode.Level == 1)
            {
                #region 点击菜单明细的场合【新增/删除用户菜单明细授权】

                if (checkNode.Checked)
                {
                    #region 新增用户菜单明细授权

                    //过滤重复的[用户菜单明细授权]
                    if (!_userMenuAuthoritiyList.Any(x => x.UMA_User_ID == mcbUserName.SelectedValue &&
                                                     x.UMA_Org_ID == LoginInfoDAX.OrgID &&
                                                     x.UMA_MenuD_ID == checkNode.Tag.ToString()))
                    {
                        _userMenuAuthoritiyList.Add(new UserMenuAuthorityUIModel()
                        {
                            UMA_IsValid   = true,
                            UMA_User_ID   = mcbUserName.SelectedValue,
                            UMA_Org_ID    = LoginInfoDAX.OrgID,
                            UMA_MenuD_ID  = checkNode.Tag.ToString(),
                            UMA_CreatedBy = LoginInfoDAX.UserName,
                            UMA_UpdatedBy = LoginInfoDAX.UserName
                        });
                    }

                    #endregion
                }
                else
                {
                    #region  除用户菜单明细授权

                    List <UserMenuAuthorityUIModel> deleteUserMenuAuthorityList =
                        _userMenuAuthoritiyList.Where(p => p.UMA_Org_ID == LoginInfoDAX.OrgID &&
                                                      p.UMA_User_ID == mcbUserName.SelectedValue &&
                                                      p.UMA_MenuD_ID == checkNode.Tag.ToString()).ToList();
                    if (deleteUserMenuAuthorityList.Count > 0)
                    {
                        _userMenuAuthoritiyList.Remove(deleteUserMenuAuthorityList[0]);
                    }

                    #endregion
                }

                //该[菜单明细]下所有[菜单明细动作]的勾选状态与该[菜单明细]一致
                foreach (TreeNode loopMenuActionTreeNode in checkNode.Nodes)
                {
                    loopMenuActionTreeNode.Checked = checkNode.Checked;
                }

                #endregion
            }
            else if (checkNode.Level == 2)
            {
                #region 点击菜单明细动作的场合【新增/删除用户菜单明细动作授权】

                if (checkNode.Checked)
                {
                    #region 新增用户菜单明细动作授权

                    //过滤重复的[用户菜单明细动作授权]
                    if (!_userActionAuthoritiyList.Any(x => x.UAA_User_ID == mcbUserName.SelectedValue &&
                                                       x.UAA_Org_ID == LoginInfoDAX.OrgID &&
                                                       x.UAA_MenuD_ID == checkNode.Parent.Tag.ToString() &&
                                                       x.UAA_Action_ID == checkNode.Tag.ToString()))
                    {
                        _userActionAuthoritiyList.Add(new UserActionAuthorityUIModel()
                        {
                            UAA_IsValid   = true,
                            UAA_User_ID   = mcbUserName.SelectedValue,
                            UAA_Org_ID    = LoginInfoDAX.OrgID,
                            UAA_MenuD_ID  = checkNode.Parent.Tag.ToString(),
                            UAA_Action_ID = checkNode.Tag.ToString(),
                            UAA_CreatedBy = LoginInfoDAX.UserName,
                            UAA_UpdatedBy = LoginInfoDAX.UserName
                        });
                    }

                    #endregion
                }
                else
                {
                    #region  除用户菜单明细动作授权

                    List <UserActionAuthorityUIModel> deleteUserActionAuthorityList =
                        _userActionAuthoritiyList.Where(p => p.UAA_Org_ID == LoginInfoDAX.OrgID &&
                                                        p.UAA_User_ID == mcbUserName.SelectedValue &&
                                                        p.UAA_MenuD_ID == checkNode.Parent.Tag.ToString() &&
                                                        p.UAA_Action_ID == checkNode.Tag.ToString()).ToList();
                    if (deleteUserActionAuthorityList.Count > 0)
                    {
                        _userActionAuthoritiyList.Remove(deleteUserActionAuthorityList[0]);
                    }

                    #endregion
                }

                #endregion
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="paramHead">待保存的车辆信息</param>
        /// <param name="paramVehicleOemPartsList">待保存的原厂件信息列表</param>
        /// <param name="paramVehicleBrandPartsList">待保存的品牌件信息列表</param>
        /// <param name="paramIsJoinVinInfo">是否合并当前车架号的信息</param>
        /// <returns></returns>
        public bool SaveDetailDS(VehicleModelMatchAutoPartsManagerUIModel paramHead, SkyCarBindingList <VehicleOemPartsInfoUIModel, MDLBS_VehicleOemPartsInfo> paramVehicleOemPartsList, SkyCarBindingList <VehicleThirdPartsInfoUIModel, MDLBS_VehicleThirdPartsInfo> paramVehicleBrandPartsList, bool paramIsJoinVinInfo)
        {
            var funcName = "SaveDetailDS";

            LogHelper.WriteBussLogStart(BussID, LoginInfoDAX.UserName, funcName, "", "", null);

            #region 准备数据

            //待同步的[车辆信息列表]
            List <VehicleModelMatchAutoPartsManagerUIModel> syncVehicleInfoList = new List <VehicleModelMatchAutoPartsManagerUIModel>();
            //待同步的[车辆原厂件信息列表]
            List <VehicleOemPartsInfoUIModel> syncVehicleOemPartsInfoList = new List <VehicleOemPartsInfoUIModel>();
            //待同步的[车辆品牌件信息列表]
            List <VehicleThirdPartsInfoUIModel> syncVehicleBrandPartsInfoList = new List <VehicleThirdPartsInfoUIModel>();

            #region 车辆信息

            //待保存的[车辆信息]
            MDLBS_VehicleInfo saveVehicleInfo = new MDLBS_VehicleInfo();

            if (paramIsJoinVinInfo)
            {
                #region 合并当前车架号对应信息的场合

                //查询当前车架号对应的车辆信息
                _bll.QueryForObject <MDLBS_VehicleInfo, MDLBS_VehicleInfo>(new MDLBS_VehicleInfo
                {
                    WHERE_VC_VIN     = paramHead.VC_VIN,
                    WHERE_VC_IsValid = true,
                }, saveVehicleInfo);
                saveVehicleInfo.VC_UpdatedBy       = LoginInfoDAX.UserName;
                saveVehicleInfo.VC_UpdatedTime     = BLLCom.GetCurStdDatetime();
                saveVehicleInfo.WHERE_VC_ID        = saveVehicleInfo.VC_ID;
                saveVehicleInfo.WHERE_VC_VersionNo = saveVehicleInfo.VC_VersionNo;

                //查询当前车架号对应的所有[原厂件信息]
                List <MDLBS_VehicleOemPartsInfo> resultVehicleOemPartsInfoList = new List <MDLBS_VehicleOemPartsInfo>();
                _bll.QueryForList <MDLBS_VehicleOemPartsInfo, MDLBS_VehicleOemPartsInfo>(new MDLBS_VehicleOemPartsInfo
                {
                    WHERE_VOPI_VC_VIN  = saveVehicleInfo.VC_VIN,
                    WHERE_VOPI_IsValid = true,
                }, resultVehicleOemPartsInfoList);

                //查询当前车架号对应的所有[品牌件信息]
                List <MDLBS_VehicleThirdPartsInfo> resultVehicleBrandPartsInfoList = new List <MDLBS_VehicleThirdPartsInfo>();
                _bll.QueryForList <MDLBS_VehicleThirdPartsInfo, MDLBS_VehicleThirdPartsInfo>(new MDLBS_VehicleThirdPartsInfo
                {
                    WHERE_VTPI_VC_VIN  = saveVehicleInfo.VC_VIN,
                    WHERE_VTPI_IsValid = true,
                }, resultVehicleBrandPartsInfoList);

                //移除重复的[原厂件信息]
                foreach (var loopOemParts in resultVehicleOemPartsInfoList)
                {
                    var curOemParts = paramVehicleOemPartsList.FirstOrDefault(
                        x => x.VOPI_VC_VIN == loopOemParts.VOPI_VC_VIN && x.VOPI_OEMNo == loopOemParts.VOPI_OEMNo);
                    if (curOemParts != null)
                    {
                        paramVehicleOemPartsList.Remove(curOemParts);
                    }
                }

                //移除重复的[品牌件信息]
                foreach (var loopBrandParts in resultVehicleBrandPartsInfoList)
                {
                    var curBrandParts = paramVehicleBrandPartsList.FirstOrDefault(x =>
                                                                                  x.VTPI_VC_VIN == loopBrandParts.VTPI_VC_VIN &&
                                                                                  x.VTPI_ThirdNo == loopBrandParts.VTPI_ThirdNo);
                    if (curBrandParts != null)
                    {
                        paramVehicleBrandPartsList.Remove(curBrandParts);
                    }
                }
                #endregion
            }
            else
            {
                #region  合并当前车架号对应信息的场合

                //将UIModel转为TBModel
                saveVehicleInfo = paramHead.ToTBModelForSaveAndDelete <MDLBS_VehicleInfo>();
                //判断主键是否被赋值
                if (string.IsNullOrEmpty(paramHead.VC_ID))
                {
                    saveVehicleInfo.VC_ID          = Guid.NewGuid().ToString();
                    saveVehicleInfo.VC_CreatedBy   = LoginInfoDAX.UserName;
                    saveVehicleInfo.VC_CreatedTime = BLLCom.GetCurStdDatetime();
                }
                saveVehicleInfo.VC_UpdatedBy   = LoginInfoDAX.UserName;
                saveVehicleInfo.VC_UpdatedTime = BLLCom.GetCurStdDatetime();
                #endregion
            }

            VehicleModelMatchAutoPartsManagerUIModel syncehicleInfo = new VehicleModelMatchAutoPartsManagerUIModel();
            _bll.CopyModel(saveVehicleInfo, syncehicleInfo);
            syncehicleInfo.VC_OperateType = "Save";
            syncVehicleInfoList.Add(syncehicleInfo);

            #endregion

            #region 原厂件信息

            //添加的明细
            foreach (var loopDetailItem in paramVehicleOemPartsList.InsertList)
            {
                loopDetailItem.VOPI_VC_VIN      = saveVehicleInfo.VC_VIN;
                loopDetailItem.VOPI_CreatedBy   = LoginInfoDAX.UserName;
                loopDetailItem.VOPI_CreatedTime = BLLCom.GetCurStdDatetime();
                loopDetailItem.VOPI_UpdatedBy   = LoginInfoDAX.UserName;
                loopDetailItem.VOPI_UpdatedTime = BLLCom.GetCurStdDatetime();

                loopDetailItem.VOPI_OperateType = "Save";
            }

            //更新的明细
            foreach (var loopDetailItem in paramVehicleOemPartsList.UpdateList)
            {
                loopDetailItem.VOPI_VC_VIN      = saveVehicleInfo.VC_VIN;
                loopDetailItem.VOPI_UpdatedBy   = LoginInfoDAX.UserName;
                loopDetailItem.VOPI_UpdatedTime = BLLCom.GetCurStdDatetime();

                loopDetailItem.VOPI_OperateType = "Save";
            }

            //删除的明细
            foreach (var loopDetailItem in paramVehicleOemPartsList.DeleteList)
            {
                loopDetailItem.VOPI_OperateType = "Delete";
            }
            syncVehicleOemPartsInfoList.AddRange(paramVehicleOemPartsList.InsertList);
            syncVehicleOemPartsInfoList.AddRange(paramVehicleOemPartsList.UpdateList);
            syncVehicleOemPartsInfoList.AddRange(paramVehicleOemPartsList.DeleteList);
            #endregion

            #region 品牌件信息

            //添加的明细
            foreach (var loopDetailItem in paramVehicleBrandPartsList.InsertList)
            {
                loopDetailItem.VTPI_VC_VIN      = saveVehicleInfo.VC_VIN;
                loopDetailItem.VTPI_CreatedBy   = LoginInfoDAX.UserName;
                loopDetailItem.VTPI_CreatedTime = BLLCom.GetCurStdDatetime();
                loopDetailItem.VTPI_UpdatedBy   = LoginInfoDAX.UserName;
                loopDetailItem.VTPI_UpdatedTime = BLLCom.GetCurStdDatetime();

                loopDetailItem.VTPI_OperateType = "Save";
            }

            //更新的明细
            foreach (var loopDetailItem in paramVehicleBrandPartsList.UpdateList)
            {
                loopDetailItem.VTPI_VC_VIN      = saveVehicleInfo.VC_VIN;
                loopDetailItem.VTPI_UpdatedBy   = LoginInfoDAX.UserName;
                loopDetailItem.VTPI_UpdatedTime = BLLCom.GetCurStdDatetime();

                loopDetailItem.VTPI_OperateType = "Save";
            }

            //删除的明细
            foreach (var loopDetailItem in paramVehicleBrandPartsList.DeleteList)
            {
                loopDetailItem.VTPI_OperateType = "Delete";
            }
            syncVehicleBrandPartsInfoList.AddRange(paramVehicleBrandPartsList.InsertList);
            syncVehicleBrandPartsInfoList.AddRange(paramVehicleBrandPartsList.UpdateList);
            syncVehicleBrandPartsInfoList.AddRange(paramVehicleBrandPartsList.DeleteList);
            #endregion

            #endregion

            #region  步到平台

            if (!SynchronizeVehicleRelateInfo(syncVehicleInfoList, syncVehicleOemPartsInfoList, syncVehicleBrandPartsInfoList))
            {
                //同步到平台失败
                ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.SAVE, "同步平台失败" });
                return(false);
            }
            #endregion

            #region 带事务的保存

            try
            {
                DBManager.BeginTransaction(DBCONFIG.Coeus);

                #region 保存[车辆信息]

                var saveVehicleInfoResult = _bll.Save(saveVehicleInfo, saveVehicleInfo.VC_ID);
                if (!saveVehicleInfoResult)
                {
                    DBManager.RollBackTransaction(DBCONFIG.Coeus);

                    //保存本地失败的场合,还原平台上保存的信息
                    RestoreSavePlatformInfo(saveVehicleInfo, paramVehicleOemPartsList, paramVehicleBrandPartsList);

                    ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.SAVE + SystemTableEnums.Name.BS_VehicleInfo });
                    LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                    return(false);
                }

                #endregion

                #region 保存[车辆原厂件信息]

                var saveOemPartsResult = _bll.UnitySave(paramVehicleOemPartsList);
                if (!saveOemPartsResult)
                {
                    DBManager.RollBackTransaction(DBCONFIG.Coeus);

                    //保存本地失败的场合,还原平台上保存的信息
                    RestoreSavePlatformInfo(saveVehicleInfo, paramVehicleOemPartsList, paramVehicleBrandPartsList);

                    ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.SAVE + SystemTableEnums.Name.BS_VehicleOemPartsInfo });
                    LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                    return(false);
                }

                #endregion

                #region 保存[车辆品牌件信息]

                var saveBrandPartsResult = _bll.UnitySave(paramVehicleBrandPartsList);
                if (!saveBrandPartsResult)
                {
                    DBManager.RollBackTransaction(DBCONFIG.Coeus);

                    //保存本地失败的场合,还原平台上保存的信息
                    RestoreSavePlatformInfo(saveVehicleInfo, paramVehicleOemPartsList, paramVehicleBrandPartsList);

                    ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.SAVE + SystemTableEnums.Name.BS_VehicleBrandPartsInfo });
                    LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                    return(false);
                }

                #endregion

                DBManager.CommitTransaction(DBCONFIG.Coeus);
            }
            catch (Exception ex)
            {
                DBManager.RollBackTransaction(DBCONFIG.Coeus);

                //保存本地失败的场合,还原平台上保存的信息
                RestoreSavePlatformInfo(saveVehicleInfo, paramVehicleOemPartsList, paramVehicleBrandPartsList);

                ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.SAVE, ex.Message });
                LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ex.Message, "", null);
                return(false);
            }

            #endregion

            //将最新数据回写给DetailDS
            CopyModel(saveVehicleInfo, paramHead);

            #region 更新[车辆原厂件信息]版本号
            foreach (var loopInsertDetail in paramVehicleOemPartsList.InsertList)
            {
                //新增时版本号为1
                loopInsertDetail.VOPI_VersionNo = 1;
            }
            foreach (var loopUpdateDetail in paramVehicleOemPartsList.UpdateList)
            {
                //更新时版本号加1
                loopUpdateDetail.VOPI_VersionNo = loopUpdateDetail.VOPI_VersionNo + 1;
            }
            #endregion

            #region 更新[车辆品牌件信息]版本号
            foreach (var loopInsertDetail in paramVehicleBrandPartsList.InsertList)
            {
                //新增时版本号为1
                loopInsertDetail.VTPI_VersionNo = 1;
            }
            foreach (var loopUpdateDetail in paramVehicleBrandPartsList.UpdateList)
            {
                //更新时版本号加1
                loopUpdateDetail.VTPI_VersionNo = loopUpdateDetail.VTPI_VersionNo + 1;
            }
            #endregion

            return(true);
        }