|
@@ -35,6 +35,7 @@ import java.io.*;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 设备管理
|
|
@@ -115,6 +116,10 @@ public class MachineManageAction implements IMINAction {
|
|
|
|
|
|
/**解绑机台号*/
|
|
|
public final static String DELETE_EQU = "deleteEqu";
|
|
|
+
|
|
|
+ /**生成指定机器指定行列的货道*/
|
|
|
+ public final static String ADD_PRO_EQU_REL = "addProEquRelLineRow";
|
|
|
+
|
|
|
private boolean contains;
|
|
|
|
|
|
|
|
@@ -149,6 +154,7 @@ public class MachineManageAction implements IMINAction {
|
|
|
map.put("equType", equType);
|
|
|
map.put("machineName", machineName);
|
|
|
map.put("createUser", createUser);
|
|
|
+ map.put("state", state);
|
|
|
map.put("channel", user.getChannel());//渠道号
|
|
|
//验证操作员权限
|
|
|
MINRowBounds rows = new MINRowBounds(page, limit);
|
|
@@ -156,6 +162,9 @@ public class MachineManageAction implements IMINAction {
|
|
|
List<Map<String, String>> list = Service.lookup(IMINDataBaseService.class)
|
|
|
.getMybatisMapper(MachineManageMapper.class)
|
|
|
.machineInf(map, rows);
|
|
|
+ //在线数
|
|
|
+ int online = list.stream().filter(item -> item.get("state").equals("00")).collect(Collectors.toList()).size();
|
|
|
+ int unOnline = list.stream().filter(item -> item.get("state").equals("01")).collect(Collectors.toList()).size();
|
|
|
//格式化时间和状态
|
|
|
list = Service.lookup(IFormatService.class).formatDateTime(list, "createTime", "modifyTime");
|
|
|
list = new MINCopyFormat("{state:'stateDesc',equType :'equTypeDesc'}").format(list);
|
|
@@ -163,6 +172,8 @@ public class MachineManageAction implements IMINAction {
|
|
|
//返回数据
|
|
|
res.set(IMINBusinessConstant.F_PAGING_LAY, list);
|
|
|
res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getMaxRows());
|
|
|
+ res.set("online",String.valueOf(online));
|
|
|
+ res.set("unOnline",String.valueOf(unOnline));
|
|
|
return res;
|
|
|
}
|
|
|
|
|
@@ -223,7 +234,7 @@ public class MachineManageAction implements IMINAction {
|
|
|
pro.setId(id);
|
|
|
pro.setMachineNo(equCode);
|
|
|
pro.setChannel("V01");
|
|
|
- pro.setState("00");
|
|
|
+ pro.setState("01");
|
|
|
pro.setCreateUser(user.getId());
|
|
|
pro.setCreateTime(nowTime);
|
|
|
pro.setRows(temRow);
|
|
@@ -237,7 +248,7 @@ public class MachineManageAction implements IMINAction {
|
|
|
pros.setId(ids);
|
|
|
pros.setChannel("V01");
|
|
|
pros.setMachineNo(CommonUtil.add(equCode, String.valueOf(i)));
|
|
|
- pros.setState("00");
|
|
|
+ pros.setState("01");
|
|
|
pros.setCreateUser(user.getId());
|
|
|
pros.setCreateTime(nowTime);
|
|
|
pros.setRows(temRow);
|
|
@@ -1357,4 +1368,44 @@ public class MachineManageAction implements IMINAction {
|
|
|
Service.lookup(ILogService.class).logging(session, logInfo);*/
|
|
|
return res;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 添加设备货道
|
|
|
+ *
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = ADD_PRO_EQU_REL, transaction = IMINTransactionEnum.CMT)
|
|
|
+ public MINActionResult addProEquRelLineRow(
|
|
|
+ @MINParam(key = "line") String line,
|
|
|
+ @MINParam(key = "row") String row,
|
|
|
+ @MINParam(key = "equId") String equId,
|
|
|
+ MINSession session) throws MINBusinessException {
|
|
|
+
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+ //获取当前时间
|
|
|
+ String nowTime = DateUtil.getCurrentDateTimeString();
|
|
|
+ // 获取操作员信息
|
|
|
+ User user = session.getUser();
|
|
|
+ VmProEquRelExample example = new VmProEquRelExample();
|
|
|
+ example.createCriteria().andIdEqualTo(equId).andCargoWayLineEqualTo(CommonUtil.subtract(line,"1")).andCargoWayRowEqualTo(CommonUtil.subtract(row,"1"));
|
|
|
+ List<VmProEquRel> List = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmProEquRelMapper.class).selectByExample(example);
|
|
|
+ if (List.size()>0){
|
|
|
+ throw new MINBusinessException("货道已存在");
|
|
|
+ }
|
|
|
+ String id = Service.lookup(IPublicService.class).getSequence("VM_PROEQUREL_ID");
|
|
|
+ VmProEquRel vmProEquRel = new VmProEquRel();
|
|
|
+ vmProEquRel.setId(id);
|
|
|
+ vmProEquRel.setEquipmentId(equId);
|
|
|
+ vmProEquRel.setCargoWayLine(CommonUtil.subtract(line,"1"));
|
|
|
+ vmProEquRel.setCargoWayRow(CommonUtil.subtract(row,"1"));
|
|
|
+ vmProEquRel.setExeitState("00");
|
|
|
+ vmProEquRel.setCreateTime(nowTime);
|
|
|
+ vmProEquRel.setCreateUser(user.getId());
|
|
|
+ Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmProEquRelMapper.class).insertSelective(vmProEquRel);
|
|
|
+ /*// 记录操作日志
|
|
|
+ String logInfo = "操作员:" + user.getName() + "添加商品,商品编号:" + id;
|
|
|
+ Service.lookup(ILogService.class).logging(session, logInfo);*/
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|