public void SetWorker(List <AscmForklift> list, bool isSetLogisticsClassName = true) { if (list != null && list.Count > 0) { string ids = string.Empty; foreach (AscmForklift ascmForklift in list) { if (!string.IsNullOrEmpty(ids) && !string.IsNullOrEmpty(ascmForklift.workerId)) { ids += ","; } if (!string.IsNullOrEmpty(ascmForklift.workerId)) { ids += "'" + ascmForklift.workerId + "'"; } } string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "userId"); if (!string.IsNullOrEmpty(where)) { string sql = "from AscmUserInfo where " + where; IList <AscmUserInfo> ilistAscmUserInfo = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmUserInfo>(sql); if (ilistAscmUserInfo != null && ilistAscmUserInfo.Count > 0) { List <AscmUserInfo> listAscmUserInfo = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmUserInfo>(ilistAscmUserInfo); if (isSetLogisticsClassName) { AscmUserInfoService.GetInstance().SetUserLogisticsClass(listAscmUserInfo); } foreach (AscmForklift ascmForklift in list) { if (!string.IsNullOrEmpty(ascmForklift.workerId)) { ascmForklift.ascmUserInfo = listAscmUserInfo.Find(e => e.userId == ascmForklift.workerId); } if (isSetLogisticsClassName && ascmForklift.ascmUserInfo != null) { ascmForklift.logisticsClassName = ascmForklift.ascmUserInfo.logisticsClassName; } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //提取数据 string queryWord = ""; string whereOther = "", whereMain = ""; string whereSupplier = "", whereWarehouse = "", whereMaterialItem = ""; string whereStartDeliveryTime = "", whereEndDeliveryTime = "", whereStatus = "", whereWipEntity = ""; 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("供应商用户错误!"); } if (Request.QueryString["queryWord"] != null && Request.QueryString["queryWord"].ToString().Trim() != "" && Request.QueryString["queryWord"].ToString().Trim() != "null") { queryWord = Request.QueryString["queryWord"].ToString(); } if (Request.QueryString["materialItem"] != null && Request.QueryString["materialItem"].ToString().Trim() != "" && Request.QueryString["materialItem"].ToString().Trim() != "null") { whereMaterialItem = "materialId = " + Request.QueryString["materialItem"].ToString(); } whereSupplier = "supplierId = " + ascmUserInfo.ascmSupplier.id + ""; if (Request.QueryString["warehouse"] != null && Request.QueryString["warehouse"].ToString().Trim() != "" && Request.QueryString["warehouse"].ToString().Trim() != "null") { whereWarehouse = "warehouseId = '" + Request.QueryString["warehouse"].ToString() + "'"; } if (Request.QueryString["status"] != null && Request.QueryString["status"].ToString().Trim() != "" && Request.QueryString["status"].ToString().Trim() != "null") { whereStatus = "status = '" + Request.QueryString["status"].ToString() + "'"; } DateTime dtStartDeliveryTime, dtEndDeliveryTime; if (Request.QueryString["startDeliveryTime"] != null && Request.QueryString["startDeliveryTime"].ToString().Trim() != "" && Request.QueryString["startDeliveryTime"].ToString().Trim() != "null" && DateTime.TryParse(Request.QueryString["startDeliveryTime"].ToString().Trim(), out dtStartDeliveryTime)) { whereStartDeliveryTime = "deliveryTime>='" + dtStartDeliveryTime.ToString("yyyy-MM-dd 00:00:00") + "'"; } if (Request.QueryString["endCreateTime"] != null && Request.QueryString["endCreateTime"].ToString().Trim() != "" && Request.QueryString["endCreateTime"].ToString().Trim() != "null" && DateTime.TryParse(Request.QueryString["endCreateTime"].ToString().Trim(), out dtEndDeliveryTime)) { whereEndDeliveryTime = "deliveryTime<'" + dtEndDeliveryTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'"; } if (Request.QueryString["wipEntityId"] != null && Request.QueryString["wipEntityId"].ToString().Trim() != "" && Request.QueryString["wipEntityId"].ToString().Trim() != "null") { whereStatus = "wipEntityId = " + Request.QueryString["wipEntityId"]; } whereMain = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereMain, whereSupplier); whereMain = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereMain, whereWarehouse); whereMain = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereMain, whereStatus); whereMain = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereMain, whereStartDeliveryTime); whereMain = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereMain, whereEndDeliveryTime); whereMain = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereMain, whereWipEntity); whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereMaterialItem); if (!string.IsNullOrEmpty(whereMain)) { whereMain = "mainId in (select id from AscmDeliveryOrderMain where " + whereMain + ")"; } whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereMain); YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage(); ynPage.SetPageSize(500); //pageRows; ynPage.SetCurrentPage(1); //pageNumber; List <AscmDeliveryOrderDetail> listAscmDeliveryOrderDetail = AscmDeliveryOrderDetailService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther); ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierDeliveryOrderDetailReport.rdlc"); ReportDataSource rds1 = new ReportDataSource(); rds1.Name = "DataSet1"; rds1.Value = listAscmDeliveryOrderDetail; ReportViewer1.LocalReport.DataSources.Clear();//好像不clear也可以 ReportViewer1.LocalReport.DataSources.Add(rds1); //string companpyTitle = YnParameterService.GetInstance().GetValue(MyParameter.companpyTitle); string companpyTitle = "美的中央空调"; string title = companpyTitle + "送货单明细统计报表"; ReportParameter[] reportParameters = new ReportParameter[] { new ReportParameter("ReportParameter_Title", title), new ReportParameter("ReportParameter_ReportTime", "打印时间:" + DateTime.Now.ToString("yyyy-MM-dd")), new ReportParameter("ReportParameter_SupplierName", "供应商:" + ascmUserInfo.ascmSupplier.name) }; ReportViewer1.LocalReport.SetParameters(reportParameters); ReportViewer1.LocalReport.Refresh(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData(); if (ynUser == null) { throw new Exception("用户错误!"); } AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId); string supplierName = ""; if (ascmUserInfo.extExpandType == "erp") { AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo); if (ascmUserInfo.ascmSupplier != null) { supplierName = ascmUserInfo.ascmSupplier.name; } } //if (ascmUserInfo.extExpandType != "erp") // throw new Exception("供应商用户错误!"); //AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo); //if (ascmUserInfo.ascmSupplier == null) // throw new Exception("供应商用户错误!"); //提取数据 int id = 0; List <AscmMaterialItem> list = new List <AscmMaterialItem>(); if (!string.IsNullOrEmpty(Request.QueryString["id"]) && int.TryParse(Request.QueryString["id"], out id)) { AscmMaterialItem ascmMaterialItem = AscmMaterialItemService.GetInstance().Get(id); if (ascmMaterialItem != null) { //条码 System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); if (ascmMaterialItem.docNumber != null) { #region Code128 MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128(); barCode128.TitleFont = new System.Drawing.Font("宋体", 10); barCode128.HeightImage = 50; System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmMaterialItem.docNumber, ascmMaterialItem.docNumber, Code.BarCode128.Encode.Code128B); bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif); bitmap.Dispose(); #endregion } ascmMaterialItem.materialBarcode = memoryStream.ToArray(); list.Add(ascmMaterialItem); } } ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("MaterialReport.rdlc"); ReportDataSource rds1 = new ReportDataSource(); rds1.Name = "DataSet1"; rds1.Value = list; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds1); string companpyTitle = "美的中央空调"; string title = companpyTitle + "供应商送货物料条码"; ReportParameter[] reportParameters = new ReportParameter[] { new ReportParameter("ReportParameter_SupplierName", supplierName) }; ReportViewer1.LocalReport.SetParameters(reportParameters); ReportViewer1.LocalReport.Refresh(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData(); if (ynUser == null) { throw new Exception("用户错误!"); } AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId); string supplierName = ""; if (ascmUserInfo.extExpandType == "erp") { AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo); if (ascmUserInfo.ascmSupplier != null) { supplierName = ascmUserInfo.ascmSupplier.name; } } //提取数据 List <AscmMaterialItem> sumList = new List <AscmMaterialItem>(); //最后一个装箱 AscmMaterialItem lastDetail = new AscmMaterialItem(); string ids = Request.QueryString["ids"]; string unitQuantitys = Request.QueryString["unitQuantitys"]; string totalNumbers = Request.QueryString["totalNumbers"]; bool isUnitPrint = Boolean.Parse(Request.QueryString["isUnitPrint"]); string[] listId = ids.Split(','); string[] listUnitQuantity = unitQuantitys.Split(','); string[] listTotalNumber = totalNumbers.Split(','); List <AscmMaterialItem> list = new List <AscmMaterialItem>(); for (int i = 0; i < listId.Count(); i++) { AscmMaterialItem ascmMaterialItem = AscmMaterialItemService.GetInstance().Get(Int32.Parse(listId[i])); AscmContainerUnitQuantity ascmContainerUnitQuantity = AscmContainerUnitQuantityService.GetInstance().Get(Int32.Parse(listUnitQuantity[i])); ascmMaterialItem.container = ascmContainerUnitQuantity.container; ascmMaterialItem.unitQuantity = ascmContainerUnitQuantity.unitQuantity; ascmMaterialItem.containerUnitQuantityId = ascmContainerUnitQuantity.id; ascmMaterialItem.totalNumber = Decimal.Parse(listTotalNumber[i]); list.Add(ascmMaterialItem); } if (!string.IsNullOrEmpty(ids)) { if (list != null && list.Count() > 0) { foreach (AscmMaterialItem ascmMaterialItem in list) { //条码 System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); if (ascmMaterialItem.docNumber != null) { #region Code128 MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128(); barCode128.TitleFont = new System.Drawing.Font("宋体", 10); barCode128.HeightImage = 50; System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmMaterialItem.docNumber, ascmMaterialItem.docNumber, Code.BarCode128.Encode.Code128B); bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif); bitmap.Dispose(); #endregion } ascmMaterialItem.materialBarcode = memoryStream.ToArray(); //如果是总数打印,单元数=总数 if (!isUnitPrint) { ascmMaterialItem.unitQuantity = ascmMaterialItem.totalNumber; } decimal totalNumber = ascmMaterialItem.totalNumber; //总数量 decimal unitQuantity = ascmMaterialItem.unitQuantity; //单元数 //decimal unitQuantity = 10; decimal count = decimal.Truncate(totalNumber / unitQuantity); //箱数量>=0 decimal rest = totalNumber % unitQuantity; //剩余数量>=0 //设置装箱数 2015.3.26 //总数 < 单元数 ,仅有一个箱子,总数 = 剩余数量 if (count == 0) { count = 1; } else { //有剩余数量,多出一箱 if (rest != 0) { count = count + 1; } } for (int i = 0; i < count; i++) { //最后一个为剩余数量 if (i == count - 1 && rest != 0) { lastDetail.materialBarcode = ascmMaterialItem.materialBarcode; lastDetail.docNumber = ascmMaterialItem.docNumber; lastDetail.description = ascmMaterialItem.description; lastDetail.unit = ascmMaterialItem.unit; lastDetail.unitQuantity = rest; sumList.Add(lastDetail); } else { sumList.Add(ascmMaterialItem); } } } } } ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierMaterialReport.rdlc"); ReportDataSource rds1 = new ReportDataSource(); rds1.Name = "DataSet1"; rds1.Value = sumList; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds1); string companpyTitle = "美的中央空调"; string title = companpyTitle + "供应商送货物料条码"; ReportParameter[] reportParameters = new ReportParameter[] { new ReportParameter("ReportParameter_SupplierName", supplierName) }; ReportViewer1.LocalReport.SetParameters(reportParameters); ReportViewer1.LocalReport.Refresh(); } }
/*[AcceptVerbs(HttpVerbs.Post)]*/ public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { try { YnUser ynUser = AscmUserInfoService.GetInstance().TryGet(model.UserName); /* * YnUser ynUser = YnUserService.GetInstance().Get(model.UserName); * if (ynUser == null) * { * //throw new Exception("用户不存在"); * //判断是否erp用户 * ynUser = YnUserService.GetInstance().Get("erp_"+model.UserName); * if (ynUser == null) * { * //判断是否mes用户 * } * } */ if (ynUser == null) { throw new Exception("用户不存在"); } if (!string.IsNullOrEmpty(ynUser.extExpandType)) { if (ynUser.extExpandType.Trim() == "erp") { //供应商登录显示供应商名称 AscmUserInfo ascmUserInfo = (AscmUserInfo)ynUser; AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo); if (ascmUserInfo.ascmSupplier != null) { ascmUserInfo.userName1 = ascmUserInfo.ascmSupplier.name; } if (!MembershipService.ValidateUser(ynUser.userId, model.Password)) { if (Request.IsAjaxRequest()) { return(Content("用户密码错误!")); } //ModelState.AddModelError("", "提供的用户名或密码不正确。"); throw new Exception("提供的用户名或密码不正确。"); } } else if (ynUser.extExpandType.Trim() == "mes") { cn.com.midea.mespda.TransferService service = new cn.com.midea.mespda.TransferService(); cn.com.midea.mespda.OutputWebMessage message = service.UserLogin(model.UserName, model.Password); if (!message.IsSuccess) { throw new Exception(message.ErrorMessage); } } } else { if (!MembershipService.ValidateUser(ynUser.userId, model.Password)) { if (Request.IsAjaxRequest()) { return(Content("用户密码错误!")); } //ModelState.AddModelError("", "提供的用户名或密码不正确。"); throw new Exception("提供的用户名或密码不正确。"); } } //HttpCookie cookie = Request.Cookies.Get("userName"); //Response.Cookies["userName"].Value = model.UserName; string _userName = HttpUtility.UrlEncode(model.UserName); Response.Cookies["userName"].Value = _userName; Response.Cookies["userName"].Expires = DateTime.MaxValue; int days = 0; int iExpires = 0; if (days > 0) { iExpires = 60 * 60 * 24 * days;//保存天数 } //YnUser ynUser = YnUserService.GetInstance().Get(model.UserName); FormsAuthenticationService.GetInstance().SignIn(ynUser.userId, 0, ynUser, true); PageInit(null); //this.ynSite.systemUser = true;//是系统用户 //this.ynSite.siteAdmin = YnUserService.GetInstance().IsSuperAdministrator(ynUser.userId) || YnUserService.GetInstance().IsAdministrator(ynUser.userId); //this.ynSite.userName = ynUser.userName;//是系统用户 if (Request.IsAjaxRequest()) { return(JavaScript("document.location.href='';")); } if (!String.IsNullOrEmpty(returnUrl)) { return(Redirect(returnUrl)); } else { //return RedirectToAction("Index", "Home"); return(RedirectToAction("YnFrame", "YnPublic")); } } catch (Exception ex) { //throw ex; ModelState.AddModelError("", ex.Message); } } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return(View(model)); }
public List <AscmDiscreteJobs> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string queryStartTime, string queryEndTime, string queryType, string queryRanker, string userName) { List <AscmDiscreteJobs> list = null; try { string sort = "", whereQueryWord = "", where = "", where_Param = ""; string userRole = AscmUserInfoService.GetInstance().GetUserRoleName(userName); string userLogisticsName = AscmUserInfoService.GetInstance().GetUserLogisticsName(userName, userRole); string hql = "from AscmDiscreteJobs"; string hql_ParamZ = "select zRankerName from AscmAllocateRule"; string hql_ParamD = "select dRankerName from AscmAllocateRule"; string sql = "select * from ASCM_DISCRETE_JOBS"; if (userRole == "领料员") { whereQueryWord = "workerName = '" + userName + "'"; where_Param = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where_Param, whereQueryWord); } else if (userRole == "总装排产员" || userRole == "电装排产员") { whereQueryWord = "workerId = '" + userName + "'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } else { if (!string.IsNullOrEmpty(userLogisticsName)) { IList <AscmLogisticsClassInfo> ilistAscmLogisticsClassInfo = AscmLogisticsClassInfoService.GetInstance().GetList("from AscmLogisticsClassInfo where logisticsClass in (" + userLogisticsName + ")", false, false); string ids = string.Empty; if (ilistAscmLogisticsClassInfo != null && ilistAscmLogisticsClassInfo.Count > 0) { foreach (AscmLogisticsClassInfo ascmlogisticsClassInfo in ilistAscmLogisticsClassInfo) { if (!string.IsNullOrEmpty(ids)) { ids += ","; } ids += ascmlogisticsClassInfo.id; } } whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "logisticsClassId"); where_Param = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where_Param, whereQueryWord); } } if (!string.IsNullOrEmpty(where_Param)) { string newCondition = string.Empty; hql_ParamZ += " where " + where_Param; hql_ParamZ = "workerId in (" + hql_ParamZ + ")"; newCondition = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(newCondition, hql_ParamZ); hql_ParamD += " where " + where_Param; hql_ParamD = "workerId in (" + hql_ParamD + ")"; newCondition = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(newCondition, hql_ParamD); where += "(" + newCondition + ")"; } if (!string.IsNullOrEmpty(queryType)) { whereQueryWord = "identificationId = " + queryType; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } if (!string.IsNullOrEmpty(queryStartTime) && !string.IsNullOrEmpty(queryEndTime)) { queryStartTime = queryStartTime + " 00:00:00"; queryEndTime = queryEndTime + " 23:59:59"; whereQueryWord = "createTime > '" + queryStartTime + "'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); whereQueryWord = "createTime <= '" + queryEndTime + "'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } else if (!string.IsNullOrEmpty(queryStartTime) && string.IsNullOrEmpty(queryEndTime)) { whereQueryWord = "createTime like '" + queryStartTime + "%'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } else if (string.IsNullOrEmpty(queryStartTime) && !string.IsNullOrEmpty(queryEndTime)) { whereQueryWord = "createTime like '" + queryEndTime + "%'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } if (!string.IsNullOrEmpty(queryRanker)) { whereQueryWord = "workerId = '" + queryRanker + "'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } if (!string.IsNullOrEmpty(where)) { hql += " where " + where; sql += " where " + where; } sql = sql.Replace("AscmAllocateRule", "ASCM_ALLOCATE_RULE"); object object1 = YnDaoHelper.GetInstance().nHibernateHelper.GetObjectBySQL("select count(*) from (" + sql + ")"); int count = 0; int.TryParse(object1.ToString(), out count); IList <AscmDiscreteJobs> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDiscreteJobs>(hql, count, ynPage); if (ilist != null && ilist.Count > 0) { list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmDiscreteJobs>(ilist); SetRanker(list); list = list.OrderBy(e => e.workerId).OrderBy(e => e.productLine).OrderBy(e => e.sequence).OrderBy(e => e.identificationId).OrderBy(e => e.id).ToList(); } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDiscreteJobs)", ex); throw ex; } return(list); }
//public List<AscmForklift> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string queryOtherWord) //{ // List<AscmForklift> list = null; // try // { // string sort = " order by id "; // if (!string.IsNullOrEmpty(sortName)) // { // sort = " order by " + sortName.Trim() + " "; // if (!string.IsNullOrEmpty(sortOrder)) // sort += sortOrder.Trim(); // } // string sql = "from AscmForklift"; // string where = "", whereQueryWord = ""; // if (!string.IsNullOrEmpty(queryWord)) // { // whereQueryWord = "forkliftType = '" + queryWord.Trim() + "'"; // where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); // } // if (!string.IsNullOrEmpty(queryOtherWord)) // { // string sSql = " from YnUser where userName like '" + queryOtherWord + "%'"; // IList<YnUser> ilistYnUser = YnFrame.Dal.YnDaoHelper.GetInstance().nHibernateHelper.Find<YnUser>(sSql); // if (ilistYnUser != null && ilistYnUser.Count > 0) // { // queryOtherWord = ""; // foreach (YnUser ynUser in ilistYnUser) // { // if (!string.IsNullOrEmpty(queryOtherWord)) // queryOtherWord += ","; // queryOtherWord += "'" + ynUser.userName + "'"; // } // } // whereQueryWord = "workerId in (" + queryOtherWord + ")"; // where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); // } // if (!string.IsNullOrEmpty(where)) // sql += " where " + where; // IList<AscmForklift> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmForklift>(sql, sql, ynPage); // if (ilist != null) // { // list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmForklift>(ilist); // SetWorker(list); // } // } // catch (Exception ex) // { // YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmForklift)",ex); // throw ex; // } // return list; //} public List <AscmForklift> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string whereOther, bool isSetWorker = true) { List <AscmForklift> list = null; try { string sort = " order by id "; if (!string.IsNullOrEmpty(sortName)) { sort = " order by " + sortName.Trim() + " "; if (!string.IsNullOrEmpty(sortOrder)) { sort += sortOrder.Trim(); } } string sql = "from AscmForklift"; string where = "", whereQueryWord = ""; if (!string.IsNullOrEmpty(queryWord)) { string whereOtherWord = ""; whereQueryWord = "userName like '" + queryWord + "%'"; List <AscmUserInfo> listAscmUserInfo = AscmUserInfoService.GetInstance().GetList(null, "", "", "", whereQueryWord); string ids = string.Empty; if (listAscmUserInfo != null && listAscmUserInfo.Count > 0) { foreach (AscmUserInfo ascmUserInfo in listAscmUserInfo) { if (!string.IsNullOrEmpty(ids)) { ids += ","; } ids += ascmUserInfo.userId; } whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "workerId"); whereOtherWord = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereOtherWord, whereQueryWord); } whereQueryWord = "forkliftNumber like '%" + queryWord + "%'"; whereOtherWord = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereOtherWord, whereQueryWord); whereQueryWord = "assetsId like '%" + queryWord + "%'"; whereOtherWord = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereOtherWord, whereQueryWord); where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOtherWord); } where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther); if (!string.IsNullOrEmpty(where)) { sql += " where " + where; } if (!string.IsNullOrEmpty(sort)) { sql += sort; } IList <AscmForklift> ilist = null; if (ynPage != null) { ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmForklift>(sql, sql, ynPage); } else { ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmForklift>(sql); } if (ilist != null && ilist.Count > 0) { list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmForklift>(ilist); if (isSetWorker) { SetWorker(list); } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmForklift)", ex); throw ex; } return(list); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { 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("供应商用户错误!"); } //提取数据 List <AscmDeliBatSumDetail> list = new List <AscmDeliBatSumDetail>(); string ids = Request.QueryString["ids"]; if (!string.IsNullOrEmpty(ids)) { YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage(); ynPage.SetPageSize(500); //pageRows; ynPage.SetCurrentPage(1); //pageNumber; list = AscmDeliBatSumDetailService.GetInstance().GetList("from AscmDeliBatSumDetail where id in(" + ids + ")"); AscmDeliBatSumDetailService.GetInstance().SetMaterial(list); AscmDeliBatSumDetailService.GetInstance().SetDeliveryOrderBatch(list); List <AscmDeliveryOrderBatch> listDeliveryOrderBatch = new List <AscmDeliveryOrderBatch>(); list.ForEach(P => listDeliveryOrderBatch.Add( new AscmDeliveryOrderBatch { id = P.batchId })); //获取货位分配 AscmDeliveryOrderBatchService.GetInstance().SetAssignWarelocation(listDeliveryOrderBatch); list.ForEach(P => P.assignWarelocation = listDeliveryOrderBatch.Find(T => T.id == P.batchId).assignWarelocation); //条码 foreach (AscmDeliBatSumDetail ascmDeliBatSumDetail in list) { System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); if (ascmDeliBatSumDetail.ascmMaterialItem != null && ascmDeliBatSumDetail.ascmMaterialItem.docNumber != null) { #region Code128 MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128(); barCode128.TitleFont = new Font("宋体", 10); barCode128.HeightImage = 50; Bitmap bitmap = barCode128.GetCodeImage(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, Code.BarCode128.Encode.Code128B); bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif); bitmap.Dispose(); #endregion #region Code39 //YnBaseClass2.Helper.BarCode39 barCode39 = new YnBaseClass2.Helper.BarCode39(); //barCode39.WidthCU = 10; //barCode39.WidthXI = 3; //System.Drawing.Bitmap bitmap = barCode39.CreateBarCode(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, 0, 0); ////生成图片 ////System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); //bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif); //bitmap.Dispose(); #endregion } ascmDeliBatSumDetail.materialBarcode = memoryStream.ToArray(); } } ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierDriverDeliveryBarCodeReport.rdlc"); ReportDataSource rds1 = new ReportDataSource(); rds1.Name = "DataSet1"; rds1.Value = list; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds1); string companpyTitle = "美的中央空调"; string title = companpyTitle + "供应商送货合单条码"; ReportParameter[] reportParameters = new ReportParameter[] { new ReportParameter("ReportParameter_SupplierName", ascmUserInfo.ascmSupplier.name) }; ReportViewer1.LocalReport.SetParameters(reportParameters); ReportViewer1.LocalReport.Refresh(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { 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("供应商用户错误!"); } //打印的数据 List <AscmDeliBatSumDetail> sumList = new List <AscmDeliBatSumDetail>(); //最后一个装箱 AscmDeliBatSumDetail lastDetail = new AscmDeliBatSumDetail(); string ids = Request.QueryString["ids"]; string unitIds = Request.QueryString["unitIds"]; string[] listId = ids.Split(','); string[] listUnitId = unitIds.Split(','); if (!string.IsNullOrEmpty(ids)) { List <AscmDeliBatSumDetail> list = new List <AscmDeliBatSumDetail>(); for (int i = 0; i < listId.Count(); i++) { AscmDeliBatSumDetail ascmDeliBatSumDetail = AscmDeliBatSumDetailService.GetInstance().Get(Int32.Parse(listId[i])); AscmContainerUnitQuantity ascmContainerUnitQuantity = AscmContainerUnitQuantityService.GetInstance().Get(Int32.Parse(listUnitId[i])); ascmDeliBatSumDetail.container = ascmContainerUnitQuantity.container; ascmDeliBatSumDetail.materialUnitQuantity = ascmContainerUnitQuantity.unitQuantity; ascmDeliBatSumDetail.containerUnitQuantityId = ascmContainerUnitQuantity.id; list.Add(ascmDeliBatSumDetail); } if (list != null) { AscmDeliBatSumDetailService.GetInstance().SetMaterial(list); AscmDeliBatSumDetailService.GetInstance().SetDeliveryOrderBatch(list); List <AscmDeliveryOrderBatch> listDeliveryOrderBatch = new List <AscmDeliveryOrderBatch>(); list.ForEach(P => listDeliveryOrderBatch.Add( new AscmDeliveryOrderBatch { id = P.batchId })); //获取货位分配 AscmDeliveryOrderBatchService.GetInstance().SetAssignWarelocation(listDeliveryOrderBatch); list.ForEach(P => P.assignWarelocation = listDeliveryOrderBatch.Find(T => T.id == P.batchId).assignWarelocation); foreach (AscmDeliBatSumDetail ascmDeliBatSumDetail in list) { //条码 System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); if (ascmDeliBatSumDetail.ascmMaterialItem.docNumber != null) { #region Code128 MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128(); barCode128.TitleFont = new System.Drawing.Font("宋体", 10); barCode128.HeightImage = 50; System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmDeliBatSumDetail.batchBarCode, ascmDeliBatSumDetail.batchBarCode, Code.BarCode128.Encode.Code128B); bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif); bitmap.Dispose(); #endregion #region Code39 //YnBaseClass2.Helper.BarCode39 barCode39 = new YnBaseClass2.Helper.BarCode39(); //barCode39.WidthCU = 10; //barCode39.WidthXI = 3; //System.Drawing.Bitmap bitmap = barCode39.CreateBarCode(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, 0, 0); ////生成图片 ////System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); //bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif); //bitmap.Dispose(); #endregion } ascmDeliBatSumDetail.materialBarcode = memoryStream.ToArray(); decimal totalNumber = ascmDeliBatSumDetail.totalNumber; //总数量 decimal unitQuantity = ascmDeliBatSumDetail.materialUnitQuantity; //单元数 //decimal unitQuantity = 10; decimal count = decimal.Truncate(totalNumber / unitQuantity); //箱数量>=0 decimal rest = totalNumber % unitQuantity; //剩余数量>=0 //设置装箱数 2015.3.26 //总数 < 单元数 ,仅有一个箱子,总数 = 剩余数量 if (count == 0) { count = 1; } else { //有剩余数量,多出一箱 if (rest != 0) { count = count + 1; } } for (int i = 0; i < count; i++) { //最后一个为剩余数量 if (i == count - 1 && rest != 0) { lastDetail.ascmDeliveryOrderBatch = ascmDeliBatSumDetail.ascmDeliveryOrderBatch; lastDetail.ascmMaterialItem = ascmDeliBatSumDetail.ascmMaterialItem; lastDetail.assignWarelocation = ascmDeliBatSumDetail.assignWarelocation; lastDetail.materialUnitQuantity = rest; sumList.Add(lastDetail); } else { sumList.Add(ascmDeliBatSumDetail); } } } } } ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierDriverDeliveryDetialBarCodeReport.rdlc"); ReportDataSource rds1 = new ReportDataSource(); rds1.Name = "DataSet1"; rds1.Value = sumList; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds1); string companpyTitle = "美的中央空调"; string title = companpyTitle + "供应商送货批单条码"; ReportParameter[] reportParameters = new ReportParameter[] { new ReportParameter("ReportParameter_SupplierName", ascmUserInfo.ascmSupplier.name) }; ReportViewer1.LocalReport.SetParameters(reportParameters); ReportViewer1.LocalReport.Refresh(); } }
/// <summary> /// 汇总物料@2014-4-22 /// </summary> /// <param name="ynPage"></param> /// <param name="userName"></param> /// <param name="queryStartTime"></param> /// <param name="queryEndTime"></param> /// <param name="queryUserName"></param> /// <returns></returns> public List <AscmWipRequirementOperations> GetSumList(YnPage ynPage, string userName, string queryStartTime, string queryEndTime, string queryUserName) { List <AscmWipRequirementOperations> list = null; try { string sql = "select new AscmWipRequirementOperations(inventoryItemId, sum(requiredQuantity), sum(quantityIssued), sum(getMaterialQuantity)) from AscmWipRequirementOperations where taskId in ({0}) group by inventoryItemId"; string sql_page = "select inventoryItemId, sum(requiredQuantity), sum(quantityIssued), sum(getMaterialQuantity) from ASCM_WIP_REQUIRE_OPERAT where taskId in ({0}) group by inventoryItemId"; string userRole = AscmUserInfoService.GetInstance().GetUserRoleName(userName); string userLogistisClass = AscmUserInfoService.GetInstance().GetUserLogisticsName(userName); string sqlParam = "select id from AscmGetMaterialTask"; string where = "", whereQueryWord = ""; if (string.IsNullOrEmpty(queryStartTime) && string.IsNullOrEmpty(queryEndTime)) { throw new Exception("汇总物料失败:请选择起止日期!"); } if (!string.IsNullOrEmpty(queryStartTime) && !string.IsNullOrEmpty(queryEndTime)) { queryStartTime = queryStartTime + " 00:00:00"; queryEndTime = queryEndTime + " 23:59:59"; whereQueryWord = "createTime >= '" + queryStartTime + "'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); whereQueryWord = "createTime <= '" + queryEndTime + "'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } else if (!string.IsNullOrEmpty(queryStartTime) && string.IsNullOrEmpty(queryEndTime)) { whereQueryWord = "createTime like '" + queryStartTime + "%'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } else if (string.IsNullOrEmpty(queryStartTime) && !string.IsNullOrEmpty(queryEndTime)) { whereQueryWord = "createTime like '" + queryEndTime + "%'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } if (!string.IsNullOrEmpty(userLogistisClass) && userRole == "领料员") { whereQueryWord = "workerId = '" + userName + "'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } else if (!string.IsNullOrEmpty(userLogistisClass) && (userRole.IndexOf("班长") > -1 || userRole.IndexOf("组长") > -1)) { whereQueryWord = "logisticsClass in (" + userLogistisClass + ")"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } if (!string.IsNullOrEmpty(where)) { sqlParam += " where " + where; } string hql = string.Format(sql, sqlParam); string sqlParam_pape = sqlParam.Replace("AscmGetMaterialTask", "ASCM_GETMATERIAL_TASK"); string Tsql = string.Format(sql_page, sqlParam_pape); object object1 = YnDaoHelper.GetInstance().nHibernateHelper.GetObjectBySQL("select count(*) from (" + Tsql + ")"); int count = 0; int.TryParse(object1.ToString(), out count); IList <AscmWipRequirementOperations> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWipRequirementOperations>(hql, count, ynPage); if (ilist != null && ilist.Count > 0) { list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWipRequirementOperations>(ilist); SetMaterial(list); } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("汇总失败(Sum AscmWipRequirementOperations)", ex); throw ex; } return(list); }