예제 #1
0
 /// <summary>
 /// 为OilDataSearchEntity的快速查询库的数据赋值
 /// </summary>
 /// <param name="oilInfoEntity"></param>
 /// <param name="oilInfoOut"></param>
 /// <param name="oilTableRows"></param>
 /// <param name="oilTableCols"></param>
 public void toOilDataSearchs(ref OilInfoBEntity oilInfoEntity, OilInfoOut oilInfoOut)
 {
     foreach (OilDataSearchOut oilDataSearchOut in oilInfoOut.oilDataSearchOuts) //插入原油数据
     {
         OilDataSearchEntity oilDataSearch = new OilDataSearchEntity();          //新建OilDataSearch实体
         oilDataSearch.oilInfoID     = oilInfoEntity.ID;
         oilDataSearch.oilTableColID = oilDataSearchOut.oilTableColID;
         oilDataSearch.oilTableRowID = oilDataSearchOut.oilTableRowID;
         oilDataSearch.labData       = oilDataSearchOut.labData;
         oilDataSearch.calData       = oilDataSearchOut.calData;
         oilInfoEntity.OilDataSearchs.Add(oilDataSearch);
     }
 }
예제 #2
0
        /// <summary>
        /// 将导入的B库数据变为OilData
        /// </summary>
        /// <param name="OilInfoBEntity"></param>
        /// <param name="OilInfoOut"></param>
        /// <param name="oilTableRows"></param>
        /// <param name="oilTableCols"></param>
        public void toOilDatas(ref OilInfoBEntity oilInfoEntity, OilInfoOut oilInfoOut, List <OilTableRowOut> oilTableRows, List <OilTableColOut> oilTableCols)
        {
            OilTableRowBll rowBll = new OilTableRowBll();
            OilTableColBll colBll = new OilTableColBll();

            foreach (OilDataOut oilDataOut in oilInfoOut.oilDatas)  //插入原油数据
            {
                OilDataBEntity oilData        = new OilDataBEntity();
                OilTableColOut oilTableColOut = oilTableCols.Where(c => c.ID == oilDataOut.oilTableColID).FirstOrDefault();
                if (oilTableColOut == null)
                {
                    continue;
                }
                string         colCode        = oilTableColOut.colCode;
                OilTableRowOut oilTableRowOut = oilTableRows.Where(c => c.ID == oilDataOut.oilTableRowID).FirstOrDefault();
                if (oilTableRowOut == null)
                {
                    continue;
                }
                string itemCode = oilTableRowOut.itemCode;
                //if (itemCode == "CLA" && oilTableRowOut.oilTableTypeID == 2)
                //    continue;
                //if (itemCode == "A10" && oilTableRowOut.oilTableTypeID == 4)
                //    itemCode = "10A";

                try
                {
                    OilTableColEntity col = colBll[colCode, (EnumTableType)oilTableRowOut.oilTableTypeID];
                    OilTableRowEntity row = rowBll[itemCode, (EnumTableType)oilTableRowOut.oilTableTypeID];
                    if (row != null && col != null)
                    {
                        oilData.oilInfoID     = oilInfoEntity.ID;
                        oilData.oilTableColID = col.ID;
                        oilData.oilTableRowID = row.ID;
                        oilData.labData       = oilDataOut.labData;
                        oilData.calData       = oilDataOut.calData;

                        oilInfoEntity.OilDatas.Add(oilData);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("导入应用库 :" + ex.ToString());
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 转换为OilInfoBEntity
        /// </summary>
        /// <param name="oilInfoEntity">OilInfoBEntity实体</param>
        /// <param name="oilInfoOut">oilInfoOut</param>
        public void toOilInfoEntity(ref OilInfoBEntity oilInfoBEntity, OilInfoOut oilInfoOut)
        {
            oilInfoBEntity.crudeName       = oilInfoOut.crudeName;
            oilInfoBEntity.englishName     = oilInfoOut.englishName;
            oilInfoBEntity.crudeIndex      = oilInfoOut.crudeIndex;
            oilInfoBEntity.country         = oilInfoOut.country;
            oilInfoBEntity.region          = oilInfoOut.region;
            oilInfoBEntity.fieldBlock      = oilInfoOut.fieldBlock;
            oilInfoBEntity.sampleDate      = oilInfoOut.sampleDate;
            oilInfoBEntity.receiveDate     = oilInfoOut.receiveDate;
            oilInfoBEntity.sampleSite      = oilInfoOut.sampleSite;
            oilInfoBEntity.assayDate       = oilInfoOut.assayDate;
            oilInfoBEntity.updataDate      = oilInfoOut.updataDate;
            oilInfoBEntity.sourceRef       = oilInfoOut.sourceRef;
            oilInfoBEntity.assayLab        = oilInfoOut.assayLab;
            oilInfoBEntity.assayer         = oilInfoOut.assayer;
            oilInfoBEntity.assayCustomer   = oilInfoOut.assayCustomer;
            oilInfoBEntity.reportIndex     = oilInfoOut.reportIndex;
            oilInfoBEntity.summary         = oilInfoOut.summary;
            oilInfoBEntity.type            = oilInfoOut.type;
            oilInfoBEntity.classification  = oilInfoOut.classification;
            oilInfoBEntity.sulfurLevel     = oilInfoOut.sulfurLevel;
            oilInfoBEntity.acidLevel       = oilInfoOut.acidLevel;
            oilInfoBEntity.corrosionLevel  = oilInfoOut.corrosionLevel;
            oilInfoBEntity.processingIndex = oilInfoOut.processingIndex;
            oilInfoBEntity.BlendingType    = oilInfoOut.BlendingType;
            oilInfoBEntity.NIRSpectrum     = oilInfoOut.NIRSpectrum;

            oilInfoBEntity.DataQuality = oilInfoOut.DataQuality;
            oilInfoBEntity.Remark      = oilInfoOut.Remark;
            oilInfoBEntity.S_01R       = oilInfoOut.S_01R;
            oilInfoBEntity.S_02R       = oilInfoOut.S_02R;
            oilInfoBEntity.S_03R       = oilInfoOut.S_03R;
            oilInfoBEntity.S_04R       = oilInfoOut.S_04R;
            oilInfoBEntity.S_05R       = oilInfoOut.S_05R;
            oilInfoBEntity.S_06R       = oilInfoOut.S_06R;
            oilInfoBEntity.S_07R       = oilInfoOut.S_07R;
            oilInfoBEntity.S_08R       = oilInfoOut.S_08R;
            oilInfoBEntity.S_09R       = oilInfoOut.S_09R;
            oilInfoBEntity.S_10R       = oilInfoOut.S_10R;
            oilInfoBEntity.DataSource  = oilInfoOut.DataSource;
            oilInfoBEntity.ICP0        = oilInfoOut.ICP0;
        }
예제 #4
0
        /// <summary>
        /// B库数据导入功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripBtnIn_Click(object sender, EventArgs e)
        {
            this.dgvLibBIn.EndEdit();
            OilInfoBAccess oilInfoBccess = new OilInfoBAccess(); //从B库进行原油查找
            LibManageBll   libManageBll  = new LibManageBll();   //导入B库管理
            string         alert         = "未导入的原油:";

            foreach (DataGridViewRow row in this.dgvLibBIn.Rows)
            {
                if (bool.Parse(row.Cells["select"].Value.ToString()) == true)
                {
                    int        oilInfoId  = int.Parse(row.Cells["ID"].Value.ToString());
                    OilInfoOut oilInfoOut = this._outLib.oilInfoOuts.Where(c => c.ID == oilInfoId).FirstOrDefault();//从库文件中获取数据

                    OilInfoBEntity oilInfoBEntity = new OilInfoBEntity();
                    libManageBll.toOilInfoEntity(ref oilInfoBEntity, oilInfoOut); //转换为OilInfoBEntity
                    oilInfoBEntity.ID = OilBll.saveInfo(oilInfoBEntity);          //将数据保存到原油应用模块

                    if (oilInfoBEntity.ID == -1)                                  //原油已存在,提示是否更新数据
                    {
                        DialogResult r = MessageBox.Show(oilInfoBEntity.crudeIndex + "原油已存在!是否要更新", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        if (r == DialogResult.Yes)
                        {
                            oilInfoBccess.Delete("crudeIndex='" + oilInfoBEntity.crudeIndex + "'"); //删除原油信息数据
                            oilInfoBEntity.ID = OilBll.save(oilInfoBEntity);                        //重新插入原油信息

                            libManageBll.toOilDatas(ref oilInfoBEntity, oilInfoOut, this._outLib.oilTableRows, this._outLib.oilTableCols);
                            OilBll.saveTables(oilInfoBEntity);

                            libManageBll.toOilDataSearchs(ref oilInfoBEntity, oilInfoOut);
                            OilBll.saveSearchTable(oilInfoBEntity);

                            libManageBll.toCurve(ref oilInfoBEntity, oilInfoOut.curves, _outLib.curveTypes);
                            OilBll.saveCurves(oilInfoBEntity);


                            if (this.ActiveMdiChild != null)
                            {
                                if (this.ActiveMdiChild.GetType().Name == "FrmMain")//如果打开窗体存在.
                                {
                                    FrmMain frmMain = (FrmMain)this.ActiveMdiChild;
                                    if (frmMain != null)  //如果打开原油库A的窗口存在,则更新
                                    {
                                        frmMain.refreshGridList();
                                    }
                                }
                            }
                            MessageBox.Show(oilInfoBEntity.crudeName + "原油导入成功!");
                        }
                        else
                        {
                            alert += oilInfoBEntity.crudeIndex + "  ";
                            MessageBox.Show(oilInfoBEntity.crudeName + "原油导入不成功!");
                        }
                    }
                    else//原油不存在
                    {
                        try
                        {
                            libManageBll.toOilDatas(ref oilInfoBEntity, oilInfoOut, this._outLib.oilTableRows, this._outLib.oilTableCols);
                            OilBll.saveTables(oilInfoBEntity);

                            libManageBll.toOilDataSearchs(ref oilInfoBEntity, oilInfoOut);
                            OilBll.saveSearchTable(oilInfoBEntity);

                            libManageBll.toCurve(ref oilInfoBEntity, oilInfoOut.curves, _outLib.curveTypes);
                            OilBll.saveCurves(oilInfoBEntity);


                            if (this.ActiveMdiChild != null)
                            {
                                if (this.ActiveMdiChild.GetType().Name == "FrmMain")//如果打开窗体存在.
                                {
                                    FrmMain frmMain = (FrmMain)this.ActiveMdiChild;
                                    if (frmMain != null)  //如果打开原油库A的窗口存在,则更新
                                    {
                                        frmMain.refreshGridList();
                                    }
                                }
                            }
                            MessageBox.Show(oilInfoBEntity.crudeName + "原油导入成功!");
                        }
                        catch (Exception ex)
                        {
                            Log.Error("原油导入错误!" + ex.ToString());
                            MessageBox.Show(oilInfoBEntity.crudeName + "原油导入不成功!");
                            return;
                        }
                    }
                }
            }
        }
예제 #5
0
        /// <summary>
        /// 导入到B库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripBtnIn_Click(object sender, EventArgs e)
        {
            this.gridList.EndEdit();
            OilInfoBAccess oilInfoAccess = new OilInfoBAccess();
            LibManageBll   libManageBll  = new LibManageBll();
            string         alert         = "未导入的原油:";

            foreach (DataGridViewRow row in this.gridList.Rows)
            {
                if (bool.Parse(row.Cells["select"].Value.ToString()) == true)
                {
                    int        oilInfoId  = int.Parse(row.Cells["ID"].Value.ToString());
                    OilInfoOut oilInfoOut = this._outLib.oilInfoOuts.Where(c => c.ID == oilInfoId).FirstOrDefault();

                    OilInfoBEntity oilInfoBEntity = new OilInfoBEntity();
                    libManageBll.toOilInfoEntity(ref oilInfoBEntity, oilInfoOut);   //转换为OilInfoEntity
                    oilInfoBEntity.ID = OilBll.saveInfo(oilInfoBEntity);

                    if (oilInfoBEntity.ID == -1)
                    {
                        try
                        {
                            #region "原油冲突"
                            DialogResult r = MessageBox.Show(oilInfoBEntity.crudeIndex + "原油已存在!是否要更新", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (r == DialogResult.Yes)
                            {
                                oilInfoAccess.Delete("crudeIndex='" + oilInfoBEntity.crudeIndex + "'"); //删除原油信息数据
                                oilInfoBEntity.ID = OilBll.save(oilInfoBEntity);                        //重新插入原油信息

                                libManageBll.toOilDatas(ref oilInfoBEntity, oilInfoOut, this._outLib.oilTableRows, this._outLib.oilTableCols);
                                OilBll.saveTables(oilInfoBEntity);
                                libManageBll.toCurve(ref oilInfoBEntity, oilInfoOut.curves, _outLib.curveTypes);
                                OilBll.saveCurves(oilInfoBEntity);
                                libManageBll.toOilDataSearchs(ref oilInfoBEntity, oilInfoOut);
                                OilBll.saveSearchTable(oilInfoBEntity.OilDataSearchs);

                                DatabaseB.FrmOpenB frmOpenB = (DatabaseB.FrmOpenB)GetChildFrm("frmOpenB");
                                if (frmOpenB != null)  //如果打开原油库B的窗口存在,则更新
                                {
                                    frmOpenB.refreshGridList(false);
                                }

                                DatabaseC.FrmOpenC frmOpenC = (DatabaseC.FrmOpenC)GetChildFrm("frmOpenC");
                                if (frmOpenC != null)  //如果打开原油库C的窗口存在,则更新
                                {
                                    frmOpenC.refreshGridList();
                                }
                            }
                            else
                            {
                                alert += oilInfoBEntity.crudeIndex + "  ";
                            }
                            #endregion
                        }
                        catch (Exception ex)
                        {
                            Log.Error("原油导入错误!" + ex.ToString());
                            return;
                        }

                        MessageBox.Show(oilInfoBEntity.crudeName + "原油导入成功!");
                    }
                    else
                    {
                        #region "原油无冲突"
                        try
                        {
                            libManageBll.toOilDatas(ref oilInfoBEntity, oilInfoOut, this._outLib.oilTableRows, this._outLib.oilTableCols);
                            OilBll.saveTables(oilInfoBEntity);
                            libManageBll.toCurve(ref oilInfoBEntity, oilInfoOut.curves, _outLib.curveTypes);
                            OilBll.saveCurves(oilInfoBEntity);
                            libManageBll.toOilDataSearchs(ref oilInfoBEntity, oilInfoOut);
                            OilBll.saveSearchTable(oilInfoBEntity.OilDataSearchs);

                            DatabaseB.FrmOpenB frmOpenB = (DatabaseB.FrmOpenB)GetChildFrm("frmOpenB");
                            if (frmOpenB != null)  //如果打开原油库A的窗口存在,则更新
                            {
                                frmOpenB.refreshGridList(false);
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error("原油导入错误!" + ex.ToString());
                            return;
                        }

                        MessageBox.Show(oilInfoBEntity.crudeName + "原油导入成功!");

                        #endregion
                    }
                }
            }
        }