コード例 #1
0
 /// <summary>
 /// 把PanelInfo的板号和层,赋予当前标签。
 /// 如果pinfo为null, 则产生新的板号。
 /// </summary>
 /// <param name="pinfo"></param>
 public void SetupPanelInfo(PanelInfo pinfo)
 {
     PanelNo     = pinfo != null ? pinfo.PanelNo : PanelGen.NewPanelNo();
     Floor       = pinfo != null ? pinfo.CurrFloor : 1;
     FloorIndex  = 0;
     Coordinates = "";
 }
コード例 #2
0
        public static bool UpdateEdgeExceed(FloorPerformance fp, PanelInfo pInfo, LableCode cur, LableCode fromcache)
        {
            var cps = new List <CommandParameter>();

            cps.Add(CreateLableCodeUpdate(fromcache));
            switch (fp)
            {
            case FloorPerformance.BothFinish:
                if (fromcache.floor == pInfo.MaxFloor || clsSetting.SplintHeight < GetFloorMaxDiameter(cur.PanelNo, cur.floor + 1) + 50)      //板满
                {
                    cps.Add(new CommandParameter("UPDATE Panel SET Status = @Status,MaxFloor=CurrFloor," +
                                                 "UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo",
                                                 new SqlParameter[] {
                        new SqlParameter("@PanelNo", pInfo.PanelNo),
                        new SqlParameter("@Status", LableState.PanelFill),
                        new SqlParameter("@UpdateDate", DateTime.Now)
                    }));
                    cur.PanelNo     = PanelGen.NewPanelNo();
                    cur.floor       = 1;
                    cur.floorIndex  = 0;
                    cur.Coordinates = null;
                    cur.Crz         = 0;
                    cur.Cx          = 0;
                    cur.Cy          = 0;
                    cur.Cz          = 0;
                    cps.Add(CreateLableCodeUpdate(cur));
                    cps.Add(new CommandParameter("UPDATE LableCode SET Floor = @Floor,PanelNo = @NewPanelNo," +
                                                 "UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo and FloorIndex=0",
                                                 new SqlParameter[] {
                        new SqlParameter("@NewPanelNo", cur.PanelNo),
                        new SqlParameter("@PanelNo", pInfo.PanelNo),
                        new SqlParameter("@Floor", cur.floor),
                        new SqlParameter("@UpdateDate", DateTime.Now)
                    }));
                    cps.Add(CreateInsertPanel(cur.PanelNo, cur.ToLocation));
                }
                else        //层满
                {
                    cur.floor++;
                    cps.Add(CreateLableCodeUpdate(cur));
                    cps.Add(new CommandParameter("UPDATE LableCode SET Floor = @Floor," +
                                                 "UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo and FloorIndex=0",
                                                 new SqlParameter[] {
                        new SqlParameter("@PanelNo", pInfo.PanelNo),
                        new SqlParameter("@Floor", cur.floor),
                        new SqlParameter("@UpdateDate", DateTime.Now)
                    }));
                    cps.Add(new CommandParameter("UPDATE Panel SET CurrFloor = @CurrFloor,OddStatus = @OddStatus,EvenStatus = @EvenStatus," +
                                                 "UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo",
                                                 new SqlParameter[] {
                        new SqlParameter("@PanelNo", pInfo.PanelNo),
                        new SqlParameter("@CurrFloor", cur.floor),
                        new SqlParameter("@OddStatus", false),
                        new SqlParameter("@EvenStatus", false),
                        new SqlParameter("@UpdateDate", DateTime.Now)
                    }));
                }
                break;

            case FloorPerformance.None:
            default:
                break;
            }
            cps.Add(new CommandParameter("UPDATE Panel SET HasExceed=@HasExceed,UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo",
                                         new SqlParameter[] {
                new SqlParameter("@PanelNo", pInfo.PanelNo),
                new SqlParameter("@HasExceed", pInfo.HasExceed),
                new SqlParameter("@UpdateDate", DateTime.Now)
            }));
            return(DataAccess.CreateDataAccess.sa.NonQueryTran(cps));
        }
コード例 #3
0
        public static bool Update(FloorPerformance fp, PanelInfo pInfo, LableCode c, LableCode c2 = null)
        {
            var cps = new List <CommandParameter>();

            cps.Add(CreateLableCodeUpdate(c));
            if (c2 != null)
            {
                cps.Add(new CommandParameter(@"update LableCode set FloorIndex=@FloorIndex,Coordinates=@Coordinates,
                    Cx=@Cx,Cy=@Cy,Cz=@Cz,Crz=@Crz,Status=@Status,Remark=@Remark,UpdateDate=@UpdateDate where LCode=@LCode",
                                             new SqlParameter[] {
                    new SqlParameter("@LCode", c2.LCode),
                    new SqlParameter("@FloorIndex", c2.floorIndex),
                    new SqlParameter("@Coordinates", c2.Coordinates),
                    new SqlParameter("@Cx", c2.cx),
                    new SqlParameter("@Cy", c2.cy),
                    new SqlParameter("@Cz", c2.cz),
                    new SqlParameter("@Crz", c2.crz),
                    new SqlParameter("@Status", c2.Status),
                    c2.Remark == null?new SqlParameter("@Remark", DBNull.Value):new SqlParameter("@Remark", c2.Remark),
                    new SqlParameter("@UpdateDate", DateTime.Now)
                }));
            }
            switch (fp)
            {
            case FloorPerformance.OddFinish:
            case FloorPerformance.EvenFinish:
                cps.Add(new CommandParameter("UPDATE Panel SET CurrFloor = @CurrFloor,OddStatus = @OddStatus,EvenStatus = @EvenStatus," +
                                             "UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo",
                                             new SqlParameter[] {
                    new SqlParameter("@PanelNo", c.PanelNo),
                    new SqlParameter("@CurrFloor", c.floor),
                    new SqlParameter("@OddStatus", fp == FloorPerformance.OddFinish),
                    new SqlParameter("@EvenStatus", fp == FloorPerformance.EvenFinish),
                    new SqlParameter("@UpdateDate", DateTime.Now)
                }));
                break;

            case FloorPerformance.BothFinish:
                if (c.floor == pInfo.MaxFloor || clsSetting.SplintHeight < GetFloorMaxDiameter(c.PanelNo, c.floor + 1) + 50)
                {
                    cps.Add(new CommandParameter("UPDATE Panel SET Status = @Status,MaxFloor=CurrFloor," +
                                                 "UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo",
                                                 new SqlParameter[] {
                        new SqlParameter("@PanelNo", c.PanelNo),
                        new SqlParameter("@Status", LableState.PanelFill),
                        new SqlParameter("@UpdateDate", DateTime.Now)
                    }));
                    if (pInfo.HasExceed)
                    {
                        var panelno = PanelGen.NewPanelNo();
                        cps.Add(new CommandParameter("UPDATE LableCode SET Floor = 1,PanelNo = @NewPanelNo," +
                                                     "UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo and FloorIndex=0",
                                                     new SqlParameter[] {
                            new SqlParameter("@NewPanelNo", panelno),
                            new SqlParameter("@PanelNo", pInfo.PanelNo),
                            new SqlParameter("@UpdateDate", DateTime.Now)
                        }));
                        cps.Add(CreateInsertPanel(panelno, c.ToLocation));
                    }
                }
                else
                {
                    cps.Add(new CommandParameter("UPDATE Panel SET CurrFloor = @CurrFloor,OddStatus = @OddStatus,EvenStatus = @EvenStatus," +
                                                 "UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo",
                                                 new SqlParameter[] {
                        new SqlParameter("@PanelNo", c.PanelNo),
                        new SqlParameter("@CurrFloor", c.floor + 1),
                        new SqlParameter("@OddStatus", false),
                        new SqlParameter("@EvenStatus", false),
                        new SqlParameter("@UpdateDate", DateTime.Now)
                    }));
                    if (pInfo.HasExceed)
                    {
                        cps.Add(new CommandParameter("UPDATE LableCode SET Floor = @Floor," +
                                                     "UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo and FloorIndex=0",
                                                     new SqlParameter[] {
                            new SqlParameter("@PanelNo", pInfo.PanelNo),
                            new SqlParameter("@Floor", c.floor + 1),
                            new SqlParameter("@UpdateDate", DateTime.Now)
                        }));
                    }
                }
                break;

            case FloorPerformance.None:
            default:
                break;
            }
            cps.Add(new CommandParameter("UPDATE Panel SET HasExceed=@HasExceed,UpdateDate = @UpdateDate WHERE PanelNo = @PanelNo",
                                         new SqlParameter[] {
                new SqlParameter("@PanelNo", pInfo.PanelNo),
                new SqlParameter("@HasExceed", pInfo.HasExceed),
                new SqlParameter("@UpdateDate", DateTime.Now)
            }));
            return(DataAccess.CreateDataAccess.sa.NonQueryTran(cps));
        }