PDA上允许用户删除点检单,并且同步到WEB端

tags/yfai-pcn-ext-v2.5
王杰 5 months ago
parent b775ab0fa1
commit 420f043fd1

@ -104,5 +104,7 @@ public interface IMesSpotCheckOrderService {
@ApiOperation(value = "新增信息", notes = "新增信息")
MesSpotCheckOrder insert(MesSpotCheckOrder bean);
@ApiOperation(value = "删除点检单", notes = "删除点检单")
void deleteBatchIds(Long[] ids, String userName, String organizeCode);
}

@ -193,5 +193,21 @@ public class MesSpotCheckOrderController {
}
}
@PostMapping("/batch-delete-ids")
@ApiOperation(value = "重新点检")
public ResultBean deleteBatchIds(Long[] ids, String userName, String organizeCode) {
try {
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(userName) || null == ids) {
throw new ImppBusiException("请检查参数");
}
spotCheckOrderService.deleteBatchIds(ids, userName, organizeCode);
return ResultBean.success("重新点检成功");
} catch (ImppBusiException imppException) {
return ResultBean.fail(imppException);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -665,5 +665,56 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
}
}
@Override
public void deleteBatchIds(Long[] ids, String userName, String organizeCode) {
for (Long id : ids) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(id, MesPcnExtConstWords.ID, ddlPackBean);
MesSpotCheckOrder spotCheckOrder = spotCheckOrderRepository.getByProperty(ddlPackBean);
if (null == spotCheckOrder) continue;
if (!StringUtils.isEmpty(spotCheckOrder.getStatus()) && spotCheckOrder.getStatus().compareTo(MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.COMPLETE.getValue()) == 0 &&
!StringUtils.isEmpty(spotCheckOrder.getSpotCheckOrderResult()) && spotCheckOrder.getSpotCheckOrderResult().compareTo(MesExtEnumUtil.SPOT_CHECK_ORDER_RESULT_TYPE.OK.getValue()) == 0) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】点检单状态为【%s】,且点检结果为OK,不允许修改,请检查数据", spotCheckOrder.getSpotCheckId(), MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.valueOfDescription(spotCheckOrder.getStatus()))
.build();
}
spotCheckOrder.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
spotCheckOrder.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
ConvertBean.serviceModelUpdate(spotCheckOrder, userName);
//获取点检方案明细
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(id, MesPcnExtConstWords.PID, packBean);
List<MesSpotCheckOrderResult> detailList = spotCheckOrderResultRepository.findByHqlWhere(packBean);
if (!CollectionUtils.isEmpty(detailList)) {
detailList.forEach(k -> {
k.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
k.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
k.setSystemSyncDatetime("");
ConvertBean.serviceModelUpdate(k, userName);
});
spotCheckOrderResultRepository.saveAll(detailList);
}
//获取点检方案零件 主表零件表 spotCheckId-pid关联
//获取点检单零件号
DdlPackBean orderPartPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(id, MesPcnExtConstWords.SPOT_CHECK_ORDER_ID, orderPartPackBean);
List<MesSpotCheckOrderPart> oldOrderPartList = spotCheckOrderPartRepository.findByHqlWhere(orderPartPackBean);
if (!CollectionUtils.isEmpty(oldOrderPartList)) {
oldOrderPartList.forEach(k -> {
k.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
k.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
k.setSystemSyncDatetime("");
ConvertBean.serviceModelUpdate(k, userName);
});
spotCheckOrderPartRepository.saveAll(oldOrderPartList);
}
}
}
}

@ -279,6 +279,8 @@ public class MesPcnExtConstWords {
public static final String REPORT_TYPE = "reportType";
//发运时间
public static final String SHIPPING_TIME = "shippingTime";
//点检单id
public static final String SPOT_CHECK_ORDER_ID = "spotCheckOrderId";
//BaseBean字段不包含工厂, 用于对象复制剔除属性BeanUtils.copyProperties(Object source, Object target, String... ignoreProperties)

Loading…
Cancel
Save