Example #1
0
        /// <summary>
        /// 零件文档扫描
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void scanBtn_Click(object sender, EventArgs e)
        {
            UltraGridRow row = this.comGrid.ActiveRow;
            if (row == null)
            {
                return;
            }
            Prod_Doc doc = row.ListObject as Prod_Doc;

            if (string.IsNullOrEmpty(doc.PRDQ_Code))
            {
                Alert.Show("请先填写报告编号!");
                return;
            }

            if (doc.PRDQ_IsScan == 1 && !row.IsAddRow)
            {
                ConfirmWin confirmWin = new ConfirmWin();
                confirmWin.ShowDialog();
                if (!confirmWin.IsAllow)
                {
                    Alert.Show("当前文档已扫描,不能进行重复扫描覆盖操作!");
                    return;
                }
            }

            string dcode = doc.PRDQ_Code;
            string compNo = string.Empty;
            if (compNoEditor != null)
            {
                compNo = compNoEditor.Text;
            }
            string filename = compNo + "_" + dcode + "_" + DateTime.Now.ToString("yyyy-MM-dd");
            CC_File file = new CC_File();
            try
            {
                //file =StartScan(filename, dcode);
                StartScan(filename, dcode);
                row.Appearance.BackColor = Color.Wheat;
                doc.PRDQ_IsScan = 1;
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }

            //if (file != null)
            //{
            //    //if (doc.PRDQ_ID != 0)
            //    //{
            //    //    file.Stat = 0;
            //    //}
            //    //CCFileList.Add(file);

            //}
        }
Example #2
0
        void top_tool_bar_DelClicked(object sender, EventArgs e)
        {
            var rows = this.comGrid.Selected.Rows;
            if (rows.Count == 0)
            {
                UltraGridRow row = this.comGrid.ActiveRow;
                if (row != null)
                {
                    rows.Add(row);
                }
            }
            if (rows.Count == 0)
            {
                Alert.Show("请选中要删除的行!");
                return;
            }

            if (Alert.ShowIsConfirm("确定删除该零件吗?"))
            {
                StringBuilder sb = new StringBuilder();
                ConfirmWin confirmWin = new ConfirmWin();
                confirmWin.Text = "零件删除确认界面";
                confirmWin.ShowDialog();
                if (!confirmWin.IsAllow)
                {
                    Alert.Show("你没有删除该零件的权限!");
                    return;
                }
                else
                {
                    List<Prod_Components> list = new List<Prod_Components>();

                    foreach (var r in rows)
                    {

                        Prod_Components comp = r.ListObject as Prod_Components;
                        compInstance.DeleteDocByComp(comp);
                        if (!compInstance.CompDelete(comp))
                        {
                            sb.Append(comp.PRDC_CompNo).Append(",");
                        }
                        list.Add(comp);
                    }

                    if (sb.ToString().Length == 0)
                    {

                        Alert.Show("数据更新成功!");
                    }
                    else
                    {

                        Alert.Show(string.Format("以下零件未能成功删除!{0}", sb.ToString().TrimEnd(',')));
                    }

                    MethodInvoker mi = delegate
                    {
                        foreach (var c in list)
                        {
                            DeleteFolder(c.PRDC_CompNo);
                        }
                    };

                    mi.BeginInvoke(null, null);

                    BindData();
                }
            }

            //UltraGridRow row = this.comGrid.ActiveRow;
            //if (row != null)
            //{
            //    ConfirmWin confirmWin = new ConfirmWin();
            //    confirmWin.Text = "零件删除确认界面";
            //    confirmWin.ShowDialog();
            //    if (!confirmWin.IsAllow)
            //    {
            //        Alert.Show("你没有删除该零件的权限!");
            //        return;
            //    }
            //    else
            //    {

            //        Prod_Components comp = row.ListObject as Prod_Components;
            //        compInstance.DeleteDocByComp(comp);
            //        compInstance.CompDelete(comp);

            //        MethodInvoker mi = delegate
            //        {
            //            DeleteFolder(comp.PRDC_CompNo);
            //        };

            //        mi.BeginInvoke(null, null);
            //        Alert.Show("删除成功!");
            //        BindData();
            //    }
            //}
        }
Example #3
0
        /// <summary>
        /// 零件文档扫描
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void scanBtn_Click(object sender, EventArgs e)
        {
            UltraGridRow row = this.prodDocGrid.ActiveRow;
            if (row == null)
            {
                return;
            }
            Prod_Doc doc = row.ListObject as Prod_Doc;

            if (string.IsNullOrEmpty(doc.PRDQ_Code))
            {
                Alert.Show("请先填写报告编号!");
                return;
            }

            if (doc.PRDQ_IsScan == 1)
            {
                ConfirmWin confirmWin = new ConfirmWin();
                confirmWin.ShowDialog();
                if (!confirmWin.IsAllow)
                {
                    Alert.Show("当前文档已扫描,不能进行重复扫描覆盖操作!");
                    return;
                }
            }

            string dcode = doc.PRDQ_Code;

            //string filename = GModel.PRM_Code + "_" + dcode + "_" + DateTime.Now.ToString("yyyy-MM-dd");

            //var file = StartScan(filename, dcode);

            //if (file != null)
            //{
            //    if (doc.PRDQ_ID != 0)
            //    {
            //        file.Stat = 1;
            //    }
            //    CCFileList.Add(file);

            //    Alert.Show("扫描完成!");

            //    row.Appearance.BackColor = Color.Wheat;
            //    doc.PRDQ_IsScan = 1;
            //}

            var com = bmHelper.FindCtl<UltraTextEditor>(this.pnlGrid.Controls, "PRM_Code");
            string prodcode = com.Text;
            if (string.IsNullOrEmpty(prodcode))
            {
                Alert.Show("请输入编号!");
                return;
            }
            string filename = prodcode + "_" + dcode + "_" + DateTime.Now.ToString("yyyy-MM-dd");
            CC_File file = new CC_File();
            try
            {
                StartScan(filename, dcode);
                row.Appearance.BackColor = Color.Wheat;
                doc.PRDQ_IsScan = 1;
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
        }