Beispiel #1
0
        private void UpdateSqlData()                         //手动状态下更新数据库
        {
            var             Db         = new DbContext().Db; //获取操作对象
            AssignmentModel assignment = new AssignmentModel();

            assignment.ID     = Rack + Row + Column + Depth;
            assignment.Rack   = Rack;
            assignment.X_Num  = Row;
            assignment.Y_Num  = Column;
            assignment.Depth  = Depth;
            assignment.Status = "OK";
            var worksheet = reoGridControl1.CurrentWorksheet;//获取当前工作表

            if (worksheet[Position] != null)
            {
                assignment.Name       = worksheet[Position].ToString();
                assignment.Code       = "";
                assignment.CreateTime = DateTime.Now;
                Db.Saveable <AssignmentModel>(assignment).ExecuteReturnEntity();
            }
            else
            {
                // var t=Db.Deleteable<AssignmentModel>.In(assignment.ID).ExecuteCommand();
            }
        }
Beispiel #2
0
        private bool InsertPallet(int depth)
        {
            var    Db = new DbContext().Db;
            string ID;

            for (int rack = 1; rack < 3; rack++)//Rack
            {
                for (int row = 1; row < 27; row++)
                {
                    for (int column = 1; column < 5; column++)
                    {
                        ID = rack.ToString("000") + row.ToString("000") + column.ToString("00") + depth.ToString("00");
                        var isAny = Db.Queryable <AssignmentModel>().Where(it => it.ID == ID).Any();
                        if (isAny)
                        {
                            continue;
                        }
                        else
                        {
                            string[] craneData = new string[17];
                            craneData[0]  = "Crane1";
                            craneData[1]  = SequenceNumber;
                            craneData[2]  = AssignmentID;
                            craneData[3]  = "CM";
                            craneData[4]  = "01";
                            craneData[5]  = "001";                 //Rack1
                            craneData[8]  = "01";                  // 起点单双深
                            craneData[9]  = rack.ToString("000");
                            craneData[12] = depth.ToString("00");  // 终点单双深
                            craneData[6]  = "901";                 //起点X
                            craneData[7]  = "01";                  //起点Y
                            craneData[10] = row.ToString("000");   //终点X
                            craneData[11] = column.ToString("00"); //终点Y
                            telegramARQ(craneData);
                            AssignmentModel model = new AssignmentModel();
                            model.ID         = ID;
                            model.Rack       = rack.ToString("000");
                            model.X_Num      = row.ToString("000");
                            model.Y_Num      = column.ToString("00");
                            model.Depth      = depth.ToString("00");
                            model.Status     = "OK";
                            model.Name       = tbRuku.Text;
                            model.Code       = "";
                            model.CreateTime = DateTime.Now;
                            var t2 = Db.Insertable(model).ExecuteCommand();
                            UpdateExcel(model.X_Num, model.Y_Num, tbRuku.Text);
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }