示例#1
0
        private void DoAssemblyPlan()
        {
            try
            {
                PlanInfoForm dialog = new PlanInfoForm();

                PlinePlanDAL dal = new PlinePlanDAL();

                string plineid = DateTime.Now.ToString("yyyyMMdd") + BaseVariable.LineID;

                if (dal.PlanExists(plineid) <= 0)
                {
                    if (dal.AddPlinePlan(PlinePlanMDL.BuildedPlan(Convert.ToInt32(BaseVariable.LineID)
                                                                  , DateTime.Now)) <= 0)
                    {
                        MessageBox.Show("加载产线配置失败,请检查配置文件信息!", "提示", MessageBoxButtons.OK);

                        return;
                    }
                }

                PlinePlanMDL mdl = dal.GetPlanInfo(plineid);

                if (mdl == null)
                {
                    MessageBox.Show("加载产线配置失败,请检查配置文件信息!", "提示", MessageBoxButtons.OK);
                    return;
                }

                dialog.PLAN = mdl;

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    if (dal.UpdatePlinePlan(dialog.PLAN) > 0)
                    {
                        MessageBox.Show("修改产线配置信息成功!", "提示", MessageBoxButtons.OK);
                        return;
                    }
                    else
                    {
                        MessageBox.Show("修改产线配置信息失败!", "提示", MessageBoxButtons.OK);
                        return;
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "提示", MessageBoxButtons.OK);
            }
        }