|
|
|
@ -30,6 +30,7 @@ import java.util.Map; |
|
|
|
public class RohsController { |
|
|
|
|
|
|
|
private static final String REFERENCE_NO_TRANS_TYPE = "reference_no"; |
|
|
|
private static final String HSF_STANDARD_CUSTOMER = "C00052"; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RohsService rohsService; |
|
|
|
@ -134,6 +135,7 @@ public class RohsController { |
|
|
|
if (StringUtils.isBlank(rohs.getRejectFlag())) { |
|
|
|
rohs.setRejectFlag("N"); |
|
|
|
} |
|
|
|
sanitizeHsfStandard(rohs); |
|
|
|
rohsService.save(rohs); |
|
|
|
rohsService.saveOrUpdateMaterials(rohs); |
|
|
|
return R.ok().put("referenceNo", newReferenceNo); |
|
|
|
@ -166,6 +168,7 @@ public class RohsController { |
|
|
|
QueryWrapper<RohsEntity> updateWrapper = new QueryWrapper<>(); |
|
|
|
updateWrapper.eq("site", rohs.getSite()).eq("reference_no", rohs.getReferenceNo()); |
|
|
|
|
|
|
|
sanitizeHsfStandard(rohs); |
|
|
|
rohsService.update(rohs, updateWrapper); |
|
|
|
rohsService.saveOrUpdateMaterials(rohs); |
|
|
|
return R.ok(); |
|
|
|
@ -287,4 +290,14 @@ public class RohsController { |
|
|
|
SysUserEntity user = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
return user == null ? "" : user.getUsername(); |
|
|
|
} |
|
|
|
|
|
|
|
private void sanitizeHsfStandard(RohsEntity rohs) { |
|
|
|
if (rohs == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
String endCustomer = StringUtils.trimToEmpty(rohs.getEndCustomer()); |
|
|
|
if (!HSF_STANDARD_CUSTOMER.equalsIgnoreCase(endCustomer)) { |
|
|
|
rohs.setHsfStandard(""); |
|
|
|
} |
|
|
|
} |
|
|
|
} |