| | |
| | | public void pageQueryIn(Page<InoutNoticeIn> page, Map<String, Object> param) throws Exception { |
| | | |
| | | String hql = " from " + InoutNoticeIn.class.getName() |
| | | + " where companyId =:companyId"; |
| | | + " where companyId =:companyId and deptId =:deptId"; |
| | | |
| | | Map<String, Object> args = new HashMap<String, Object>(); |
| | | args.put("companyId", ContextUtil.getCompanyId()); |
| | | args.put("deptId", ContextUtil.subDeptId(null)); |
| | | |
| | | Object year = param.get("year"); |
| | | if (year == null) { |
| | | param.put("year", DateFormatUtils.format(new Date(), "yyyy")); |
| | | } |
| | | |
| | | String str = (String) param.get("deptId"); |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | hql += " and deptId =:deptId"; |
| | | args.put("deptId", str); |
| | | } |
| | | |
| | | str = (String) param.get("id"); |
| | | String str = (String) param.get("id"); |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | hql += " and id=:id"; |
| | | args.put("id", str); |
| | |
| | | |
| | | public String saveOrUpdateIn(InoutNoticeIn data) { |
| | | |
| | | //新增入库通知单时,需要进行唯一性判断。即保证单位、粮食品种、年份唯一,且不存在未完成状态的单子。 |
| | | if (Constant.YN_Y.equals(data.getTag())) { |
| | | data.setCompanyId(ContextUtil.getCompanyId()); |
| | | |
| | | NoticeParam param = new NoticeParam(); |
| | | param.setCompanyId(data.getCompanyId()); |
| | | param.setDeptId(data.getDeptId()); |
| | | param.setCustomerId(data.getCustomerId()); |
| | | param.setFoodVariety(data.getFoodVariety()); |
| | | param.setYear(data.getYear()); |
| | | //若有合同信息,添加合同信息 |
| | | if (StringUtils.isNotEmpty(data.getContractId())) { |
| | | param.setContractId(data.getContractId()); |
| | | } |
| | | //若有计划信息,添加计划信息 |
| | | if (StringUtils.isNotEmpty(data.getPlanId())) { |
| | | param.setPlanId(data.getPlanId()); |
| | | } |
| | | param.setCompleteStatus(InoutConstant.COMPLETE_STATUS_NONE); |
| | | Integer integer = inoutManagerService.queryNoticeIn(param); |
| | | if (integer > 0) { |
| | | return "新增的入库通知单已存在,不能再次新增,请核查!"; |
| | | } |
| | | } |
| | | //2023-09-02禁用,原因:同一个用户有多个合同,就导致有多个通知单 |
| | | // //新增入库通知单时,需要进行唯一性判断。即保证单位、粮食品种、年份唯一,且不存在未完成状态的单子。 |
| | | // if (Constant.YN_Y.equals(data.getTag())) { |
| | | // data.setCompanyId(ContextUtil.getCompanyId()); |
| | | // |
| | | // NoticeParam param = new NoticeParam(); |
| | | // param.setCompanyId(data.getCompanyId()); |
| | | // param.setDeptId(data.getDeptId()); |
| | | // param.setCustomerId(data.getCustomerId()); |
| | | // param.setFoodVariety(data.getFoodVariety()); |
| | | // param.setYear(data.getYear()); |
| | | // //若有合同信息,添加合同信息 |
| | | // if (StringUtils.isNotEmpty(data.getContractId())) { |
| | | // param.setContractId(data.getContractId()); |
| | | // } |
| | | // //若有计划信息,添加计划信息 |
| | | // if (StringUtils.isNotEmpty(data.getPlanId())) { |
| | | // param.setPlanId(data.getPlanId()); |
| | | // } |
| | | // param.setCompleteStatus(InoutConstant.COMPLETE_STATUS_NONE); |
| | | // Integer integer = inoutManagerService.queryNoticeIn(param); |
| | | // if (integer > 0) { |
| | | // return "新增的入库通知单已存在,不能再次新增,请核查!"; |
| | | // } |
| | | // } |
| | | |
| | | Session session = this.getSessionFactory().openSession(); |
| | | |
| | |
| | | public void pageQueryOut(Page<InoutNoticeOut> page, Map<String, Object> param) throws Exception { |
| | | |
| | | String hql = " from " + InoutNoticeOut.class.getName() |
| | | + " where companyId =:companyId"; |
| | | + " where companyId =:companyId and deptId =:deptId"; |
| | | |
| | | Map<String, Object> args = new HashMap<String, Object>(); |
| | | args.put("companyId", ContextUtil.getCompanyId()); |
| | | args.put("deptId", ContextUtil.subDeptId(null)); |
| | | |
| | | Object year = param.get("year"); |
| | | if (year == null) { |
| | | param.put("year", DateFormatUtils.format(new Date(), "yyyy")); |
| | | } |
| | | |
| | | String str = (String) param.get("deptId"); |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | hql += " and deptId =:deptId"; |
| | | args.put("deptId", str); |
| | | } |
| | | |
| | | str = (String) param.get("id"); |
| | | String str = (String) param.get("id"); |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | hql += " and id =:id"; |
| | | args.put("id", str); |
| | |
| | | |
| | | public String saveOrUpdateOut(InoutNoticeOut data) { |
| | | |
| | | //新增出库通知单时,需要进行唯一性判断。即保证单位、仓库、粮食品种、年份唯一,且不存在未完成状态的单子。 |
| | | if (Constant.YN_Y.equals(data.getTag())) { |
| | | data.setCompanyId(ContextUtil.getCompanyId()); |
| | | NoticeParam param = new NoticeParam(); |
| | | param.setCompanyId(data.getCompanyId()); |
| | | param.setDeptId(data.getDeptId()); |
| | | |
| | | param.setCustomerId(data.getCustomerId()); |
| | | param.setDepotId(data.getDepotId()); |
| | | param.setFoodVariety(data.getFoodVariety()); |
| | | param.setYear(data.getYear()); |
| | | //若有合同信息,添加合同信息 |
| | | if (StringUtils.isNotEmpty(data.getContractId())) { |
| | | param.setContractId(data.getContractId()); |
| | | } |
| | | //若有计划信息,添加计划信息 |
| | | if (StringUtils.isNotEmpty(data.getPlanId())) { |
| | | param.setPlanId(data.getPlanId()); |
| | | } |
| | | param.setCompleteStatus(InoutConstant.COMPLETE_STATUS_NONE); |
| | | Integer integer = inoutManagerService.queryNoticeOut(param); |
| | | if (integer > 0) { |
| | | return "新增的出库通知单已存在,不能再次新增,请核查!"; |
| | | } |
| | | } |
| | | //2023-09-02 暂时禁用通知单唯一性判断,原因:同一个单位有多个合同,就有多个通知单 |
| | | // //新增出库通知单时,需要进行唯一性判断。即保证单位、仓库、粮食品种、年份唯一,且不存在未完成状态的单子。 |
| | | // if (Constant.YN_Y.equals(data.getTag())) { |
| | | // data.setCompanyId(ContextUtil.getCompanyId()); |
| | | // NoticeParam param = new NoticeParam(); |
| | | // param.setCompanyId(data.getCompanyId()); |
| | | // param.setDeptId(data.getDeptId()); |
| | | // |
| | | // param.setCustomerId(data.getCustomerId()); |
| | | // param.setDepotId(data.getDepotId()); |
| | | // param.setFoodVariety(data.getFoodVariety()); |
| | | // param.setYear(data.getYear()); |
| | | // //若有合同信息,添加合同信息 |
| | | // if (StringUtils.isNotEmpty(data.getContractId())) { |
| | | // param.setContractId(data.getContractId()); |
| | | // } |
| | | // //若有计划信息,添加计划信息 |
| | | // if (StringUtils.isNotEmpty(data.getPlanId())) { |
| | | // param.setPlanId(data.getPlanId()); |
| | | // } |
| | | // param.setCompleteStatus(InoutConstant.COMPLETE_STATUS_NONE); |
| | | // Integer integer = inoutManagerService.queryNoticeOut(param); |
| | | // if (integer > 0) { |
| | | // return "新增的出库通知单已存在,不能再次新增,请核查!"; |
| | | // } |
| | | // } |
| | | Session session = this.getSessionFactory().openSession(); |
| | | |
| | | try { |
| | |
| | | } |
| | | |
| | | str = (String) parameter.get("key"); |
| | | if (StringUtils.isNoneEmpty(str)) { |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | hql += " and (name like:name or customerName like:customerName) "; |
| | | args.put("name", "%" + str + "%"); |
| | | args.put("customerName", "%" + str + "%"); |