/// <summary> /// 显示任务 /// </summary> private void Display() { List <Model.task_info> list = new List <Gunark.Model.task_info>(); //查询满足条件的结果集 switch (PubFlag.task_type) { case "领取枪弹": list = task_info_bll.GetModelList("TASK_BIGTYPE='3'and TASK_STATUS='3' and ('" + string.Format("{0:yyyy-MM-dd HH:mm:ss.f}", DateTime.Now) + "' between TASK_PLAN_BEGINTIME and TASK_PLAN_FINISHTIME)"); dataGridView1.DataSource = list; break; case "归还枪弹": if (PubFlag.online) { list = task_info_bll.GetModelList("(TASK_BIGTYPE='3' or TASK_BIGTYPE='6' or TASK_BIGTYPE='13' or TASK_BIGTYPE='8' or TASK_BIGTYPE='9') and (TASK_STATUS='5' or TASK_STATUS='7')"); } else { list = task_info_bll.GetModelList("(TASK_BIGTYPE='13' or TASK_BIGTYPE='8') and (TASK_STATUS='5' or TASK_STATUS='7')"); } //判断任务状态是否为超期未还 for (int i = 0; i < list.Count; i++) { if ((string.Format("{0:yyyy-MM-dd HH:mm:ss.f}", DateTime.Now).CompareTo(list[i].TASK_PLAN_FINISHTIME) == 1)) { Model.task_info task_info = new BLL.task_info().GetModel(list[i].TASK_ID); list[i].TASK_STATUS = "7"; task_info.TASK_STATUS = "7"; new BLL.task_info().Update(task_info); } } dataGridView1.DataSource = list; break; case "其他任务": list = task_info_bll.GetModelList("(TASK_BIGTYPE='2'or TASK_BIGTYPE='4' or TASK_BIGTYPE='5' or TASK_BIGTYPE='6' or TASK_BIGTYPE='7' or TASK_BIGTYPE='9' or TASK_BIGTYPE='10' or TASK_BIGTYPE='11' or TASK_BIGTYPE='12' or TASK_BIGTYPE='14') and TASK_STATUS='3' and ('" + string.Format("{0:yyyy-MM-dd HH:mm:ss.f}", DateTime.Now) + "' between TASK_PLAN_BEGINTIME and TASK_PLAN_FINISHTIME)"); dataGridView1.DataSource = list; break; default: break; } }
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); } } }
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); } } }
/// <summary> /// 显示任务 /// </summary> private void Display() { List<Model.task_info> list = new List<Gunark.Model.task_info>(); //查询满足条件的结果集 switch (PubFlag.task_type) { case "领取枪弹": list = task_info_bll.GetModelList("TASK_BIGTYPE='3'and TASK_STATUS='3' and ('" + string.Format("{0:yyyy-MM-dd HH:mm:ss.f}", DateTime.Now) + "' between TASK_PLAN_BEGINTIME and TASK_PLAN_FINISHTIME)"); dataGridView1.DataSource = list; break; case "归还枪弹": if(PubFlag.online) list = task_info_bll.GetModelList("(TASK_BIGTYPE='3' or TASK_BIGTYPE='6' or TASK_BIGTYPE='13' or TASK_BIGTYPE='8' or TASK_BIGTYPE='9') and (TASK_STATUS='5' or TASK_STATUS='7')"); else list = task_info_bll.GetModelList("(TASK_BIGTYPE='13' or TASK_BIGTYPE='8') and (TASK_STATUS='5' or TASK_STATUS='7')"); //判断任务状态是否为超期未还 for (int i = 0; i < list.Count; i++) { if ((string.Format("{0:yyyy-MM-dd HH:mm:ss.f}", DateTime.Now).CompareTo(list[i].TASK_PLAN_FINISHTIME) == 1)) { Model.task_info task_info = new BLL.task_info().GetModel(list[i].TASK_ID); list[i].TASK_STATUS = "7"; task_info.TASK_STATUS = "7"; new BLL.task_info().Update(task_info); } } dataGridView1.DataSource = list; break; case "其他任务": list = task_info_bll.GetModelList("(TASK_BIGTYPE='2'or TASK_BIGTYPE='4' or TASK_BIGTYPE='5' or TASK_BIGTYPE='6' or TASK_BIGTYPE='7' or TASK_BIGTYPE='9' or TASK_BIGTYPE='10' or TASK_BIGTYPE='11' or TASK_BIGTYPE='12' or TASK_BIGTYPE='14') and TASK_STATUS='3' and ('" + string.Format("{0:yyyy-MM-dd HH:mm:ss.f}", DateTime.Now) + "' between TASK_PLAN_BEGINTIME and TASK_PLAN_FINISHTIME)"); dataGridView1.DataSource = list; break; default: break; } }