Example #1
0
 /// <summary>
 /// 任务删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnTaskDelete_Click(object sender, EventArgs e)
 {
     if (MessageBoxEx.Show("确认删除所选任务?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (dataGridViewTasks.SelectedRows == null)
         {
             MessageBoxEx.Show("请先选中要删除的数据行!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         else
         {
             string message = string.Empty;
             try
             {
                 int id = int.Parse(dataGridViewTasks.SelectedRows[0].Cells["ID"].Value.ToString());
                 WinForm.AscmWebService.AscmWebService service = new AscmWebService.AscmWebService();
                 if (service.TaskDelete(frmMain.encryptTicket, id, ref message))
                 {
                     btnTasksSearch_Click(this, new EventArgs());
                     MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBoxEx.Show(message, "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             catch (Exception ex)
             {
                 MessageBoxEx.Show(ex.Message, "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }
Example #2
0
        private List<AscmMaterialItem> GetMaterialItem(ref int count)
        {
            List<AscmMaterialItem> list = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(pcMaterialList.PageSize);
            ynPage.SetCurrentPage((pcMaterialList.PageCurrent <= 0) ? 1 : pcMaterialList.PageCurrent);
            _ynPage = YnBaseClass2.Helper.ObjectHelper.Serialize(ynPage);
            try
            {

                WinForm.AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                string jsonStr = Service.SumMaterialTotal(frmMain.encryptTicket, ref _ynPage, ref message);
                if (!string.IsNullOrEmpty(jsonStr))
                {
                    list = (List<AscmMaterialItem>)JsonConvert.DeserializeObject(jsonStr, typeof(List<AscmMaterialItem>));
                    if (list != null && list.Count > 0)
                    {
                        ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                        count = ynPage.GetRecordCount();
                    }
                    else
                    {
                        MessageBoxEx.Show("系统没查到当天的作业单的所有物料!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return list;
        }
Example #3
0
 public List<AscmGetMaterialTask> GetMaterialTaskInfo()
 {
     List<AscmGetMaterialTask> list = null;
     try
     {
         string message = string.Empty;
         if (!string.IsNullOrEmpty(GetMaterialTaskId))
         {
             WinForm.AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
             string jsonStr = Service.CheckTaskInfo(frmMain.encryptTicket, GetMaterialTaskId, ref message);
             if (!string.IsNullOrEmpty(jsonStr))
             {
                 list = (List<AscmGetMaterialTask>)JsonConvert.DeserializeObject(jsonStr, typeof(List<AscmGetMaterialTask>));
                 if (list == null || list.Count == 0)
                 {
                     MessageBoxEx.Show("没有查到符合该条件任务信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return list;
 }
Example #4
0
        private List<AscmWipRequirementOperations> GetWipRequirementOperations(ref int count)
        {
            List<AscmWipRequirementOperations> list = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(pageControlMaterial.PageSize);
            ynPage.SetCurrentPage((pageControlMaterial.PageCurrent <= 0) ? 1 : pageControlMaterial.PageCurrent);
            _ynPage = YnBaseClass2.Helper.ObjectHelper.Serialize(ynPage);

            try
            {
                if (!string.IsNullOrEmpty(GetMaterialTaskId) && !string.IsNullOrEmpty(DiscreteJobsId))
                {
                    WinForm.AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                    string jsonStr = Service.GetMtlList(frmMain.encryptTicket, GetMaterialTaskId, DiscreteJobsId, ref _ynPage, ref message);
                    if (!string.IsNullOrEmpty(jsonStr))
                    {
                        list = (List<AscmWipRequirementOperations>)JsonConvert.DeserializeObject(jsonStr, typeof(List<AscmWipRequirementOperations>));
                        if (list != null && list.Count > 0)
                        {
                            ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                            count = ynPage.GetRecordCount();
                        }
                        else
                        {
                            MessageBoxEx.Show("没有查询到符合条件的领料任务!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return list;
        }
Example #5
0
        /// <summary>
        /// 任务分页查询 返回数量与单页数据
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        private List<AscmGetMaterialTask> taskQuery(ref int count)
        {
            List<AscmGetMaterialTask> listTasks = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(pageControlTask.PageSize);
            ynPage.SetCurrentPage((pageControlTask.PageCurrent <= 0) ? 1 : pageControlTask.PageCurrent);
            _ynPage = YnBaseClass2.Helper.ObjectHelper.Serialize(ynPage);
            //try
            //{
            string queryStatus = (cbxTaskStatus.SelectedItem == null) ? string.Empty : cbxTaskStatus.SelectedItem.ToString().Trim();
            if (!String.IsNullOrEmpty(queryStatus))
            {
                switch (queryStatus)
                {
                    case "已完成":
                        queryStatus = "FINISH";
                        break;
                    case "执行中":
                        queryStatus = "EXECUTE";
                        break;
                    case "已分配":
                        queryStatus = "NOTEXECUTE";
                        break;
                    case "未分配":
                        queryStatus = "NOTALLOCATE";
                        break;
                    default:
                        queryStatus = "";
                        break;
                }
            }
            string queryDate = taskCreateTime.Text.Trim();
            if (!String.IsNullOrEmpty(queryDate))
            {
                if (queryDate.LastIndexOf("星") > 0)
                {
                    queryDate = queryDate.Substring(0, queryDate.LastIndexOf("星"));
                }
                queryDate = DateTime.Parse(queryDate).ToString("yyyy-MM-dd");
            }
            WinForm.AscmWebService.AscmWebService service = new AscmWebService.AscmWebService();
            string jsonstr = service.GetTasksList(frmMain.encryptTicket, queryStatus, queryDate, ref _ynPage, ref message);
            if (!string.IsNullOrEmpty(jsonstr))
            {
                listTasks = (List<AscmGetMaterialTask>)JsonConvert.DeserializeObject(jsonstr, typeof(List<AscmGetMaterialTask>));
                if (listTasks != null && listTasks.Count > 0)
                {
                    ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                    count = ynPage.GetRecordCount();
                }
                else
                {
                    MessageBoxEx.Show("没有查询到符合条件的领料任务!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
            return listTasks;
        }
Example #6
0
        /// <summary>
        /// 物料查询 返回查询总数量与单页数据
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        private List<AscmMaterialItem> materialQuery(ref int count)
        {
            List<AscmMaterialItem> listMaterials = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

            string queryMaterialDocNumber = txtMaterialDocNumber.Text;
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(pageControlMaterial.PageSize);
            ynPage.SetCurrentPage((pageControlMaterial.PageCurrent <= 0) ? 1 : pageControlMaterial.PageCurrent);
            _ynPage = YnBaseClass2.Helper.ObjectHelper.Serialize(ynPage);

            WinForm.AscmWebService.AscmWebService service = new AscmWebService.AscmWebService();
            string jsonstr = service.GetMaterialList(encryptTicket, queryMaterialDocNumber, ref _ynPage, ref message);
            if (!string.IsNullOrEmpty(jsonstr))
            {
                listMaterials = (List<AscmMaterialItem>)JsonConvert.DeserializeObject(jsonstr, typeof(List<AscmMaterialItem>));
                if (listMaterials != null && listMaterials.Count > 0)
                {
                    ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                    count = ynPage.GetRecordCount();
                }
                else
                {
                    MessageBoxEx.Show("没有查询到符合条件的领料任务!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            return listMaterials;
        }
Example #7
0
        private void tsbStartTask_Click(object sender, EventArgs e)
        {
            try
            {
                string str = string.Empty;
                string message = string.Empty;
                foreach (Node node in advTree1.Nodes)
                {
                    if (node.Checked)
                    {
                        if (!string.IsNullOrEmpty(str))
                            str += ",";
                        str += node.Text;
                    }
                }
                if (!string.IsNullOrEmpty(str))
                {
                    WinForm.AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                    if (Service.StartExcuteTask(frmMain.encryptTicket, frmMain.userName, str, ref message))
                    {
                        MessageBoxEx.Show("任务开始执行!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(message))
                        {
                            MessageBox.Show(message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("请检查任务状态,无法执行开始操作!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }

                    }
                }
                else
                {
                    MessageBox.Show("请选择任务!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                pageControlTask.Bind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #8
0
        private void tsbGetMaterial_Click(object sender, EventArgs e)
        {
            try
            {
                string str = string.Empty;
                string message = string.Empty;
                foreach (Node node in advTree1.Nodes)
                {
                    if (node.Checked)
                    {
                        if (!string.IsNullOrEmpty(str))
                            str += ",";
                        str += node.Text;
                    }
                }

                if (!string.IsNullOrEmpty(str))
                {
                    WinForm.AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                    Service.ConfrimedGetMaterial(frmMain.encryptTicket, frmMain.userName, str, ref message);
                    pageControlTask.Bind();
                    if (!string.IsNullOrEmpty(message))
                    {

                        MessageBox.Show(message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("请检查该任务备料数量,无法执行领料操作!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("请选择任务!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #9
0
        private void tsbEndTask_Click(object sender, EventArgs e)
        {
            try
            {

                string message = string.Empty;
                WinForm.AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                if (Service.EndExcuteTask(frmMain.encryptTicket, frmMain.userName, ref message))
                {
                    MessageBoxEx.Show("正在执行的任务结束!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    pageControlTask.Bind();
                }
                else
                {
                    if (!string.IsNullOrEmpty(message))
                    {
                        MessageBox.Show(message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("请检查任务领料数量,无法执行结束任务操作!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    pageControlTask.Bind();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #10
0
        private List<AscmGetMaterialTask> GetTaskTree(ref int count)
        {
            List<AscmGetMaterialTask> listTasks = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(pageControlTask.PageSize);
            ynPage.SetCurrentPage((pageControlTask.PageCurrent <= 0) ? 1 : pageControlTask.PageCurrent);
            _ynPage = YnBaseClass2.Helper.ObjectHelper.Serialize(ynPage);

            try
            {
                string status = (tscbTaskStatus.SelectedItem == null) ? string.Empty : tscbTaskStatus.SelectedItem.ToString().Trim();
                if (!string.IsNullOrEmpty(status))
                {
                    switch (status)
                    {
                        case "已完成":
                            status = "FINISH";
                            break;
                        case "执行中":
                            status = "EXECUTE";
                            break;
                        case "已分配":
                            status = "NOTEXECUTE";
                            break;
                        case "未分配":
                            status = "NOTALLOCATE";
                            break;
                        default:
                            status = "";
                            break;
                    }
                }
                WinForm.AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                string jsonStr = Service.GetTaskList(frmMain.encryptTicket, frmMain.userName, status, ref _ynPage, ref message);
                if (!string.IsNullOrEmpty(jsonStr))
                {
                    listTasks = (List<AscmGetMaterialTask>)JsonConvert.DeserializeObject(jsonStr, typeof(List<AscmGetMaterialTask>));
                    if (listTasks != null && listTasks.Count > 0)
                    {
                        ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                        count = ynPage.GetRecordCount();
                    }
                    else
                    {
                        MessageBoxEx.Show("没有查询到符合条件的领料任务!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return listTasks;
        }
Example #11
0
        private List<AscmWipDiscreteJobs> GetJobTree(int jobId)
        {
            List<AscmWipDiscreteJobs> listJobs = null;
            string message = string.Empty;

            try
            {
                WinForm.AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                string jsonStr = Service.GetJobList(frmMain.encryptTicket, jobId, ref message);
                if (!string.IsNullOrEmpty(jsonStr))
                {
                    listJobs = (List<AscmWipDiscreteJobs>)JsonConvert.DeserializeObject(jsonStr, typeof(List<AscmWipDiscreteJobs>));
                    if (listJobs == null || listJobs.Count == 0)
                    {
                        MessageBoxEx.Show("没有查询到符合条件的领料任务!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return listJobs;
        }
Example #12
0
        /// <summary>
        /// 登录按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username = "";
            string password = "";

            #region 用户登录检测

            if (!String.IsNullOrEmpty(txtUsername.Text.Trim()))
            {
                username = txtUsername.Text.Trim();
            }
            else
            {
                MessageBoxEx.Show("请输入登录用户名", "登录提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!String.IsNullOrEmpty(txtPassword.Text.Trim()))
            {
                password = txtPassword.Text.Trim();
            }
            else if (username.ToLower() == "admin")//其它用户允许空密码
            {
                MessageBoxEx.Show("请输入登录密码", "登录提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;

            }

            #endregion
            #region 用户登录判断

            WinForm.AscmWebService.AscmWebService service = new AscmWebService.AscmWebService();
            string message = "";
            string encryptTicket = "";
            try
            {
                if (service.UserAuthentication(username, password, YnBaseClass2.Helper.HostHelper.GetHostIP(), ref message, ref encryptTicket))
                {
                    //Main_Form.encryptTicket = encryptTicket;
                    //Main_Form.userName = username;
                    //this.DialogResult = DialogResult.OK;
                    //this.Close();

                    if (cbUserPwd.Checked == true)
                    {
                        Remember(true, username, password);
                    }
                    else
                    {
                        Remember(false, username, password);
                    }

                    frmMain.encryptTicket = encryptTicket;
                    frmMain.userName = username;
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBoxEx.Show(message, "登录失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
                MessageBoxEx.Show(message, "登录失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            #endregion
        }