/// <summary>
        /// 清空数据
        /// </summary>
        void ClearData()
        {
            m_lnqDeviceMaintenance = new S_DeviceMaintenanceBill();

            txtBillNo.Text               = "";
            txtDept.Text                 = "";
            txtDept.Tag                  = -1;
            txtDeviceCode.Text           = "";
            txtDeviceName.Text           = "";
            txtFaultDescription.Text     = "";
            txtMaintenanceCondition.Text = "";
            txtReplacementParts.Text     = "";
            txtServiceEvaluation.Text    = "";
            dtpDeviceNormalUseTime.Value = ServerTime.Time;
            dtpDeviceDamageTime.Value    = ServerTime.Time;
            lbAttendant.Text             = "";
            lbAttendantDate.Text         = "";
            lbBillStatus.Text            = "";
            lbProposer.Text              = "";
            lbProposerDate.Text          = "";
            lbReviewers.Text             = "";
            lbReviewersDate.Text         = "";
        }
Exemplo n.º 2
0
        /// <summary>
        /// 流程管理
        /// </summary>
        /// <param name="deviceMaintenanceBill">LINQ数据集</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回True,失败返回False</returns>
        public bool FlowInfo(S_DeviceMaintenanceBill deviceMaintenanceBill, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

                var varData = from a in ctx.S_DeviceMaintenanceBill
                              where a.Bill_ID == deviceMaintenanceBill.Bill_ID
                              select a;

                S_DeviceMaintenanceBill lnqDeviceMaintenanceBill = new S_DeviceMaintenanceBill();

                if (varData.Count() == 0)
                {
                    lnqDeviceMaintenanceBill.Bill_ID          = deviceMaintenanceBill.Bill_ID;
                    lnqDeviceMaintenanceBill.DeviceCode       = deviceMaintenanceBill.DeviceCode;
                    lnqDeviceMaintenanceBill.DeviceName       = deviceMaintenanceBill.DeviceName;
                    lnqDeviceMaintenanceBill.FaultDescription = deviceMaintenanceBill.FaultDescription;
                    lnqDeviceMaintenanceBill.UseDept          = deviceMaintenanceBill.UseDept;
                    lnqDeviceMaintenanceBill.DeviceDamageTime = deviceMaintenanceBill.DeviceDamageTime;
                    lnqDeviceMaintenanceBill.BillStatus       = "等待维修";
                    lnqDeviceMaintenanceBill.Proposer         = BasicInfo.LoginName;
                    lnqDeviceMaintenanceBill.ProposerDate     = ServerTime.Time;

                    ctx.S_DeviceMaintenanceBill.InsertOnSubmit(lnqDeviceMaintenanceBill);
                }
                else if (varData.Count() == 1)
                {
                    lnqDeviceMaintenanceBill = varData.Single();

                    switch (lnqDeviceMaintenanceBill.BillStatus)
                    {
                    case "等待维修":

                        lnqDeviceMaintenanceBill.BillStatus           = "等待评价";
                        lnqDeviceMaintenanceBill.MaintenanceCondition = deviceMaintenanceBill.MaintenanceCondition;
                        lnqDeviceMaintenanceBill.ReplacementParts     = deviceMaintenanceBill.ReplacementParts;
                        lnqDeviceMaintenanceBill.DeviceNormalUseTime  = deviceMaintenanceBill.DeviceNormalUseTime;
                        lnqDeviceMaintenanceBill.Attendant            = BasicInfo.LoginName;
                        lnqDeviceMaintenanceBill.AttendantDate        = ServerTime.Time;
                        break;

                    case "等待评价":

                        lnqDeviceMaintenanceBill.BillStatus        = "等待确认";
                        lnqDeviceMaintenanceBill.ServiceEvaluation = deviceMaintenanceBill.ServiceEvaluation;
                        lnqDeviceMaintenanceBill.Reviewers         = BasicInfo.LoginName;
                        lnqDeviceMaintenanceBill.ReviewersDate     = ServerTime.Time;
                        break;

                    case "等待确认":

                        lnqDeviceMaintenanceBill.BillStatus    = "单据已完成";
                        lnqDeviceMaintenanceBill.Confirmor     = BasicInfo.LoginName;
                        lnqDeviceMaintenanceBill.ConfirmorDate = ServerTime.Time;
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    error = "单据号重复";
                    return(false);
                }

                ctx.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }