Ejemplo n.º 1
0
        public void SubmitInfo_TCUSoft(string billNo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            FlowControlService.IFlowServer serviceFlow =
                FlowControlService.ServerModuleFactory.GetServerModule <FlowControlService.IFlowServer>();

            if (serviceFlow.GetNextBillStatus(billNo) != CE_CommonBillStatus.单据完成.ToString())
            {
                return;
            }

            if (billNo == null)
            {
                throw new Exception("业务单号无效");
            }

            var varData = from a in ctx.Business_Project_TCU_SoftwareUpdate
                          where a.BillNo == billNo
                          select a;

            if (varData.Count() != 1)
            {
                throw new Exception("业务单号无效");
            }

            if (varData.Single().IsPassTest == null || !((bool)varData.Single().IsPassTest))
            {
                return;
            }

            var varData1 = from a in ctx.TCU_CarModelInfo_Software
                           where a.CarModelNo == varData.Single().CarModelNo &&
                           a.RelateBillNo == billNo
                           select a;

            if (varData1.Count() > 0)
            {
                return;
            }

            TCU_CarModelInfo_Software software = new TCU_CarModelInfo_Software();

            software.CarModelNo   = varData.Single().CarModelNo;
            software.RelateBillNo = billNo;

            ctx.TCU_CarModelInfo_Software.InsertOnSubmit(software);
            ctx.SubmitChanges();
        }
Ejemplo n.º 2
0
        bool DataCheck()
        {
            try
            {
                if (customDataGridView1.Rows.Count == 0)
                {
                    throw new Exception("请录入【DID】信息");
                }

                if (txtCarModelNo.Text.Trim().Length == 0)
                {
                    throw new Exception("请选择【车型代号】");
                }

                if (cmbVersionType.Text.Trim().Length == 0)
                {
                    throw new Exception("请选择【版本号】之前的【版本类型】,V或者S");
                }

                if (txtVersion.Text.Trim().Length < 4 || txtVersion.Text.Trim().Length > 5)
                {
                    throw new Exception("【版本号】长度有误");
                }

                if (txtUpdateContent.Text.Trim().Length == 0)
                {
                    throw new Exception("请录入【升级内容】");
                }

                if (txtUpdateReason.Text.Trim().Length == 0)
                {
                    throw new Exception("请录入【升级原因】");
                }

                if (btnDownload_TCUSoft.Tag == null || btnDownload_TCUSoft.Tag.ToString().Trim().Length == 0)
                {
                    throw new Exception("请上传软件文件");
                }

                if (txtTechnicalNote.Text.Trim().Length == 0)
                {
                    throw new Exception("请录入【技术变更单编号】");
                }

                FlowControlService.IFlowServer serviceFlow =
                    FlowControlService.ServerModuleFactory.GetServerModule <FlowControlService.IFlowServer>();

                Flow_FlowInfo flow =
                    serviceFlow.GetNowFlowInfo(serviceFlow.GetBusinessTypeID(CE_BillTypeEnum.TCU软件升级, null), txtBillNo.Text);

                if (flow.FlowID == 72)
                {
                    if (btnDownload_TestReport.Tag == null || btnDownload_TestReport.Tag.ToString().Trim().Length == 0)
                    {
                        throw new Exception("请上传【测试报告】");
                    }

                    if (txtTestResult.Text.Trim().Length == 0)
                    {
                        throw new Exception("请填写【测试结果】");
                    }

                    if (GlobalObject.GeneralFunction.GetRadioButton(groupBox3) == null)
                    {
                        throw new Exception("请选择【测试结论】");
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return(false);
            }
        }
Ejemplo n.º 3
0
        public void SaveInfo_TCUSoft(Business_Project_TCU_SoftwareUpdate updateInfo,
                                     List <View_Business_Project_TCU_SoftwareUpdate_DID> lstDID)
        {
            FlowControlService.IFlowServer serviceFlow =
                FlowControlService.ServerModuleFactory.GetServerModule <FlowControlService.IFlowServer>();
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;
            Flow_FlowInfo flow             =
                serviceFlow.GetNowFlowInfo(serviceFlow.GetBusinessTypeID(CE_BillTypeEnum.TCU软件升级, null), updateInfo.BillNo);

            ctx.Connection.Open();
            ctx.Transaction = ctx.Connection.BeginTransaction();

            try
            {
                if (updateInfo == null || updateInfo.BillNo == null)
                {
                    return;
                }

                var varData = from a in ctx.Business_Project_TCU_SoftwareUpdate
                              where a.BillNo == updateInfo.BillNo
                              select a;

                Business_Project_TCU_SoftwareUpdate tempInfo = new Business_Project_TCU_SoftwareUpdate();

                if (varData.Count() == 0)
                {
                    tempInfo.BillNo           = updateInfo.BillNo;
                    tempInfo.CarModelNo       = updateInfo.CarModelNo;
                    tempInfo.ClientVersion    = updateInfo.ClientVersion;
                    tempInfo.DiagnosisVersion = updateInfo.DiagnosisVersion;
                    tempInfo.HardwareVersion  = updateInfo.HardwareVersion;
                    tempInfo.ProgramUnique    = updateInfo.ProgramUnique;
                    tempInfo.TechnicalNote    = updateInfo.TechnicalNote;
                    tempInfo.UnderVersion     = updateInfo.UnderVersion;
                    tempInfo.UpdateContent    = updateInfo.UpdateContent;
                    tempInfo.UpdateReason     = updateInfo.UpdateReason;
                    tempInfo.Version          = updateInfo.Version;

                    ctx.Business_Project_TCU_SoftwareUpdate.InsertOnSubmit(tempInfo);
                }
                else if (varData.Count() == 1)
                {
                    tempInfo = varData.Single();

                    switch (flow.FlowID)
                    {
                    case 70:
                        tempInfo.CarModelNo       = updateInfo.CarModelNo;
                        tempInfo.ClientVersion    = updateInfo.ClientVersion;
                        tempInfo.DiagnosisVersion = updateInfo.DiagnosisVersion;
                        tempInfo.HardwareVersion  = updateInfo.HardwareVersion;
                        tempInfo.ProgramUnique    = updateInfo.ProgramUnique;
                        tempInfo.TechnicalNote    = updateInfo.TechnicalNote;
                        tempInfo.UnderVersion     = updateInfo.UnderVersion;
                        tempInfo.UpdateContent    = updateInfo.UpdateContent;
                        tempInfo.UpdateReason     = updateInfo.UpdateReason;
                        tempInfo.Version          = updateInfo.Version;
                        break;

                    case 72:
                        tempInfo.IsPassTest = updateInfo.IsPassTest;
                        tempInfo.TestReport = updateInfo.TestReport;
                        tempInfo.TestResult = updateInfo.TestResult;
                        break;

                    default:
                        break;
                    }
                }

                ctx.SubmitChanges();

                if (lstDID != null && serviceFlow.GetNowBillStatus(updateInfo.BillNo) == CE_CommonBillStatus.新建单据.ToString())
                {
                    var varData1 = from a in ctx.Business_Project_TCU_SoftwareUpdate_DID
                                   where a.BillNo == updateInfo.BillNo
                                   select a;

                    ctx.Business_Project_TCU_SoftwareUpdate_DID.DeleteAllOnSubmit(varData1);
                    ctx.SubmitChanges();

                    foreach (View_Business_Project_TCU_SoftwareUpdate_DID item in lstDID)
                    {
                        Business_Project_TCU_SoftwareUpdate_DID tempDID = new Business_Project_TCU_SoftwareUpdate_DID();

                        tempDID.BillNo      = updateInfo.BillNo;
                        tempDID.DID         = item.DID;
                        tempDID.DataContent = item.内容;
                        tempDID.DataSize    = item.字节数;

                        ctx.Business_Project_TCU_SoftwareUpdate_DID.InsertOnSubmit(tempDID);
                    }
                }

                ctx.SubmitChanges();
                ctx.Transaction.Commit();
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                throw new Exception(ex.Message);
            }
        }