private List<AscmWipRequirementOperations> DataBindDataGridView(ref int count, string queryStartTime, string queryEndTime)
        {
            List<AscmWipRequirementOperations> list = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

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

            try
            {
                AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                string jsonString = Service.SumMaterial(frmMainView.encryptTicket, frmMainView.userName, queryStartTime, queryEndTime, ref _ynPage, ref message);
                if (!string.IsNullOrEmpty(jsonString))
                {
                    list = (List<AscmWipRequirementOperations>)JsonConvert.DeserializeObject(jsonString, typeof(List<AscmWipRequirementOperations>));
                    if (list != null && list.Count > 0)
                    {
                        ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                        count = ynPage.GetRecordCount();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return list;
        }
 private void btnItemAdd_Click(object sender, EventArgs e)
 {
     frmAddTaskForm frmAddTaskForm = new frmAddTaskForm();
     frmAddTaskForm.ShowDialog();
     if (frmAddTaskForm.DialogResult == DialogResult.OK)
     {
         AscmGetMaterialTask ascmGetMaterialTask = frmAddTaskForm.ascmGetMaterialTask;
         string jsonString = JsonConvert.SerializeObject(ascmGetMaterialTask);
         string message = "";
         AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
         if (Service.AddUnAutoTask(frmMainView.encryptTicket, frmMainView.userName, jsonString, ref message))
         {
             pagerControlTask.Bind();
         }
     }
 }
        public string GetTaskBarNotifierData()
        {
            string message = "";
            string taskString = string.Empty;

            try
            {
                AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                taskString = Service.GetTaskbarNotifierMessage(frmMainView.encryptTicket, frmMainView.userName, ref message);
                taskString = taskString.Replace(",", "\r");
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            return taskString;
        }
 private void btnItemDelete_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (DataGridViewRow dr in this.dgViewTaskList.Rows)
         {
             if (dr.Selected)
             {
                 int id = int.Parse(dr.Cells[0].Value.ToString());
                 string message = "";
                 AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                 if (Service.DeleteUnAutoTask(frmMainView.encryptTicket, frmMainView.userName, id, ref message))
                 {
                     pagerControlTask.Bind();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private List<AscmWipRequirementOperations> DataBindDataGridView(ref int count)
        {
            List<AscmWipRequirementOperations> list = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

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

            try
            {
                if (taskId != 0 && jobId != 0)
                {
                    AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                    //string jsonString = Service.GetMonistorMaterialList(frmMainView.encryptTicket, taskId.ToString(), jobId.ToString(), ref _ynPage, ref message);
                    string jsonString = Service.GetMonitorMaterialList(frmMainView.encryptTicket, taskId.ToString(), jobId.ToString(), tbItemWarehouse.Text, tbItemMtlCategory.Text, ref _ynPage, ref message);
                    if (!string.IsNullOrEmpty(jsonString))
                    {
                        list = (List<AscmWipRequirementOperations>)JsonConvert.DeserializeObject(jsonString,typeof(List<AscmWipRequirementOperations>));
                        if (list != null && list.Count > 0)
                        {
                            ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                            count = ynPage.GetRecordCount();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return list;
        }
        private List<AscmMtlOnhandQuantitiesDetail> DataBindDataGridView(ref int count, int queryId)
        {
            List<AscmMtlOnhandQuantitiesDetail> list = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

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

            try
            {
                AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                string jsonString = Service.GetMaterialWarehouseList(frmMainView.encryptTicket, materialId, ref _ynPage, ref message);
                if (!string.IsNullOrEmpty(jsonString))
                {
                    list = (List<AscmMtlOnhandQuantitiesDetail>)JsonConvert.DeserializeObject(jsonString, typeof(List<AscmMtlOnhandQuantitiesDetail>));
                    if (list != null && list.Count > 0)
                    {
                        ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                        count = ynPage.GetRecordCount();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return list;
        }
Beispiel #7
0
        private void btnLinkWarehouse_Click(object sender, EventArgs e)
        {
            try
            {
                string message = "", queryWord = "";
                if (!string.IsNullOrEmpty(cbWarehouse.Text))
                    queryWord = cbWarehouse.Text.Trim().ToUpper();

                AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                string jsonString = Service.GetSomeWareHouse(frmMainView.encryptTicket, queryWord, ref message);
                if (!string.IsNullOrEmpty(jsonString))
                {
                    List<AscmWarehouse> list = (List<AscmWarehouse>)JsonConvert.DeserializeObject(jsonString, typeof(List<AscmWarehouse>));
                    if (list != null && list.Count > 0)
                    {
                        StructComboBoxWarehouse(this.cbWarehouse, list);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw ex;
            }
        }
Beispiel #8
0
        private void btnLinkMaterial_Click(object sender, EventArgs e)
        {
            try
            {
                string message = "";

                AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                string jsonString = Service.GetSomeMaterialList(frmMainView.encryptTicket, cbMaterial.Text, ref message);
                if (!string.IsNullOrEmpty(jsonString))
                {
                    List<AscmMaterialItem> list = (List<AscmMaterialItem>)JsonConvert.DeserializeObject(jsonString, typeof(List<AscmMaterialItem>));
                    if (list != null && list.Count > 0)
                    {
                        StructComboBoxMaterial(this.cbMaterial, list);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw ex;
            }
        }
        private List<AscmGetMaterialTask> DataBindDataGridView(ref int count, string queryStartTime, string queryEndTime, string queryTaskStatus)
        {
            List<AscmGetMaterialTask> list = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

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

            try
            {
                string queryStatus = string.Empty;
                if (queryTaskStatus != null)
                {
                    switch (queryTaskStatus.ToString())
                    {
                        case "已分配":
                            queryStatus = "NOTEXECUTE";
                            break;
                        case "执行中":
                            queryStatus = "EXECUTE";
                            break;
                        case "已完成":
                            queryStatus = "FINISH";
                            break;
                        case "已关闭":
                            queryStatus = "CLOSE";
                            break;
                        default:
                            queryStatus = "";
                            break;
                    }
                }

                AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                string jsonString = Service.GetUnAutoTaskList(frmMainView.encryptTicket, queryStartTime, queryEndTime, queryStatus, ref _ynPage, ref message);
                if (!string.IsNullOrEmpty(jsonString))
                {
                    list = (List<AscmGetMaterialTask>)JsonConvert.DeserializeObject(jsonString, typeof(List<AscmGetMaterialTask>));
                    if (list != null && list.Count > 0)
                    {
                        ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                        count = ynPage.GetRecordCount();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return list;
        }
        private List<AscmWipRequirementOperations> DataBindAdvTreeSecondLevelNode(int id, string mtlCategory)
        {
            List<AscmWipRequirementOperations> list = null;
            string message = string.Empty;

            AscmWebService.AscmWebService service = new AscmWebService.AscmWebService();
            string jsonString = service.GetMonitorJobList(frmMainView.encryptTicket, id, mtlCategory, ref message);
            if (!string.IsNullOrEmpty(jsonString))
            {
                list = (List<AscmWipRequirementOperations>)JsonConvert.DeserializeObject(jsonString, typeof(List<AscmWipRequirementOperations>));
            }

            return list;
        }
        private List<AscmWipDiscreteJobs> DataBindAdvTreeFristLevelNode(ref int count, string taskString)
        {
            List<AscmWipDiscreteJobs> list = 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 queryType = string.Empty;
                if (cbItemTaskType.SelectedItem != null)
                {
                    switch (cbItemTaskType.SelectedItem.ToString())
                    {
                        case "总装":
                            queryType = "1";
                            break;
                        case "电装":
                            queryType = "2";
                            break;
                        default:
                            queryType = "";
                            break;
                    }
                }

                string queryFormat = string.Empty;
                if (cbItemMtlCategoryStatus.SelectedItem != null)
                {
                    switch (cbItemMtlCategoryStatus.SelectedItem.ToString())
                    {
                        case "有库存":
                            queryFormat = "INSTOCK";
                            break;
                        case "须备料":
                            queryFormat = "PRESTOCK";
                            break;
                        case "须配料":
                            queryFormat = "MIXSTOCK";
                            break;
                        case "特殊子库":
                            queryFormat = "SPECWAREHOUSE";
                            break;
                        case "临时任务":
                            queryFormat = "TEMPTASK";
                            break;
                        default:
                            queryFormat = "";
                            break;
                    }
                }

                string queryStatus = string.Empty;
                if (cbItemTaskStatus.SelectedItem != null)
                {
                    switch (cbItemTaskStatus.SelectedItem.ToString())
                    {
                        case "已分配":
                            queryStatus = "NOTEXECUTE";
                            break;
                        case "执行中":
                            queryStatus = "EXECUTE";
                            break;
                        case "已完成":
                            queryStatus = "FINISH";
                            break;
                        case "已关闭":
                            queryStatus = "CLOSE";
                            break;
                        default:
                            queryStatus = "";
                            break;
                    }
                }

                string queryLine = (tbItemProductLine.Text == "") ? string.Empty : tbItemProductLine.Text.ToUpper().ToString();
                string queryTime = (cbItemTaskTime.SelectedItem == null) ? string.Empty : cbItemTaskTime.SelectedItem.ToString();
                string queryWarehouse = (tbItemWarehouse.Text == "") ? string.Empty : tbItemWarehouse.Text.ToUpper().ToString();

                AscmWebService.AscmWebService service = new AscmWebService.AscmWebService();
                string jsonString = service.GetMonitorTaskList(frmMainView.encryptTicket, frmMainView.userName, tbItemStart.Text, tbItemEnd.Text, tbItemJobStart.Text, tbItemJobEnd.Text, queryType, queryFormat, queryStatus, queryLine, queryTime, queryWarehouse, tbItemWipEntity.Text, taskString, ref _ynPage, ref message);
                if (!string.IsNullOrEmpty(jsonString))
                {
                    list = (List<AscmWipDiscreteJobs>)JsonConvert.DeserializeObject(jsonString, typeof(List<AscmWipDiscreteJobs>));
                    if (list != null && list.Count > 0)
                    {
                        ynPage = (YnBaseDal.YnPage)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnBaseDal.YnPage), _ynPage);
                        count = ynPage.GetRecordCount();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return list;
        }
 private void btnItemUnMark_Click(object sender, EventArgs e)
 {
     try
     {
         string message = string.Empty;
         AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
         if (Service.UnMarkTask(frmMainView.encryptTicket, frmMainView.userName, this.taskId, this.jobId, ref message))
             pageControlTask.Bind();
         else
             MessageBox.Show(message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void btnItemSure_Click(object sender, EventArgs e)
        {
            try
            {
                string message = "";
                AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
                if (Service.ConfrimedBatchGetmaterials(frmMainView.encryptTicket, frmMainView.userName, releaseHeaderIds, ref message))
                {
                    MessageBoxEx.Show("领料成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    pageControlTask.Bind();
                    releaseHeaderIds = "";
                }
                else
                {
                    MessageBox.Show(message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 private void btnItemStop_Click(object sender, EventArgs e)
 {
     try
     {
         string message = string.Empty;
         if (string.IsNullOrEmpty(releaseHeaderIds))
         {
             MessageBox.Show("请选择任务!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         else
         {
             string[] myArray = releaseHeaderIds.Split(',');
             string newReleaseHeaderIds = string.Empty;
             foreach (string item in myArray)
             {
                 if (!string.IsNullOrEmpty(newReleaseHeaderIds) && !string.IsNullOrEmpty(item))
                     newReleaseHeaderIds += ",";
                 if (!string.IsNullOrEmpty(item))
                     newReleaseHeaderIds += item;
             }
             releaseHeaderIds = newReleaseHeaderIds;
             AscmWebService.AscmWebService Service = new AscmWebService.AscmWebService();
             if (Service.EndExcuteTask(frmMainView.encryptTicket, frmMainView.userName, releaseHeaderIds, ref message))
             {
                 MessageBoxEx.Show("任务已结束!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 pageControlTask.Bind();
             }
             else
             {
                 MessageBox.Show(message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         releaseHeaderIds = "";
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #15
0
        /// <summary>
        /// Login Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUserLogin_Click(object sender, EventArgs e)
        {
            string username = "";
            string password = "";

            #region User login authentication

            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 Verify that the user exists

            AscmWebService.AscmWebService service = new AscmWebService.AscmWebService();
            string message = "";
            string encryptTicket = "";
            try
            {
                if (service.UserAuthentication(username, password, YnBaseClass2.Helper.HostHelper.GetHostIP(), ref message, ref encryptTicket))
                {
                    if (cbUserPwd.Checked == true)
                    {
                        Remember(true, username, password);
                    }
                    else
                    {
                        Remember(false, username, password);
                    }

                    frmMainView.encryptTicket = encryptTicket;
                    frmMainView.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
        }