|
|
|
@ -15,15 +15,9 @@ import javax.persistence.EntityManager;
|
|
|
|
|
import javax.persistence.Query;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : MES物料信息Dao
|
|
|
|
|
* @Reference :
|
|
|
|
|
* @Author : xiangming.liao
|
|
|
|
|
* @CreateDate : 2020-02-21
|
|
|
|
|
* @Modify:
|
|
|
|
|
**/
|
|
|
|
|
@Service
|
|
|
|
|
public class MesEquipmentLogDao implements IMesEquipmentLogDao {
|
|
|
|
|
|
|
|
|
@ -69,15 +63,13 @@ public class MesEquipmentLogDao implements IMesEquipmentLogDao {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateEquipVariableStatus(String organizeCode, Integer equipId, List<Long> equipmentLogIdList, Integer equipVariableStatus) {
|
|
|
|
|
public void updateEquipVariableStatus(String organizeCode, Integer equipId, Map<Long, String> equipmentLogIdMap, Integer equipVariableStatus) {
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(equipId) || CollectionUtils.isEmpty(equipmentLogIdList)) return;
|
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(equipId) || CollectionUtils.isEmpty(equipmentLogIdMap) || StringUtils.isEmpty(equipVariableStatus)) return;
|
|
|
|
|
|
|
|
|
|
StringBuffer builder = new StringBuffer();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < equipmentLogIdList.size(); i ++) {
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(equipmentLogIdList.get(i))) continue;
|
|
|
|
|
for (int i = 0; i < equipmentLogIdMap.size(); i ++) {
|
|
|
|
|
|
|
|
|
|
builder.append(" update mes_equipment_log_");
|
|
|
|
|
builder.append(equipId);
|
|
|
|
@ -85,16 +77,21 @@ public class MesEquipmentLogDao implements IMesEquipmentLogDao {
|
|
|
|
|
builder.append(i);
|
|
|
|
|
builder.append(" where id = :id_");
|
|
|
|
|
builder.append(i);
|
|
|
|
|
builder.append(" and modify_date_time = :modifyDatetime_");
|
|
|
|
|
builder.append(i);
|
|
|
|
|
builder.append(" ;");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Query update = entityManager.createNativeQuery(builder.toString());
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < equipmentLogIdList.size(); i ++) {
|
|
|
|
|
if (StringUtils.isEmpty(equipmentLogIdList.get(i))) continue;
|
|
|
|
|
update.setParameter(String.format("%s_%s", MesPcnExtConstWords.EQUIP_VARIABLE_STATUS, i), equipVariableStatus);
|
|
|
|
|
update.setParameter(String.format("%s_%s", MesPcnExtConstWords.ID, i), equipmentLogIdList.get(i));
|
|
|
|
|
Integer index = 0;
|
|
|
|
|
for (Map.Entry<Long, String> entry : equipmentLogIdMap.entrySet()) {
|
|
|
|
|
if (null == entry) continue;
|
|
|
|
|
update.setParameter(String.format("%s_%s", MesPcnExtConstWords.EQUIP_VARIABLE_STATUS, index), equipVariableStatus);
|
|
|
|
|
update.setParameter(String.format("%s_%s", MesPcnExtConstWords.ID, index), entry.getKey());
|
|
|
|
|
update.setParameter(String.format("%s_%s", MesPcnExtConstWords.MODIFY_DATE_TIME, index), entry.getValue());
|
|
|
|
|
index ++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update.executeUpdate();
|
|
|
|
|