| | |
| | | homeMapper.DeleteStroageCageByCell(cell); |
| | | } else { |
| | | homeMapper.updateStroageCageByCell(cell, num); |
| | | homeMapper.UpdateStroageCageWidthByCell(cell); |
| | | homeMapper.UpdateStroageCageWidthByCell(cell);// 修改笼子宽度 |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | |
| | | homeMapper.FinishTask(storageTask.getId());// 完成任务 |
| | | if (storageTask.getTaskType().equals("0")) { |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()), 1);// 玻璃数量+1 |
| | | homeMapper.DeletequeueByGlassid(storageTask.getGlassId()); |
| | | } else { |
| | | StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getShelfRack()); |
| | | if (storageCage.getNumber() > 1) { |
| | |
| | | } |
| | | |
| | | // 开始任务 |
| | | public Result ClaimTasks(String flowcard, Integer state) { |
| | | public Result ClaimTasks(String flowcard, Integer state, Integer line) { |
| | | if (state == 1) { |
| | | homeMapper.ClaimTasks(flowcard, 0); |
| | | homeMapper.ClaimTasks(flowcard, 0, line); |
| | | } else { |
| | | homeMapper.ClaimTasks(flowcard, 1); |
| | | homeMapper.ClaimTasks(flowcard, 1, line); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | |
| | | // 修改测量信息 |
| | | public Result UpdateQueue(GlassInfo glassInfo) { |
| | | homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(), |
| | | glassInfo.getGlasstype()); |
| | | glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | |
| | | // 读取DB105区文件 |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | // 移除 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 3); |
| | | //删除数据 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 3); |
| | | // 删除数据 |
| | | QueueMapper.DeleteErrorQueue(); |
| | | |
| | | |
| | | // plcmes.getPlcParameter("GaToMES").setValue("3"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 开始工程 |
| | | public Result StartChange(String flowcard) { |
| | | homeMapper.StartChange(flowcard, 1); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | |
| | | // 读取DB105区文件 |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | // 重新测量 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2); |
| | | //删除数据 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 2); |
| | | // 删除数据 |
| | | QueueMapper.DeleteErrorQueue(); |
| | | // plcmes.getPlcParameter("GaToMES").setValue("2"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | // 筛选处理数据 1.去除无用数据 2.计算配片ID 3.计算ID 4. 计算总层数 |
| | | List<Map> TypeDatas = homeMapper.SelectType(); |
| | | Map<String, String> TypeData = new HashMap<String, String>();// 得到处理完后所有的类型 |
| | | Map<String, Integer> groupby=new HashMap<String, Integer>(); // 得到处理完后所有总层数; |
| | | Map<String, Integer> OrderFinishedProduct=new HashMap<String, Integer>(); // 得到处理完后订单成品总数量; |
| | | //"order zong 0 1 10 2 10" |
| | | Map<String, Integer> groupby = new HashMap<String, Integer>(); // 得到处理完后所有总层数; |
| | | Map<String, Integer> OrderFinishedProduct = new HashMap<String, Integer>(); // 得到处理完后订单成品总数量; |
| | | // "order zong 0 1 10 2 10" |
| | | List<Map> RemoveErrorData = IportDataStr.stream() |
| | | .filter(item -> (item.get("order") != null && item.get("glasstype") != null && item.get("tier") != null |
| | | && |
| | | item.get("films") != null && item.get("base") != null && item.get("height") != null |
| | | && item.get("thickness") != null && item.get("quantity") != null&& item.get("matching") != null)) |
| | | && item.get("thickness") != null && item.get("quantity") != null |
| | | && item.get("matching") != null)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | TypeDatas.forEach(item -> { |
| | |
| | | }); |
| | | |
| | | RemoveErrorData.forEach(item -> { |
| | | String key=item.get("order").toString()+"_"+item.get("matching").toString(); |
| | | String keyCount=item.get("order").toString()+"_"+item.get("matching").toString()+"_"+item.get("tier").toString(); |
| | | String keyCountSum=item.get("order").toString()+"_"+item.get("matching").toString()+"_Sum";//订单总数 |
| | | if (OrderFinishedProduct.get(keyCount)!=null) { |
| | | Integer count=OrderFinishedProduct.get(keyCount)+1; |
| | | Integer sumcount=OrderFinishedProduct.get(keyCountSum)+Integer.parseInt(item.get("quantity").toString()); |
| | | OrderFinishedProduct.put(keyCount,count); |
| | | OrderFinishedProduct.put(keyCountSum,sumcount); |
| | | }else if(OrderFinishedProduct.get(keyCount)==null&&groupby.get(key)==null){ |
| | | OrderFinishedProduct.put(keyCount,1); |
| | | OrderFinishedProduct.put(keyCountSum,Integer.parseInt(item.get("quantity").toString())); |
| | | String key = item.get("order").toString() + "_" + item.get("matching").toString(); |
| | | String keyCount = item.get("order").toString() + "_" + item.get("matching").toString() + "_" |
| | | + item.get("tier").toString(); |
| | | String keyCountSum = item.get("order").toString() + "_" + item.get("matching").toString() + "_Sum";// 订单总数 |
| | | if (OrderFinishedProduct.get(keyCount) != null) { |
| | | Integer count = OrderFinishedProduct.get(keyCount) + 1; |
| | | Integer sumcount = OrderFinishedProduct.get(keyCountSum) |
| | | + Integer.parseInt(item.get("quantity").toString()); |
| | | OrderFinishedProduct.put(keyCount, count); |
| | | OrderFinishedProduct.put(keyCountSum, sumcount); |
| | | } else if (OrderFinishedProduct.get(keyCount) == null && groupby.get(key) == null) { |
| | | OrderFinishedProduct.put(keyCount, 1); |
| | | OrderFinishedProduct.put(keyCountSum, Integer.parseInt(item.get("quantity").toString())); |
| | | } |
| | | if (groupby.get(key)!=null) { |
| | | Integer Tiers=groupby.get(key)+1; |
| | | if (groupby.get(key) != null) { |
| | | Integer Tiers = groupby.get(key) + 1; |
| | | groupby.put(key, Tiers); |
| | | }else{ |
| | | } else { |
| | | groupby.put(key, 1); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | System.out.println(RemoveErrorData.size()); |
| | | // 处理完成 添加数据库 |
| | | int count=1; |
| | | int count = 1; |
| | | for (Map map : RemoveErrorData) { |
| | | String key = map.get("base").toString() + "_" + map.get("height").toString() + "_" |
| | | + map.get("thickness").toString() + "_" + map.get("films").toString(); |
| | | + map.get("thickness").toString() + "_" + map.get("films").toString(); |
| | | |
| | | String tierkey = map.get("order").toString() + "_" + map.get("matching").toString(); |
| | | |
| | |
| | | Integer glasstype; |
| | | if (TypeData.get(key) == null) { |
| | | glasstype = homeMapper.SelectMaxType(); |
| | | if (glasstype==null) { |
| | | glasstype=1; |
| | | if (glasstype == null) { |
| | | glasstype = 1; |
| | | } |
| | | } else { |
| | | glasstype = Integer.valueOf(value); |
| | |
| | | // |
| | | homeMapper.AddGlassinfo(map.get("order").toString(), glasstype, |
| | | Integer.parseInt(map.get("matching").toString()) // 需要计算 配片ID |
| | | ,map.get("order").toString()+"-"+count+"" // 需要计算 玻璃ID |
| | | , map.get("order").toString() + "-" + count + "" // 需要计算 玻璃ID |
| | | , Integer.parseInt(map.get("tier").toString()), map.get("films").toString(), |
| | | Double.parseDouble(map.get("base").toString()), Double.parseDouble(map.get("height").toString()), |
| | | Double.parseDouble(map.get("thickness").toString()), |
| | | Integer.parseInt(map.get("quantity").toString()),groupby.get(tierkey));// 需要计算总层数 |
| | | //订单内总层数 |
| | | homeMapper.InsertFlowcard(map.get("order").toString(),OrderFinishedProduct.get(tierkey+"_Sum")); |
| | | Integer.parseInt(map.get("quantity").toString()), groupby.get(tierkey));// 需要计算总层数 |
| | | // 订单内总层数 |
| | | homeMapper.InsertFlowcard(map.get("order").toString(), OrderFinishedProduct.get(tierkey + "_Sum")); |
| | | count++; |
| | | } |
| | | Map<String, Object> ResultCode = new HashMap<>(); |
| | | ResultCode.put("message", "200"); |
| | | return Result.success(ResultCode); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |