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