Ejemplo n.º 1
0
        /// <summary>
        /// 【详情】选择配件名称
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtSI_Name_EditorButtonClick(object sender, EditorButtonEventArgs e)
        {
            //查询配件档案
            FrmAutoPartsArchiveQuery frmAutoPartsArchiveQuery = new FrmAutoPartsArchiveQuery()
            {
                StartPosition = FormStartPosition.CenterScreen
            };
            DialogResult dialogResult = frmAutoPartsArchiveQuery.ShowDialog();

            if (dialogResult != DialogResult.OK)
            {
                return;
            }
            var selectedAutoPartsArchiveList = frmAutoPartsArchiveQuery.SelectedGridList;

            foreach (var loopAutoPartsArchive in selectedAutoPartsArchiveList)
            {
                txtSI_Org_ID.Text                   = LoginInfoDAX.OrgID;
                txtSI_ThirdNo.Text                  = loopAutoPartsArchive.APA_ThirdNo;
                txtSI_OEMNo.Text                    = loopAutoPartsArchive.APA_OEMNo;
                txtSI_Barcode.Text                  = loopAutoPartsArchive.APA_Barcode;
                txtSI_Name.Text                     = loopAutoPartsArchive.APA_Name;
                txtSI_Specification.Text            = loopAutoPartsArchive.APA_Specification;
                ckSI_PurchasePriceIsVisible.Checked = false;
                ckSI_IsValid.Checked                = true;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增
        /// </summary>
        public override void NewAction()
        {
            #region 检查详情是否已保存

            SetCardCtrlsToDetailDS();
            base.NewUIModel = DetailDS;
            if (ViewHasChanged(_skipPropertyList) ||
                _detailGridDS.InsertList.Count > 0 ||
                _detailGridDS.UpdateList.Count > 0 ||
                _detailGridDS.DeleteList.Count > 0)
            {
                //信息尚未保存,确定进行当前操作?
                DialogResult dialogResult = MessageBoxs.Show(Trans.IS, ToString(), MsgHelp.GetMsg(MsgCode.W_0001), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }
            }
            #endregion

            //执行基类方法
            base.NewAction();

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                #region 当前选中【详情】Tab的场合,初始化【详情】

                //初始化【详情】Tab内控件
                InitializeDetailTabControls();

                //将最新的值Copy到初始UIModel
                SetCardCtrlsToDetailDS();
                this.AcceptUIModelChanges();
                #endregion
            }
            else
            {
                #region 当前选中【列表】Tab的场合,查询配件档案

                FrmAutoPartsArchiveQuery frmAutoPartsArchiveQuery = new FrmAutoPartsArchiveQuery(CustomEnums.CustomeSelectionMode.Multiple)
                {
                    StartPosition = FormStartPosition.CenterScreen
                };
                DialogResult dialogResult = frmAutoPartsArchiveQuery.ShowDialog();
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }
                List <MDLBS_AutoPartsArchive> selectedAutoPartsArchiveList = new List <MDLBS_AutoPartsArchive>();
                selectedAutoPartsArchiveList = frmAutoPartsArchiveQuery.SelectedGridList;
                //选择的数据中重复的数量
                int repeatCount = 0;
                foreach (var loopAutoPartsArchive in selectedAutoPartsArchiveList)
                {
                    var isRepeat = false;
                    foreach (var loopGrid in _detailGridDS)
                    {
                        if (loopGrid.SI_Barcode == loopAutoPartsArchive.APA_Barcode)
                        {
                            isRepeat     = true;
                            repeatCount += 1;
                            continue;
                        }
                    }
                    if (!isRepeat)
                    {
                        AutoPartsShareInventoryManagerUIModel shareInventory = new AutoPartsShareInventoryManagerUIModel
                        {
                            RowID                     = Guid.NewGuid().ToString(),
                            SI_Org_ID                 = LoginInfoDAX.OrgID,
                            SI_ThirdNo                = loopAutoPartsArchive.APA_ThirdNo,
                            SI_OEMNo                  = loopAutoPartsArchive.APA_OEMNo,
                            SI_Barcode                = loopAutoPartsArchive.APA_Barcode,
                            SI_Name                   = loopAutoPartsArchive.APA_Name,
                            SI_Specification          = loopAutoPartsArchive.APA_Specification,
                            SI_PurchasePriceIsVisible = false,
                            SI_IsValid                = true
                        };
                        shareInventory.SI_CreatedBy   = shareInventory.SI_UpdatedBy = LoginInfoDAX.UserName;
                        shareInventory.SI_CreatedTime = shareInventory.SI_UpdatedTime = BLLCom.GetCurStdDatetime();
                        _detailGridDS.Insert(0, shareInventory);
                    }
                }
                //4.Grid绑定数据源
                gdGrid.DataSource = _detailGridDS;
                gdGrid.DataBind();
                //5.设置Grid自适应列宽(根据单元格内容)
                gdGrid.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows);

                if (repeatCount > 0)
                {
                    MessageBoxs.Show(Trans.IS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0000, new object[] { "已过滤" + repeatCount + "条重复的数据!" }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                #endregion
            }
        }