Exemple #1
0
        private void HandleSocket()
        {
            // Handle socket
            socket.On("task_change", (arg) =>
            {
                Application.Current.Dispatcher.Invoke((Action) delegate
                {
                    JObject data  = (JObject)arg;
                    string roomid = data.GetValue("room_id").ToString();
                    if (!currentRoom.ID.Equals(roomid))
                    {
                        return;
                    }

                    string id          = data.GetValue("task_id").ToString();
                    string name        = data.GetValue("work").ToString();
                    string description = data.GetValue("description").ToString();
                    string performer   = data.GetValue("performer").ToString();
                    DateTime startday  = (DateTime)data.GetValue("start_day");
                    DateTime endday    = (DateTime)data.GetValue("end_day");
                    TaskType tag       = TaskTypeModel.GetTaskType(data.GetValue("tag").ToString());
                    double progress    = (double)data.GetValue("progress");

                    listTaskModel.AddWithCheck(new TaskModel(id, name, description, startday, endday, performer, progress, tag), "ID");
                    NotifyChanged("ListTask");
                });
            });
        }
        public ActionResult Index()
        {
            List <TaskTypeModel> Types = new List <TaskTypeModel>();

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                string queryString = "SELECT * FROM TaskType";
                connection.Open();
                using (SqlCommand command = new SqlCommand(queryString, connection))
                {
                    try
                    {
                        SqlDataReader reader = command.ExecuteReader();
                        while (reader.Read())
                        {
                            TaskTypeModel _model = new TaskTypeModel();
                            _model.TypeID = (int)reader[0];
                            _model.Type   = (string)reader[1];
                            Types.Add(_model);
                        }
                        reader.Close();
                    }
                    catch (Exception)
                    {
                        throw new Exception("Error");
                    }
                }
                return(View(Types));
            }
        }
        private ManageTaskModel AutoCreateManaTask(StockModel stockModel
                                                   , StockListModel stockListModel, TaskTypeModel taskType, ref long manaTaskID)
        {
            ManageTaskModel manaTaskModel = new ManageTaskModel();//生成管理任务

            manaTaskModel.TaskCode = stockListModel.ProductFrameCode;
            LoginPresenter loginPre = (LoginPresenter)this.View.GetPresenter(typeof(LoginPresenter));

            if (loginPre != null)
            {
                manaTaskModel.TaskCreatePerson = loginPre.View.UserName;
            }

            manaTaskModel.TaskCreateTime = DateTime.Now;
            LogicStoreAreaModel logicEndModel = bllLogicStoreArea.GetModel(taskType.EndLogicAreaID);

            manaTaskModel.TaskEndArea    = logicEndModel.LogicStoreAreaName;
            manaTaskModel.TaskEndPostion = taskType.EndDevice;

            LogicStoreAreaModel logicStartModel = bllLogicStoreArea.GetModel(taskType.StartLogicAreaID);

            manaTaskModel.TaskStartArea = logicStartModel.LogicStoreAreaName;
            GoodsSiteModel gsModel = bllGoodsSite.GetModel(stockModel.GoodsSiteID);

            manaTaskModel.TaskStartPostion = gsModel.DeviceID;
            manaTaskModel.TaskStatus       = EnumTaskStatus.待执行.ToString();
            manaTaskModel.TaskType         = EnumTaskCategory.出库.ToString();
            manaTaskModel.TaskTypeName     = taskType.TaskTypeName;
            manaTaskID = bllTask.Add(manaTaskModel);
            return(manaTaskModel);
        }
        public async Task <IActionResult> Post(TaskTypeModel model)
        {
            model = this.mapper.Map(
                await this.mediator.Send(
                    new CreateTaskTypeCommand(model.Name, model.Cost, model.Duration)));

            return(CreatedAtRoute(RouteNames.TaskTypeResource.GetById, new { id = model.Id }, model));
        }
Exemple #5
0
        private void CreateTask()
        {
            //Debug.LogOutput(taskModel.Name + " " + taskModel.Description + " " + taskModel.Performer + " " + taskModel.StartDay + " " + taskModel.EndDay + " " + listTaskTypeModel.List[SelectedIndexTag].Content);
            taskModel.Tag       = TaskTypeModel.GetTaskType(ListTag[SelectedIndexTag].Content);
            taskModel.Performer = Performer;

            taskModel.EmitToServer(CurrentRoom.ID);
            Cancel();
        }
Exemple #6
0
        public async Task AddTaskType(TaskTypeModel taskType)
        {
            var parameters = new
            {
                taskType.Name,
                taskType.DisplayOrder
            };

            await _dataAccess.SaveDataAsync <dynamic>("spTasks_AddTaskType", parameters, ConnectionStringName);
        }
Exemple #7
0
        public IActionResult updateTask([FromRoute] string id, TaskRequest request)
        {
            using (var connection = new SqlConnection(ConfString))
                using (var command = new SqlCommand())
                {
                    command.Connection = connection;
                    //dla creatora
                    command.CommandText = "Select * From Task Where IdTask = @index;";
                    command.Parameters.AddWithValue("index", id);

                    connection.Open();
                    SqlDataReader dr = command.ExecuteReader();

                    if (dr.Read())
                    {
                        var       tran      = connection.BeginTransaction();
                        TaskModel taskModel = new TaskModel();
                        taskModel.Name        = request.Name;
                        taskModel.Description = request.Description;
                        taskModel.Deadline    = request.DeadLine;
                        taskModel.IdTeam      = request.IdTeam;

                        dr.Close();

                        TaskTypeModel p      = request.TaskType;
                        string        taskid = p.IdTaskType;
                        command.CommandText = "Select * From TaskType Where IdTaskType =" + taskid;

                        if (!dr.Read())
                        {
                            command.CommandText = "Insert INTO TaskType (idTaskType, Name) Values (" + Int32.Parse(p.IdTaskType) + ", '" + p.Name + ",)";
                        }



                        command.CommandText = "Update task Set Name=@name, Description=@description, Deadline=@deadline, IdTeam=@idteam, IdAssignedTo=@idAssignedTo, IdCreator=@idcreator, IdTaskType=@idTaskType Where IdTask=@index";
                        command.Parameters.AddWithValue("name", request.Name);
                        command.Parameters.AddWithValue("description", request.Description);
                        command.Parameters.AddWithValue("deadline", request.DeadLine);
                        command.Parameters.AddWithValue("idteam", request.IdTeam);
                        command.Parameters.AddWithValue("idAssignedTo", request.IdAssignedTo);
                        command.Parameters.AddWithValue("idcreator", request.IdCreator);
                        command.Parameters.AddWithValue("IdTaskType", p.IdTaskType);


                        tran.Commit();
                    }
                    else
                    {
                        //tworzenie
                    }

                    return(null);
                }
        }
        public async Task UpdateTaskType(TaskTypeModel model)
        {
            using (var db = _dbContextFactory.Create())
            {
                var taskType = await db.TaskTypes.FindAsync(model.Id);

                taskType = _lifeTaskMappingService.PopulateTaskTypeFromModel(model, taskType);

                await db.SaveChangesAsync();
            }
        }
        public async Task UpdateTaskType(TaskTypeModel model)
        {
            var task = await _queries.GetTaskType(model.Id);

            if (task == null)
            {
                // TODO - determine what the service should do here
                return;
            }

            await _commands.UpdateTaskType(model);
        }
        public async Task AddTaskType(TaskTypeModel model, int userId)
        {
            using (var db = _dbContextFactory.Create())
            {
                var taskType = new TaskType();

                taskType = _lifeTaskMappingService.PopulateTaskTypeFromModel(model, taskType, userId);

                db.TaskTypes.Add(taskType);
                await db.SaveChangesAsync();
            }
        }
Exemple #11
0
        public async Task <IActionResult> Post([FromBody] TaskTypeModel model)
        {
            var userId = _userManagerService.TryGetUserId(User);

            if (!userId.HasValue)
            {
                return(new UnauthorizedResult());
            }

            await _taskTypesService.AddTaskType(model, userId.Value);

            return(new NoContentResult());
        }
        public IHttpActionResult CreateTaskType(TaskTypeModel model)
        {
            var response = new DataResponse <EntityTaskTypes>();

            if (ModelState.IsValid)
            {
                var entityDocumentTypes = new EntityTaskTypes();
                entityDocumentTypes.TaskType   = model.TaskType;
                entityDocumentTypes.BusinessId = CurrentBusinessId.Value;
                entityDocumentTypes.CreatedBy  = CurrentUserId;
                entityDocumentTypes.CreatedOn  = DateTime.UtcNow;
                response = repository.Insert(entityDocumentTypes);
            }
            return(Ok <DataResponse>(response));
        }
        public async Task <IActionResult> Put(int id, TaskTypeModel model)
        {
            TaskType result = await this.mediator.Send(new UpdateTaskTypeCommand(id, model.Name, model.Cost, model.Duration));

            if (result == null)
            {
                result = await this.mediator.Send(new CreateTaskTypeCommand(model.Name, model.Cost, model.Duration));

                model = this.mapper.Map(result);

                return(CreatedAtRoute(RouteNames.TaskTypeResource.GetById, new { id = model.Id }, model));
            }

            model = this.mapper.Map(result);

            return(Ok(model));
        }
        public IHttpActionResult UpdateTaskType(TaskTypeModel model)
        {
            var response = new DataResponse <EntityTaskTypes>();

            if (ModelState.IsValid)
            {
                var entityDocumentTypes = new EntityTaskTypes();
                entityDocumentTypes.Id        = model.Id;
                entityDocumentTypes.TaskType  = model.TaskType;
                entityDocumentTypes.UpdatedBy = CurrentUserId;
                entityDocumentTypes.UpdatedOn = System.DateTime.UtcNow;

                response = repository.Update(entityDocumentTypes);
            }

            return(Ok <DataResponse>(response));
        }
Exemple #15
0
        public async Task <IActionResult> Put([FromBody] TaskTypeModel model)
        {
            try
            {
                var type = await _taskTypeService.UpdateAsync(_mapper.Map <TaskTypeDto>(model));

                return(Ok(_mapper.Map <TaskTypeModel>(type)));
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
Exemple #16
0
        public List <TaskTypeModel> GetTaskType()
        {
            var datatable = siteSetupData.GetTaskType();
            List <TaskTypeModel> tasktype = new List <TaskTypeModel>();

            foreach (DataRow dr in datatable.Rows)
            {
                TaskTypeModel m = new TaskTypeModel();
                m.TaskTypeId              = dr.IsNull("Id") ? 0 : int.Parse(dr["Id"].ToString());
                m.TaskType                = dr.IsNull("Type") ? "" : (dr["Type"].ToString());
                m.TaskTypeName            = dr.IsNull("Name") ? "" : (dr["Name"].ToString());
                m.RequiresManagerApproval = dr.IsNull("RequiresManagerApproval") ? false : bool.Parse(dr["RequiresManagerApproval"].ToString());
                m.DispalyinPOS            = dr.IsNull("DisplayInPOS") ? false : bool.Parse(dr["DisplayInPOS"].ToString());
                tasktype.Add(m);
            }
            return(tasktype);
        }
        public TaskType PopulateTaskTypeFromModel(TaskTypeModel model, TaskType dbTaskType, int?userId = null)
        {
            // TODO - potentially need better checks on whether a user already exists
            if (dbTaskType.UserId == 0)
            {
                if (userId.HasValue)
                {
                    dbTaskType.UserId = userId.Value;
                }
                else
                {
                    throw new InvalidOperationException("This task has not been created in the context of a user");
                }
            }

            dbTaskType.Name  = model.Name;
            dbTaskType.Color = model.Color;

            return(dbTaskType);
        }
        private void OutHouseByHandEventHandler(object sender, OutHouseByHandEventArgs e)
        {
            int outHouse = this.View.AskMessBox("您确定要将选中货位手动出库么?");

            if (outHouse == 0)
            {
                GoodsSiteModel gsModel = bllGoodsSite.GetModel(e.GoodsSiteID);
                if (gsModel == null)
                {
                    if (this.mainPre != null)
                    {
                        this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "此货位为空,不能出库!");
                        return;
                    }
                }
                if (!((e.GsStoreStatus == EnumGSStoreStatus.货 || e.GsStoreStatus == EnumGSStoreStatus.空料框) && e.GsRunStatus == EnumGSRunStatus.任务完成 &&
                      gsModel.GoodsSiteInOutType == EnumTaskCategory.入库.ToString()))
                {
                    if (this.mainPre != null)
                    {
                        this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "请选择货位任务类型为“入库”,并且货位存储类型为“有货”或“空料框”,并且货位任务状态为“任务完成”的货位出库!!");
                        return;
                    }
                }

                View_QueryStockListModel viewGsStockModel = bllView_QueryStockList.GetOutHouseModel(e.GoodsSiteID, e.GsStoreStatus, e.GsRunStatus);
                if (viewGsStockModel != null)
                {
                    Hashtable     updateGsStatusHs = null;
                    TaskTypeModel taskType         = null;
                    StockModel    stockModel       = bllStock.GetModelByGsID(e.GoodsSiteID);
                    bool          exeHandTask      = false;//执行手动选择的任务类型
                    if (stockModel != null)
                    {
                        StockListModel stockListModel = bllStockList.GetModelByStockID(stockModel.StockID);
                        if (stockListModel != null)
                        {
                            string shouldTaskName = GetTaskName(stockListModel.StoreHouseName, stockListModel.ProductStatus);
                            #region 根据人工选定的出库类型出库
                            if (e.OutHouseType != shouldTaskName)
                            {
                                if (this.View.AskMessBox("当前产品状态出库类型应为“" + shouldTaskName + "”,您确定要“" + e.OutHouseType + "”么?") == 0)
                                {
                                    EnumTaskName handTaskName = (EnumTaskName)Enum.Parse(typeof(EnumTaskName), e.OutHouseType);
                                    taskType = bllTaskType.GetModel((int)handTaskName);
                                    switch (handTaskName)
                                    {
                                    case EnumTaskName.电芯出库_A1:
                                        updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID);       //获取更新货位状态Hs
                                        break;

                                    case EnumTaskName.电芯出库_B1:
                                        updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID);       //获取更新货位状态Hs
                                        break;

                                    case EnumTaskName.空料框出库:
                                        updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.空料框.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID);      //获取更新货位状态Hs
                                        break;

                                    case EnumTaskName.分容出库_A1:
                                        updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID);       //获取更新货位状态Hs
                                        break;
                                    }

                                    exeHandTask = true;
                                }
                            }
                            #endregion
                            #region 根据货物状态出库
                            if (exeHandTask == false)
                            {
                                if (stockListModel.StoreHouseName == EnumStoreHouse.A1库房.ToString())//手动出库根据物料状态出库
                                {
                                    if (viewGsStockModel.ProductStatus == EnumProductStatus.A1库静置10小时.ToString())
                                    {
                                        taskType         = bllTaskType.GetModel((int)EnumTaskName.电芯出库_A1);
                                        updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID);   //获取更新货位状态Hs
                                    }
                                    else if (viewGsStockModel.ProductStatus == EnumProductStatus.A1库老化3天.ToString())
                                    {
                                        taskType         = bllTaskType.GetModel((int)EnumTaskName.分容出库_A1);
                                        updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID);   //获取更新货位状态Hs
                                    }
                                }
                                else if (stockListModel.StoreHouseName == EnumStoreHouse.B1库房.ToString())
                                {
                                    if (stockListModel.ProductStatus == EnumProductStatus.空料框.ToString())
                                    {
                                        taskType         = bllTaskType.GetModel((int)EnumTaskName.空料框出库);
                                        updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.空料框.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID);  //获取更新货位状态Hs
                                    }
                                    else
                                    {
                                        taskType         = bllTaskType.GetModel((int)EnumTaskName.电芯出库_B1);
                                        updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID);   //获取更新货位状态Hs
                                    }
                                }
                            }
                            #endregion
                            #region 出库处理逻辑
                            long                manaTaskID        = 0;
                            ManageTaskModel     manaTaskModel     = AutoCreateManaTask(stockModel, stockListModel, taskType, ref manaTaskID);
                            ManageTaskListModel manaTaskListModel = AutoCreateManaTaskList(manaTaskID, manaTaskModel, stockListModel);
                            AutoCreateControlTask(manaTaskModel, manaTaskID, taskType);

                            List <Hashtable> hashList = new List <Hashtable>();
                            hashList.Add(updateGsStatusHs);

                            bool executeStatus = ExecuteManyHashSqls(hashList);
                            if (executeStatus == true)
                            {
                                if (this.mainPre != null)
                                {
                                    string trayIDListStr = bllStockDetail.GetTrayIDStrList(stockListModel.StockListID);
                                    this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + "生成出库“"
                                                         + taskType.TaskTypeName + "”任务成功!" + "开始位置:" + manaTaskModel.TaskStartPostion + ",结束位置:"
                                                         + manaTaskModel.TaskEndPostion + "托盘号:" + trayIDListStr);
                                }
                            }
                            else
                            {
                                if (this.mainPre != null)
                                {
                                    this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + "生成出库“"
                                                         + taskType.TaskTypeName + "”任务失败!" + "开始位置:" + manaTaskModel.TaskStartPostion + ",结束位置:"
                                                         + manaTaskModel.TaskEndPostion);
                                }
                            }
                            #endregion
                        }
                    }
                    else
                    {
                        if (this.mainPre != null)
                        {
                            this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "没有货物出库!");
                            this.View.ShowMessage("信息提示", "没有货物出库!");
                        }
                    }
                }
            }
        }
        public HttpResponseMessage AddTaskTpye([FromBody] TaskTypeModel taskTypeModel)
        {
            if (!string.IsNullOrWhiteSpace(taskTypeModel.Name))
            {
                Regex reg = new Regex(@"^[^ %@#!*~&',;=?$\x22]+$");
                var   m   = reg.IsMatch(taskTypeModel.Name);
                if (!m)
                {
                    return(PageHelper.toJson(PageHelper.ReturnValue(false, "类型名称存在非法字符!")));
                }
                if (taskTypeModel.Describe != "")
                {
                    var m1 = reg.IsMatch(taskTypeModel.Describe);

                    if (!m1)
                    {
                        return(PageHelper.toJson(PageHelper.ReturnValue(false, "描述存在非法字符!")));
                    }
                }
                var model = new TaskTypeEntity
                {
                    Id       = taskTypeModel.Id,
                    Name     = taskTypeModel.Name,
                    Describe = taskTypeModel.Describe
                };
                var mo1 = new TaskTypeSearchCondition
                {
                    NameRe = taskTypeModel.Name
                };

                if (taskTypeModel.Type == "add")
                {
                    int taskTypeCount = _taskTypeService.GetTaskTypeCount(mo1);
                    if (taskTypeCount > 0)
                    {
                        return(PageHelper.toJson(PageHelper.ReturnValue(false, "名称重复,请更换")));
                    }
                    else
                    {
                        try
                        {
                            if (_taskTypeService.Create(model) != null)
                            {
                                return(PageHelper.toJson(PageHelper.ReturnValue(true, "添加成功")));
                            }
                        }
                        catch (Exception)
                        {
                            return(PageHelper.toJson(PageHelper.ReturnValue(false, "添加失败")));
                        }
                    }
                }
                if (taskTypeModel.Type == "edit")
                {
                    try
                    {
                        _taskTypeService.Update(_taskTypeService.GetTaskTypeById(taskTypeModel.Id));
                        return(PageHelper.toJson(PageHelper.ReturnValue(true, "修改成功")));
                    }
                    catch (Exception)
                    {
                        return(PageHelper.toJson(PageHelper.ReturnValue(false, "修改失败")));
                    }
                }
            }
            return(PageHelper.toJson(PageHelper.ReturnValue(false, "类型名称不能为空!")));
        }
        private void AutoCreateControlTask(ManageTaskModel manaTaskModel, long taskID, TaskTypeModel taskType)
        {
            ControlTaskModel controlTaskModel = new ControlTaskModel();//生成控制任务

            controlTaskModel.ControlCode  = manaTaskModel.TaskCode;
            controlTaskModel.TaskTypeName = taskType.TaskTypeName;
            controlTaskModel.StartArea    = manaTaskModel.TaskStartArea;
            controlTaskModel.StartDevice  = manaTaskModel.TaskStartPostion;
            controlTaskModel.TargetArea   = manaTaskModel.TaskEndArea;
            controlTaskModel.TargetDevice = manaTaskModel.TaskEndPostion;
            controlTaskModel.TaskID       = taskID;
            controlTaskModel.CreateMode   = EnumCreateMode.手动生成.ToString();
            controlTaskModel.TaskStatus   = EnumTaskStatus.待执行.ToString();
            controlTaskModel.TaskType     = manaTaskModel.TaskType;
            controlTaskModel.TaskTypeCode = taskType.TaskTypeCode;
            controlTaskModel.CreateTime   = DateTime.Now;
            bllControlTask.Add(controlTaskModel);
        }
 public async Task AddTaskType(TaskTypeModel model, int userId)
 {
     await _commands.AddTaskType(model, userId);
 }
        private void InStoreByHandEventHandler(object sender, InStoreByHandEventArgs e)
        {
            int            taskTypeCode   = (int)(EnumTaskName)Enum.Parse(typeof(EnumTaskName), e.TaskTypeName);
            TaskTypeModel  taskType       = bllTaskType.GetModel(taskTypeCode);
            GoodsSiteModel goodsSiteModel = null;

            string[] trayIDs = SplitStringArray(e.TrayIDs);

            if (trayIDs != null)
            {
                for (int i = 0; i < trayIDs.Length; i++)
                {
                    TB_Tray_indexModel trayModel = bllTbTrayIndex.GetModel(trayIDs[i]);
                    if (trayModel == null)
                    {
                        this.View.ShowMessage("信息提示", "条码:“" + trayIDs[i] + "”不存在此条码信息,请重新输入");

                        return;
                    }
                }
            }
            int createStatus = this.View.AskMessBox("您确定要手动生成“" + e.TaskTypeName + "”任务么?");

            if (createStatus == 0)
            {
                if (taskType != null)//控制任务接口插入一个任务申请
                {
                    if (taskType.TaskTypeCode == (int)EnumTaskName.空料框出库)
                    {
                        //查询空料框
                        goodsSiteModel = bllGoodsSite.GetGoodsSite(taskType.StartLogicAreaID, EnumGSStoreStatus.空料框, EnumGSRunStatus.任务完成, EnumGSType.货位);
                        if (goodsSiteModel == null)
                        {
                            if (mainPres != null)
                            {
                                mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "库中没有空料框了,手动生成“"
                                                 + e.TaskTypeName + "”任务失败!");
                            }
                            return;
                        }
                        else
                        {
                            ControlInterfaceModel controlInterModel = new ControlInterfaceModel();
                            controlInterModel.CreateTime      = DateTime.Now;
                            controlInterModel.DeviceCode      = taskType.EndDevice;
                            controlInterModel.InterfaceStatus = EnumCtrlInterStatus.未生成.ToString();
                            controlInterModel.InterfaceType   = EnumTaskCategory.出库.ToString();
                            //生成控制条码 需要跟控制层
                            controlInterModel.TaskCode           = bllControlInter.GetNewTaskCode();
                            controlInterModel.InterfaceParameter = e.TrayIDs;
                            long controlInterID = bllControlInter.Add(controlInterModel);
                            if (controlInterID != 1)
                            {
                                if (mainPres != null)
                                {
                                    mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",手动生成“"
                                                     + e.TaskTypeName + "”任务成功!");
                                    //mainPres.View.AddLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "手动生成“" + e.TaskTypeName + "”任务成功!");
                                }
                            }
                        }
                    }
                    else if (taskType.TaskTypeCode == (int)EnumTaskName.电芯入库_A1 || taskType.TaskTypeCode == (int)EnumTaskName.电芯入库_B1 ||
                             taskType.TaskTypeCode == (int)EnumTaskName.分容入库_A1 || taskType.TaskTypeCode == (int)EnumTaskName.空料框入库)
                    {
                        goodsSiteModel = bllGoodsSite.GetGoodsSite(taskType.EndLogicAreaID, EnumGSStoreStatus.空货位, EnumGSRunStatus.待用, EnumGSType.货位);
                        if (goodsSiteModel == null)
                        {
                            if (mainPres != null)
                            {
                                mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",库中没有空料框了,手动生成“" + e.TaskTypeName + "”任务失败!");
                            }
                            return;
                        }
                        else
                        {
                            ControlInterfaceModel controlInterModel = new ControlInterfaceModel();
                            controlInterModel.CreateTime         = DateTime.Now;
                            controlInterModel.DeviceCode         = taskType.StartDevice;
                            controlInterModel.InterfaceStatus    = EnumCtrlInterStatus.未生成.ToString();
                            controlInterModel.InterfaceType      = EnumTaskCategory.入库.ToString();
                            controlInterModel.InterfaceParameter = e.TrayIDs;
                            controlInterModel.TaskCode           = bllControlInter.GetNewTaskCode();
                            long controlInterID = bllControlInter.Add(controlInterModel);
                            if (controlInterID != 1)
                            {
                                if (mainPres != null)
                                {
                                    mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr
                                                     + ",手动生成“" + e.TaskTypeName + "”任务成功!");
                                }
                            }
                        }
                    }
                }
                DataTable dtCtrlTaskList = bllControlTask.GetCtrlDatatable(this.currentEnumTaskName, this.currentEnumTaskStatus
                                                                           , this.currentHouseName, this.currentCreateMode, this.currentTaskType);
                this.View.ShowControlTaskData(dtCtrlTaskList);
            }
        }
Exemple #23
0
        public async Task <IActionResult> Put([FromBody] TaskTypeModel model)
        {
            await _taskTypesService.UpdateTaskType(model);

            return(new NoContentResult());
        }
Exemple #24
0
        private void OutHouseEventHandler(object sender, StockEventArgs e)
        {
            int outHouse = this.View.AskMessBox("您确定要将选中库存手动出库么?");

            if (outHouse == 0)
            {
                for (int i = 0; i < e.StockIDArr.Count(); i++)
                {
                    //if (!(e.GsStoreStatusArr[i] == (EnumGSStoreStatus.有货 | EnumGSStoreStatus.空料框)&&e.GsRunStatusArr[i] == EnumGSRunStatus.任务完成
                    //    &&e.GSTaskTypeArr[i] == EnumTaskCategory.入库))
                    //{
                    //    if (this.mainPres != null)
                    //    {
                    //        this.mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "请选择货位任务类型为“入库”,并且货位存储类型为“有货”或“空料框”,并且货位任务状态为“任务完成”的货位出库!!");
                    //        continue;
                    //    }
                    //}
                    if (!((e.GsStoreStatusArr[i] == EnumGSStoreStatus.货 || e.GsStoreStatusArr[i] == EnumGSStoreStatus.空料框) && e.GsRunStatusArr[i] == EnumGSRunStatus.任务完成 &&
                          e.GSTaskTypeArr[i] == EnumTaskCategory.入库))
                    {
                        if (this.mainPres != null)
                        {
                            this.mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "请选择货位任务类型为“入库”,并且货位存储类型为“有货”或“空料框”,并且货位任务状态为“任务完成”的货位出库!!");
                            return;
                        }
                    }
                    Hashtable     updateGsStatusHs = null;
                    TaskTypeModel taskType         = null;
                    StockModel    stockModel       = bllStock.GetModel(e.StockIDArr[i]);
                    if (stockModel == null)
                    {
                        continue;
                    }
                    StockListModel stockListModel = bllStockList.GetModelByStockID(e.StockIDArr[i]);
                    if (stockListModel == null)
                    {
                        continue;
                    }
                    GoodsSiteModel goodsSiteModel = bllGoodsSite.GetModel(stockModel.GoodsSiteID);
                    if (goodsSiteModel == null)
                    {
                        continue;
                    }

                    ManageTaskListModel existManaTaskList = bllTaskList.GetModelByStockListID(stockListModel.StockListID);
                    if (existManaTaskList == null)
                    {
                        if (stockListModel.StoreHouseName == EnumStoreHouse.A1库房.ToString())//手动出库默认出库任务类型为一次检测出库
                        {
                            if (e.ProductStatusArr[i] == EnumProductStatus.A1库老化3天)
                            {
                                taskType = bllTaskType.GetModel((int)EnumTaskName.分容出库_A1);
                            }
                            else if (e.ProductStatusArr[i] == EnumProductStatus.A1库静置10小时)
                            {
                                taskType = bllTaskType.GetModel((int)EnumTaskName.电芯出库_A1);
                            }

                            updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString()
                                                                             , EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), goodsSiteModel.GoodsSiteID); //获取更新货位状态Hs
                        }
                        else if (stockListModel.StoreHouseName == EnumStoreHouse.B1库房.ToString())
                        {
                            if (e.ProductStatusArr[i] == EnumProductStatus.空料框)
                            {
                                taskType         = bllTaskType.GetModel((int)EnumTaskName.空料框出库);
                                updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.空料框.ToString()
                                                                                 , EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), goodsSiteModel.GoodsSiteID); //获取更新货位状态Hs
                            }
                            else
                            {
                                taskType         = bllTaskType.GetModel((int)EnumTaskName.电芯出库_B1);
                                updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString()
                                                                                 , EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), goodsSiteModel.GoodsSiteID); //获取更新货位状态Hs
                            }
                        }

                        long                manaTaskID        = 0;
                        ManageTaskModel     manaTaskModel     = AutoCreateManaTask(stockModel, stockListModel, taskType, ref manaTaskID);
                        ManageTaskListModel manaTaskListModel = AutoCreateManaTaskList(manaTaskID, manaTaskModel, stockListModel);
                        AutoCreateControlTask(manaTaskModel, manaTaskID, taskType);

                        List <Hashtable> hashList = new List <Hashtable>();
                        hashList.Add(updateGsStatusHs);

                        bool executeStatus = ExecuteManyHashSqls(hashList);
                        if (executeStatus == true)
                        {
                            if (this.mainPres != null)
                            {
                                string trayIDListStr = bllStockDetail.GetTrayIDStrList(stockListModel.StockListID);
                                this.mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",货位:" + goodsSiteModel.GoodsSiteName + "生成“" + taskType.TaskTypeName + "”任务成功!"
                                                      + "托盘号:" + trayIDListStr);
                            }
                        }
                        else
                        {
                            if (this.mainPres != null)
                            {
                                this.mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + "货位:" + goodsSiteModel.GoodsSiteName + "生成“" + taskType.TaskTypeName + "”任务失败!");
                            }
                        }
                    }
                }
            }
        }
 public async Task AddTaskType(TaskTypeModel taskType)
 {
     await _taskData.AddTaskType(taskType);
 }