Beispiel #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (!CheckDate_ADD())
            {
                return;
            }

            m_listDebitSchedule = (dataGridView1.DataSource as BindingCollection <View_S_DebitSchedule>).ToList();

            View_S_DebitSchedule tempLnq = new View_S_DebitSchedule();

            tempLnq.单据号      = txtSDBNo.Text;
            tempLnq.规格       = txtSpec.Text;
            tempLnq.图号型号     = txtCode.Text;
            tempLnq.物品ID     = (int)txtCode.Tag;
            tempLnq.物品名称     = txtName.Text;
            tempLnq.总成编码     = txtEditionCode.Text;
            tempLnq.基数       = numRedices.Value;
            tempLnq.适用范围     = cmbApplicable.Text;
            tempLnq.一次性整台份发料 = chbOnceTheWholeIssue.Checked;

            m_listDebitSchedule.Add(tempLnq);

            RefreshDataGridView(m_listDebitSchedule);
        }
Beispiel #2
0
        private void txtEditionCode_OnCompleteSearch()
        {
            if (cmbApplicable.Text.Length == 0)
            {
                MessageDialog.ShowPromptMessage("请先选择适用范围");
                txtEditionCode.Text = "";
                txtEditionCode.Tag  = null;
                return;
            }

            if (txtEditionCode.DataResult == null)
            {
                return;
            }

            txtEditionCode.Text = txtEditionCode.DataResult["图号型号"].ToString();

            if (lbSDBStatus.Text == ProductOrderListStatus.新建单据.ToString())
            {
                m_listDebitSchedule = new List <View_S_DebitSchedule>();
                DataTable tempTable = m_findProductOrder.GetAllData(txtEditionCode.Text.ToString(),
                                                                    GlobalObject.GeneralFunction.StringConvertToEnum <CE_DebitScheduleApplicable>(cmbApplicable.Text));

                foreach (DataRow dr in tempTable.Rows)
                {
                    View_S_DebitSchedule tempLnq = new View_S_DebitSchedule();

                    tempLnq.单据号      = txtSDBNo.Text;
                    tempLnq.规格       = dr["规格"].ToString();
                    tempLnq.基数       = (decimal)dr["基数"];
                    tempLnq.图号型号     = dr["零件编码"].ToString();
                    tempLnq.物品ID     = (int)dr["物品ID"];
                    tempLnq.物品名称     = dr["零件名称"].ToString();
                    tempLnq.总成编码     = dr["产品编码"].ToString();
                    tempLnq.适用范围     = dr["适用范围"].ToString();
                    tempLnq.一次性整台份发料 = Convert.ToBoolean(dr["一次性整台份发料"]);

                    m_listDebitSchedule.Add(tempLnq);
                }

                RefreshDataGridView(m_listDebitSchedule);
            }
        }
Beispiel #3
0
        void SetTempSource()
        {
            m_listDebitSchedule_Temp = new List <View_S_DebitSchedule>();

            foreach (View_S_DebitSchedule item in m_listDebitSchedule)
            {
                View_S_DebitSchedule tempLnq = new View_S_DebitSchedule();

                tempLnq.单据号      = item.单据号;
                tempLnq.规格       = item.规格;
                tempLnq.基数       = item.基数;
                tempLnq.图号型号     = item.图号型号;
                tempLnq.物品ID     = item.物品ID;
                tempLnq.物品名称     = item.物品名称;
                tempLnq.总成编码     = item.总成编码;
                tempLnq.适用范围     = item.适用范围;
                tempLnq.一次性整台份发料 = item.一次性整台份发料;

                m_listDebitSchedule_Temp.Add(tempLnq);
            }
        }
Beispiel #4
0
        private void btn_Import_Click(object sender, EventArgs e)
        {
            //string error = "";

            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                //MessageDialog.ShowPromptMessage(error);
                return;
            }

            if (!dtTemp.Columns.Contains("图号型号"))
            {
                MessageDialog.ShowPromptMessage("无【图号型号】列");
            }

            if (!dtTemp.Columns.Contains("物品名称"))
            {
                MessageDialog.ShowPromptMessage("无【物品名称】列");
            }

            if (!dtTemp.Columns.Contains("规格"))
            {
                MessageDialog.ShowPromptMessage("无【规格】列");
            }

            if (!dtTemp.Columns.Contains("基数"))
            {
                MessageDialog.ShowPromptMessage("无【基数】列");
            }

            if (!dtTemp.Columns.Contains("一次性整台份发料"))
            {
                MessageDialog.ShowPromptMessage("无【一次性整台份发料】列");
            }

            m_listDebitSchedule = new List <View_S_DebitSchedule>();

            foreach (DataRow dr in dtTemp.Rows)
            {
                View_S_DebitSchedule tempLnq = new View_S_DebitSchedule();

                int goodsID = UniversalFunction.GetGoodsID(dr["图号型号"].ToString(), dr["物品名称"].ToString(), dr["规格"].ToString());

                if (goodsID != 0)
                {
                    tempLnq.物品ID = goodsID;

                    foreach (View_S_DebitSchedule item in m_listDebitSchedule)
                    {
                        if (item.物品ID == tempLnq.物品ID)
                        {
                            MessageDialog.ShowPromptMessage(UniversalFunction.GetGoodsMessage(tempLnq.物品ID)
                                                            + "已存在一条记录,不能插入重复记录");
                        }
                    }
                }
                else
                {
                    MessageDialog.ShowPromptMessage("图号:" + dr["图号型号"].ToString()
                                                    + " 名称:" + dr["物品名称"].ToString() + " 规格:" + dr["规格"].ToString() + " 不存在于系统中");
                    return;
                }

                if (dr["基数"] == null || Convert.ToInt32(dr["基数"]) == 0)
                {
                    MessageDialog.ShowPromptMessage("图号:" + dr["图号型号"].ToString()
                                                    + " 名称:" + dr["物品名称"].ToString() + " 规格:" + dr["规格"].ToString() + " 【基数】不符合要求,请重新检查");
                }
                else
                {
                    tempLnq.基数 = Convert.ToDecimal(dr["基数"]);
                }

                if (dr["一次性整台份发料"] == null)
                {
                    MessageDialog.ShowPromptMessage("图号:" + dr["图号型号"].ToString()
                                                    + " 名称:" + dr["物品名称"].ToString() + " 规格:" + dr["规格"].ToString() + " 【一次性整台份发料】不符合要求,请重新检查");
                }
                else
                {
                    tempLnq.一次性整台份发料 = dr["一次性整台份发料"].ToString().Trim() == "是" ? true : false;
                }

                tempLnq.单据号  = txtSDBNo.Text;
                tempLnq.规格   = dr["规格"].ToString();
                tempLnq.图号型号 = dr["图号型号"].ToString();
                tempLnq.物品名称 = dr["物品名称"].ToString();
                tempLnq.总成编码 = txtEditionCode.Text;
                tempLnq.适用范围 = cmbApplicable.Text;

                m_listDebitSchedule.Add(tempLnq);
            }

            RefreshDataGridView(m_listDebitSchedule);
            MessageDialog.ShowPromptMessage("导入完成");
        }