コード例 #1
0
        /// <summary>
        /// 审核出库
        /// </summary>
        /// <param name="p_drCommit">审核的行</param>
        internal void m_mthCommitOutStorage()
        {
            if (!m_objViewer.m_blnIsAdmin)
            {
                MessageBox.Show("当前用户没有药库管理权限,不能审核", "药品出库", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            List <DataRow> lstCheck    = new List <DataRow>();
            bool           blnNewState = false;

            for (int iSe = 0; iSe < m_objViewer.m_dgvMainInfo.Rows.Count; iSe++)
            {
                if (Convert.ToBoolean(m_objViewer.m_dgvMainInfo.Rows[iSe].Cells[0].Value))
                {
                    DataRow drCheck = m_objViewer.m_dtvCurrentMainVienPage1[iSe].Row;

                    clsDcl_Purchase_Detail clsDcl = new clsDcl_Purchase_Detail();
                    clsDcl.m_lngCheckBillState(2, drCheck["OUTSTORAGEID_VCHR"].ToString(), out blnNewState);
                    if (!blnNewState)
                    {
                        MessageBox.Show("已选中的出库单,包含不是新制状态的单据,请刷新后重试", "药品出库", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }

                    if (drCheck["STATUS"].ToString() == "1")
                    {
                        lstCheck.Add(drCheck);
                    }
                }
            }

            if (lstCheck.Count == 0)
            {
                MessageBox.Show("请先选择需审核的药品出库信息", "药品出库", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            DataRow[] drNew = lstCheck.ToArray();

            if (drNew == null || drNew.Length == 0)
            {
                MessageBox.Show("没有需审核的药品出库信息", "药品出库", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string strCurrentOutStorageID = string.Empty;

            try
            {
                long[] lngMainSEQ = new long[drNew.Length];
                for (int iMSeq = 0; iMSeq < drNew.Length; iMSeq++)
                {
                    lngMainSEQ[iMSeq] = Convert.ToInt64(drNew[iMSeq]["SERIESID_INT"]);
                }

                clsMS_StorageGrossForOut[] objSubArr = null;
                //List<clsMS_StorageGrossForOut> lisDetail = new List<clsMS_StorageGrossForOut>();
                long                     lngRes      = 0;
                DataTable                dtbDetail   = null;
                clsDcl_OutStorage        objOSDomain = new clsDcl_OutStorage();
                clsMS_AccountDetail_VO[] objAccount  = null;
                for (int iSEQ = 0; iSEQ < lngMainSEQ.Length; iSEQ++)
                {
                    strCurrentOutStorageID = drNew[iSEQ]["OUTSTORAGEID_VCHR"].ToString();
                    lngRes    = objOSDomain.m_lngGetOutStorageDetail(lngMainSEQ[iSEQ], out dtbDetail);
                    objSubArr = m_objGetDetail(dtbDetail);
                    if (objSubArr != null && objSubArr.Length > 0)
                    {
                        objAccount = m_objAccountDetailArr(dtbDetail, Convert.ToInt32(drNew[iSEQ]["FORMTYPE"]), strCurrentOutStorageID);
                        lngRes     = objOSDomain.m_lngCommitOutStorage(objSubArr, objAccount, m_objViewer.LoginInfo.m_strEmpID, lngMainSEQ[iSEQ], m_objViewer.m_blnIsImmAccount);

                        if (lngRes > 0)
                        {
                            m_mthUpdateUIAfterCommit(drNew[iSEQ]);
                        }
                    }
                }

                //if (lisDetail.Count > 0)
                //{
                //    clsDcl_Storage objSTDomain = new clsDcl_Storage();
                //    lngRes = objSTDomain.m_lngSubStorageDetailRealGross(lisDetail.ToArray());

                //    for (int iList = 0; iList < lisDetail.Count; iList++)
                //    {
                //        lngRes = objSTDomain.m_lngSubStorageGross(lisDetail[iList]);
                //    }

                //    if (lngRes > 0)
                //    {
                //        lngRes = objOSDomain.m_lngSetCommitUser(m_objViewer.LoginInfo.m_strEmpID, lngMainSEQ);
                //    }

                //    if (lngRes > 0)
                //    {
                //        p_drCommit = drNew;
                //    }
                //}
                objOSDomain = null;

                if (lngRes > 0)
                {
                    MessageBox.Show("审核完成", "药品出库", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("审核失败", "药品出库", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            }
            catch (Exception objEx)
            {
                com.digitalwave.Utility.clsLogText objLogger = new com.digitalwave.Utility.clsLogText();
                bool blnRes = objLogger.LogError(objEx);
            }
        }
コード例 #2
0
        /// <summary>
        /// 删除出库药品信息
        /// </summary>
        internal void m_mthDeleteOutStorage()
        {
            List <long> lngCheckRowIndex = new List <long>();
            List <long> lngWrongRowIndex = new List <long>();
            bool        blnNewState      = false;

            for (int iSe = 0; iSe < m_objViewer.m_dgvMainInfo.Rows.Count; iSe++)
            {
                if (Convert.ToBoolean(m_objViewer.m_dgvMainInfo.Rows[iSe].Cells[0].Value))
                {
                    clsDcl_Purchase_Detail clsDcl = new clsDcl_Purchase_Detail();
                    clsDcl.m_lngCheckBillState(2, m_objViewer.m_dtvCurrentMainVienPage1[iSe]["OUTSTORAGEID_VCHR"].ToString(), out blnNewState);
                    if (!blnNewState)
                    {
                        MessageBox.Show("已选中的出库单,包含不是新制状态的单据,请刷新后重试", "药品出库", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }

                    int intState = Convert.ToInt32(m_objViewer.m_dtvCurrentMainVienPage1[iSe]["STATUS"]);
                    if (intState == 2 || intState == 3)//已审核或已入帐

                    {
                        lngWrongRowIndex.Add(Convert.ToInt64(m_objViewer.m_dtvCurrentMainVienPage1[iSe]["SERIESID_INT"]));
                        continue;
                    }
                    lngCheckRowIndex.Add(Convert.ToInt64(m_objViewer.m_dtvCurrentMainVienPage1[iSe]["SERIESID_INT"]));
                }
            }

            if (lngWrongRowIndex.Count > 0)
            {
                DialogResult drResultQ = MessageBox.Show("部分已选择记录已审核或已入账,将不能删除,是否继续?", "药品出库", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (drResultQ == DialogResult.No)
                {
                    return;
                }
            }

            if (lngCheckRowIndex.Count == 0)
            {
                MessageBox.Show("请先选择一条新制药品入库信息", "药品出库", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            DialogResult drResult = MessageBox.Show("是否删除选中记录?", "药品出库", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (drResult == DialogResult.No)
            {
                return;
            }

            clsMS_StorageGrossForOut[] objGetOutValue = m_objGetOutValue(lngCheckRowIndex.ToArray());

            clsDcl_OutStorage objOSDomain = new clsDcl_OutStorage();
            long lngRes = objOSDomain.m_lngDeleteMainOutStorage(lngCheckRowIndex.ToArray());

            objOSDomain = null;
            if (lngRes > 0)
            {
                m_mthAddAvailaGross(objGetOutValue);
                MessageBox.Show("删除成功", "药品出库", MessageBoxButtons.OK, MessageBoxIcon.Information);

                StringBuilder stbFilter = new StringBuilder(50);
                for (int iSer = 0; iSer < lngCheckRowIndex.Count; iSer++)
                {
                    stbFilter.Append(" SERIESID_INT = '");
                    stbFilter.Append(lngCheckRowIndex[iSer]);
                    stbFilter.Append("'");
                    if (iSer < lngCheckRowIndex.Count - 1)
                    {
                        stbFilter.Append(" or ");
                    }
                }
                DataRow[] drRemove = m_objViewer.m_dtbMainDataPage1.Select(stbFilter.ToString());
                if (drRemove != null && drRemove.Length > 0)
                {
                    for (int iRev = 0; iRev < drRemove.Length; iRev++)
                    {
                        m_objViewer.m_dtbMainDataPage1.Rows.Remove(drRemove[iRev]);
                    }
                }

                DataView dtvSub = m_objViewer.m_dgvSubInfo.DataSource as DataView;
                if (m_objViewer.m_dtvCurrentMainVienPage1.Count == 0 && dtvSub != null)
                {
                    dtvSub.Table.Rows.Clear();
                }
            }
            else
            {
                MessageBox.Show("删除失败", "药品出库", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }