Ejemplo n.º 1
0
        private VM_Report_Plastic getPlasticReportById(int id)
        {
            var retData = new VM_Result_Data();
            var vmPls   = new VM_Report_Plastic();

            retData.Content = "搜索塑料表失败";
            var bllPls    = new MesWeb.BLL.T_Report_Plastic();
            var bllHeader = new MesWeb.BLL.T_Report_Header();
            var bllFooter = new MesWeb.BLL.T_Report_Footer();
            var pls       = bllPls.GetModel(id);

            if (pls == null)
            {
                return(null);
            }
            var header = bllHeader.GetModel(pls.ReportHeaderId.Value);

            if (header != null)
            {
                try {
                    var footer = bllFooter.GetModel(pls.ReportFooterId.Value);
                    ReportPlasticUpdate(out vmPls, pls, header, footer);
                } catch (Exception e) {
                    log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name);
                    log.Error(e);
                }
            }
            return(vmPls);
        }
Ejemplo n.º 2
0
        public JsonResult SearchPlastictBySpecNumAction(string specNum)
        {
            var retData = new VM_Result_Data();

            retData.Content = "搜索塑料表失败";
            var bllPls    = new MesWeb.BLL.T_Report_Plastic();
            var bllHeader = new MesWeb.BLL.T_Report_Header();
            var bllFooter = new MesWeb.BLL.T_Report_Footer();
            var header    = bllHeader.GetModelList("SpecNum = '" + specNum + "'").First();

            if (header != null)
            {
                try {
                    var pls = bllPls.GetModelList("ReportHeaderId = " + header.Id).First();
                    if (pls != null)
                    {
                        var vmPls  = new VM_Report_Plastic();
                        var footer = bllFooter.GetModel(pls.ReportFooterId.Value);
                        ReportPlasticUpdate(out vmPls, pls, header, footer);
                        retData.Appendix = vmPls;
                        retData.Content  = "查询塑料报表成功";
                        retData.Code     = RESULT_CODE.OK;
                    }
                } catch (Exception e) {
                    log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name);
                    log.Error(e);
                }
            }

            return(Json(retData));
        }
Ejemplo n.º 3
0
        public JsonResult SaveReportPlasticAction(VM_Report_Plastic plastic)
        {
            var retData = new VM_Result_Data();

            retData.Content = "更新塑料报告失败";
            var bllPls    = new MesWeb.BLL.T_Report_Plastic();
            var bllHeader = new MesWeb.BLL.T_Report_Header();
            var bllFooter = new MesWeb.BLL.T_Report_Footer();
            var bllValue  = new MesWeb.BLL.T_Report_Value();

            try {
                var oldPls = bllPls.GetModel(plastic.Id);

                if (oldPls != null)
                {
                    //更新header
                    var oldHeader = bllHeader.GetModel(oldPls.ReportHeaderId.Value);
                    var newHeader = plastic.toReportHeader();
                    newHeader.Id = oldHeader.Id;
                    bllHeader.Update(newHeader);
                    //更新footer
                    var oldFooter = bllFooter.GetModel(oldPls.ReportFooterId.Value);
                    var newFooter = plastic.toReportFooter();
                    newFooter.Id = oldFooter.Id;
                    bllFooter.Update(newFooter);
                    //更新plastic
                    oldPls.Code = plastic.Code;
                    bllPls.Update(oldPls);
                    //更新具体值
                    var oldElecRate = bllValue.GetModel(oldPls.ElecRateId.Value);
                    var newElecRate = plastic.toElecRateValue();
                    newElecRate.Id = oldElecRate.Id;
                    bllValue.Update(newElecRate);

                    var oldElecStrength = bllValue.GetModel(oldPls.ElecStrengthId.Value);
                    var newElecStrength = plastic.toElecStrengthValue();
                    newElecStrength.Id = oldElecStrength.Id;
                    bllValue.Update(newElecStrength);

                    var oldMpaBefore = bllValue.GetModel(oldPls.MpaBeforeId.Value);
                    var newMpaBefore = plastic.toMpaBeforeValue();
                    newMpaBefore.Id = oldMpaBefore.Id;
                    bllValue.Update(newMpaBefore);

                    var oldElongBefore = bllValue.GetModel(oldPls.ElongBeforeId.Value);
                    var newElongBefore = plastic.toElongBeforeValue();
                    newElongBefore.Id = oldElongBefore.Id;
                    bllValue.Update(newElongBefore);

                    var oldAgingCondition = bllValue.GetModel(oldPls.AgingConditionId.Value);
                    var newAgingCondition = plastic.toAgingConditionValue();
                    newAgingCondition.Id = oldAgingCondition.Id;
                    bllValue.Update(newAgingCondition);

                    var oldMpaAfter = bllValue.GetModel(oldPls.MpaAfterId.Value);
                    var newMpaAfter = plastic.toMpaAfterValue();
                    newMpaAfter.Id = oldMpaAfter.Id;
                    bllValue.Update(newMpaAfter);

                    var oldElongAfter = bllValue.GetModel(oldPls.ElongAfterId.Value);
                    var newElongAfter = plastic.toElongAfterValue();
                    newElongAfter.Id = oldElongAfter.Id;
                    bllValue.Update(newElongAfter);

                    var oldMpaRateMax = bllValue.GetModel(oldPls.MpaRateMaxId.Value);
                    var newMpaRateMax = plastic.toMpaRateMaxValue();
                    newMpaRateMax.Id = oldMpaRateMax.Id;
                    bllValue.Update(newMpaRateMax);

                    var oldElongRateMax = bllValue.GetModel(oldPls.ElongRateMaxId.Value);
                    var newElongRateMax = plastic.toElongRateMaxValue();
                    newElongRateMax.Id = oldElongRateMax.Id;
                    bllValue.Update(newElongRateMax);

                    var oldAgingQualityLoss = bllValue.GetModel(oldPls.AgingQualityLossId.Value);
                    var newAgingQualityLoss = plastic.toAgingQualityLossValue();
                    newAgingQualityLoss.Id = oldAgingQualityLoss.Id;
                    bllValue.Update(newAgingQualityLoss);

                    var oldThermalStablityTime = bllValue.GetModel(oldPls.ThermalStablityTimeId.Value);
                    var newThermalStablityTime = plastic.toThermalStablityTimeValue();
                    newThermalStablityTime.Id = oldThermalStablityTime.Id;
                    bllValue.Update(newThermalStablityTime);

                    var oldBittleImpactTest = bllValue.GetModel(oldPls.BittleImpactTestId.Value);
                    var newBittleImpactTest = plastic.toBittleImpactTestValue();
                    newBittleImpactTest.Id = oldBittleImpactTest.Id;
                    bllValue.Update(newBittleImpactTest);

                    var oldThermalDeformation = bllValue.GetModel(oldPls.ThermalDeformationId.Value);
                    var newThermalDeformation = plastic.toThermalDeformationValue();
                    newThermalDeformation.Id = oldThermalDeformation.Id;
                    bllValue.Update(newThermalDeformation);

                    var oldOxyIndex = bllValue.GetModel(oldPls.OxyIndexId.Value);
                    var newOxyIndex = plastic.toOxyIndexValue();
                    newOxyIndex.Id = oldOxyIndex.Id;
                    bllValue.Update(newOxyIndex);

                    var oldSpecGravity = bllValue.GetModel(oldPls.SpecGravityId.Value);
                    var newSpecGravity = plastic.toSpecGravityValue();
                    newSpecGravity.Id = oldSpecGravity.Id;
                    bllValue.Update(newSpecGravity);

                    var oldShoreHBTest = bllValue.GetModel(oldPls.ShoreHBTestId.Value);
                    var newShoreHBTest = plastic.toShoreHBTestValue();
                    newShoreHBTest.Id = oldShoreHBTest.Id;
                    bllValue.Update(newShoreHBTest);

                    var oldApperanceQuality = bllValue.GetModel(oldPls.ApperanceQualityId.Value);
                    var newApperanceQuality = plastic.toApperanceQualityValue();
                    newApperanceQuality.Id = oldApperanceQuality.Id;
                    bllValue.Update(newApperanceQuality);

                    var oldPkgAndLabel = bllValue.GetModel(oldPls.PkgAndLabelId.Value);
                    var newPkgAndLabel = plastic.toPkgAndLabelValue();
                    newPkgAndLabel.Id = oldPkgAndLabel.Id;
                    bllValue.Update(newPkgAndLabel);

                    retData.Code    = RESULT_CODE.OK;
                    retData.Content = "更新塑料表成功";
                }
            } catch (Exception e) {
                log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name);
                log.Error(e);
            }

            return(Json(retData));
        }