|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.xujie.common.utils.PageUtils; |
|
|
|
import com.xujie.modules.base.dao.PropertiesMapper; |
|
|
|
import com.xujie.modules.baseInformation.mapper.SrmPartSkuMapper; |
|
|
|
import com.xujie.modules.constants.FlowInstanceConstans; |
|
|
|
import com.xujie.modules.part.dao.PartMapper; |
|
|
|
import com.xujie.modules.part.entity.Part; |
|
|
|
@ -51,6 +52,8 @@ public class PartServiceImpl extends ServiceImpl<PartMapper, Part> implements IP |
|
|
|
private ErfFlowInstanceService erfFlowInstanceService; |
|
|
|
@Autowired |
|
|
|
private PropertiesMapper propertiesMapper; |
|
|
|
@Autowired |
|
|
|
private SrmPartSkuMapper srmPartSkuMapper; |
|
|
|
|
|
|
|
@Value("${part.formal-approval.enabled:true}") |
|
|
|
private Boolean partFormalApprovalEnabled; |
|
|
|
@ -66,6 +69,12 @@ public class PartServiceImpl extends ServiceImpl<PartMapper, Part> implements IP |
|
|
|
throw new RuntimeException("工厂不能为空(请前端传site)"); |
|
|
|
} |
|
|
|
|
|
|
|
// 传了sku时校验site+sku在part_sku中是否已维护,未传sku则不校验 |
|
|
|
String sku = StringUtils.trim(model.getSku()); |
|
|
|
if (StringUtils.isNotBlank(sku) && srmPartSkuMapper.selectPartSkuByCode(sku, site) == null) { |
|
|
|
throw new RuntimeException("当前SKU不存在,请先维护"); |
|
|
|
} |
|
|
|
|
|
|
|
// 新增时按“基准料号 + 后缀”规则自动生成料号 |
|
|
|
if (model.getId() == null) { |
|
|
|
if (StringUtils.isBlank(model.getPartNo())) { |
|
|
|
|