fix:设备台账新增报错问题解决

This commit is contained in:
zhangxuanming 2024-12-20 09:24:54 +08:00
parent 43e8d5f5bf
commit 52954eb751

View File

@ -10,6 +10,7 @@ import com.ktg.mes.wm.utils.WmBarCodeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@ -66,8 +67,9 @@ public class DvMachineryServiceImpl implements IDvMachineryService
return AjaxResult.error("设备编码重复");
}
dvMachinery.setCreateTime(DateUtils.getNowDate());
dvMachineryMapper.insertDvMachinery(dvMachinery);
wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_MACHINERY,dvMachinery.getMachineryId(),dvMachinery.getMachineryCode(),dvMachinery.getMachineryName());
return AjaxResult.success(dvMachineryMapper.insertDvMachinery(dvMachinery));
return AjaxResult.success("操作成功");
}
/**
@ -120,6 +122,7 @@ public class DvMachineryServiceImpl implements IDvMachineryService
for (DvMachinery machinery : machineryList) {
// 去除空格
String machineryCode = machinery.getMachineryCode().trim();
machinery.setCreateTime(new Date());
List<DvMachinery> existing = dvMachineryMapper.selectByMachineryCode(machineryCode);
if (existing != null && existing.size() > 0) {
if (isUpdateSupport) {