修改pc端修改上线后 APP端采购页面变更了,购物车里没有变

This commit is contained in:
yangjun 2025-11-27 15:16:15 +08:00
parent e4e3efd509
commit 083635bf59
3 changed files with 65 additions and 7 deletions

View File

@ -84,9 +84,12 @@ public class InvoicingApi {
@ApiOperation(value="生成采购单预览信息", notes="生成采购单预览信息")
@AutoLog(value = "生成采购单预览信息")
@PostMapping(value = "/generatedPurchaseViewOrder")
public Result<List<CgdMainEntity>> generatedPurchaseViewOrder(@RequestBody List<QgdInfoEntity> infoList, HttpServletRequest req) {
List<CgdMainEntity> list = invoicingApi.generatedPurchaseViewOrder(infoList);
return Result.OK(list);
public Result<Object> generatedPurchaseViewOrder(@RequestBody List<QgdInfoEntity> infoList, HttpServletRequest req) {
Map<String,Object> list = invoicingApi.generatedPurchaseViewOrder(infoList);
if(list.get("status").equals("2")){
return Result.error(list.get("errorMessage").toString());
}
return Result.OK(list.get("data"));
}
@ApiOperation(value="生成采购单信息", notes="生成采购单信息")
@AutoLog(value = "生成采购单信息")

View File

@ -16,7 +16,7 @@ public interface IInvoicingApi {
String addShoppingCartList(List<QgdInfoEntity> infoList,Integer maxCount);
List<CgdMainEntity> generatedPurchaseViewOrder(List<QgdInfoEntity> infoList);
Map<String,Object> generatedPurchaseViewOrder(List<QgdInfoEntity> infoList);
IPage<CgdMainEntity> queryCgdList(Integer pageNo, Integer pageSize, CgdMainEntity cgdMainEntityDto, HttpServletRequest req);

View File

@ -257,8 +257,9 @@ public class NuInvoicingCgdMainServiceImpl extends ServiceImpl<NuInvoicingCgdMai
}
@Override
public List<CgdMainEntity> generatedPurchaseViewOrder(List<QgdInfoEntity> infoEntityList) {
public Map<String,Object> generatedPurchaseViewOrder(List<QgdInfoEntity> infoEntityList) {
Map<String,Object> map = new HashMap<>();
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<NuInvoicingCgdMain> mapList = new ArrayList<>();
@ -266,8 +267,52 @@ public class NuInvoicingCgdMainServiceImpl extends ServiceImpl<NuInvoicingCgdMai
Map<String, List<QgdInfo>> tempMap = new HashMap<>();
String nuId = infoEntityList.get(0).getNuId();
//获取物料集合
List<String> wlIdList = new ArrayList<>();
//错误提示
String errorMessage = "";
for (QgdInfoEntity qgdInfoEntity : infoEntityList) {
ConfigMaterialInfo configMaterialInfo = configMaterialInfoMapper.selectById(qgdInfoEntity.getWlId());
if(!StringUtils.equals(qgdInfoEntity.getWlName(),configMaterialInfo.getMaterialName())){
errorMessage = "物料名称不一致,请移除【"+qgdInfoEntity.getWlName()+"】物料编码为【"+qgdInfoEntity.getWlMaterialNo()+"】这个物料后重新采购!";
break;
}
if(!StringUtils.equals(qgdInfoEntity.getWlMaterialNo(),configMaterialInfo.getMaterialNo())){
errorMessage = "物料编码不一致,请移除【"+qgdInfoEntity.getWlName()+"】物料编码为【"+qgdInfoEntity.getWlMaterialNo()+"】这个物料后重新采购!";
break;
}
if(!StringUtils.equals(qgdInfoEntity.getWlUnits(),configMaterialInfo.getMaterialUnits()) && !StringUtils.equals(qgdInfoEntity.getWlUnits(),configMaterialInfo.getOneUnit()) && !StringUtils.equals(qgdInfoEntity.getWlUnits(),configMaterialInfo.getTwoUnit())){
errorMessage = "采购单位不一致,请移除【"+qgdInfoEntity.getWlName()+"】采购单位为【"+qgdInfoEntity.getWlUnits()+"】这个物料后重新采购!";
break;
}
if(!StringUtils.equals(qgdInfoEntity.getWlSpecificationModel(),configMaterialInfo.getSpecificationModel())){
errorMessage = "规格型号不一致,请移除【"+qgdInfoEntity.getWlName()+"】规格型号为【"+qgdInfoEntity.getWlSpecificationModel()+"】这个物料后重新采购!";
break;
}
String price = String.format("%.2f",configMaterialInfo.getReferenceUnitPrice());
String oneprice = String.format("%.2f",configMaterialInfo.getOneUnitPrice());
String twoprice = String.format("%.2f",configMaterialInfo.getTwoUnitPrice());
String cgdj = String.format("%.2f",qgdInfoEntity.getReferenceUnitPrice());
if(StringUtils.equals(cgdj,price) || StringUtils.equals(cgdj,oneprice) || StringUtils.equals(cgdj,twoprice)){
//如果有一个相等了就代表是正确的
//一个都没有相等则说明是错误的
}else{
errorMessage = "采购单价不一致,请移除【"+qgdInfoEntity.getWlName()+"】采购单价为【"+qgdInfoEntity.getReferenceUnitPrice()+"】这个物料后重新采购!";
break;
}
if(!StringUtils.equals(qgdInfoEntity.getWlUpperLimit(),configMaterialInfo.getUpperLimit())){
errorMessage = "物料上限不一致,请移除【"+qgdInfoEntity.getWlName()+"】物料上限为【"+qgdInfoEntity.getWlUpperLimit()+"】这个物料后重新采购!";
break;
}
if(!StringUtils.equals(qgdInfoEntity.getWlLowerLimit(),configMaterialInfo.getLowerLimit())){
errorMessage = "物料下限不一致,请移除【"+qgdInfoEntity.getWlName()+"】物料下限为【"+qgdInfoEntity.getWlLowerLimit()+"】这个物料后重新采购!";
break;
}
wlIdList.add(qgdInfoEntity.getWlId());
String suppliersId = qgdInfoEntity.getSuppliersId();
if (!tempMap.containsKey(suppliersId)) {
tempMap.put(suppliersId, new ArrayList<>());
@ -276,6 +321,14 @@ public class NuInvoicingCgdMainServiceImpl extends ServiceImpl<NuInvoicingCgdMai
BeanUtils.copyProperties(qgdInfoEntity,qgdInfo);
tempMap.get(suppliersId).add(qgdInfo);
}
//判断是否错误
if(StringUtils.isNotBlank(errorMessage)){
System.out.println(errorMessage);
map.put("status","2");
map.put("errorMessage",errorMessage);
return map;
}
String qgdDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
String qgdXlh = "";
@ -367,7 +420,9 @@ public class NuInvoicingCgdMainServiceImpl extends ServiceImpl<NuInvoicingCgdMai
System.out.println(mapList);
List<CgdMainEntity> mapList2 = BeanUtil.copyToList(mapList,CgdMainEntity.class);
return mapList2;
map.put("status","1");
map.put("data",mapList2);
return map;
}