|
@@ -472,60 +472,87 @@ public class BomProcedureVersionServiceImpl extends SuperServiceImpl<BomProcedur
|
|
|
if("3".equals(bean.getTrayConf())){
|
|
|
List<BomProcedureTray> procedureTrayList = bean.getProcedureTrayList();
|
|
|
if(procedureTrayList != null && procedureTrayList.size() >0){
|
|
|
- Map<String,List<BomProcedureTray>> trayMap = new HashMap<>();
|
|
|
+// Map<String,List<BomProcedureTray>> trayMap = new HashMap<>();
|
|
|
+// for(BomProcedureTray tray:procedureTrayList){
|
|
|
+// isFalse(tray.getTrayId()==null,"存在夹具未选择,请选择夹具");
|
|
|
+// List<BomProcedureTray> trayList = new ArrayList<>();
|
|
|
+// //按组序分组重新组装数据
|
|
|
+// if(trayMap.containsKey(tray.getGroupSort())){
|
|
|
+// trayMap.get(tray.getGroupSort()).add(tray);
|
|
|
+// }else{
|
|
|
+// trayList.add(tray);
|
|
|
+// trayMap.put(tray.getGroupSort(),trayList);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ int sort=1;
|
|
|
for(BomProcedureTray tray:procedureTrayList){
|
|
|
- isFalse(tray.getTrayId()==null,"存在夹具未选择,请选择夹具");
|
|
|
- List<BomProcedureTray> trayList = new ArrayList<>();
|
|
|
- //按组序分组重新组装数据
|
|
|
- if(trayMap.containsKey(tray.getGroupSort())){
|
|
|
- trayMap.get(tray.getGroupSort()).add(tray);
|
|
|
- }else{
|
|
|
- trayList.add(tray);
|
|
|
- trayMap.put(tray.getGroupSort(),trayList);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //保存组序表
|
|
|
- for(Map.Entry<String, List<BomProcedureTray>> entry : trayMap.entrySet()){
|
|
|
+ //添加组
|
|
|
BomProcedureTrayGroup groupBean = new BomProcedureTrayGroup();
|
|
|
- groupBean.setGroupSort(Integer.parseInt(entry.getKey()));
|
|
|
- //分组后的数据 优先级在一个组序中是一样的,默认取第一个
|
|
|
- groupBean.setGroupPrority(Integer.parseInt(entry.getValue().get(0).getGroupPrority()));
|
|
|
+ groupBean.setGroupSort(sort);
|
|
|
+ groupBean.setGroupPrority(sort);
|
|
|
groupBean.setProcedureId(bean.getId());
|
|
|
bomProcedureTrayGroupService.save(groupBean);
|
|
|
+ sort++;
|
|
|
+ //添加明细,添加选择的夹具
|
|
|
+ tray.setId(null);
|
|
|
+ tray.setProcedureId(bean.getId());
|
|
|
+ tray.setGroupId(groupBean.getId());
|
|
|
+ tray.setBizType("2");
|
|
|
+ bomProcedureTrayService.save(tray);
|
|
|
+
|
|
|
+ //添加明细,从bom里添加托盘
|
|
|
+ BomProcedureTray tpTray = new BomProcedureTray();
|
|
|
+ tpTray.setProcedureId(bean.getId());
|
|
|
+ tpTray.setGroupId(groupBean.getId());
|
|
|
+ tpTray.setBizType("1");
|
|
|
+ bomProcedureTrayService.save(tray);
|
|
|
|
|
|
- //遍历组序里面的托盘夹具,进行保存
|
|
|
- int sort=1;
|
|
|
- for(BomProcedureTray tray:entry.getValue()){
|
|
|
- tray.setId(null);
|
|
|
- tray.setProcedureId(bean.getId());
|
|
|
- tray.setGroupId(groupBean.getId());
|
|
|
- //tray.setTrayId(Long.parseLong("123"));
|
|
|
- //业务类型(1-托盘2-夹具)
|
|
|
- if(sort == 1){
|
|
|
- tray.setBizType("1");
|
|
|
- }else{
|
|
|
- tray.setBizType("2");
|
|
|
- }
|
|
|
- tray.setSort(sort);
|
|
|
- sort++;
|
|
|
-
|
|
|
- bomProcedureTrayService.save(tray);
|
|
|
-
|
|
|
- //保存托盘/夹具 位置对应关系表
|
|
|
- List<Long> positionList = tray.getPositionList();
|
|
|
- if(positionList != null && positionList.size() > 0){
|
|
|
- if(positionList != null && positionList.size() > 0){
|
|
|
- for(Long id:positionList){
|
|
|
- BomProcedureTrayPosition tp = new BomProcedureTrayPosition();
|
|
|
- tp.setTrayPositionId(id);
|
|
|
- tp.setProcedureTrayId(tray.getId());
|
|
|
- bomProcedureTrayPositionService.save(tp);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //保存组序表
|
|
|
+// for(Map.Entry<String, List<BomProcedureTray>> entry : trayMap.entrySet()){
|
|
|
+// BomProcedureTrayGroup groupBean = new BomProcedureTrayGroup();
|
|
|
+// groupBean.setGroupSort(Integer.parseInt(entry.getKey()));
|
|
|
+// //分组后的数据 优先级在一个组序中是一样的,默认取第一个
|
|
|
+// groupBean.setGroupPrority(Integer.parseInt(entry.getValue().get(0).getGroupPrority()));
|
|
|
+// groupBean.setProcedureId(bean.getId());
|
|
|
+// bomProcedureTrayGroupService.save(groupBean);
|
|
|
+//
|
|
|
+// //遍历组序里面的托盘夹具,进行保存
|
|
|
+// int sort=1;
|
|
|
+// for(BomProcedureTray tray:entry.getValue()){
|
|
|
+// tray.setId(null);
|
|
|
+// tray.setProcedureId(bean.getId());
|
|
|
+// tray.setGroupId(groupBean.getId());
|
|
|
+// //tray.setTrayId(Long.parseLong("123"));
|
|
|
+// //业务类型(1-托盘2-夹具)
|
|
|
+// if(sort == 1){
|
|
|
+// tray.setBizType("1");
|
|
|
+// }else{
|
|
|
+// tray.setBizType("2");
|
|
|
+// }
|
|
|
+// tray.setSort(sort);
|
|
|
+// sort++;
|
|
|
+//
|
|
|
+// bomProcedureTrayService.save(tray);
|
|
|
+//
|
|
|
+// //保存托盘/夹具 位置对应关系表
|
|
|
+//// List<Long> positionList = tray.getPositionList();
|
|
|
+//// if(positionList != null && positionList.size() > 0){
|
|
|
+//// if(positionList != null && positionList.size() > 0){
|
|
|
+//// for(Long id:positionList){
|
|
|
+//// BomProcedureTrayPosition tp = new BomProcedureTrayPosition();
|
|
|
+//// tp.setTrayPositionId(id);
|
|
|
+//// tp.setProcedureTrayId(tray.getId());
|
|
|
+//// bomProcedureTrayPositionService.save(tp);
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
|