Example #1
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 #2
0
        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);
        }
Example #3
0
        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 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;
        }
Example #5
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(frmMain.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 #6
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 #7
0
        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);
        }
Example #8
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 #9
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 #10
0
        private List <AscmWipDiscreteJobs> getWipDiscreteJobsList(ref int count)
        {
            List <AscmWipDiscreteJobs> listJobs = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

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

                string startdate = startDate.Value.ToString("yyyy-MM-dd");
                string enddate   = endDate.Value.ToString("yyyy-MM-dd");

                AscmWebService.AscmWebService service = new AscmWebService.AscmWebService();
                string jsonstr = service.MaterialOfDiscreteJobList(frmMain.encryptTicket, materialId, startdate, enddate, ref _ynPage, ref message);
                if (!string.IsNullOrEmpty(jsonstr))
                {
                    listJobs = (List <AscmWipDiscreteJobs>)JsonConvert.DeserializeObject(jsonstr, typeof(List <AscmWipDiscreteJobs>));
                    if (listJobs != null && listJobs.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)
            {
                MessageBoxEx.Show(ex.Message + message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(listJobs);
        }
Example #11
0
        private List<AscmWipDiscreteJobs> getWipDiscreteJobsList(ref int count)
        {
            List<AscmWipDiscreteJobs> listJobs = null;
            string message = string.Empty;
            string _ynPage = string.Empty;

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

                string startdate = startDate.Value.ToString("yyyy-MM-dd");
                string enddate = endDate.Value.ToString("yyyy-MM-dd");

                AscmWebService.AscmWebService service = new AscmWebService.AscmWebService();
                string jsonstr = service.MaterialOfDiscreteJobList(frmMain.encryptTicket, materialId, startdate, enddate, ref _ynPage, ref message);
                if (!string.IsNullOrEmpty(jsonstr))
                {
                    listJobs = (List<AscmWipDiscreteJobs>)JsonConvert.DeserializeObject(jsonstr, typeof(List<AscmWipDiscreteJobs>));
                    if (listJobs != null && listJobs.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)
            {
                MessageBoxEx.Show(ex.Message + message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return listJobs;
        }
Example #12
0
        public ActionResult EmployeeCarSwipeLogList(int? page, int? rows, string sort, string order, string queryWord, int? doorId,
            string direction, string plateNumber, string employeeName, string queryStartTime, string queryEndTime)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = string.Empty;
                if (doorId.HasValue)
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, "doorId=" + doorId);
                if (!string.IsNullOrEmpty(direction))
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, "direction='" + direction + "'");
                if (!string.IsNullOrEmpty(plateNumber))
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, "plateNumber like '%" + plateNumber.Trim() + "%'");
                if (!string.IsNullOrEmpty(employeeName))
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, "employeeName like '%" + employeeName.Trim() + "%'");
                DateTime dtStartCreateTime, dtEndCreateTime;
                if (!string.IsNullOrEmpty(queryStartTime) && DateTime.TryParse(queryStartTime, out dtStartCreateTime))
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, "createTime>='" + dtStartCreateTime.ToString("yyyy-MM-dd 00:00:00") + "'");
                if (!string.IsNullOrEmpty(queryEndTime) && DateTime.TryParse(queryEndTime, out dtEndCreateTime))
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, "createTime<'" + dtEndCreateTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'");

                List<AscmEmpCarSwipeLog> list = AscmEmpCarSwipeLogService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                if (list != null)
                    list.ForEach(P => jsonDataGridResult.rows.Add(P));

                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #13
0
        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;
        }
Example #14
0
        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);
        }
Example #15
0
        public ActionResult EmployeeAscxList(int? id,int? page, int? rows, string sort, string order, string q)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmEmployee> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "";
                if (string.IsNullOrEmpty(q))
                {
                    if (id.HasValue)
                    {
                        whereOther = "id=" + id.Value;
                    }
                }
                list = AscmEmployeeService.GetInstance().GetList(ynPage, "", "", q,whereOther);
                foreach (AscmEmployee ascmEmployee in list)
                {
                    jsonDataGridResult.rows.Add(ascmEmployee.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #16
0
        public ActionResult SupplierMaterialList(int? page, int? rows, string sort, string order, int? supplierId, string queryWord, string startInventoryItemId, string endInventoryItemId)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                if (supplierId.HasValue)
                {
                    List<AscmSupplierMaterialLink> listAscmSupplierMaterialLink = AscmSupplierMaterialLinkService.GetInstance().GetList(supplierId.Value);
                    List<AscmMaterialItem> listAscmMaterialItem = null;
                    if (listAscmSupplierMaterialLink != null && listAscmSupplierMaterialLink.Count() > 0)
                    {
                        string materialIds = string.Empty;
                        foreach (AscmSupplierMaterialLink ascmSupplierMaterialLink in listAscmSupplierMaterialLink)
                        {
                            if (!string.IsNullOrEmpty(materialIds))
                                materialIds += ",";
                            materialIds += ascmSupplierMaterialLink.materialId;
                        }
                        if (!string.IsNullOrEmpty(materialIds))
                        {
                            string[] Ids = materialIds.Split(',');
                            int iCount = Ids.Length;
                            string sWhere = string.Empty;
                            if (iCount > 900)
                            {
                                string ids = string.Empty;
                                for (int i = 0; i < iCount; i++)
                                {
                                    if (!string.IsNullOrEmpty(ids))
                                        ids += ",";
                                    ids += Ids.ElementAt(i);
                                    if ((i + 1) % 900 == 0 || (i + 1) == iCount)
                                    {
                                        if (!string.IsNullOrEmpty(sWhere))
                                            sWhere += " or ";
                                        sWhere += "id in (" + ids + ")";
                                        ids = string.Empty;
                                    }
                                }
                            }
                            else
                                sWhere = "id in (" + materialIds + ")";

                            string whereStartInventoryItemId = string.Empty, whereEndInventoryItemId = string.Empty, sWhereId = string.Empty;
                            if (!string.IsNullOrEmpty(startInventoryItemId))
                            {
                                whereStartInventoryItemId = " docNumber='" + startInventoryItemId.Trim() + "'";
                            }
                            if (!string.IsNullOrEmpty(endInventoryItemId))
                            {
                                if (!string.IsNullOrEmpty(startInventoryItemId))
                                {
                                    whereStartInventoryItemId = " docNumber>='" + startInventoryItemId.Trim() + "' and docNumber<='" + endInventoryItemId.Trim() + "'";
                                }
                                else
                                {
                                    whereEndInventoryItemId = " docNumber<='" + endInventoryItemId.Trim() + "'";
                                }
                            }
                            sWhereId = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(sWhereId, whereStartInventoryItemId);
                            sWhereId = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(sWhereId, whereEndInventoryItemId);
                            if (!string.IsNullOrEmpty(sWhereId))
                                sWhere = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(sWhereId, sWhere);
                            listAscmMaterialItem = AscmMaterialItemService.GetInstance().GetList(ynPage, "docNumber", "", "", "", "", sWhere);
                            if (listAscmMaterialItem != null && listAscmMaterialItem.Count() > 0)
                            {
                                foreach (AscmMaterialItem ascmMaterialItem in listAscmMaterialItem)
                                {
                                    jsonDataGridResult.rows.Add(ascmMaterialItem);
                                }
                            }
                        }
                    }
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                //jsonDataGridResult.message = ex.Message;
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #17
0
        public ActionResult RfidList(int? page, int? rows, string sort, string order, string queryWord, string queryType)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmRfid> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "";
                if (!string.IsNullOrEmpty(queryType))
                    whereOther = " bindType='" + queryType.Trim() + "' ";
                list = AscmRfidService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                foreach (AscmRfid ascmRfid in list)
                {
                    jsonDataGridResult.rows.Add(ascmRfid.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #18
0
        public ActionResult RfidAscxList(int? id, int? page, int? rows, string sort, string order, string q)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmRfid> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string sql = "from AscmRfid where bindType = 'FORKLIFT'";
                IList<AscmRfid> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmRfid>(sql, sql, ynPage);
                if (ilist != null && ilist.Count > 0)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmRfid>(ilist);
                    foreach (AscmRfid ascmRfid in list)
                    {
                        jsonDataGridResult.rows.Add(ascmRfid);
                    }
                }

                //list = AscmRfidService.GetInstance().GetList(ynPage, "", "", q, null);
                //if (list != null)
                //{
                //    foreach (AscmRfid ascmRfid in list)
                //    {
                //        jsonDataGridResult.rows.Add(ascmRfid);
                //    }
                //}
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult,JsonRequestBehavior.AllowGet);
        }
Example #19
0
        public ActionResult SupplierAscxList(int? id, int? page, int? rows, string sort, string order, string q)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmSupplier> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                list = AscmSupplierService.GetInstance().GetList(ynPage, "", "", q,null);
                foreach (AscmSupplier ascmSupplier in list)
                {
                    jsonDataGridResult.rows.Add(ascmSupplier.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #20
0
        public ActionResult DeliveryNotifyMainList(int? page, int? rows, string sort, string order, string queryWord,
            string supplier, string materialItem, string warehouse, string alert, string filter, string startReleasedTime, string endReleasedTime, string startNeedTime, string endNeedTime, string status, string employeeBuyer, string wipEntityIds)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmDeliveryNotifyMain> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "", whereSupplier = "", whereMaterialItem = "", whereWarehouse = "", whereAlert = "", whereFilter = "", whereStartReleaseTime = "", whereEndReleaseTime = "";
                string whereStartNeedTime = "", whereEndNeedTime = "", whereStatus = "", whereEmployeeBuyer = "", whereWipEntityIds = "";
                if (!string.IsNullOrEmpty(supplier))
                    whereSupplier = "a.supplierId=" + supplier;
                if (!string.IsNullOrEmpty(materialItem))
                    whereMaterialItem = "a.materialId= " + materialItem;
                if (!string.IsNullOrEmpty(warehouse))
                    whereWarehouse = "a.warehouseId = '" + warehouse + "'";
                if (!string.IsNullOrEmpty(alert))
                {
                    string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    if (alert == AscmDeliveryNotifyMain.AlertDefine.alert)
                    {
                        whereAlert = "a.appointmentStartTime <='" + datetime + "' and a.appointmentEndTime >= '" + datetime + "'";
                    }
                    if (alert == AscmDeliveryNotifyMain.AlertDefine.overdue)
                    {
                        whereAlert = "a.appointmentEndTime < '" + datetime + "'";
                    }
                }
                //if (!string.IsNullOrEmpty(filter))
                //{
                //    whereFilter = "e.receivedQuantity < a.releasedquantity";
                //}

                if (!string.IsNullOrEmpty(filter))
                    whereFilter = "a.totalReceiveQuantity < a.releasedQuantity";

                if (!string.IsNullOrEmpty(wipEntityIds))
                    whereWipEntityIds = "a.wipEntityId > 0";

                if (!string.IsNullOrEmpty(status))
                    whereStatus = "status = '" + status + "'";

                if (!string.IsNullOrEmpty(employeeBuyer))
                    whereEmployeeBuyer = "a.materialId in (select id from Ascm_Material_Item where Ascm_Material_Item.buyerId=" + employeeBuyer + ")";

                DateTime dtStartReleasedTime,dtEndReleasedTime;
                if (!string.IsNullOrEmpty(startReleasedTime) && DateTime.TryParse(startReleasedTime, out dtStartReleasedTime))
                    whereStartReleaseTime = "a.releasedTime>='" + dtStartReleasedTime.ToString("yyyy-MM-dd 00:00:00") + "'";
                if (!string.IsNullOrEmpty(endReleasedTime) && DateTime.TryParse(endReleasedTime, out dtEndReleasedTime))
                    whereEndReleaseTime = "a.releasedTime<'" + dtEndReleasedTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'";

                DateTime dtStartNeedTime, dtEndNeedTime;
                if (!string.IsNullOrEmpty(startNeedTime) && DateTime.TryParse(startNeedTime, out dtStartNeedTime))
                    whereStartNeedTime = "a.needTime>='" + dtStartNeedTime.ToString("yyyy-MM-dd 00:00:00") + "'";
                if (!string.IsNullOrEmpty(endReleasedTime) && DateTime.TryParse(endNeedTime, out dtEndNeedTime))
                    whereEndNeedTime = "a.needTime<'" + dtEndNeedTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'";

                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereSupplier);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereMaterialItem);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereWarehouse);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereAlert);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereFilter);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartReleaseTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndReleaseTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartNeedTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndNeedTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStatus);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEmployeeBuyer);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereWipEntityIds);

                list = AscmDeliveryNotifyMainService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                foreach (AscmDeliveryNotifyMain ascmDeliveryNotifyMain in list)
                {
                    jsonDataGridResult.rows.Add(ascmDeliveryNotifyMain.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #21
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 #22
0
        public ActionResult ErpUserInfoList(int? page, int? rows, string sort, string order, string queryWord)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmUserInfo> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string organizationId = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketOrganizationId();

                string where = " extExpandType='erp' and not exists (select 1 from Ascm_Ak_Web_User_Sec_Attr b where b.attributeCode='" + AscmAkWebUserSecAttrValues.AttributeCodeDefine.supplierUser + "' and b.webUserId=u.extExpandId) ";
                //where = " extExpandType='erp'";
                //where = " not exists (from AscmAkWebUserSecAttrValues b where b.id=a.extExpandId) ";
                //where = " not exists (from AscmAkWebUserSecAttrValues b where b.id=a.extExpandId) ";
                list = AscmUserInfoService.GetInstance().GetList( ynPage, sort, order, queryWord, where);
                foreach (AscmUserInfo ascmUserInfo in list)
                {
                    //ynUser.listYnDepartment = YnDepartmentService.GetInstance().GetListInUser(ynUser.userId);
                    //ynUser.listYnDepartmentPositionLink = YnDepartmentPositionLinkService.GetInstance().GetListInUser(ynUser.userId);
                    //ynUser.listYnRole = YnRoleService.GetInstance().GetListInUser(ynUser.userId);
                    jsonDataGridResult.rows.Add(ascmUserInfo.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #23
0
        public ActionResult NotFinalDiscreteJobsList(int? page, int? rows, string sort, string order, string queryWord, string queryStartDate, string queryEndDate, string queryDocnumber, string queryStatus)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmDiscreteJobs> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();

            try
            {
                string hql = "select new AscmWipRequirementOperations(b.wipEntityId) from AscmGetMaterialTask a, AscmWipRequirementOperations b, AscmWipEntities c";

                if (string.IsNullOrEmpty(queryStartDate) && string.IsNullOrEmpty(queryEndDate))
                    throw new Exception("起止作业日期不能为空!");

                string where = "", whereQueryWord = "", whereWipEntity = "";

                whereQueryWord = "a.id = b.taskId";
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);

                whereQueryWord = "b.wipEntityId = c.wipEntityId";
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);

                if (!string.IsNullOrEmpty(queryStatus))
                {
                    whereQueryWord = "a.status = '" + queryStatus + "'";
                    where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }
                else
                {
                    whereQueryWord = "a.status != 'FINISH'";
                    where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryStartDate))
                {
                    string startDate = Convert.ToDateTime(queryStartDate).ToString("yyyy-MM-dd") + " 00:00";
                    whereQueryWord = "a.dateReleased >= '" + startDate + "'";
                    where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryEndDate))
                {
                    string endDate = Convert.ToDateTime(queryEndDate).ToString("yyyy-MM-dd") + " 00:00";
                    whereQueryWord = "a.dateReleased <= '" + endDate + "'";
                    where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryDocnumber))
                {
                    whereQueryWord = "c.name like '" + queryDocnumber + "%'";
                    where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(where))
                    hql += " where " + where;

                IList<AscmWipRequirementOperations> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmWipRequirementOperations>(hql);
                if (ilist != null && ilist.Count > 0)
                {
                    var wipEntityId = ilist.Select(P => P.wipEntityId).Distinct();
                    if (wipEntityId != null)
                    {
                        string wipEntityIds = string.Empty;
                        foreach (int item in wipEntityId)
                        {
                            if (!string.IsNullOrEmpty(wipEntityIds))
                                wipEntityIds += ",";
                            wipEntityIds += item;
                        }

                        whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(wipEntityIds, "wipEntityId");
                        whereWipEntity = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereWipEntity, whereQueryWord);
                    }

                    if (!string.IsNullOrEmpty(queryDocnumber))
                    {
                        whereQueryWord = "jobId like '" + queryDocnumber + "%'";
                        whereWipEntity = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereWipEntity, whereQueryWord);
                    }
                }

                if (!string.IsNullOrEmpty(whereWipEntity))
                {
                    list = AscmDiscreteJobsService.GetInstance().GetList(ynPage, "", "", "", whereWipEntity);
                    if (list != null && list.Count > 0)
                    {
                        foreach (AscmDiscreteJobs ascmDiscreteJobs in list)
                        {
                            jsonDataGridResult.rows.Add(ascmDiscreteJobs);
                        }
                    }
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
                jsonDataGridResult.result = true;
            }
            catch (Exception ex)
            {
                jsonDataGridResult.result = false;
                jsonDataGridResult.message = ex.Message;
            }

            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #24
0
        //物料子类
        public ActionResult MaterialSubCategoryList(int? page, int? rows, string sort, string order, string queryWord, string queryOtherWord, string categoryCode)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE);//pageRows
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1);//pageNumber

            List<AscmMaterialSubCategory> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                if (string.IsNullOrEmpty(categoryCode))
                    throw new Exception("物料大类不能为空!");

                string whereOther = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(categoryCode))
                {
                    AscmMaterialCategory ascmMaterialCategory = AscmMaterialCategoryService.GetInstance().GetId(categoryCode);
                    whereQueryWord = "categoryId = " + ascmMaterialCategory.id.ToString();
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryWord) && !string.IsNullOrEmpty(queryOtherWord))
                {
                    if (queryWord == queryOtherWord)
                    {
                        whereQueryWord = "subCategoryCode like '" + queryWord + "%'";
                        whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                    }
                    else
                    {
                        whereQueryWord = "subCategoryCode >= '" + queryWord + "'";
                        whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                        whereQueryWord = "subCategoryCode <= '" + queryOtherWord + "'";
                        whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                    }
                }
                else if (!string.IsNullOrEmpty(queryWord) && string.IsNullOrEmpty(queryOtherWord))
                {
                    whereQueryWord = "subCategoryCode like '" + queryWord + "%'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }
                else if (string.IsNullOrEmpty(queryWord) && !string.IsNullOrEmpty(queryOtherWord))
                {
                    whereQueryWord = "subCategoryCode like '" + queryOtherWord + "%'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                list = AscmMaterialSubCategoryService.GetInstance().GetList(ynPage, "combinationCode", "", "", whereOther);
                if (list != null && list.Count > 0)
                {
                    foreach (AscmMaterialSubCategory ascmMaterialSubCategory in list)
                    {
                        jsonDataGridResult.rows.Add(ascmMaterialSubCategory);
                    }
                }
                jsonDataGridResult.result = true;
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                jsonDataGridResult.result = false;
                jsonDataGridResult.message = ex.Message;
            }

            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
        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);
        }
Example #26
0
        public ActionResult LoadJobLog(int? page, int? rows, string sort, string order, string jobName, string queryWord)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmJobLog> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                if (jobName != null && jobName.Trim() != "")
                {
                    list = AscmJobLogService.GetInstance().GetList(ynPage, sort, order, jobName, queryWord);
                    if (list != null)
                    {
                        foreach (AscmJobLog ascmJobLog in list)
                        {
                            jsonDataGridResult.rows.Add(ascmJobLog);
                        }
                        jsonDataGridResult.total = ynPage.GetRecordCount();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #27
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 #28
0
        public ActionResult SumGetMaterialQuantityList(int? page, int? rows, string sort, string order, string queryWord, string queryStartDate, string queryEndDate, string queryDocnumber)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            string userName = string.Empty;
            string userRole = string.Empty;
            if (User.Identity.IsAuthenticated)
            {
                userName = User.Identity.Name;
            }
            userRole = AscmUserInfoService.GetInstance().GetUserRoleName(userName);

            List<AscmMaterialItem> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string where = "", whereOther = "", whereQueryWord = "", whereMaterial = "", whereTask = "";

                if (string.IsNullOrEmpty(queryStartDate) && string.IsNullOrEmpty(queryEndDate))
                    throw new Exception("起止日期不能为空!");

                string startDate = string.Empty;
                if (!string.IsNullOrEmpty(queryStartDate))
                {
                    startDate = Convert.ToDateTime(queryStartDate).ToString("yyyy-MM-dd") + " 00:00:00";
                    whereQueryWord = "createTime >= '" + startDate + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                string endDate = string.Empty;
                if (!string.IsNullOrEmpty(queryEndDate))
                {
                    endDate = Convert.ToDateTime(queryEndDate).ToString("yyyy-MM-dd") + " 23:59:59";
                    whereQueryWord = "createTime <= '" + endDate + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                if (userRole.IndexOf("领料员") > -1)
                {
                    whereQueryWord = "workerId = '" + userName + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryDocnumber))
                {
                    whereQueryWord = " docNumber like '" + queryDocnumber + "%'";
                    whereMaterial = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereMaterial, whereQueryWord);

                    List<AscmMaterialItem> listAscmMaterialItem = AscmMaterialItemService.GetInstance().GetList(null, "", "", "", whereMaterial);
                    if (listAscmMaterialItem == null || listAscmMaterialItem.Count == 0)
                        throw new Exception("物料编码不存在!");

                    if (listAscmMaterialItem != null && listAscmMaterialItem.Count > 0)
                    {
                        string idsMaterial = string.Empty;
                        foreach (AscmMaterialItem item in listAscmMaterialItem)
                        {
                            if (!string.IsNullOrEmpty(idsMaterial))
                                idsMaterial += ",";
                            idsMaterial += item.id;
                        }

                        if (!string.IsNullOrEmpty(idsMaterial))
                        {
                            whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(idsMaterial, "inventoryitemid");
                            whereTask = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereTask, whereQueryWord);
                        }
                    }
                }

                List<AscmGetMaterialTask> listAscmGetMaterialTask = AscmGetMaterialTaskService.GetInstance().GetList(null, "", "", "", whereOther);
                if (listAscmGetMaterialTask == null || listAscmGetMaterialTask.Count == 0)
                    throw new Exception("找不到指定日期的领料任务!");

                if (listAscmGetMaterialTask != null && listAscmGetMaterialTask.Count > 0)
                {
                    string ids = string.Empty;
                    foreach (AscmGetMaterialTask ascmGetMaterialTask in listAscmGetMaterialTask)
                    {
                        if (!string.IsNullOrEmpty(ids))
                            ids += ",";
                        ids += ascmGetMaterialTask.id;
                    }

                    if (!string.IsNullOrEmpty(ids))
                    {
                        whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "taskId");
                        whereTask = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereTask, whereQueryWord);
                    }
                }

                string sql = "select inventoryitemid, sum(requiredQuantity), sum(quantityIssued), sum(getMaterialQuantity), sum(requiredQuantity - quantityIssued) as quantityDifference, sum(requiredQuantity - getMaterialQuantity) as quantityGetMaterialDifference from ascm_wip_require_operat";

                if (!string.IsNullOrEmpty(whereTask))
                    sql += " where " + whereTask + " group by inventoryitemid";
                IList ilistOperations = YnDaoHelper.GetInstance().nHibernateHelper.ExecuteReader(sql);
                if (ilistOperations == null || ilistOperations.Count == 0)
                    throw new Exception("指定条件查询结果中未找到汇总编码");

                if (ilistOperations != null && ilistOperations.Count > 0)
                {
                    string idsOperations = string.Empty;
                    foreach (object[] obj in ilistOperations)
                    {
                        if (!string.IsNullOrEmpty(idsOperations))
                            idsOperations += ",";
                        idsOperations += obj[0].ToString();
                    }
                    whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(idsOperations,"id");
                    where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                list = AscmMaterialItemService.GetInstance().GetList(ynPage,"","","",where);

                if (list != null && list.Count > 0)
                {
                    foreach (AscmMaterialItem ascmMaterialItem in list)
                    {
                        foreach (object[] obj in ilistOperations)
                        {
                            int id = Convert.ToInt32(obj[0].ToString());
                            if (ascmMaterialItem.id == id)
                            {
                                ascmMaterialItem.requiredQuantity = Convert.ToDecimal(obj[1].ToString());
                                ascmMaterialItem.quantityIssued = Convert.ToDecimal(obj[2].ToString());
                                ascmMaterialItem.getMaterialQuantity = Convert.ToDecimal(obj[3].ToString());
                                ascmMaterialItem.quantityDifference = Convert.ToDecimal(obj[4].ToString());
                                ascmMaterialItem.quantityGetMaterialDifference = Convert.ToDecimal(obj[5].ToString());
                            }
                        }
                        jsonDataGridResult.rows.Add(ascmMaterialItem);
                    }
                }
                jsonDataGridResult.result = true;
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                jsonDataGridResult.message = ex.Message;
                jsonDataGridResult.result = false;
            }

            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #29
0
        public ActionResult DeliveryOrderBatchNotInBatchSumList(int? page, int? rows, string sort, string order, string queryWord,
            string supplier, string warehouse, string startCreateTime, string endCreateTime, string status, string ascmStatus)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "", whereSupplier = "", whereWarehouse = "", whereAscmStatus = "";
                string whereStartCreateTime = "", whereEndCreateTime = "", whereStatus = "";
                string whereNotInSum = " id not in(select batchId from AscmDeliBatSumDetail where mainId in(select id from AscmDeliBatSumMain where status='" + AscmDeliBatSumMain.StatusDefine.unConfirm + "'))";

                if (!string.IsNullOrEmpty(supplier))
                    whereSupplier = "supplierId=" + supplier;
                if (!string.IsNullOrEmpty(warehouse))
                    whereWarehouse = "warehouseId = '" + warehouse + "'";
                if (!string.IsNullOrEmpty(status))
                    whereStatus = "status = '" + status + "'";

                DateTime dtStartCreateTime, dtEndCreateTime;
                if (!string.IsNullOrEmpty(startCreateTime) && DateTime.TryParse(startCreateTime, out dtStartCreateTime))
                    whereStartCreateTime = "createTime>='" + dtStartCreateTime.ToString("yyyy-MM-dd 00:00:00") + "'";
                if (!string.IsNullOrEmpty(endCreateTime) && DateTime.TryParse(endCreateTime, out dtEndCreateTime))
                    whereEndCreateTime = "createTime<'" + dtEndCreateTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'";
                if (!string.IsNullOrEmpty(ascmStatus))
                {
                    if (ascmStatus == "INSTORAGE")
                        whereAscmStatus = "ascmStatus='" + ascmStatus + "'";
                    else
                        whereAscmStatus = "ascmStatus!='INSTORAGE'  or ascmStatus is null";
                }

                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereSupplier);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereWarehouse);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartCreateTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndCreateTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStatus);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereNotInSum);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereAscmStatus);

                List<AscmDeliveryOrderBatch> list = AscmDeliveryOrderBatchService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                if (list != null)
                {
                    foreach (AscmDeliveryOrderBatch ascmDeliveryOrderBatch in list)
                    {
                        jsonDataGridResult.rows.Add(ascmDeliveryOrderBatch.GetOwner());
                    }
                    jsonDataGridResult.total = ynPage.GetRecordCount();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #30
0
        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;
        }
Example #31
0
        // 作业自定义控件
        public ActionResult WipEntitiesAscxList(int? id, int? page, int? rows, string sort, string order, string q)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE);//pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1);//pageNumber;

            List<AscmDiscreteJobs> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                list = AscmDiscreteJobsService.GetInstance().GetList(ynPage, sort, order, q, null);
                if (list != null && list.Count > 0)
                {
                    foreach (AscmDiscreteJobs ascmDiscreteJobs in list)
                    {
                        jsonDataGridResult.rows.Add(ascmDiscreteJobs);
                    }
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #32
0
        public ActionResult DeliveryOrderBatchAscxList1(int? page, int? rows, string sort, string order, string queryWord,
           string supplier, string warehouse, string startCreateTime, string endCreateTime, string status, string ascmStatus,
            string startConfirmDate, string endConfirmDate, string startNotifyDate, string endNotifyDate, string startMaterialDocNumber, string endMaterialDocNumber,
            string appointmentStartTime, string appointmentEndTime, string queryFilter, bool? isSupplierSelect, int? supplierDeliveryBatSumId, bool appointmentTimeFilter)
        {
            //isSupplierSelect是否供应商选择批单方式,如果是则不显示已生成的批单
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "", whereSupplier = "", whereWarehouse = "", whereAscmStatus = "";//whereBatSumMain = "",
                string whereStartCreateTime = "", whereEndCreateTime = "", whereStatus = "";

                if (!string.IsNullOrEmpty(supplier) && supplier != "null")
                    whereSupplier = "supplierId=" + supplier;
                if (!string.IsNullOrEmpty(warehouse) && warehouse != "null")
                    whereWarehouse = "warehouseId = '" + warehouse + "'";
                if (!string.IsNullOrEmpty(status))
                    whereStatus = "status = '" + status + "'";

                DateTime dtStartCreateTime, dtEndCreateTime;
                if (!string.IsNullOrEmpty(startCreateTime) && DateTime.TryParse(startCreateTime, out dtStartCreateTime))
                    whereStartCreateTime = "createTime>='" + dtStartCreateTime.ToString("yyyy-MM-dd HH:mm:00") + "'";
                if (!string.IsNullOrEmpty(endCreateTime) && DateTime.TryParse(endCreateTime, out dtEndCreateTime))
                    //whereEndCreateTime = "createTime<'" + dtEndCreateTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'";
                    whereEndCreateTime = "createTime<='" + dtEndCreateTime.ToString("yyyy-MM-dd HH:mm:00") + "'";

                if (!string.IsNullOrEmpty(ascmStatus))
                {
                    if (ascmStatus == "INSTORAGE")
                        if (ascmStatus == AscmDeliveryOrderBatch.AscmStatusDefine.inStorage)
                            whereAscmStatus = "ascmStatus='" + ascmStatus + "'";
                        else
                            whereAscmStatus = " ascmStatus is null or ascmStatus<>'" + AscmDeliveryOrderBatch.AscmStatusDefine.inStorage + "'";
                }

                #region 物料编码
                string whereStartMaterialId = "", whereEndMaterialId = "";
                if (startMaterialDocNumber != null && startMaterialDocNumber != "")
                {
                    whereStartMaterialId = "id in (select batchId from AscmDeliveryOrderMain where id in(select mainId from AscmDeliveryOrderDetail where materialId in(select id from AscmMaterialItem where docNumber='" + startMaterialDocNumber.Trim() + "')))";
                }
                if (endMaterialDocNumber != null && endMaterialDocNumber != "")
                {
                    if (startMaterialDocNumber != null && startMaterialDocNumber != "")
                    {
                        whereStartMaterialId = "id in (select batchId from AscmDeliveryOrderMain where id in(select mainId from AscmDeliveryOrderDetail where materialId  in(select id from AscmMaterialItem where docNumber>='" + startMaterialDocNumber.Trim() + "' and docNumber<='" + endMaterialDocNumber.Trim() + "')))";
                    }
                    else
                    {
                        whereEndMaterialId = "id in (select batchId from AscmDeliveryOrderMain where id in(select mainId from AscmDeliveryOrderDetail where materialId in(select id from AscmMaterialItem where docNumber<='" + endMaterialDocNumber.Trim() + "')))";
                    }
                }
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartMaterialId);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndMaterialId);
                #endregion

                #region 确认时间
                string whereStartConfirmDate = "", whereEndConfirmDate = "";
                DateTime dtStartConfirmDate, dtEndConfirmDate;
                if (!string.IsNullOrEmpty(startConfirmDate) && DateTime.TryParse(startConfirmDate, out dtStartConfirmDate))
                    whereStartConfirmDate = "id in(select batchId from AscmDeliveryOrderMain where id in (select mainId from AscmDeliveryOrderDetail where notifyDetailId in (select id from AscmDeliveryNotifyDetail where mainId in (select id from AscmDeliveryNotifyMain where confirmTime>='" + dtStartConfirmDate.ToString("yyyy-MM-dd 00:00:00") + "'))))";
                if (!string.IsNullOrEmpty(endConfirmDate) && DateTime.TryParse(endConfirmDate, out dtEndConfirmDate))
                    whereEndConfirmDate = "id in(select batchId from AscmDeliveryOrderMain where id in (select mainId from AscmDeliveryOrderDetail where notifyDetailId in (select id from AscmDeliveryNotifyDetail where mainId in (select id from AscmDeliveryNotifyMain where confirmTime<'" + dtEndConfirmDate.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'))))";

                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartConfirmDate);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndConfirmDate);
                #endregion

                #region 通知时间
                string whereStartNotifyDate = "", whereEndNotifyDate = "";
                DateTime dtStartNotifyDate, dtEndNotifyDate;
                if (!string.IsNullOrEmpty(startNotifyDate) && DateTime.TryParse(startNotifyDate, out dtStartNotifyDate))
                    whereStartNotifyDate = "id in(select batchId from AscmDeliveryOrderMain where id in (select mainId from AscmDeliveryOrderDetail where notifyDetailId in (select id from AscmDeliveryNotifyDetail where mainId in (select id from AscmDeliveryNotifyMain where releasedTime>='" + dtStartNotifyDate.ToString("yyyy-MM-dd 00:00:00") + "'))))";
                if (!string.IsNullOrEmpty(endNotifyDate) && DateTime.TryParse(endNotifyDate, out dtEndNotifyDate))
                    whereEndNotifyDate = "id in(select batchId from AscmDeliveryOrderMain where id in (select mainId from AscmDeliveryOrderDetail where notifyDetailId in (select id from AscmDeliveryNotifyDetail where mainId in (select id from AscmDeliveryNotifyMain where releasedTime<'" + dtEndNotifyDate.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'))))";

                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartNotifyDate);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndNotifyDate);
                #endregion

                #region 预约时间
                DateTime dtAppointmentStartTime, dtAppointmentEndTime;
                string _appointmentStartTime = appointmentStartTime;
                string _appointmentEndTime = appointmentEndTime;
                if (!string.IsNullOrEmpty(_appointmentEndTime) && DateTime.TryParse(_appointmentEndTime, out dtAppointmentEndTime))
                {
                    _appointmentEndTime = dtAppointmentEndTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00");
                }
                AscmDeliBatSumMain ascmDeliBatSumMain = null;
                if (supplierDeliveryBatSumId.HasValue)
                {
                    ascmDeliBatSumMain = AscmDeliBatSumMainService.GetInstance().Get(supplierDeliveryBatSumId.Value);
                    //ascmDeliBatSumMain.appointmentStartTime = "2013-11-20 09:00";
                    //ascmDeliBatSumMain.appointmentEndTime = "2013-11-20 10:00";
                    DateTime dtSumMainStartTime, dtSumMainEndTime;
                    DateTime dtTmp;
                    if (DateTime.TryParse(ascmDeliBatSumMain.appointmentStartTime, out dtSumMainStartTime) && DateTime.TryParse(ascmDeliBatSumMain.appointmentEndTime, out dtSumMainEndTime))
                    {
                        if (!string.IsNullOrEmpty(_appointmentStartTime) && DateTime.TryParse(_appointmentStartTime, out dtTmp))
                        {
                            if (dtTmp < dtSumMainStartTime)
                                _appointmentStartTime = dtSumMainStartTime.ToString("yyyy-MM-dd HH:mm");
                        }
                        if (!string.IsNullOrEmpty(_appointmentEndTime) && DateTime.TryParse(_appointmentEndTime, out dtTmp))
                        {
                            if (dtTmp > dtSumMainEndTime)
                                _appointmentEndTime = dtSumMainEndTime.ToString("yyyy-MM-dd HH:mm");
                        }
                    }
                    //2013.11.28对相同司机合单进行判断
                    List<AscmDeliBatSumMain> listAscmDeliBatSumMain = AscmDeliBatSumMainService.GetInstance().GetList("from AscmDeliBatSumMain where id<>" + ascmDeliBatSumMain.id + " and driverId=" + ascmDeliBatSumMain.driverId + " and status='" + AscmDeliBatSumMain.StatusDefine.unConfirm + "'");
                    foreach (AscmDeliBatSumMain ascmDeliBatSumMain_Other in listAscmDeliBatSumMain)
                    {
                        DateTime dtSumMainStartTime_Other, dtSumMainEndTime_Other;
                        if (DateTime.TryParse(ascmDeliBatSumMain_Other.appointmentStartTime, out dtSumMainStartTime_Other) && DateTime.TryParse(ascmDeliBatSumMain_Other.appointmentEndTime, out dtSumMainEndTime_Other))
                        {
                            if (!string.IsNullOrEmpty(_appointmentStartTime) && DateTime.TryParse(_appointmentStartTime, out dtTmp))
                            {
                                if (dtTmp < dtSumMainStartTime_Other)
                                    _appointmentStartTime = dtSumMainStartTime_Other.ToString("yyyy-MM-dd HH:mm");
                            }
                            if (!string.IsNullOrEmpty(_appointmentEndTime) && DateTime.TryParse(_appointmentEndTime, out dtTmp))
                            {
                                if (dtTmp > dtSumMainEndTime_Other)
                                    _appointmentEndTime = dtSumMainEndTime_Other.ToString("yyyy-MM-dd HH:mm");
                            }
                        }
                    }
                    //5)	最晚到货时间早于当前时间的批单,该批单总是可以勾选入合单
                    if (!string.IsNullOrEmpty(_appointmentEndTime) && DateTime.TryParse(_appointmentEndTime, out dtTmp))
                    {
                        if (dtTmp < DateTime.Now)
                        {
                            _appointmentStartTime = null;
                            _appointmentEndTime = null;
                        }
                    }
                }
                if (appointmentTimeFilter)
                {
                    string whereAppointment = "";
                    //if (!string.IsNullOrEmpty(_appointmentStartTime) && DateTime.TryParse(_appointmentStartTime, out dtAppointmentStartTime))
                    //    whereAppointment = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereAppointment, "appointmentStartTime>='" + dtAppointmentStartTime.ToString("yyyy-MM-dd HH:mm") + "'");
                    //if (!string.IsNullOrEmpty(_appointmentEndTime) && DateTime.TryParse(_appointmentEndTime, out dtAppointmentEndTime))
                    //    whereAppointment = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereAppointment, "appointmentEndTime<='" + dtAppointmentEndTime.ToString("yyyy-MM-dd HH:mm") + "'");
                    if (!string.IsNullOrEmpty(_appointmentStartTime) && DateTime.TryParse(_appointmentStartTime, out dtAppointmentStartTime) &&
                       !string.IsNullOrEmpty(_appointmentEndTime) && DateTime.TryParse(_appointmentEndTime, out dtAppointmentEndTime))
                    {
                        whereAppointment = "((appointmentEndTime between '" + dtAppointmentStartTime.ToString("yyyy-MM-dd HH:mm") + "' and '" + dtAppointmentEndTime.ToString("yyyy-MM-dd HH:mm") + "') or ";
                        whereAppointment += "(appointmentStartTime between '" + dtAppointmentStartTime.ToString("yyyy-MM-dd HH:mm") + "' and '" + dtAppointmentEndTime.ToString("yyyy-MM-dd HH:mm") + "' ) or ";
                        whereAppointment += "('" + dtAppointmentStartTime.ToString("yyyy-MM-dd HH:mm") + "' between appointmentStartTime and appointmentEndTime ) or ";
                        whereAppointment += "('" + dtAppointmentEndTime.ToString("yyyy-MM-dd HH:mm") + "' between appointmentStartTime and appointmentEndTime ))";
                    }
                    if (whereAppointment != "")
                    {
                        whereAppointment = "(" + whereAppointment + ") or appointmentStartTime=appointmentEndTime or appointmentEndTime<'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "'";
                        whereAppointment = "id in(select batchId from AscmDeliveryOrderMain where id in (select mainId from AscmDeliveryOrderDetail where notifyDetailId in (select id from AscmDeliveryNotifyDetail where mainId in (select id from AscmDeliveryNotifyMain where " + whereAppointment + "))))";
                        whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereAppointment);
                    }
                    //whereAscmStatus = " ascmStatus is null or ascmStatus<>'" + AscmDeliveryOrderBatch.AscmStatusDefine.inStorage + "'";
                    //whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, "ascmStatus<>'" + AscmDeliveryOrderBatch.AscmStatusDefine.inStorage + "'");
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, "ascmStatus is null or ascmStatus=''");
                }

                //whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereAppointmentEndTime);
                #endregion

                #region 已经完成批单不能显示
                if (isSupplierSelect.HasValue)
                {
                    //whereBatSumMain = " select * from AscmDeliBatSumMain where status in ('" + AscmDeliBatSumMain.StatusDefine.unConfirm + "','" + AscmDeliBatSumMain.StatusDefine.confirm + "')";
                    //whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereAscmStatus);
                }
                if (supplierDeliveryBatSumId.HasValue)
                {
                    if (string.IsNullOrEmpty(queryFilter))
                    {
                        //string whereBatSumMain = " id not in (select batchId from AscmDeliBatSumDetail where mainId in (select id from AscmDeliBatSumMain where driverId=" + ascmDeliBatSumMain.driverId + "))";
                        string whereBatSumMain = " id not in (select batchId from AscmDeliBatSumDetail)";
                        whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereBatSumMain);
                    }
                }
                #endregion

                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereSupplier);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereWarehouse);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartCreateTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndCreateTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStatus);
                //whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereBatSumMain);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereAscmStatus);

                List<AscmDeliveryOrderBatch> list = AscmDeliveryOrderBatchService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                if (list != null)
                {
                    AscmDeliveryOrderBatchService.GetInstance().SetDeliveryNotifyMain(list);
                    if (!string.IsNullOrEmpty(sort) && sort.ToLower() == "appointmentEndTime".ToLower())
                    {
                        list = list.OrderBy(p => p.appointmentEndTime).ToList();
                    }
                    else if (!string.IsNullOrEmpty(sort) && sort.ToLower() == "warehouseId".ToLower())
                    {
                        list = list.OrderBy(p => p.warehouseId).ToList();
                    }

                    foreach (AscmDeliveryOrderBatch ascmDeliveryOrderBatch in list)
                    {
                        jsonDataGridResult.rows.Add(ascmDeliveryOrderBatch.GetOwner());
                    }
                    jsonDataGridResult.total = ynPage.GetRecordCount();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #33
0
        public ActionResult AllocateLogisticsTaskList(int? page, int? rows, string sort, string order, string queryWord, string queryStartDate, string queryEndDate, string queryStartJobDate, string queryEndJobDate, string queryStatus, string queryLine, string queryType, string queryWarehouse)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            List<AscmGetMaterialTask> list = null;

            string userName = string.Empty;
            if (User.Identity.IsAuthenticated)
            {
                userName = User.Identity.Name;
            }

            try
            {
                string userRole = AscmUserInfoService.GetInstance().GetUserRoleName(userName);
                string userLogisticsClass = AscmUserInfoService.GetInstance().GetUserLogisticsName(userName);

                string whereOther = "", whereQueryWord = "";
                if (userRole.IndexOf("物流班长") > -1 || userRole.IndexOf("物流组长") > -1)
                {
                    string whereOrQueryWord = "";
                    string ids_userId = AscmAllocateRuleService.GetInstance().GetLogisticsRankerName(userLogisticsClass, userName);
                    if (!string.IsNullOrEmpty(ids_userId))
                        whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids_userId, "rankerId");
                    whereOrQueryWord = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereOrQueryWord, whereQueryWord);

                    whereQueryWord = "rankerId is null";
                    whereOrQueryWord = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereOrQueryWord, whereQueryWord);

                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereOrQueryWord);
                }
                else if (userRole.IndexOf("排产员") > -1)
                {
                    whereQueryWord = "rankerId = '" + userName + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }
                else if (userRole.IndexOf("领料员") > -1)
                {
                    whereQueryWord = "workerId = '" + userName + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                if (string.IsNullOrEmpty(queryStartDate) && string.IsNullOrEmpty(queryEndDate) && string.IsNullOrEmpty(queryStartJobDate) && string.IsNullOrEmpty(queryEndJobDate))
                    throw new Exception("请选择生成日期或作业日期");

                if (!string.IsNullOrEmpty(queryStartDate) && !string.IsNullOrEmpty(queryEndDate))
                {
                    queryStartDate = queryStartDate + " 00:00:00";
                    queryEndDate = queryEndDate + " 23:59:59";
                    whereQueryWord = "createTime >= '" + queryStartDate + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                    whereQueryWord = "createTime <= '" + queryEndDate + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }
                else if (!string.IsNullOrEmpty(queryStartDate) && string.IsNullOrEmpty(queryEndDate))
                {
                    whereQueryWord = "createTime like '" + queryStartDate + "%'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }
                else if (string.IsNullOrEmpty(queryStartDate) && !string.IsNullOrEmpty(queryEndDate))
                {
                    whereQueryWord = "createTime like '" + queryEndDate + "%'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryStartJobDate) && !string.IsNullOrEmpty(queryEndJobDate))
                {
                    queryStartJobDate = queryStartJobDate + " 00:00:00";
                    queryEndJobDate = queryEndJobDate + " 23:59:59";
                    whereQueryWord = "dateReleased >= '" + queryStartJobDate + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                    whereQueryWord = "dateReleased <= '" + queryEndJobDate + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }
                else if (!string.IsNullOrEmpty(queryStartJobDate) && string.IsNullOrEmpty(queryEndJobDate))
                {
                    whereQueryWord = "dateReleased like '" + queryStartJobDate + "%'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }
                else if (string.IsNullOrEmpty(queryStartJobDate) && !string.IsNullOrEmpty(queryEndJobDate))
                {
                    whereQueryWord = "dateReleased like '" + queryEndJobDate + "%'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryStatus))
                {
                    whereQueryWord = "status = '" + queryStatus + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryLine))
                {
                    whereQueryWord = "productline like '" + queryLine.Trim() + "%'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryType))
                {
                    whereQueryWord = "IdentificationId =" + queryType;
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryWarehouse))
                {
                    whereQueryWord = "warehouserId = '" + queryWarehouse + "'";
                    whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord);
                }

                list = AscmGetMaterialTaskService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                AscmGetMaterialTaskService.GetInstance().SetRanker(list);
                AscmGetMaterialTaskService.GetInstance().SetWorker(list);
                AscmGetMaterialTaskService.GetInstance().SetWarehousePlace(list);
                AscmGetMaterialTaskService.GetInstance().SumQuantity(list);
                list = list.OrderBy(e => e.statusInt).ToList<AscmGetMaterialTask>();
                if (list != null && list.Count > 0)
                {
                    foreach (AscmGetMaterialTask ascmGetMaterialTask in list)
                    {
                        jsonDataGridResult.rows.Add(ascmGetMaterialTask);
                    }
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
                jsonDataGridResult.result = true;
            }
            catch (Exception ex)
            {
                jsonDataGridResult.result = false;
                jsonDataGridResult.message = ex.Message;
            }

            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #34
0
        public ActionResult DeliveryOrderMainList(int? page, int? rows, string sort, string order, string queryWord,
            string supplier, string warehouse, string startDeliveryTime, string endDeliveryTime, string status)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmDeliveryOrderMain> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "", whereSupplier = "", whereWarehouse="";
                string whereStartDeliveryTime = "", whereEndDeliveryTime = "", whereStatus = "";

                if (!string.IsNullOrEmpty(supplier))
                    whereSupplier = "supplierId=" + supplier;
                if (!string.IsNullOrEmpty(warehouse))
                    whereWarehouse = "warehouseId = '" + warehouse + "'";
                if (!string.IsNullOrEmpty(status))
                    whereStatus = "status = '" + status + "'";

                DateTime dtStartDeliveryTime, dtEndDeliveryTime;
                if (!string.IsNullOrEmpty(startDeliveryTime) && DateTime.TryParse(startDeliveryTime, out dtStartDeliveryTime))
                    whereStartDeliveryTime = "deliveryTime>='" + dtStartDeliveryTime.ToString("yyyy-MM-dd 00:00:00") + "'";
                if (!string.IsNullOrEmpty(endDeliveryTime) && DateTime.TryParse(endDeliveryTime, out dtEndDeliveryTime))
                    whereEndDeliveryTime = "deliveryTime<'" + dtEndDeliveryTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'";

                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereSupplier);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereWarehouse);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartDeliveryTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndDeliveryTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStatus);
                //whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereMaterialItem);

                list = AscmDeliveryOrderMainService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                foreach (AscmDeliveryOrderMain ascmDeliveryOrderMain in list)
                {
                    jsonDataGridResult.rows.Add(ascmDeliveryOrderMain.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #35
0
        public ActionResult MaterialAscxList(int? page, int? rows, string sort, string order, string q, string subInventory)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmMaterialItem> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "";
            //                if (!string.IsNullOrEmpty(subInventory))
            //                {
            //                    whereOther = string.Format(@" id in
            //						(select a.pk.materialId from AscmLocationMaterialLink a
            //							inner join AscmWarelocation b on b.id = a.pk.warelocationId and b.warehouseId='{0}') ", subInventory);
            //                }

                list = AscmMaterialItemService.GetInstance().GetList(ynPage, "", "", q, whereOther);
                foreach (AscmMaterialItem ascmMaterialItem in list)
                {
                    jsonDataGridResult.rows.Add(ascmMaterialItem.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #36
0
        public ActionResult MaterialMonitorList(int? page, int? rows, string sort, string order, string queryWord,
            int? supplierId, string warehouse, string startCreateTime, string endCreateTime, string status, int? employeeBuyer)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmDeliveryOrderBatch> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "", whereSupplier = "", whereWarehouse = "", whereEmployeeBuyer = "";
                string whereStartCreateTime = "", whereEndCreateTime = "", whereStatus = "";

                if (supplierId.HasValue)
                    whereSupplier = "supplierId=" + supplierId.Value;
                if (!string.IsNullOrEmpty(warehouse))
                    whereWarehouse = "warehouseId = '" + warehouse + "'";
                //if (!string.IsNullOrEmpty(status))
                whereStatus = "status = '" + MideaAscm.Dal.FromErp.Entities.AscmDeliveryOrderMain.StatusDefine.open + "'";

                DateTime dtStartCreateTime, dtEndCreateTime;
                if (!string.IsNullOrEmpty(startCreateTime) && DateTime.TryParse(startCreateTime, out dtStartCreateTime))
                    whereStartCreateTime = "createTime>='" + dtStartCreateTime.ToString("yyyy-MM-dd 00:00:00") + "'";
                if (!string.IsNullOrEmpty(endCreateTime) && DateTime.TryParse(endCreateTime, out dtEndCreateTime))
                    whereEndCreateTime = "createTime<'" + dtEndCreateTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'";

                if (employeeBuyer.HasValue)
                    whereEmployeeBuyer = "id in(select batchId from AscmDeliveryOrderMain where id in(select mainId from AscmDeliveryOrderDetail where materialId in(select id from AscmMaterialItem where buyerId=" + employeeBuyer + ")))";

                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereSupplier);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereWarehouse);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartCreateTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndCreateTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStatus);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEmployeeBuyer);

                list = AscmDeliveryOrderBatchService.GetInstance().GetMonitorList(ynPage, "", "", queryWord, whereOther);
                if (list != null)
                {
                    foreach (AscmDeliveryOrderBatch ascmDeliveryOrderBatch in list)
                    {
                        jsonDataGridResult.rows.Add(ascmDeliveryOrderBatch.GetOwner());
                    }
                    jsonDataGridResult.total = ynPage.GetRecordCount();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #37
0
        public ActionResult MaterialList(int? page, int? rows, string sort, string order, string queryWord, string categoryCode)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "", whereCategoryCode = "";
                //根据物料大类筛选,‘0000’为通用
                if (categoryCode != null && categoryCode != "" && categoryCode != "0000")
                    whereCategoryCode = "substr(docNumber,1,4)='" + categoryCode + "'";
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereCategoryCode);

                List<AscmMaterialItem> list = AscmMaterialItemService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                foreach (AscmMaterialItem ascmMaterialItem in list)
                {
                    jsonDataGridResult.rows.Add(ascmMaterialItem.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #38
0
        public ActionResult SupplierDeliveryNotifyMainList(int? page, int? rows, string sort, string order, string queryWord,
            string startReleasedTime, string endReleasedTime, string startNeedTime, string endNeedTime, string status, string employeeBuyer)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            List<AscmDeliveryNotifyMain> list = null;
            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                    throw new Exception("用户错误!");
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                if (ascmUserInfo.extExpandType != "erp")
                    throw new Exception("供应商用户错误!");
                AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                if (ascmUserInfo.ascmSupplier == null)
                    throw new Exception("供应商用户错误!");

                string whereOther = "", whereSupplier = "", whereStartReleaseTime = "", whereEndReleaseTime = "";
                string whereStartNeedTime = "", whereEndNeedTime = "", whereStatus = "", whereEmployeeBuyer = "";
                //if (!string.IsNullOrEmpty(supplier))
                whereSupplier = "supplierId=" + ascmUserInfo.ascmSupplier.id;
                if (!string.IsNullOrEmpty(status))
                {
                    whereStatus = "status = '" + status + "'";
                }
                else
                {
                    foreach (string s1 in MideaAscm.Dal.FromErp.Entities.AscmDeliveryNotifyMain.StatusDefine.GetSupplierList())
                    {
                        if (whereStatus != "")
                            whereStatus += ",";
                        whereStatus += "'" + s1 + "'";
                    }
                    if (whereStatus != "")
                        whereStatus = " status in (" + whereStatus + ")";
                }

                if (!string.IsNullOrEmpty(employeeBuyer))
                {
                    whereEmployeeBuyer = "materialId in (select id from AscmMaterialItem where buyerId=" + employeeBuyer + ")";
                }

                DateTime dtStartReleasedTime, dtEndReleasedTime;
                if (!string.IsNullOrEmpty(startReleasedTime) && DateTime.TryParse(startReleasedTime, out dtStartReleasedTime))
                    whereStartReleaseTime = "releasedTime>='" + dtStartReleasedTime.ToString("yyyy-MM-dd 00:00:00") + "'";
                if (!string.IsNullOrEmpty(endReleasedTime) && DateTime.TryParse(endReleasedTime, out dtEndReleasedTime))
                    whereEndReleaseTime = "releasedTime<'" + dtEndReleasedTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'";

                DateTime dtStartNeedTime, dtEndNeedTime;
                if (!string.IsNullOrEmpty(startNeedTime) && DateTime.TryParse(startNeedTime, out dtStartNeedTime))
                    whereStartNeedTime = "needTime>='" + dtStartNeedTime.ToString("yyyy-MM-dd 00:00:00") + "'";
                if (!string.IsNullOrEmpty(endReleasedTime) && DateTime.TryParse(endNeedTime, out dtEndNeedTime))
                    whereEndNeedTime = "needTime<'" + dtEndNeedTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'";

                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereSupplier);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartReleaseTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndReleaseTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartNeedTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndNeedTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStatus);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEmployeeBuyer);

                list = AscmDeliveryNotifyMainService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                foreach (AscmDeliveryNotifyMain ascmDeliveryNotifyMain in list)
                {
                    jsonDataGridResult.rows.Add(ascmDeliveryNotifyMain.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                //throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #39
0
        public ActionResult MaterialQueryList(int? page, int? rows, string sort, string order, string queryWord, string startInventoryItemId, string endInventoryItemId)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "";

                #region 物料编码
                string whereStartInventoryItemId = "", whereEndInventoryItemId = "";
                if (startInventoryItemId != null && startInventoryItemId != "")
                {
                    whereStartInventoryItemId = " docNumber='" + startInventoryItemId.Trim() + "')";
                }
                if (endInventoryItemId != null && endInventoryItemId != "")
                {
                    if (startInventoryItemId != null && startInventoryItemId != "")
                    {
                        whereStartInventoryItemId = " docNumber>='" + startInventoryItemId.Trim() + "' and docNumber<='" + endInventoryItemId.Trim() + "')";
                    }
                    else
                    {
                        whereEndInventoryItemId = " docNumber<='" + endInventoryItemId.Trim() + "')";
                    }
                }
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartInventoryItemId);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndInventoryItemId);
                #endregion

                List<AscmMaterialItem> list = AscmMaterialItemService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                foreach (AscmMaterialItem ascmMaterialItem in list)
                {
                    jsonDataGridResult.rows.Add(ascmMaterialItem.GetOwner());
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Example #40
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 #41
0
        public ActionResult ReadingHeadLogList(int? page, int? rows, string sort, string order, string queryWord, int? readingHeadId, string queryStartTime, string queryEndTime)
        {
            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
            ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows;
            ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;

            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            try
            {
                string whereOther = "", whereReadingHead = "";
                string whereStartCreateTime = "", whereEndCreateTime = "";
                if (readingHeadId.HasValue)
                    whereReadingHead = "readingHeadId=" + readingHeadId.Value;
                DateTime dtStartCreateTime, dtEndCreateTime;
                if (!string.IsNullOrEmpty(queryStartTime) && DateTime.TryParse(queryStartTime, out dtStartCreateTime))
                    whereStartCreateTime = "createTime>='" + dtStartCreateTime.ToString("yyyy-MM-dd 00:00:00") + "'";
                if (!string.IsNullOrEmpty(queryEndTime) && DateTime.TryParse(queryEndTime, out dtEndCreateTime))
                    whereEndCreateTime = "createTime<'" + dtEndCreateTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'";

                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereReadingHead);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartCreateTime);
                whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndCreateTime);

                List<AscmReadingHeadLog> list = AscmReadingHeadLogService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther);
                if (list != null)
                {
                    foreach (AscmReadingHeadLog ascmReadingHeadLog in list)
                    {
                        jsonDataGridResult.rows.Add(ascmReadingHeadLog);
                    }
                }
                jsonDataGridResult.total = ynPage.GetRecordCount();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }