Exemplo n.º 1
0
        private void txtAssociatedBillNo_Click(object sender, EventArgs e)
        {
            if (cmbSiteSource.SelectedIndex == 2)
            {
                FormQueryInfo frm = QueryInfoDialog.GetFeedBackBill("", "");
                frm.ShowDialog();

                if ((string)frm.GetDataItem("反馈单号") != null)
                {
                    txtAssociatedBillNo.ReadOnly = true;

                    txtAssociatedBillNo.Text = (string)frm.GetDataItem("反馈单号");
                    txtApplicant.Tag         = m_personnerServer.GetPersonnelViewInfoByName((string)frm.GetDataItem("反馈人"));
                    txtApplicant.Text        = (string)frm.GetDataItem("反馈人");

                    dtpxtApplicant.Value = (DateTime)frm.GetDataItem("反馈日期");
                    txtBugDescribe.Text  = (string)frm.GetDataItem("故障说明");

                    txtBugDescribe.ReadOnly = true;
                    txtApplicant.Enabled    = false;
                    dtpxtApplicant.Enabled  = false;
                }
            }
            else
            {
                txtAssociatedBillNo.ReadOnly = false;
            }
        }
        private void btnLoadExcel_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog        openFileDialog1 = new OpenFileDialog();
                System.Data.DataTable dtTemp          = ExcelHelperP.RenderFromExcel(openFileDialog1);

                if (dtTemp == null || dtTemp.Rows.Count == 0 || dtTemp.Columns.Count < 8 || dtTemp.Rows.Count != 39)
                {
                    MessageDialog.ShowPromptMessage("加载的EXCEL文件数据格式错误");
                    return;
                }

                string error       = null;
                string productCode = dtTemp.Rows[0][3].ToString();
                string cvtNumber   = dtTemp.Rows[0][6].ToString();

                if (!ServerModule.ServerModuleFactory.GetServerModule <IProductCodeServer>().VerifyProductCodesInfo(
                        productCode, cvtNumber, GlobalObject.CE_BarCodeType.内部钢印码, out error))
                {
                    MessageDialog.ShowErrorMessage(error);
                    return;
                }

                string 试验设备名称 = dtTemp.Rows[1][3].ToString();
                string 油品     = "出光1";
                string 试验结果   = dtTemp.Rows[37][5].ToString();

                IPersonnelArchiveServer personnelInfoServer = Service_Peripheral_HR.ServerModuleFactory.GetServerModule <IPersonnelArchiveServer>();

                string 装配员工号 = personnelInfoServer.GetPersonnelViewInfoByName(dtTemp.Rows[38][4].ToString());

                if (GlobalObject.GeneralFunction.IsNullOrEmpty(装配员工号))
                {
                    MessageDialog.ShowPromptMessage("文件中的装配员姓名在公司不唯一,无法获取到员工编号");
                    return;
                }

                string 线员工号 = personnelInfoServer.GetPersonnelViewInfoByName(dtTemp.Rows[38][7].ToString());

                if (GlobalObject.GeneralFunction.IsNullOrEmpty(线员工号))
                {
                    MessageDialog.ShowPromptMessage("文件中的下线员姓名在公司不唯一,无法获取到员工编号");
                    return;
                }

                string remark = dtTemp.Rows[35][2].ToString();

                remark += string.Format("【工号:{0}, 姓名:{1}从EXCEL文件中导入】", BasicInfo.LoginID, BasicInfo.LoginName);

                DataTable dt = new DataTable();

                dt.Columns.Add("TestType");         // 试验类型,如:基本功能、N挡磨合等
                dt.Columns.Add("TestItemName");     // 试验项目,如:密封性、传动平稳
                dt.Columns.Add("TestCondition");    // 试验条件,如:整个试验过程中
                dt.Columns.Add("TestRequirement");  // 试验要求,如:总成各结合面、外表面及油封刃口处不得有渗透现象
                dt.Columns.Add("TestData");         // 试验数据,如:0.5Mpa
                dt.Columns.Add("TestResult");       // 试验结论,如:合格

                string 检测项目     = "";
                string 试验项目     = "";
                string 试验条件     = "";
                string 试验要求     = "";
                string 检测数据     = "";
                string 试验项目测试结果 = "";
                string 试验项目备份   = "";

                for (int i = 3; i < 35; i++)
                {
                    if (!GlobalObject.GeneralFunction.IsNullOrEmpty(dtTemp.Rows[i][1].ToString()))
                    {
                        检测项目   = dtTemp.Rows[i][1].ToString();
                        试验项目   = "";
                        试验项目备份 = "";
                    }

                    if (!GlobalObject.GeneralFunction.IsNullOrEmpty(dtTemp.Rows[i][2].ToString()))
                    {
                        试验项目备份 = dtTemp.Rows[i][2].ToString();

                        if (!GlobalObject.GeneralFunction.IsNullOrEmpty(dtTemp.Rows[i][3].ToString()))
                        {
                            试验项目 = dtTemp.Rows[i][2].ToString() + "-" + dtTemp.Rows[i][3].ToString();
                        }
                        else
                        {
                            试验项目 = dtTemp.Rows[i][2].ToString();
                        }

                        试验条件 = "";
                    }
                    else if (!GlobalObject.GeneralFunction.IsNullOrEmpty(dtTemp.Rows[i][3].ToString()))
                    {
                        试验项目 = 试验项目备份 + "-" + dtTemp.Rows[i][3].ToString();
                        试验条件 = "";
                    }

                    if (!GlobalObject.GeneralFunction.IsNullOrEmpty(dtTemp.Rows[i][4].ToString()))
                    {
                        试验条件 = dtTemp.Rows[i][4].ToString();
                    }

                    试验要求     = dtTemp.Rows[i][5].ToString();
                    检测数据     = dtTemp.Rows[i][6].ToString();
                    试验项目测试结果 = dtTemp.Rows[i][7].ToString();

                    dt.Rows.Add(new object[] { 检测项目, 试验项目, 试验条件, 试验要求, 检测数据, 试验项目测试结果 });
                }

                CvtTestInfo testInfo = new CvtTestInfo(
                    productCode + " " + cvtNumber, 试验设备名称, 油品, 试验结果, 装配员工号, 线员工号, remark, dt);

                m_cvtTestDataService.SaveCVTExpData(testInfo);

                MessageDialog.ShowPromptMessage(string.Format("导入【{0}】文件成功!", openFileDialog1.FileName));
            }
            catch (Exception exce)
            {
                MessageDialog.ShowErrorMessage(exce.Message);
            }

            //for (int row = 0; row < dtTemp.Rows.Count; row++)
            //{
            //    for (int col = 0; col < dtTemp.Columns.Count; col++)
            //    {
            //        Console.Write("[{0}, {1}]:{2}\t", row, col, dtTemp.Rows[row][col].ToString());
            //    }

            //    Console.WriteLine();
            //}
        }
Exemplo n.º 3
0
        private void 财务toolStripButton_Click(object sender, EventArgs e)
        {
            if (m_marketPartBillServer.GetDataByBillNo(m_billNo).Rows[0]["单据状态"].ToString() == "等待财务审核" ||
                m_marketPartBillServer.GetDataByBillNo(m_billNo).Rows[0]["单据状态"].ToString() == "已完成")
            {
                if (txtClient.Text.Trim() != "" && txtClient.Text.Trim() != "全部" && txtClient.Text.Trim() != "其它")
                {
                    if (Convert.ToDecimal(txtLowestPrice.Text) > numSellUnitPrice.Value)
                    {
                        MessageDialog.ShowPromptMessage("请重新填写销售价格!");
                        return;
                    }

                    for (int i = 0; i < m_listMarketPart.Count; i++)
                    {
                        for (int j = 0; j < dataGridView1.Rows.Count; j++)
                        {
                            if (m_listMarketPart[i].GoodsID == dataGridView1.Rows[j].Cells["GoodsID"].Value.ToString() &&
                                m_listMarketPart[i].批次号 == dataGridView1.Rows[j].Cells["批次号"].Value.ToString() &&
                                m_listMarketPart[i].供应商 == dataGridView1.Rows[j].Cells["供应商"].Value.ToString())
                            {
                                m_listMarketPart[i].备注      = m_listMarketPart[i].备注 + " " + txtRemark.Text;
                                m_listMarketPart[i].销售单价    = numSellUnitPrice.Value;
                                m_listMarketPart[i].主机厂代码   = tbsOutCode.Text;
                                m_listMarketPart[i].主机厂物品名称 = txtOutName.Text;
                                m_listMarketPart[i].最低定价    = Convert.ToDecimal(txtLowestPrice.Text);
                                m_listMarketPart[i].供应商     = txtprovider.Text.Trim();
                            }
                        }
                    }

                    S_MarketingPartBill bill = new S_MarketingPartBill();

                    bill.ClientID         = txtClient.Tag.ToString();
                    bill.Remark           = txtMainRemark.Text;
                    bill.CW_Auditor       = BasicInfo.LoginID;
                    bill.CW_AuditTime     = ServerTime.Time;
                    bill.Status           = "已完成";
                    bill.BillNo           = m_billNo;
                    bill.AssociatedBillNo = txtAssociated.Text;

                    if (!m_marketPartBillServer.UpdateData(bill, m_listMarketPart, "财务", out m_error))
                    {
                        MessageDialog.ShowPromptMessage(m_error);
                        return;
                    }
                    else
                    {
                        MessageDialog.ShowPromptMessage("审核成功!");
                    }

                    List <string> noticeUser = new List <string>();

                    noticeUser.Add(m_personnerArchiveServer.GetPersonnelViewInfoByName(txtRecorder.Text));

                    m_billMessageServer.EndFlowMessage(m_billNo,
                                                       string.Format("{0} 号销售清单已经处理完毕", m_billNo),
                                                       null, noticeUser);
                }
                else
                {
                    MessageDialog.ShowPromptMessage("客户不正确,请重新选择!");
                    return;
                }
            }
            else
            {
                MessageDialog.ShowPromptMessage("请确认单据状态!");
                return;
            }

            this.Close();
        }