Example #1
0
        /// <summary>
        ///  获取子表内容
        /// </summary>
        /// <param name="p_drDetail"></param>
        /// <param name="p_lngMainSEQ"></param>
        /// <returns></returns>
        private clsMS_StockPlan_Detail_VO[] m_objGetDetailArr(DataRow[] p_drDetail, long p_lngMainSEQ)
        {
            clsMS_StockPlan_Detail_VO[] objDetailArr = null;
            if (p_drDetail == null || p_drDetail.Length == 0)
            {
                return(null);
            }

            objDetailArr = new clsMS_StockPlan_Detail_VO[p_drDetail.Length];
            DateTime datTemp;

            for (int iRow = 0; iRow < p_drDetail.Length; iRow++)
            {
                objDetailArr[iRow] = new clsMS_StockPlan_Detail_VO();
                objDetailArr[iRow].m_lngSERIESID2_INT     = p_lngMainSEQ;
                objDetailArr[iRow].m_strMEDICINEID_CHR    = p_drDetail[iRow]["MEDICINEID_CHR"].ToString();
                objDetailArr[iRow].m_strMEDICINENAME_VCHR = p_drDetail[iRow]["MEDICINENAME_VCHR"].ToString();
                objDetailArr[iRow].m_strMEDSPEC_VCHR      = p_drDetail[iRow]["MEDSPEC_VCHR"].ToString();
                objDetailArr[iRow].m_strASSISTCODE_CHR    = p_drDetail[iRow]["ASSISTCODE_CHR"].ToString();
                objDetailArr[iRow].m_strUNIT_VCHR         = p_drDetail[iRow]["UNIT_VCHR"].ToString();
                objDetailArr[iRow].m_dblAMOUNT            = Convert.ToDouble(p_drDetail[iRow]["AMOUNT"]);
                objDetailArr[iRow].m_strPRODUCTORID_CHR   = p_drDetail[iRow]["PRODUCTORID_CHR"].ToString();
                objDetailArr[iRow].m_strREMARK_VCHR       = p_drDetail[iRow]["REMARK_VCHR"].ToString();
                if (DateTime.TryParse(p_drDetail[iRow]["LASTINSTORAGEDATE_DAT"].ToString(), out datTemp))
                {
                    objDetailArr[iRow].m_datLASTINSTORAGEDATE_DAT = Convert.ToDateTime(p_drDetail[iRow]["LASTINSTORAGEDATE_DAT"]);
                }
                objDetailArr[iRow].m_dblCALLPRICE_INT   = Convert.ToDouble(p_drDetail[iRow]["CALLPRICE_INT"]);
                objDetailArr[iRow].m_dblSTOCKSUM        = objDetailArr[iRow].m_dblCALLPRICE_INT * objDetailArr[iRow].m_dblAMOUNT;
                objDetailArr[iRow].m_strVENDORID_CHR    = p_drDetail[iRow]["VENDORID_CHR"].ToString();
                objDetailArr[iRow].m_strVENDORNAME_VCHR = p_drDetail[iRow]["vendorname"].ToString();
                objDetailArr[iRow].m_lngSTATUS          = 1;
            }
            return(objDetailArr);
        }
Example #2
0
        private clsMS_StockPlan_Detail_VO[] GetSelectedRetail()
        {
            if (m_dgvDrugStorage.DataSource == null)
            {
                return(null);
            }
            DataTable dtbResult = m_dgvDrugStorage.DataSource as DataTable;

            if (dtbResult.Rows.Count <= 0)
            {
                return(null);
            }
            DataTable dtbSelected = dtbResult.Clone();

            dtbResult.PrimaryKey = new DataColumn[] { dtbResult.Columns["medicineid_chr"] };
            DataRow drSelect = null;

            for (int i1 = 0; i1 < m_dgvDrugStorage.Rows.Count; i1++)
            {
                if (m_dgvDrugStorage[0, i1].Value == null)
                {
                    continue;
                }
                if (m_dgvDrugStorage[0, i1].Value.ToString() == "T")
                {
                    drSelect = dtbResult.Rows.Find(m_dgvDrugStorage["medicineid_chr", i1].Value);
                    dtbSelected.Rows.Add(drSelect.ItemArray);
                }
            }
            int iRow = dtbSelected.Rows.Count;

            if (iRow > 0)
            {
                clsMS_StockPlan_Detail_VO[] m_objDetailArr = new clsMS_StockPlan_Detail_VO[iRow];
                DateTime datTemp;
                for (int i2 = 0; i2 < m_objDetailArr.Length; i2++)
                {
                    m_objDetailArr[i2] = new clsMS_StockPlan_Detail_VO();
                    m_objDetailArr[i2].m_strASSISTCODE_CHR    = dtbSelected.Rows[i2]["assistcode_chr"].ToString();
                    m_objDetailArr[i2].m_strMEDICINEID_CHR    = dtbSelected.Rows[i2]["medicineid_chr"].ToString();
                    m_objDetailArr[i2].m_strMEDICINENAME_VCHR = dtbSelected.Rows[i2]["medicinename_vchr"].ToString();
                    m_objDetailArr[i2].m_strMEDSPEC_VCHR      = dtbSelected.Rows[i2]["medspec_vchr"].ToString();
                    m_objDetailArr[i2].m_strPRODUCTORID_CHR   = dtbSelected.Rows[i2]["productorid_chr"].ToString();
                    m_objDetailArr[i2].m_strUNIT_VCHR         = dtbSelected.Rows[i2]["opunit_chr"].ToString();
                    m_objDetailArr[i2].m_dblAMOUNT            = Convert.ToDouble(dtbSelected.Rows[i2]["amount"]);
                    m_objDetailArr[i2].m_strVENDORID_CHR      = dtbSelected.Rows[i2]["vendorid_chr"].ToString();
                    m_objDetailArr[i2].m_strVENDORNAME_VCHR   = dtbSelected.Rows[i2]["vendorname"].ToString();
                    if (DateTime.TryParse(dtbSelected.Rows[i2]["instoragedate_dat"].ToString(), out datTemp))
                    {
                        m_objDetailArr[i2].m_datLASTINSTORAGEDATE_DAT = datTemp;
                    }
                    m_objDetailArr[i2].m_dblCALLPRICE_INT = Convert.ToDouble(dtbSelected.Rows[i2]["callprice_int"]);
                    m_objDetailArr[i2].m_dblSTOCKSUM      = m_objDetailArr[i2].m_dblAMOUNT * m_objDetailArr[i2].m_dblCALLPRICE_INT;
                }
                return(m_objDetailArr);
            }
            return(null);
        }
Example #3
0
        /// <summary>
        /// 修改选定的入库单
        /// </summary>
        /// <param name="p_objMain">主表</param>
        /// <param name="p_objSubVO">子表</param>
        internal void m_mthModifySelected(out clsMS_StockPlan_VO p_objMain, out clsMS_StockPlan_Detail_VO[] p_objSubVO)
        {
            p_objMain  = null;
            p_objSubVO = null;
            #region 主表VO
            clsMS_StockPlan_VO objMain = null;
            if (m_objViewer.m_dgvMainInfo.SelectedRows.Count == 1)
            {
                DataRowView drvMain = m_objViewer.m_dtvMainView[m_objViewer.m_dgvMainInfo.SelectedRows[0].Index];
                //int intState = Convert.ToInt32(drvMain["STATE_INT"]);
                //if (intState != 1)
                //{
                //    MessageBox.Show("非新制表单不能修改", "采购计划", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    return;
                //}
                objMain = new clsMS_StockPlan_VO();
                objMain.m_lngSERIESID_INT     = Convert.ToInt64(drvMain["SERIESID_INT"]);
                objMain.m_strSTOCKPLANID_VCHR = drvMain["STOCKPLANID_VCHR"].ToString();
                //objMain.m_strSTORAGENAME_VCHR = drvMain["STORAGENAME_VCHR"].ToString();
                objMain.m_lngSTATE_INT       = Convert.ToInt32(drvMain["STATE_INT"]);
                objMain.m_strVENDORID_CHR    = drvMain["VENDORID_CHR"].ToString();
                objMain.m_strVENDORNAME_VCHR = drvMain["vendorname_vchr"].ToString();
                objMain.m_strSTORAGEID_CHR   = drvMain["STORAGEID_CHR"].ToString();
                objMain.m_datSTOCKPLAN_DAT   = Convert.ToDateTime(drvMain["STOCKPLAN_DAT"]);
                objMain.m_datNEWORDER_DAT    = Convert.ToDateTime(drvMain["NEWORDER_DAT"]);
                objMain.m_strCOMMENT_VCHR    = drvMain["COMMENT_VCHR"].ToString();
                objMain.m_strMAKERID_CHR     = drvMain["MAKERID_CHR"].ToString();
                objMain.m_strMAKERNAME_VCHR  = drvMain["MAKERNAME"].ToString();
            }

            if (objMain == null)
            {
                return;
            }
            p_objMain = objMain;
            #endregion

            #region 子表VO
            clsMS_StockPlan_Detail_VO[] objSubVO = null;
            DataView dvSub = m_objViewer.m_dgvSubInfo.DataSource as DataView;
            if (dvSub != null && dvSub.Count > 0)
            {
                DataRowView drvCurrent = null;
                objSubVO = new clsMS_StockPlan_Detail_VO[dvSub.Count];
                DateTime dtTemp;
                for (int iRow = 0; iRow < m_objViewer.m_dgvSubInfo.Rows.Count; iRow++)
                {
                    drvCurrent     = dvSub[iRow];
                    objSubVO[iRow] = new clsMS_StockPlan_Detail_VO();
                    objSubVO[iRow].m_lngSERIESID_INT      = Convert.ToInt64(drvCurrent["SERIESID_INT"]);
                    objSubVO[iRow].m_lngSERIESID2_INT     = Convert.ToInt64(drvCurrent["SERIESID2_INT"]);
                    objSubVO[iRow].m_strMEDICINEID_CHR    = drvCurrent["MEDICINEID_CHR"].ToString();
                    objSubVO[iRow].m_strMEDICINENAME_VCHR = drvCurrent["MEDICINENAME_VCHR"].ToString();
                    objSubVO[iRow].m_strMEDSPEC_VCHR      = drvCurrent["MEDSPEC_VCHR"].ToString();
                    objSubVO[iRow].m_dblAMOUNT            = Convert.ToInt32(drvCurrent["AMOUNT"]);
                    objSubVO[iRow].m_strPRODUCTORID_CHR   = drvCurrent["PRODUCTORID_CHR"].ToString();
                    objSubVO[iRow].m_strUNIT_VCHR         = drvCurrent["UNIT_VCHR"].ToString();
                    objSubVO[iRow].m_strASSISTCODE_CHR    = drvCurrent["ASSISTCODE_CHR"].ToString();
                    objSubVO[iRow].m_lngSTATUS            = Convert.ToInt16(drvCurrent["STATUS"]);
                    objSubVO[iRow].m_dblCALLPRICE_INT     = Convert.ToDouble(drvCurrent["CALLPRICE_INT"]);
                    objSubVO[iRow].m_dblSTOCKSUM          = Convert.ToDouble(drvCurrent["STOCKSUM"]);
                    if (DateTime.TryParse(drvCurrent["LASTINSTORAGEDATE_DAT"].ToString(), out dtTemp))
                    {
                        objSubVO[iRow].m_datLASTINSTORAGEDATE_DAT = dtTemp;
                    }
                    objSubVO[iRow].m_strVENDORID_CHR    = drvCurrent["VENDORID_CHR"].ToString();
                    objSubVO[iRow].m_strVENDORNAME_VCHR = drvCurrent["vendorname"].ToString();
                }
            }
            p_objSubVO = objSubVO;
            #endregion
        }