修改接口校验
This commit is contained in:
parent
b4d2d2b3b1
commit
23b123da53
|
|
@ -65,6 +65,11 @@ public class InvoicingApi {
|
|||
@PostMapping(value = "/eddShoppingCartList")
|
||||
public Result<String> eddShoppingCartList(@RequestBody QgdInfoEntity qgdInfoEntity) {
|
||||
String result = invoicingApi.eddShoppingCartList(qgdInfoEntity);
|
||||
if("1".equals( result)){
|
||||
return Result.error("请购信息已存在,不可重复请购!");
|
||||
}else if(result.indexOf("2@")>-1){
|
||||
return Result.error("您已有其他物料请购数据,请购总数量超出库存上限,请修改请购数量,剩余请购数量为:" + result.split("@")[1]);
|
||||
}
|
||||
return Result.OK("修改成功!");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -606,10 +606,32 @@ public class NuInvoicingCgdMainServiceImpl extends ServiceImpl<NuInvoicingCgdMai
|
|||
}
|
||||
|
||||
@Override
|
||||
public String eddShoppingCartList(QgdInfoEntity qgdInfoEntity) {
|
||||
public String eddShoppingCartList(QgdInfoEntity info) {
|
||||
QgdInfo qgdInfo = new QgdInfo();
|
||||
BeanUtils.copyProperties(qgdInfoEntity,qgdInfo);
|
||||
BeanUtils.copyProperties(info,qgdInfo);
|
||||
|
||||
QgdInfo qgdInfoRes = qgdInfoMapper.selectOne(new QueryWrapper<QgdInfo>().eq("wl_id",info.getWlId()).eq("nu_id",info.getNuId()).eq("suppliers_id",info.getSuppliersId()));
|
||||
|
||||
//获取物料基础信息
|
||||
ConfigMaterialInfo ConfigMaterialInfo = configMaterialInfoMapper.selectById(info.getWlId());
|
||||
if(qgdInfoRes!=null){
|
||||
return "1";
|
||||
}
|
||||
List<QgdInfo> listqg = qgdInfoMapper.selectList(new QueryWrapper<QgdInfo>().eq("wl_id",info.getWlId()).eq("nu_id",info.getNuId()));
|
||||
int totalQgsl = 0;
|
||||
if(StringUtils.isNotBlank(info.getKcsl())){
|
||||
totalQgsl = Integer.parseInt(info.getKcsl());
|
||||
}
|
||||
for(QgdInfo qgdInfoParam : listqg){
|
||||
totalQgsl += qgdInfoParam.getPurchaseQuantity();
|
||||
}
|
||||
int dqsl = info.getPurchaseQuantity();
|
||||
String upperLimit = ConfigMaterialInfo.getUpperLimit();
|
||||
if(Integer.parseInt(upperLimit)<(totalQgsl + dqsl)){
|
||||
return "2@"+ (Integer.parseInt(upperLimit) - totalQgsl);
|
||||
}
|
||||
|
||||
qgdInfoMapper.updateById(qgdInfo);
|
||||
return "1";
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue