|
@@ -447,165 +447,165 @@ public class ProjectController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 导入Excel数据
|
|
|
- 领料单
|
|
|
- */
|
|
|
- @ResponseBody
|
|
|
- @RequiresPermissions("sg:managementcenter:project:importPicking")
|
|
|
- @RequestMapping(value = "importPicking")
|
|
|
- public AjaxJson importFileRequisition(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request){
|
|
|
- AjaxJson j = new AjaxJson();
|
|
|
- String str = "";//提示
|
|
|
- try {
|
|
|
- ImportUtil importUtil = new ImportUtil(file, 0, 0);
|
|
|
- //读取表格list
|
|
|
- List<PickingRequisition> listPickRequisition = PickingInfo.getListPickRequisition(importUtil);
|
|
|
- /*
|
|
|
- 如下3个list是导入操作(得到最终保存数据库的集合)。对领料单进行数据库保存。
|
|
|
- */
|
|
|
- List<PickingRequisition> duplicateRemoval = PickingInfo.getDuplicateRemoval(listPickRequisition);//去重集合
|
|
|
- if (null==duplicateRemoval || duplicateRemoval.size()<=0){
|
|
|
- j.setSuccess(false);
|
|
|
- j.setMsg("导入失败:导入表格无数据");
|
|
|
- return j;
|
|
|
- }
|
|
|
- List<PickingRequisition> repeatRequisition = PickingInfo.getRepeatRequisition(duplicateRemoval);//去掉重复的领料单号
|
|
|
- List<PickingRequisition> pickingRequisitions = pickingRequisitionService.pickingRequisitions(repeatRequisition);//得到数据库中数据
|
|
|
- List<PickingRequisition> sureSavePicking = PickingInfo.getSureSavePicking(pickingRequisitions, repeatRequisition);//参数1:得到数据库集合 参数2:读取表格list
|
|
|
- if (null!=sureSavePicking&&sureSavePicking.size()>0){
|
|
|
- pickingRequisitionService.saveList(sureSavePicking);
|
|
|
- }
|
|
|
- //判断该项目已完成首次领料
|
|
|
- List<PickingRequisition> judgePicking = PickingInfo.getJudgePicking(listPickRequisition);//获取领料状态
|
|
|
- /**
|
|
|
- * 一致的,修改领料状态
|
|
|
- */
|
|
|
- //获取需求数量和已出库数量都一致领料单集合
|
|
|
- List<PickingRequisition> changePicking = PickingInfo.getChangePicking(judgePicking);
|
|
|
- if (null!=changePicking&&changePicking.size()>0){
|
|
|
- List<Project> listProjectPicking1 = projectService.findListProjectPicking(changePicking);
|
|
|
- for (Project project:listProjectPicking1){
|
|
|
- projectService.getUpdateAcquisitionStatus("2",project.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- /*
|
|
|
- 发送通知方法集合
|
|
|
- */
|
|
|
- //获得该项目是否允许领料是否允许领料状态的项目:返回不一致集合
|
|
|
- List<PickingRequisition> notifyPickingRequisitions = PickingInfo.getUnifiedPicking(judgePicking);
|
|
|
- //去重
|
|
|
- List<PickingRequisition> duplicate = PickingInfo.getDuplicateRemoval(notifyPickingRequisitions);
|
|
|
- //根据项目定义号去项目表中查找项目信息
|
|
|
- List<Project> listProjectPicking = projectService.findListProjectPicking(duplicate);
|
|
|
- if (null!=listProjectPicking&&listProjectPicking.size()>0){
|
|
|
- //根据项目的id去数据库中查找项目领导审核时间
|
|
|
- List<Acquisition> findListDate = pickingRequisitionService.getFindListDate(listProjectPicking);
|
|
|
- if (null!=findListDate&&findListDate.size()>0){
|
|
|
- List<Acquisition> sureFindListDate = PickingInfo.getSureFindListDate(findListDate);
|
|
|
- //得到整合后的list集合(存在项目信息)
|
|
|
- List<ProjectAcquisition> listProjectAcquisition = PickingInfo.getListProjectAcquisition(listProjectPicking, sureFindListDate);
|
|
|
-
|
|
|
- //得到和项目表匹配的pickAcquisition的集合同时判断给超过三天的领料做标识
|
|
|
- List<PickingRequisition> listSameSetOf = PickingInfo.getListSameSetOf(listProjectAcquisition, listPickRequisition);
|
|
|
- if (null!=listSameSetOf&&listSameSetOf.size()>0){
|
|
|
- //根据物料编码进行去重
|
|
|
- List<PickingRequisition> duplicateRemovalMaterCode = PickingInfo.getDuplicateRemovalMaterCode(listSameSetOf);
|
|
|
- //得到库存对应的集合
|
|
|
- List<MaterialInventory> byListPicking = materialInventoryService.findByListPicking(duplicateRemovalMaterCode);
|
|
|
-
|
|
|
- //所有缺货未缺货信息的登记
|
|
|
- List<PickingRequisition> whetherStock = PickingInfo.getWhetherStock(listSameSetOf, byListPicking);
|
|
|
-
|
|
|
- //得到非缺货信息1的通知
|
|
|
- List<OaNotifyMaterial> noStockList = PickingInfo.getNoStock(whetherStock);
|
|
|
- //得到缺货信息3的通知(缺货项目信息)
|
|
|
- List<OaNotifyMaterial> yesStock2List = PickingInfo.getYesStock2(whetherStock);
|
|
|
- //得到缺货信息2的通知
|
|
|
- List<OaNotifyMaterial> yesStock1List = PickingInfo.getYesStock1(whetherStock);
|
|
|
- //发送通知方法
|
|
|
- //非缺货信息1
|
|
|
- if (null!=noStockList && noStockList.size()>0){
|
|
|
- int count = 0;
|
|
|
- List<String> listUserId = PickingInfo.getListUserId(PickingInfo.ALL_USER_ID);
|
|
|
- List<String> userId = pickingRequisitionService.findUserId(listUserId);
|
|
|
- String stringJoiningTogether = PickingInfo.getStringJoiningTogether(userId);//获取通知人
|
|
|
- OaNotify oaNotify = new OaNotify();
|
|
|
- oaNotify.setType("5");
|
|
|
- oaNotify.setTitle("非缺货信息");//非缺货信息
|
|
|
-// oaNotify.setContent(noStock);
|
|
|
- oaNotify.setContent("请在详情中查看...");
|
|
|
- oaNotify.setStatus("1");
|
|
|
- oaNotify.setOaNotifyRecordIds(stringJoiningTogether);
|
|
|
- oaNotifyService.saveList(oaNotify,noStockList);
|
|
|
- List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
|
|
|
- for(OaNotifyRecord o : list){
|
|
|
- count++;
|
|
|
- //发送通知到客户端
|
|
|
- ServletContext context = SpringContextHolder
|
|
|
- .getBean(ServletContext.class);
|
|
|
- new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
|
|
|
- }
|
|
|
- str="已经发送非缺货信息通知;";
|
|
|
- }
|
|
|
- //非缺货信息2
|
|
|
- if (null!=yesStock1List&&yesStock1List.size()>0){
|
|
|
- int count = 0;
|
|
|
- List<String> listUserId = PickingInfo.getListUserId(PickingInfo.QH_USER_ID);
|
|
|
- List<String> userId = pickingRequisitionService.findUserId(listUserId);
|
|
|
- String stringJoiningTogether = PickingInfo.getStringJoiningTogether(userId);//获取通知人
|
|
|
- OaNotify oaNotify = new OaNotify();
|
|
|
- oaNotify.setType("6");
|
|
|
- oaNotify.setTitle("缺货信息");
|
|
|
- oaNotify.setContent("请在详情中查看...");
|
|
|
- oaNotify.setStatus("1");
|
|
|
- oaNotify.setOaNotifyRecordIds(stringJoiningTogether);
|
|
|
- oaNotifyService.saveList(oaNotify,yesStock1List);
|
|
|
- List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
|
|
|
- for(OaNotifyRecord o : list){
|
|
|
- count++;
|
|
|
- //发送通知到客户端
|
|
|
- ServletContext context = SpringContextHolder
|
|
|
- .getBean(ServletContext.class);
|
|
|
- new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
|
|
|
- }
|
|
|
- str+="已经发送缺货信息通知;";
|
|
|
- }
|
|
|
- //非缺货信息2
|
|
|
- if (null!=yesStock2List&&yesStock2List.size()>0){
|
|
|
- int count = 0;
|
|
|
- List<String> listUserId = PickingInfo.getListUserId(PickingInfo.QH_USER_ID);
|
|
|
- List<String> userId = pickingRequisitionService.findUserId(listUserId);
|
|
|
- String stringJoiningTogether = PickingInfo.getStringJoiningTogether(userId);//获取通知人
|
|
|
- OaNotify oaNotify = new OaNotify();
|
|
|
- oaNotify.setType("7");
|
|
|
- oaNotify.setTitle("缺货项目信息");
|
|
|
- oaNotify.setContent("请在详情中查看...");
|
|
|
- oaNotify.setStatus("1");
|
|
|
- oaNotify.setOaNotifyRecordIds(stringJoiningTogether);
|
|
|
- oaNotifyService.saveList(oaNotify,yesStock2List);
|
|
|
- List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
|
|
|
- for(OaNotifyRecord o : list){
|
|
|
- count++;
|
|
|
- //发送通知到客户端
|
|
|
- ServletContext context = SpringContextHolder
|
|
|
- .getBean(ServletContext.class);
|
|
|
- new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
|
|
|
- }
|
|
|
- str+="已经发送缺货项目信息通知;";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- if (str.length()<=0){
|
|
|
- str+="暂无通知!";
|
|
|
- }
|
|
|
- j.setMsg( "已成功导入 "+listPickRequisition.size()+" 条领料表单记录."+str);
|
|
|
- } catch (Exception e) {
|
|
|
- j.setSuccess(false);
|
|
|
- j.setMsg("导入领料表单失败!失败信息:"+e.getMessage());
|
|
|
- }
|
|
|
- return j;
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 导入Excel数据
|
|
|
+// 领料单
|
|
|
+// */
|
|
|
+// @ResponseBody
|
|
|
+// @RequiresPermissions("sg:managementcenter:project:importPicking")
|
|
|
+// @RequestMapping(value = "importPicking")
|
|
|
+// public AjaxJson importFileRequisition(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request){
|
|
|
+// AjaxJson j = new AjaxJson();
|
|
|
+// String str = "";//提示
|
|
|
+// try {
|
|
|
+// ImportUtil importUtil = new ImportUtil(file, 0, 0);
|
|
|
+// //读取表格list
|
|
|
+// List<PickingRequisition> listPickRequisition = PickingInfo.getListPickRequisition(importUtil);
|
|
|
+// /*
|
|
|
+// 如下3个list是导入操作(得到最终保存数据库的集合)。对领料单进行数据库保存。
|
|
|
+// */
|
|
|
+// List<PickingRequisition> duplicateRemoval = PickingInfo.getDuplicateRemoval(listPickRequisition);//去重集合
|
|
|
+// if (null==duplicateRemoval || duplicateRemoval.size()<=0){
|
|
|
+// j.setSuccess(false);
|
|
|
+// j.setMsg("导入失败:导入表格无数据");
|
|
|
+// return j;
|
|
|
+// }
|
|
|
+// List<PickingRequisition> repeatRequisition = PickingInfo.getRepeatRequisition(duplicateRemoval);//去掉重复的领料单号
|
|
|
+// List<PickingRequisition> pickingRequisitions = pickingRequisitionService.pickingRequisitions(repeatRequisition);//得到数据库中数据
|
|
|
+// List<PickingRequisition> sureSavePicking = PickingInfo.getSureSavePicking(pickingRequisitions, repeatRequisition);//参数1:得到数据库集合 参数2:读取表格list
|
|
|
+// if (null!=sureSavePicking&&sureSavePicking.size()>0){
|
|
|
+// pickingRequisitionService.saveList(sureSavePicking);
|
|
|
+// }
|
|
|
+// //判断该项目已完成首次领料
|
|
|
+// List<PickingRequisition> judgePicking = PickingInfo.getJudgePicking(listPickRequisition);//获取领料状态
|
|
|
+// /**
|
|
|
+// * 一致的,修改领料状态
|
|
|
+// */
|
|
|
+// //获取需求数量和已出库数量都一致领料单集合
|
|
|
+// List<PickingRequisition> changePicking = PickingInfo.getChangePicking(judgePicking);
|
|
|
+// if (null!=changePicking&&changePicking.size()>0){
|
|
|
+// List<Project> listProjectPicking1 = projectService.findListProjectPicking(changePicking);
|
|
|
+// for (Project project:listProjectPicking1){
|
|
|
+// projectService.getUpdateAcquisitionStatus("2",project.getId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// /*
|
|
|
+// 发送通知方法集合
|
|
|
+// */
|
|
|
+// //获得该项目是否允许领料是否允许领料状态的项目:返回不一致集合
|
|
|
+// List<PickingRequisition> notifyPickingRequisitions = PickingInfo.getUnifiedPicking(judgePicking);
|
|
|
+// //去重
|
|
|
+// List<PickingRequisition> duplicate = PickingInfo.getDuplicateRemoval(notifyPickingRequisitions);
|
|
|
+// //根据项目定义号去项目表中查找项目信息
|
|
|
+// List<Project> listProjectPicking = projectService.findListProjectPicking(duplicate);
|
|
|
+// if (null!=listProjectPicking&&listProjectPicking.size()>0){
|
|
|
+// //根据项目的id去数据库中查找项目领导审核时间
|
|
|
+// List<Acquisition> findListDate = pickingRequisitionService.getFindListDate(listProjectPicking);
|
|
|
+// if (null!=findListDate&&findListDate.size()>0){
|
|
|
+// List<Acquisition> sureFindListDate = PickingInfo.getSureFindListDate(findListDate);
|
|
|
+// //得到整合后的list集合(存在项目信息)
|
|
|
+// List<ProjectAcquisition> listProjectAcquisition = PickingInfo.getListProjectAcquisition(listProjectPicking, sureFindListDate);
|
|
|
+//
|
|
|
+// //得到和项目表匹配的pickAcquisition的集合同时判断给超过三天的领料做标识
|
|
|
+// List<PickingRequisition> listSameSetOf = PickingInfo.getListSameSetOf(listProjectAcquisition, listPickRequisition);
|
|
|
+// if (null!=listSameSetOf&&listSameSetOf.size()>0){
|
|
|
+// //根据物料编码进行去重
|
|
|
+// List<PickingRequisition> duplicateRemovalMaterCode = PickingInfo.getDuplicateRemovalMaterCode(listSameSetOf);
|
|
|
+// //得到库存对应的集合
|
|
|
+// List<MaterialInventory> byListPicking = materialInventoryService.findByListPicking(duplicateRemovalMaterCode);
|
|
|
+//
|
|
|
+// //所有缺货未缺货信息的登记
|
|
|
+// List<PickingRequisition> whetherStock = PickingInfo.getWhetherStock(listSameSetOf, byListPicking);
|
|
|
+//
|
|
|
+// //得到非缺货信息1的通知
|
|
|
+// List<OaNotifyMaterial> noStockList = PickingInfo.getNoStock(whetherStock);
|
|
|
+// //得到缺货信息3的通知(缺货项目信息)
|
|
|
+// List<OaNotifyMaterial> yesStock2List = PickingInfo.getYesStock2(whetherStock);
|
|
|
+// //得到缺货信息2的通知
|
|
|
+// List<OaNotifyMaterial> yesStock1List = PickingInfo.getYesStock1(whetherStock);
|
|
|
+// //发送通知方法
|
|
|
+// //非缺货信息1
|
|
|
+// if (null!=noStockList && noStockList.size()>0){
|
|
|
+// int count = 0;
|
|
|
+// List<String> listUserId = PickingInfo.getListUserId(PickingInfo.ALL_USER_ID);
|
|
|
+// List<String> userId = pickingRequisitionService.findUserId(listUserId);
|
|
|
+// String stringJoiningTogether = PickingInfo.getStringJoiningTogether(userId);//获取通知人
|
|
|
+// OaNotify oaNotify = new OaNotify();
|
|
|
+// oaNotify.setType("5");
|
|
|
+// oaNotify.setTitle("非缺货信息");//非缺货信息
|
|
|
+//// oaNotify.setContent(noStock);
|
|
|
+// oaNotify.setContent("请在详情中查看...");
|
|
|
+// oaNotify.setStatus("1");
|
|
|
+// oaNotify.setOaNotifyRecordIds(stringJoiningTogether);
|
|
|
+// oaNotifyService.saveList(oaNotify,noStockList);
|
|
|
+// List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
|
|
|
+// for(OaNotifyRecord o : list){
|
|
|
+// count++;
|
|
|
+// //发送通知到客户端
|
|
|
+// ServletContext context = SpringContextHolder
|
|
|
+// .getBean(ServletContext.class);
|
|
|
+// new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
|
|
|
+// }
|
|
|
+// str="已经发送非缺货信息通知;";
|
|
|
+// }
|
|
|
+// //非缺货信息2
|
|
|
+// if (null!=yesStock1List&&yesStock1List.size()>0){
|
|
|
+// int count = 0;
|
|
|
+// List<String> listUserId = PickingInfo.getListUserId(PickingInfo.QH_USER_ID);
|
|
|
+// List<String> userId = pickingRequisitionService.findUserId(listUserId);
|
|
|
+// String stringJoiningTogether = PickingInfo.getStringJoiningTogether(userId);//获取通知人
|
|
|
+// OaNotify oaNotify = new OaNotify();
|
|
|
+// oaNotify.setType("6");
|
|
|
+// oaNotify.setTitle("缺货信息");
|
|
|
+// oaNotify.setContent("请在详情中查看...");
|
|
|
+// oaNotify.setStatus("1");
|
|
|
+// oaNotify.setOaNotifyRecordIds(stringJoiningTogether);
|
|
|
+// oaNotifyService.saveList(oaNotify,yesStock1List);
|
|
|
+// List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
|
|
|
+// for(OaNotifyRecord o : list){
|
|
|
+// count++;
|
|
|
+// //发送通知到客户端
|
|
|
+// ServletContext context = SpringContextHolder
|
|
|
+// .getBean(ServletContext.class);
|
|
|
+// new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
|
|
|
+// }
|
|
|
+// str+="已经发送缺货信息通知;";
|
|
|
+// }
|
|
|
+// //非缺货信息2
|
|
|
+// if (null!=yesStock2List&&yesStock2List.size()>0){
|
|
|
+// int count = 0;
|
|
|
+// List<String> listUserId = PickingInfo.getListUserId(PickingInfo.QH_USER_ID);
|
|
|
+// List<String> userId = pickingRequisitionService.findUserId(listUserId);
|
|
|
+// String stringJoiningTogether = PickingInfo.getStringJoiningTogether(userId);//获取通知人
|
|
|
+// OaNotify oaNotify = new OaNotify();
|
|
|
+// oaNotify.setType("7");
|
|
|
+// oaNotify.setTitle("缺货项目信息");
|
|
|
+// oaNotify.setContent("请在详情中查看...");
|
|
|
+// oaNotify.setStatus("1");
|
|
|
+// oaNotify.setOaNotifyRecordIds(stringJoiningTogether);
|
|
|
+// oaNotifyService.saveList(oaNotify,yesStock2List);
|
|
|
+// List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
|
|
|
+// for(OaNotifyRecord o : list){
|
|
|
+// count++;
|
|
|
+// //发送通知到客户端
|
|
|
+// ServletContext context = SpringContextHolder
|
|
|
+// .getBean(ServletContext.class);
|
|
|
+// new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
|
|
|
+// }
|
|
|
+// str+="已经发送缺货项目信息通知;";
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (str.length()<=0){
|
|
|
+// str+="暂无通知!";
|
|
|
+// }
|
|
|
+// j.setMsg( "已成功导入 "+listPickRequisition.size()+" 条领料表单记录."+str);
|
|
|
+// } catch (Exception e) {
|
|
|
+// j.setSuccess(false);
|
|
|
+// j.setMsg("导入领料表单失败!失败信息:"+e.getMessage());
|
|
|
+// }
|
|
|
+// return j;
|
|
|
+// }
|
|
|
}
|