| | |
| | | import com.ld.igds.m.InoutManageUtil; |
| | | import com.ld.igds.m.service.HPlanManageService; |
| | | import com.ld.igds.models.DicTrigger; |
| | | import com.ld.igds.models.MPlan; |
| | | import com.ld.igds.models.MPlanDetail; |
| | | import com.ld.igds.models.InoutPlan; |
| | | import com.ld.igds.models.InoutPlanDetail; |
| | | import com.ld.igds.sys.service.SysDeptService; |
| | | import com.ld.igds.util.ContextUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | |
| | | /** |
| | | * 综合业务-计划管理 |
| | | * |
| | | * @author: chen |
| | | * |
| | | * @author: chen |
| | | */ |
| | | @Component |
| | | public class PlanManagePR { |
| | | |
| | | @Autowired |
| | | private HPlanManageService service; |
| | | @Autowired |
| | | private SysDeptService sysDeptService; |
| | | @Autowired |
| | | private HPlanManageService service; |
| | | @Autowired |
| | | private SysDeptService sysDeptService; |
| | | |
| | | /** |
| | | * planManagePR#getPlanTitle 获取计划title |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public Map<String, Object> getPlanTitle(Map<String, Object> param) { |
| | | Map<String, Object> result = new HashMap<String, Object>(); |
| | | //获取参数中报表类型 |
| | | String type = (String)param.get("type"); |
| | | /** |
| | | * planManagePR#getPlanTitle 获取计划title |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public Map<String, Object> getPlanTitle(Map<String, Object> param) { |
| | | Map<String, Object> result = new HashMap<String, Object>(); |
| | | //获取参数中报表类型 |
| | | String type = (String) param.get("type"); |
| | | |
| | | //设置计划title |
| | | String title = "计划"; |
| | | if(InoutManageUtil.PLAN_TYPE_1.equals(type)){ |
| | | title = "采购" + title; |
| | | } |
| | | if(InoutManageUtil.PLAN_TYPE_2.equals(type)){ |
| | | title = "销售" + title; |
| | | } |
| | | if(InoutManageUtil.PLAN_TYPE_3.equals(type)){ |
| | | title = "轮换" + title; |
| | | } |
| | | if(InoutManageUtil.PLAN_TYPE_4.equals(type)){ |
| | | title = "加工" + title; |
| | | } |
| | | //设置计划title |
| | | String title = "计划"; |
| | | if (InoutManageUtil.PLAN_TYPE_1.equals(type)) { |
| | | title = "采购" + title; |
| | | } |
| | | if (InoutManageUtil.PLAN_TYPE_2.equals(type)) { |
| | | title = "销售" + title; |
| | | } |
| | | if (InoutManageUtil.PLAN_TYPE_3.equals(type)) { |
| | | title = "轮换" + title; |
| | | } |
| | | if (InoutManageUtil.PLAN_TYPE_4.equals(type)) { |
| | | title = "加工" + title; |
| | | } |
| | | |
| | | //获取参数中分库编码 |
| | | String deptId = (String)param.get("deptId"); |
| | | if (StringUtils.isEmpty(deptId)) { |
| | | deptId = ContextUtil.subDeptId(null); |
| | | } |
| | | //获取分库编码对应的分库名称 |
| | | String deptName = ""; |
| | | List<DefaultDept> defaultDepts = sysDeptService.loadUserDepts(ContextUtil.getLoginUserName()); |
| | | for (DefaultDept defaultDept : defaultDepts) { |
| | | if(defaultDept.getId().equals(deptId)){ |
| | | deptName = defaultDept.getName(); |
| | | } |
| | | } |
| | | //获取参数中分库编码 |
| | | String deptId = (String) param.get("deptId"); |
| | | if (StringUtils.isEmpty(deptId)) { |
| | | deptId = ContextUtil.subDeptId(null); |
| | | } |
| | | //获取分库编码对应的分库名称 |
| | | String deptName = ""; |
| | | List<DefaultDept> defaultDepts = sysDeptService.loadUserDepts(ContextUtil.getLoginUserName()); |
| | | for (DefaultDept defaultDept : defaultDepts) { |
| | | if (defaultDept.getId().equals(deptId)) { |
| | | deptName = defaultDept.getName(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(deptName)) { |
| | | title = deptName + " - " + title; |
| | | } |
| | | result.put("title", title); |
| | | return result; |
| | | } |
| | | if (StringUtils.isNotEmpty(deptName)) { |
| | | title = deptName + " - " + title; |
| | | } |
| | | result.put("title", title); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 计划类型 |
| | | * ${dorado.getDataProvider("planManagePR#triggerPlanType").getResult()} |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<DicTrigger> triggerPlanType() { |
| | | List<DicTrigger> list = new ArrayList<DicTrigger>(); |
| | | /** |
| | | * 计划类型 |
| | | * ${dorado.getDataProvider("planManagePR#triggerPlanType").getResult()} |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<DicTrigger> triggerPlanType() { |
| | | List<DicTrigger> list = new ArrayList<DicTrigger>(); |
| | | |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_1, "采购计划")); |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_2, "销售计划")); |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_3, "轮换计划")); |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_4, "加工计划")); |
| | | |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_1, "采购计划")); |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_2, "销售计划")); |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_3, "轮换计划")); |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_4, "加工计划")); |
| | | return list; |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | /** |
| | | * 轮换计划类型 |
| | | * ${dorado.getDataProvider("planManagePR#triggerPlanTurn").getResult()} |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<DicTrigger> triggerPlanTurn() { |
| | | List<DicTrigger> list = new ArrayList<DicTrigger>(); |
| | | |
| | | /** |
| | | * 轮换计划类型 |
| | | * ${dorado.getDataProvider("planManagePR#triggerPlanTurn").getResult()} |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<DicTrigger> triggerPlanTurn() { |
| | | List<DicTrigger> list = new ArrayList<DicTrigger>(); |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_TURN_IN, "轮入")); |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_TURN_OUT, "轮出")); |
| | | |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_TURN_IN, "轮入")); |
| | | list.add(new DicTrigger(InoutManageUtil.PLAN_TYPE_TURN_OUT, "轮出")); |
| | | return list; |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | /** |
| | | * 获取计划列表 |
| | | * planManagePR#pagePlan |
| | | * |
| | | * @param page |
| | | * @param param |
| | | * @throws Exception |
| | | */ |
| | | @DataProvider |
| | | public void pagePlan(Page<InoutPlan> page, Map<String, Object> param) throws Exception { |
| | | if (null == param) { |
| | | param = new HashMap<String, Object>(); |
| | | } |
| | | service.pagePlan(page, param); |
| | | } |
| | | |
| | | /** |
| | | * 获取计划列表 |
| | | * planManagePR#pagePlan |
| | | * |
| | | * @param page |
| | | * @param param |
| | | * @throws Exception |
| | | */ |
| | | @DataProvider |
| | | public void pagePlan(Page<MPlan> page, Map<String, Object> param) throws Exception { |
| | | if (null == param) { |
| | | param = new HashMap<String, Object>(); |
| | | } |
| | | service.pagePlan(page, param); |
| | | } |
| | | /** |
| | | * 获取计划详细列表 |
| | | * planManagePR#listPlan |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<InoutPlan> listPlan() { |
| | | return service.listPlan(); |
| | | } |
| | | |
| | | /** |
| | | * 获取计划详细列表 |
| | | * planManagePR#listPlanDetail |
| | | * |
| | | * @param planId |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<MPlanDetail> listPlanDetail(String planId) { |
| | | return service.listPlanDetail(planId); |
| | | } |
| | | |
| | | /** |
| | | * 保存计划 |
| | | * planManagePR#savePlan |
| | | * |
| | | * @param data |
| | | */ |
| | | @DataResolver |
| | | public void savePlan(MPlan data) { |
| | | service.savePlan(data); |
| | | } |
| | | /** |
| | | * 获取计划详细列表 |
| | | * planManagePR#listPlanDetail |
| | | * |
| | | * @param planId |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<InoutPlanDetail> listPlanDetail(String planId) { |
| | | return service.listPlanDetail(planId); |
| | | } |
| | | |
| | | /** |
| | | * 删除计划 |
| | | * planManagePR#delPlan |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String delPlan(MPlan data) { |
| | | return service.delPlan(data); |
| | | } |
| | | |
| | | /** |
| | | * 删除计划详细信息 |
| | | * planManagePR#delPlanDetail |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String delPlanDetail(MPlanDetail data){ |
| | | return service.delPlanDetail(data); |
| | | } |
| | | |
| | | /** |
| | | * 获取计划列表 |
| | | * planManagePR#pagePlanDetail |
| | | * |
| | | * @param page |
| | | * @param param |
| | | * @throws Exception |
| | | */ |
| | | @DataProvider |
| | | public void pagePlanDetail(Page<InoutPlanDetail> page, Map<String, Object> param) throws Exception { |
| | | if (null == param) { |
| | | param = new HashMap<String, Object>(); |
| | | } |
| | | service.pagePlanDetail(page, param); |
| | | } |
| | | |
| | | /** |
| | | * 保存计划 |
| | | * planManagePR#savePlan |
| | | * |
| | | * @param data |
| | | */ |
| | | @DataResolver |
| | | public void savePlan(InoutPlan data) { |
| | | service.savePlan(data); |
| | | } |
| | | |
| | | /** |
| | | * 删除计划 |
| | | * planManagePR#delPlan |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String delPlan(InoutPlan data) { |
| | | return service.delPlan(data); |
| | | } |
| | | |
| | | /** |
| | | * 删除计划详细信息 |
| | | * planManagePR#delPlanDetail |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String delPlanDetail(InoutPlanDetail data) { |
| | | return service.delPlanDetail(data); |
| | | } |
| | | } |