Beispiel #1
0
 /// <summary>
 /// 更改任务、枪柜、枪位、子弹数量状态
 /// </summary>
 /// <param name="task_info">任务对象</param>
 /// <param name="task_status">任务状态</param>
 /// <param name="gun_status">枪支状态</param>
 /// <param name="gun_pos_status">枪位状态</param>
 /// <param name="gun_info_id">枪支id集合</param>
 /// <param name="gun_pos_id">枪位id集合</param>
 /// <param name="magazine_id">子弹id集合</param>
 /// <param name="list_bullet">子弹任务详情集合</param>
 public static void update(Model.task_info task_info, string task_status, string gun_status, string gun_pos_status, string bullet_opreat, List <string> gun_info_id, List <string> gun_pos_id, List <string> magazine_id, List <Model.task_info_detail> list_bullet)
 {
     task_info.TASK_STATUS = task_status;
     new BLL.task_info().Update(task_info);
     //更新枪支状态“3”表示未置枪,“1”表示置枪
     for (int i = 0; i < gun_info_id.Count; i++)
     {
         Model.gun_info gun_info = new BLL.gun_info().GetModel(gun_info_id[i]);
         if (task_info.task_BigType == 2)
         {
             gun_info.IN_TIME = DateTime.Now;
         }
         else if (task_info.task_BigType == 5 || task_info.task_BigType == 7 || task_info.task_BigType == 12)
         {
             gun_info.OUT_TIME = DateTime.Now;
         }
         gun_info.GUN_STATUS = gun_status;
         new BLL.gun_info().Update(gun_info);
     }
     //更新枪柜状态,“2”表示未置枪,“3”表示置枪,"8"表示已封存,”7“表示已出库
     for (int i = 0; i < gun_pos_id.Count; i++)
     {
         Model.position_info gun_pos_info = new BLL.position_info().GetModel(gun_pos_id[i]);
         gun_pos_info.GUN_POSITION_STATUS = gun_pos_status;
         new BLL.position_info().Update(gun_pos_info);
     }
     //更新现存子弹数量,库存量-取弹数量
     if (bullet_opreat == "取弹")
     {
         for (int i = 0; i < magazine_id.Count; i++)
         {
             Model.magazine_info mag_info = new BLL.magazine_info().GetModel(magazine_id[i]);
             mag_info.STOCK_QTY = mag_info.STOCK_QTY - list_bullet[i].APPLY_BULLET_QTY;
             new BLL.magazine_info().Update(mag_info);
         }
     }
     else if (bullet_opreat == "还弹")
     {
         for (int i = 0; i < magazine_id.Count; i++)
         {
             Model.magazine_info mag_info = new BLL.magazine_info().GetModel(magazine_id[i]);
             mag_info.STOCK_QTY = mag_info.STOCK_QTY + list_bullet[i].APPLY_BULLET_QTY;
             new BLL.magazine_info().Update(mag_info);
         }
     }
 }
 /// <summary>
 /// 更改任务、枪柜、枪位、子弹数量状态
 /// </summary>
 /// <param name="task_info">任务对象</param>
 /// <param name="task_status">任务状态</param>
 /// <param name="gun_status">枪支状态</param>
 /// <param name="gun_pos_status">枪位状态</param>
 /// <param name="gun_info_id">枪支id集合</param>
 /// <param name="gun_pos_id">枪位id集合</param>
 /// <param name="magazine_id">子弹id集合</param>
 /// <param name="list_bullet">子弹任务详情集合</param>
 public static void update(Model.task_info task_info, string task_status, string gun_status, string gun_pos_status,string bullet_opreat, List<string> gun_info_id, List<string> gun_pos_id, List<string> magazine_id, List<Model.task_info_detail> list_bullet)
 {
     task_info.TASK_STATUS = task_status;
     new BLL.task_info().Update(task_info);
     //更新枪支状态“3”表示未置枪,“1”表示置枪
     for (int i = 0; i < gun_info_id.Count; i++)
     {
         Model.gun_info gun_info = new BLL.gun_info().GetModel(gun_info_id[i]);
         if (task_info.task_BigType == 2)
         {
             gun_info.IN_TIME = DateTime.Now;
         }
         else if (task_info.task_BigType == 5 || task_info.task_BigType == 7 || task_info.task_BigType == 12)
         {
             gun_info.OUT_TIME = DateTime.Now;
         }
         gun_info.GUN_STATUS = gun_status;
         new BLL.gun_info().Update(gun_info);
     }
     //更新枪柜状态,“2”表示未置枪,“3”表示置枪,"8"表示已封存,”7“表示已出库
     for (int i = 0; i < gun_pos_id.Count; i++)
     {
         Model.position_info gun_pos_info = new BLL.position_info().GetModel(gun_pos_id[i]);
         gun_pos_info.GUN_POSITION_STATUS = gun_pos_status;
         new BLL.position_info().Update(gun_pos_info);
     }
     //更新现存子弹数量,库存量-取弹数量
     if (bullet_opreat == "取弹")
     {
         for (int i = 0; i < magazine_id.Count; i++)
         {
             Model.magazine_info mag_info = new BLL.magazine_info().GetModel(magazine_id[i]);
             mag_info.STOCK_QTY = mag_info.STOCK_QTY - list_bullet[i].APPLY_BULLET_QTY;
             new BLL.magazine_info().Update(mag_info);
         }
     }
     else if (bullet_opreat == "还弹")
     {
         for (int i = 0; i < magazine_id.Count; i++)
         {
             Model.magazine_info mag_info = new BLL.magazine_info().GetModel(magazine_id[i]);
             mag_info.STOCK_QTY = mag_info.STOCK_QTY + list_bullet[i].APPLY_BULLET_QTY;
             new BLL.magazine_info().Update(mag_info);
         }
     }
 }
        private static void addTask(string prams)
        {
            Bll.task_info task_info_bll = new Gunark.BLL.task_info();
            Bll.task_info_detail task_detail_info_bll = new Gunark.BLL.task_info_detail();
            Bll.position_info position_info_bll = new Gunark.BLL.position_info();
            Bll.gun_info gun_info_bll = new Gunark.BLL.gun_info();
            Bll.magazine_info magazine_info_bll = new Gunark.BLL.magazine_info();
            int j = 10;

            string[] attributes = prams.Split('|');
            //任务信息
            Model.task_info task_info = new Gunark.Model.task_info();
            task_info.task_ID = attributes[0];
            task_info.GUNARK_ID = attributes[1];
            task_info.UNIT_ID = attributes[2];
            task_info.TASK_STATUS = attributes[3];
            task_info.TASK_BIGTYPE = int.Parse(attributes[4]);
            task_info.TASK_SMALLTYPE = attributes[5];
            task_info.TASK_PROPERTY = attributes[6];
            task_info.TASK_PLAN_BEGINTIME = attributes[7];
            task_info.TASK_PLAN_FINISHTIME = attributes[8];
            task_info.TASK_APPLY_USERID = attributes[9];
            task_info.TASK_APPLY_TIME = attributes[10];
            task_info_bll.Add(task_info);
            //任务详情信息
            int task_detail_info_count = int.Parse(attributes[11].Substring(1, attributes[11].LastIndexOf("&") - 1));
            for (int i = 0; i < task_detail_info_count; i++)
            {
                Model.task_info_detail task_detail_info = new Gunark.Model.task_info_detail();
                if(i == 0)
                    task_detail_info.TASK_DETAIL_ID = attributes[++j].Substring(attributes[j].LastIndexOf("&") + 1);
                else
                    task_detail_info.TASK_DETAIL_ID = attributes[++j];
                task_detail_info.TASK_ID = attributes[++j];
                task_detail_info.GUNARK_ID = attributes[++j];
                task_detail_info.UNIT_ID = attributes[++j];
                task_detail_info.GUN_INFO_ID = attributes[++j];
                task_detail_info.GUN_POSITION_INFO_ID = attributes[++j];
                task_detail_info.GUN_DUTY_USER = attributes[++j];
                task_detail_info.BULLET_TYPE = attributes[++j];
                task_detail_info.MAGAZINE_INFO_ID = attributes[++j];
                task_detail_info.APPLY_BULLET_QTY = int.Parse(attributes[++j]);
                task_detail_info.DEPLETION_BULLET_QTY = int.Parse(attributes[++j]);
                if (i != task_detail_info_count - 1)
                    ++j;
                task_detail_info_bll.Add(task_detail_info);
            }
            //枪位信息
            int gun_position_info_count = 0;
            try
            {
                 gun_position_info_count = int.Parse(attributes[j + 1].Substring(1, attributes[j + 1].LastIndexOf("&") - 1));
            }
            catch { }
            if (gun_position_info_count != 0)
            {
                for (int i = 0; i < gun_position_info_count; i++)
                {
                    Model.position_info gun_position_info = new Gunark.Model.position_info();
                    if (i == 0)
                        gun_position_info.GUN_POSITION_INFO_ID = attributes[++j].Substring(3);
                    else
                        gun_position_info.GUN_POSITION_INFO_ID = attributes[++j];
                    gun_position_info.GUNARK_ID = attributes[++j];
                    gun_position_info.UNIT_ID = attributes[++j];
                    gun_position_info.GUN_POSITION_NUMBER = attributes[++j];
                    gun_position_info.GUN_POSITION_STATUS = attributes[++j];
                    gun_position_info.GUN_INFO_ID = attributes[++j];
                    gun_position_info.GUN_BULLET_NUMBER = attributes[++j];
                    gun_position_info.GUN_TYPE = attributes[++j];
                    if (i != gun_position_info_count - 1)
                        ++j;
                    position_info_bll.Add(gun_position_info);
                }
                //枪支信息
                int gun_info_count = int.Parse(attributes[j + 1].Substring(1, attributes[j + 1].LastIndexOf("&") - 1));
                for (int i = 0; i < gun_info_count; i++)
                {
                    Model.gun_info gun_info = new Gunark.Model.gun_info();
                    if (i == 0)
                        gun_info.GUN_INFO_ID = attributes[++j].Substring(3);
                    else
                        gun_info.GUN_INFO_ID = attributes[++j];
                    gun_info.GUNARK_ID = attributes[++j];
                    gun_info.UNIT_ID = attributes[++j];
                    gun_info.GUN_NUMBER = attributes[++j];
                    gun_info.GUN_TYPE = attributes[++j];
                    gun_info.GUN_STATUS = attributes[++j];
                    gun_info.GUN_BULLET_LOCATION = attributes[++j];
                    if (i != gun_info_count - 1)
                        ++j;
                    gun_info_bll.Add(gun_info);
                }
                //弹仓信息
                int magazine_info_count = int.Parse(attributes[j + 1].Substring(1, attributes[j + 1].LastIndexOf("&") - 1));
                for (int i = 0; i < magazine_info_count; i++)
                {
                    Model.magazine_info magazine_info = new Gunark.Model.magazine_info();
                    if (i == 0)
                        magazine_info.MAGAZINE_INFO_ID = attributes[++j].Substring(3);
                    else
                        magazine_info.MAGAZINE_INFO_ID = attributes[++j];
                    magazine_info.GUNARK_ID = attributes[++j];
                    magazine_info.UNIT_ID = attributes[++j];
                    magazine_info.MAGAZINE_NUMBER = attributes[++j];
                    magazine_info.STOCK_QTY = int.Parse(attributes[++j]);
                    magazine_info.CAPACITY_QTY = int.Parse(attributes[++j]);
                    magazine_info.MAGAZINE_NAME = attributes[++j];
                    magazine_info.BULLET_MODEL = attributes[++j];
                    magazine_info.BULLET_GROUP_ID = attributes[++j];
                    ////if (i != magazine_info_count - 1)
                    ////    ++j;
                    magazine_info_bll.Add(magazine_info);
                }
            }
            else
            {
                int magazine_info_count = 0;
                //弹仓信息
                try
                {
                    magazine_info_count = int.Parse(attributes[j + 1].Substring(7, attributes[j + 1].LastIndexOf("&") - 1));
                }
                catch { }
                for (int i = 0; i < magazine_info_count; i++)
                {
                    Model.magazine_info magazine_info = new Gunark.Model.magazine_info();
                    if (i == 0)
                        magazine_info.MAGAZINE_INFO_ID = attributes[++j].Substring(9);
                    else
                        magazine_info.MAGAZINE_INFO_ID = attributes[++j];
                    magazine_info.GUNARK_ID = attributes[++j];
                    magazine_info.UNIT_ID = attributes[++j];
                    magazine_info.MAGAZINE_NUMBER = attributes[++j];
                    magazine_info.STOCK_QTY = int.Parse(attributes[++j]);
                    magazine_info.CAPACITY_QTY = int.Parse(attributes[++j]);
                    magazine_info.MAGAZINE_NAME = attributes[++j];
                    magazine_info.BULLET_MODEL = attributes[++j];
                    magazine_info.BULLET_GROUP_ID = attributes[++j];
                    ////if (i != magazine_info_count - 1)
                    ////    ++j;
                    magazine_info_bll.Add(magazine_info);
                }
            }
        }
Beispiel #4
0
        private static void addTask(string prams)
        {
            Bll.task_info        task_info_bll        = new Gunark.BLL.task_info();
            Bll.task_info_detail task_detail_info_bll = new Gunark.BLL.task_info_detail();
            Bll.position_info    position_info_bll    = new Gunark.BLL.position_info();
            Bll.gun_info         gun_info_bll         = new Gunark.BLL.gun_info();
            Bll.magazine_info    magazine_info_bll    = new Gunark.BLL.magazine_info();
            int j = 10;

            string[] attributes = prams.Split('|');
            //任务信息
            Model.task_info task_info = new Gunark.Model.task_info();
            task_info.task_ID              = attributes[0];
            task_info.GUNARK_ID            = attributes[1];
            task_info.UNIT_ID              = attributes[2];
            task_info.TASK_STATUS          = attributes[3];
            task_info.TASK_BIGTYPE         = int.Parse(attributes[4]);
            task_info.TASK_SMALLTYPE       = attributes[5];
            task_info.TASK_PROPERTY        = attributes[6];
            task_info.TASK_PLAN_BEGINTIME  = attributes[7];
            task_info.TASK_PLAN_FINISHTIME = attributes[8];
            task_info.TASK_APPLY_USERID    = attributes[9];
            task_info.TASK_APPLY_TIME      = attributes[10];
            task_info_bll.Add(task_info);
            //任务详情信息
            int task_detail_info_count = int.Parse(attributes[11].Substring(1, attributes[11].LastIndexOf("&") - 1));

            for (int i = 0; i < task_detail_info_count; i++)
            {
                Model.task_info_detail task_detail_info = new Gunark.Model.task_info_detail();
                if (i == 0)
                {
                    task_detail_info.TASK_DETAIL_ID = attributes[++j].Substring(attributes[j].LastIndexOf("&") + 1);
                }
                else
                {
                    task_detail_info.TASK_DETAIL_ID = attributes[++j];
                }
                task_detail_info.TASK_ID              = attributes[++j];
                task_detail_info.GUNARK_ID            = attributes[++j];
                task_detail_info.UNIT_ID              = attributes[++j];
                task_detail_info.GUN_INFO_ID          = attributes[++j];
                task_detail_info.GUN_POSITION_INFO_ID = attributes[++j];
                task_detail_info.GUN_DUTY_USER        = attributes[++j];
                task_detail_info.BULLET_TYPE          = attributes[++j];
                task_detail_info.MAGAZINE_INFO_ID     = attributes[++j];
                task_detail_info.APPLY_BULLET_QTY     = int.Parse(attributes[++j]);
                task_detail_info.DEPLETION_BULLET_QTY = int.Parse(attributes[++j]);
                if (i != task_detail_info_count - 1)
                {
                    ++j;
                }
                task_detail_info_bll.Add(task_detail_info);
            }
            //枪位信息
            int gun_position_info_count = 0;

            try
            {
                gun_position_info_count = int.Parse(attributes[j + 1].Substring(1, attributes[j + 1].LastIndexOf("&") - 1));
            }
            catch { }
            if (gun_position_info_count != 0)
            {
                for (int i = 0; i < gun_position_info_count; i++)
                {
                    Model.position_info gun_position_info = new Gunark.Model.position_info();
                    if (i == 0)
                    {
                        gun_position_info.GUN_POSITION_INFO_ID = attributes[++j].Substring(3);
                    }
                    else
                    {
                        gun_position_info.GUN_POSITION_INFO_ID = attributes[++j];
                    }
                    gun_position_info.GUNARK_ID           = attributes[++j];
                    gun_position_info.UNIT_ID             = attributes[++j];
                    gun_position_info.GUN_POSITION_NUMBER = attributes[++j];
                    gun_position_info.GUN_POSITION_STATUS = attributes[++j];
                    gun_position_info.GUN_INFO_ID         = attributes[++j];
                    gun_position_info.GUN_BULLET_NUMBER   = attributes[++j];
                    gun_position_info.GUN_TYPE            = attributes[++j];
                    if (i != gun_position_info_count - 1)
                    {
                        ++j;
                    }
                    position_info_bll.Add(gun_position_info);
                }
                //枪支信息
                int gun_info_count = int.Parse(attributes[j + 1].Substring(1, attributes[j + 1].LastIndexOf("&") - 1));
                for (int i = 0; i < gun_info_count; i++)
                {
                    Model.gun_info gun_info = new Gunark.Model.gun_info();
                    if (i == 0)
                    {
                        gun_info.GUN_INFO_ID = attributes[++j].Substring(3);
                    }
                    else
                    {
                        gun_info.GUN_INFO_ID = attributes[++j];
                    }
                    gun_info.GUNARK_ID           = attributes[++j];
                    gun_info.UNIT_ID             = attributes[++j];
                    gun_info.GUN_NUMBER          = attributes[++j];
                    gun_info.GUN_TYPE            = attributes[++j];
                    gun_info.GUN_STATUS          = attributes[++j];
                    gun_info.GUN_BULLET_LOCATION = attributes[++j];
                    if (i != gun_info_count - 1)
                    {
                        ++j;
                    }
                    gun_info_bll.Add(gun_info);
                }
                //弹仓信息
                int magazine_info_count = int.Parse(attributes[j + 1].Substring(1, attributes[j + 1].LastIndexOf("&") - 1));
                for (int i = 0; i < magazine_info_count; i++)
                {
                    Model.magazine_info magazine_info = new Gunark.Model.magazine_info();
                    if (i == 0)
                    {
                        magazine_info.MAGAZINE_INFO_ID = attributes[++j].Substring(3);
                    }
                    else
                    {
                        magazine_info.MAGAZINE_INFO_ID = attributes[++j];
                    }
                    magazine_info.GUNARK_ID       = attributes[++j];
                    magazine_info.UNIT_ID         = attributes[++j];
                    magazine_info.MAGAZINE_NUMBER = attributes[++j];
                    magazine_info.STOCK_QTY       = int.Parse(attributes[++j]);
                    magazine_info.CAPACITY_QTY    = int.Parse(attributes[++j]);
                    magazine_info.MAGAZINE_NAME   = attributes[++j];
                    magazine_info.BULLET_MODEL    = attributes[++j];
                    magazine_info.BULLET_GROUP_ID = attributes[++j];
                    ////if (i != magazine_info_count - 1)
                    ////    ++j;
                    magazine_info_bll.Add(magazine_info);
                }
            }
            else
            {
                int magazine_info_count = 0;
                //弹仓信息
                try
                {
                    magazine_info_count = int.Parse(attributes[j + 1].Substring(7, attributes[j + 1].LastIndexOf("&") - 1));
                }
                catch { }
                for (int i = 0; i < magazine_info_count; i++)
                {
                    Model.magazine_info magazine_info = new Gunark.Model.magazine_info();
                    if (i == 0)
                    {
                        magazine_info.MAGAZINE_INFO_ID = attributes[++j].Substring(9);
                    }
                    else
                    {
                        magazine_info.MAGAZINE_INFO_ID = attributes[++j];
                    }
                    magazine_info.GUNARK_ID       = attributes[++j];
                    magazine_info.UNIT_ID         = attributes[++j];
                    magazine_info.MAGAZINE_NUMBER = attributes[++j];
                    magazine_info.STOCK_QTY       = int.Parse(attributes[++j]);
                    magazine_info.CAPACITY_QTY    = int.Parse(attributes[++j]);
                    magazine_info.MAGAZINE_NAME   = attributes[++j];
                    magazine_info.BULLET_MODEL    = attributes[++j];
                    magazine_info.BULLET_GROUP_ID = attributes[++j];
                    ////if (i != magazine_info_count - 1)
                    ////    ++j;
                    magazine_info_bll.Add(magazine_info);
                }
            }
        }