请领单、退货单提交必须有物料检测
This commit is contained in:
parent
5584085a2e
commit
4a38ac5397
|
|
@ -293,14 +293,14 @@ public class QingLingServiceImpl implements IQinglingApi {
|
|||
}
|
||||
|
||||
//检测是否有物料
|
||||
// QueryWrapper<NuInvoicingQldInfo> infoQW = new QueryWrapper<>();
|
||||
// infoQW.eq("qld_no", dto.getQldNo());
|
||||
// List<NuInvoicingQldInfo> infoList = invoicingQldInfoMapper.selectList(infoQW);
|
||||
// if (CollectionUtils.isEmpty(infoList)) {
|
||||
// result.put("status", "faild");
|
||||
// result.put("message", "不存在物料,无法提交");
|
||||
// return result;
|
||||
// }
|
||||
QueryWrapper<NuInvoicingQldInfo> infoQW = new QueryWrapper<>();
|
||||
infoQW.eq("qld_no", dto.getQldNo());
|
||||
List<NuInvoicingQldInfo> infoList = invoicingQldInfoMapper.selectList(infoQW);
|
||||
if (CollectionUtils.isEmpty(infoList)) {
|
||||
result.put("status", "faild");
|
||||
result.put("message", "不存在物料,无法提交");
|
||||
return result;
|
||||
}
|
||||
|
||||
//回退单-提交
|
||||
QueryWrapper<NuInvoicingQldMain> qw = new QueryWrapper<>();
|
||||
|
|
@ -370,11 +370,11 @@ public class QingLingServiceImpl implements IQinglingApi {
|
|||
List<NuInvoicingQldGwc> gwcList = invoicingQldGwcService.list(gwcQW);
|
||||
|
||||
//请购车未添加物料
|
||||
// if (CollectionUtils.isEmpty(gwcList)) {
|
||||
// result.put("status", "empty");
|
||||
// result.put("message", "请选择请领物料");
|
||||
// return result;
|
||||
// }
|
||||
if (CollectionUtils.isEmpty(gwcList)) {
|
||||
result.put("status", "empty");
|
||||
result.put("message", "请选择请领物料");
|
||||
return result;
|
||||
}
|
||||
|
||||
//检测哪些“物料”有未完成请领流程的
|
||||
{
|
||||
|
|
|
|||
|
|
@ -276,8 +276,8 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
//指令工单处判断是否允许提交
|
||||
InvoicingOrdersEntity p_ = new InvoicingOrdersEntity();
|
||||
p_.setPoolId(dto.getId());
|
||||
Map<String, String> j = invoicingThOrdersApi.izCanSubmit(p_);
|
||||
if (!j.get("error_code").equals("0")) {
|
||||
Map<String,String> j = invoicingThOrdersApi.izCanSubmit(p_);
|
||||
if(!j.get("error_code").equals("0")){
|
||||
result.put("status", "nodeError");
|
||||
result.put("message", j.get("msg"));
|
||||
return result;
|
||||
|
|
@ -310,11 +310,11 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
// return result;
|
||||
// }
|
||||
//未添加退货物料检测
|
||||
// if (CollectionUtils.isEmpty(gwcList)) {
|
||||
// result.put("status", "faild");
|
||||
// result.put("message", "未添加物料");
|
||||
// return result;
|
||||
// }
|
||||
if (CollectionUtils.isEmpty(gwcList)) {
|
||||
result.put("status", "faild");
|
||||
result.put("message", "未添加物料");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//处理数据 主表当前数据:main
|
||||
|
|
@ -373,160 +373,44 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
thdMainMapper.updateById(main);
|
||||
|
||||
//购物车数据 挪到info表里
|
||||
if (!CollectionUtils.isEmpty(gwcList)) {
|
||||
wlList = gwcList.stream().map(NuInvoicingThdGwc::getWlId).collect(Collectors.toList());
|
||||
//========================================================================
|
||||
wlList = gwcList.stream().map(NuInvoicingThdGwc::getWlId).collect(Collectors.toList());
|
||||
|
||||
//查出对应物料信息存储到info表和日志表中
|
||||
List<String> gwcWlStrs = gwcList.stream().map(NuInvoicingThdGwc::getWlId).collect(Collectors.toList());
|
||||
List<ConfigMaterialInfo> maList = configMaterialInfoMapper.queryByWlids(gwcWlStrs);
|
||||
Map<String, ConfigMaterialInfo> maMap = maList.stream().collect(Collectors.toMap(ConfigMaterialInfo::getId, item -> item));
|
||||
//查出对应物料信息存储到info表和日志表中
|
||||
List<String> gwcWlStrs = gwcList.stream().map(NuInvoicingThdGwc::getWlId).collect(Collectors.toList());
|
||||
List<ConfigMaterialInfo> maList = configMaterialInfoMapper.queryByWlids(gwcWlStrs);
|
||||
Map<String, ConfigMaterialInfo> maMap = maList.stream().collect(Collectors.toMap(ConfigMaterialInfo::getId, item -> item));
|
||||
|
||||
//移除购物车数据
|
||||
InvoicingThdGwcEntity t_ = new InvoicingThdGwcEntity();
|
||||
t_.setPkId(dto.getId());
|
||||
thdGwcMapper.removeAll(t_);
|
||||
//移除购物车数据
|
||||
InvoicingThdGwcEntity t_ = new InvoicingThdGwcEntity();
|
||||
t_.setPkId(dto.getId());
|
||||
thdGwcMapper.removeAll(t_);
|
||||
|
||||
//info表插入物料数据
|
||||
List<NuInvoicingThdInfo> infoList = Lists.newArrayList();
|
||||
for (int i = 0; i < gwcList.size(); i++) {
|
||||
NuInvoicingThdGwc gwc = gwcList.get(i);//购物车取到的单条物料
|
||||
NuInvoicingThdInfo info = new NuInvoicingThdInfo();
|
||||
info.setThdNo(thdNo);//退货单号
|
||||
info.setKfId(gwc.getKfId());//库房id
|
||||
info.setWlId(gwc.getWlId());//物料id
|
||||
info.setThNum(gwc.getThNum());//退货数量
|
||||
info.setNuId(gwc.getNuId());//护理单元id
|
||||
info.setElderId(gwc.getElderId());//长者id
|
||||
//info表插入物料数据
|
||||
List<NuInvoicingThdInfo> infoList = Lists.newArrayList();
|
||||
for (int i = 0; i < gwcList.size(); i++) {
|
||||
NuInvoicingThdGwc gwc = gwcList.get(i);//购物车取到的单条物料
|
||||
NuInvoicingThdInfo info = new NuInvoicingThdInfo();
|
||||
info.setThdNo(thdNo);//退货单号
|
||||
info.setKfId(gwc.getKfId());//库房id
|
||||
info.setWlId(gwc.getWlId());//物料id
|
||||
info.setThNum(gwc.getThNum());//退货数量
|
||||
info.setNuId(gwc.getNuId());//护理单元id
|
||||
info.setElderId(gwc.getElderId());//长者id
|
||||
|
||||
info.setMaterialCategoryName(maMap.get(gwc.getWlId()).getCategoryName());//物料类别名称
|
||||
info.setMaterialTypeName(maMap.get(gwc.getWlId()).getTypeName());//物料类型名称
|
||||
info.setMaterialMedicationName(maMap.get(gwc.getWlId()).getMedicationName());//物料类型名称
|
||||
info.setMaterialName(maMap.get(gwc.getWlId()).getMaterialName());//物料名称
|
||||
info.setMaterialUnits(maMap.get(gwc.getWlId()).getMaterialUnits());//物料单位
|
||||
info.setMaterialNo(maMap.get(gwc.getWlId()).getMaterialNo());//物料编码
|
||||
info.setSpecificationModel(maMap.get(gwc.getWlId()).getSpecificationModel());//规格型号
|
||||
info.setMaterialImg(maMap.get(gwc.getWlId()).getMaterialImg());//物料图片
|
||||
info.setSalesUnitPrice(maMap.get(gwc.getWlId()).getSalesUnitPrice());//物料销售单价
|
||||
infoList.add(info);
|
||||
}
|
||||
thdInfoService.saveBatch(infoList);
|
||||
|
||||
//库房出入库日志+库存
|
||||
{
|
||||
//库房出入库日志
|
||||
QueryWrapper<BlWarehouseMaterialInfo> kcQW = new QueryWrapper<>();
|
||||
kcQW.in("wl_id", wlList);
|
||||
List<BlWarehouseMaterialInfo> kfnumList = warehouseMaterialInfoService.list(kcQW);
|
||||
Map<String, Map<String, String>> kfWlSlMap = kfnumList.stream().collect(Collectors.groupingBy(BlWarehouseMaterialInfo::getNuId, Collectors.toMap(BlWarehouseMaterialInfo::getWlId, BlWarehouseMaterialInfo::getKcsl)));
|
||||
List<NuWarehouseMaterialCrkInfo> kfCrkLogList = Lists.newArrayList();
|
||||
for (int i = 0; i < infoList.size(); i++) {
|
||||
NuInvoicingThdInfo item = infoList.get(i);
|
||||
NuWarehouseMaterialCrkInfo kfCrkLog = new NuWarehouseMaterialCrkInfo();
|
||||
BeanUtils.copyProperties(item, kfCrkLog);
|
||||
kfCrkLog.setId(null);
|
||||
kfCrkLog.setCreateBy(null);
|
||||
kfCrkLog.setCreateTime(null);
|
||||
kfCrkLog.setUpdateBy(null);
|
||||
kfCrkLog.setUpdateTime(null);
|
||||
kfCrkLog.setCgdId(thdNo);//退货单号
|
||||
kfCrkLog.setNuId(item.getKfId());//库房id 不是nuid
|
||||
kfCrkLog.setWlId(item.getWlId());//物料id
|
||||
kfCrkLog.setCrkNum(item.getThNum());//出入库数量
|
||||
kfCrkLog.setCrkType("3");//出入库类型 3退货
|
||||
kfCrkLog.setCzqkcl(kfWlSlMap.get(item.getKfId()).get(item.getWlId()));//操作前库存量
|
||||
kfCrkLog.setDqkcl((Integer.parseInt(kfWlSlMap.get(item.getKfId()).get(item.getWlId())) + item.getThNum()) + "");//当前库存量
|
||||
kfCrkLog.setCrkStatus("1");//出入库状态 1入库
|
||||
kfCrkLog.setContent("退货单:" + thdNo);//备注
|
||||
|
||||
kfCrkLog.setMaterialCategoryName(item.getMaterialCategoryName());//物料类别名称
|
||||
kfCrkLog.setMaterialTypeName(item.getMaterialTypeName());//物料类型名称
|
||||
kfCrkLog.setMaterialMedicationName(item.getMaterialMedicationName());//物料类型名称
|
||||
kfCrkLog.setMaterialName(item.getMaterialName());//物料名称
|
||||
kfCrkLog.setMaterialUnits(item.getMaterialUnits());//物料单位
|
||||
kfCrkLog.setMaterialNo(item.getMaterialNo());//物料编码
|
||||
kfCrkLog.setSpecificationModel(item.getSpecificationModel());//规格型号
|
||||
kfCrkLog.setMaterialImg(item.getMaterialImg());//物料图片
|
||||
kfCrkLog.setSalesUnitPrice(item.getSalesUnitPrice());//物料销售单价
|
||||
kfCrkLogList.add(kfCrkLog);
|
||||
}
|
||||
warehouseMaterialCrkInfoService.saveBatch(kfCrkLogList);
|
||||
|
||||
//库房库存调整
|
||||
Map<String, Integer> thdWlNumMap = infoList.stream().collect(Collectors.toMap(NuInvoicingThdInfo::getWlId, NuInvoicingThdInfo::getThNum));
|
||||
List<BlWarehouseMaterialInfo> kfUpdateList = Lists.newArrayList();
|
||||
kfnumList.stream().forEach(item -> {
|
||||
if (thdWlNumMap.get(item.getWlId()) != null) {
|
||||
item.setKcsl((Integer.parseInt(item.getKcsl()) + thdWlNumMap.get(item.getWlId())) + "");
|
||||
kfUpdateList.add(item);
|
||||
}
|
||||
});
|
||||
warehouseMaterialInfoService.updateBatchById(kfUpdateList);
|
||||
}
|
||||
|
||||
//护理单元出入库日志+库存
|
||||
{
|
||||
//护理单元出入库日志
|
||||
List<NuInvoicingNuCrkLog> nuCrkLogList = Lists.newArrayList();
|
||||
infoList.stream().forEach(item -> {
|
||||
NuInvoicingNuCrkLog nuInvoicingNuCrkLog = new NuInvoicingNuCrkLog();
|
||||
BeanUtils.copyProperties(item, nuInvoicingNuCrkLog);
|
||||
nuInvoicingNuCrkLog.setCreateBy(null);
|
||||
nuInvoicingNuCrkLog.setCreateTime(null);
|
||||
nuInvoicingNuCrkLog.setWlNum(item.getThNum());//退货数量
|
||||
nuInvoicingNuCrkLog.setType("2");//类型 2退货
|
||||
nuInvoicingNuCrkLog.setOrderNumber(item.getThdNo());//单号
|
||||
nuInvoicingNuCrkLog.setOrderType("thd");//单子类型: thd退货单
|
||||
nuInvoicingNuCrkLog.setContent("退货单:" + item.getThdNo());//备注
|
||||
|
||||
nuInvoicingNuCrkLog.setMaterialCategoryName(item.getMaterialCategoryName());//物料类别名称
|
||||
nuInvoicingNuCrkLog.setMaterialTypeName(item.getMaterialTypeName());//物料类型名称
|
||||
nuInvoicingNuCrkLog.setMaterialMedicationName(item.getMaterialMedicationName());//物料类型名称
|
||||
nuInvoicingNuCrkLog.setMaterialName(item.getMaterialName());//物料名称
|
||||
nuInvoicingNuCrkLog.setMaterialUnits(item.getMaterialUnits());//物料单位
|
||||
nuInvoicingNuCrkLog.setMaterialNo(item.getMaterialNo());//物料编码
|
||||
nuInvoicingNuCrkLog.setSpecificationModel(item.getSpecificationModel());//规格型号
|
||||
nuInvoicingNuCrkLog.setMaterialImg(item.getMaterialImg());//物料图片
|
||||
nuInvoicingNuCrkLog.setSalesUnitPrice(item.getSalesUnitPrice());//物料销售单价
|
||||
nuCrkLogList.add(nuInvoicingNuCrkLog);
|
||||
});
|
||||
invoicingNuCrkLogService.saveBatch(nuCrkLogList);
|
||||
|
||||
//护理单元货品修改对应现有数量
|
||||
QueryWrapper<NuInvoicingNuKcsl> nuKcslQW = new QueryWrapper<>();
|
||||
nuKcslQW.eq("nu_id", main.getNuId());
|
||||
nuKcslQW.eq("elder_id", main.getElderId());
|
||||
List<NuInvoicingNuKcsl> nuKcslList = invoicingNuKcslService.list(nuKcslQW);
|
||||
List<NuInvoicingNuKcsl> needUpdateList = Lists.newArrayList();
|
||||
if (!CollectionUtils.isEmpty(nuKcslList)) {
|
||||
Map<String, NuInvoicingNuKcsl> nuKcslMap = nuKcslList.stream().collect(Collectors.toMap(NuInvoicingNuKcsl::getWlId, kcsl -> kcsl));
|
||||
infoList.stream().forEach(item -> {
|
||||
NuInvoicingNuKcsl nuInvoicingNuKcsl = new NuInvoicingNuKcsl();
|
||||
nuInvoicingNuKcsl.setNuId(item.getNuId());
|
||||
nuInvoicingNuKcsl.setElderId(item.getElderId());
|
||||
nuInvoicingNuKcsl.setWlId(item.getWlId());
|
||||
nuInvoicingNuKcsl.setKfId((item.getKfId()));
|
||||
|
||||
if (nuKcslMap.containsKey(item.getWlId())) {
|
||||
NuInvoicingNuKcsl existingKcsl = nuKcslMap.get(item.getWlId());
|
||||
nuInvoicingNuKcsl.setWlNum(existingKcsl.getWlNum() - item.getThNum());
|
||||
needUpdateList.add(nuInvoicingNuKcsl);
|
||||
} else {
|
||||
//护理单元已有物料 不包含 本次退货物料(极其低概率 可以理解为不会发生) 上面已经做了退货物料检测
|
||||
throw new RuntimeException("入库失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(needUpdateList)) {
|
||||
needUpdateList.stream().forEach(item -> {
|
||||
UpdateWrapper<NuInvoicingNuKcsl> nuKcslUW = new UpdateWrapper<>();
|
||||
nuKcslUW.eq("nu_id", item.getNuId());
|
||||
nuKcslUW.eq("elder_id", item.getElderId());
|
||||
nuKcslUW.eq("wl_id", item.getWlId());
|
||||
invoicingNuKcslService.update(item, nuKcslUW);
|
||||
});
|
||||
}
|
||||
}
|
||||
info.setMaterialCategoryName(maMap.get(gwc.getWlId()).getCategoryName());//物料类别名称
|
||||
info.setMaterialTypeName(maMap.get(gwc.getWlId()).getTypeName());//物料类型名称
|
||||
info.setMaterialMedicationName(maMap.get(gwc.getWlId()).getMedicationName());//物料类型名称
|
||||
info.setMaterialName(maMap.get(gwc.getWlId()).getMaterialName());//物料名称
|
||||
info.setMaterialUnits(maMap.get(gwc.getWlId()).getMaterialUnits());//物料单位
|
||||
info.setMaterialNo(maMap.get(gwc.getWlId()).getMaterialNo());//物料编码
|
||||
info.setSpecificationModel(maMap.get(gwc.getWlId()).getSpecificationModel());//规格型号
|
||||
info.setMaterialImg(maMap.get(gwc.getWlId()).getMaterialImg());//物料图片
|
||||
info.setSalesUnitPrice(maMap.get(gwc.getWlId()).getSalesUnitPrice());//物料销售单价
|
||||
infoList.add(info);
|
||||
}
|
||||
thdInfoService.saveBatch(infoList);
|
||||
//========================================================================
|
||||
//日志记录
|
||||
NuInvoicingThdLog logData = new NuInvoicingThdLog();
|
||||
logData.setThdId(dto.getId());//退货指令id
|
||||
|
|
@ -537,6 +421,122 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
logData.setNuId(main.getNuId());//护理单元id
|
||||
logData.setElderId(main.getElderId());//长者id
|
||||
thdLogMapper.insert(logData);
|
||||
|
||||
//库房出入库日志+库存
|
||||
{
|
||||
//库房出入库日志
|
||||
QueryWrapper<BlWarehouseMaterialInfo> kcQW = new QueryWrapper<>();
|
||||
kcQW.in("wl_id", wlList);
|
||||
List<BlWarehouseMaterialInfo> kfnumList = warehouseMaterialInfoService.list(kcQW);
|
||||
Map<String, Map<String, String>> kfWlSlMap = kfnumList.stream().collect(Collectors.groupingBy(BlWarehouseMaterialInfo::getNuId, Collectors.toMap(BlWarehouseMaterialInfo::getWlId, BlWarehouseMaterialInfo::getKcsl)));
|
||||
List<NuWarehouseMaterialCrkInfo> kfCrkLogList = Lists.newArrayList();
|
||||
for (int i = 0; i < infoList.size(); i++) {
|
||||
NuInvoicingThdInfo item = infoList.get(i);
|
||||
NuWarehouseMaterialCrkInfo kfCrkLog = new NuWarehouseMaterialCrkInfo();
|
||||
BeanUtils.copyProperties(item, kfCrkLog);
|
||||
kfCrkLog.setId(null);
|
||||
kfCrkLog.setCreateBy(null);
|
||||
kfCrkLog.setCreateTime(null);
|
||||
kfCrkLog.setUpdateBy(null);
|
||||
kfCrkLog.setUpdateTime(null);
|
||||
kfCrkLog.setCgdId(thdNo);//退货单号
|
||||
kfCrkLog.setNuId(item.getKfId());//库房id 不是nuid
|
||||
kfCrkLog.setWlId(item.getWlId());//物料id
|
||||
kfCrkLog.setCrkNum(item.getThNum());//出入库数量
|
||||
kfCrkLog.setCrkType("3");//出入库类型 3退货
|
||||
kfCrkLog.setCzqkcl(kfWlSlMap.get(item.getKfId()).get(item.getWlId()));//操作前库存量
|
||||
kfCrkLog.setDqkcl((Integer.parseInt(kfWlSlMap.get(item.getKfId()).get(item.getWlId())) + item.getThNum()) + "");//当前库存量
|
||||
kfCrkLog.setCrkStatus("1");//出入库状态 1入库
|
||||
kfCrkLog.setContent("退货单:" + thdNo);//备注
|
||||
|
||||
kfCrkLog.setMaterialCategoryName(item.getMaterialCategoryName());//物料类别名称
|
||||
kfCrkLog.setMaterialTypeName(item.getMaterialTypeName());//物料类型名称
|
||||
kfCrkLog.setMaterialMedicationName(item.getMaterialMedicationName());//物料类型名称
|
||||
kfCrkLog.setMaterialName(item.getMaterialName());//物料名称
|
||||
kfCrkLog.setMaterialUnits(item.getMaterialUnits());//物料单位
|
||||
kfCrkLog.setMaterialNo(item.getMaterialNo());//物料编码
|
||||
kfCrkLog.setSpecificationModel(item.getSpecificationModel());//规格型号
|
||||
kfCrkLog.setMaterialImg(item.getMaterialImg());//物料图片
|
||||
kfCrkLog.setSalesUnitPrice(item.getSalesUnitPrice());//物料销售单价
|
||||
kfCrkLogList.add(kfCrkLog);
|
||||
}
|
||||
warehouseMaterialCrkInfoService.saveBatch(kfCrkLogList);
|
||||
|
||||
//库房库存调整
|
||||
Map<String, Integer> thdWlNumMap = infoList.stream().collect(Collectors.toMap(NuInvoicingThdInfo::getWlId, NuInvoicingThdInfo::getThNum));
|
||||
List<BlWarehouseMaterialInfo> kfUpdateList = Lists.newArrayList();
|
||||
kfnumList.stream().forEach(item -> {
|
||||
if (thdWlNumMap.get(item.getWlId()) != null) {
|
||||
item.setKcsl((Integer.parseInt(item.getKcsl()) + thdWlNumMap.get(item.getWlId())) + "");
|
||||
kfUpdateList.add(item);
|
||||
}
|
||||
});
|
||||
warehouseMaterialInfoService.updateBatchById(kfUpdateList);
|
||||
}
|
||||
|
||||
//护理单元出入库日志+库存
|
||||
{
|
||||
//护理单元出入库日志
|
||||
List<NuInvoicingNuCrkLog> nuCrkLogList = Lists.newArrayList();
|
||||
infoList.stream().forEach(item -> {
|
||||
NuInvoicingNuCrkLog nuInvoicingNuCrkLog = new NuInvoicingNuCrkLog();
|
||||
BeanUtils.copyProperties(item, nuInvoicingNuCrkLog);
|
||||
nuInvoicingNuCrkLog.setCreateBy(null);
|
||||
nuInvoicingNuCrkLog.setCreateTime(null);
|
||||
nuInvoicingNuCrkLog.setWlNum(item.getThNum());//退货数量
|
||||
nuInvoicingNuCrkLog.setType("2");//类型 2退货
|
||||
nuInvoicingNuCrkLog.setOrderNumber(item.getThdNo());//单号
|
||||
nuInvoicingNuCrkLog.setOrderType("thd");//单子类型: thd退货单
|
||||
nuInvoicingNuCrkLog.setContent("退货单:" + item.getThdNo());//备注
|
||||
|
||||
nuInvoicingNuCrkLog.setMaterialCategoryName(item.getMaterialCategoryName());//物料类别名称
|
||||
nuInvoicingNuCrkLog.setMaterialTypeName(item.getMaterialTypeName());//物料类型名称
|
||||
nuInvoicingNuCrkLog.setMaterialMedicationName(item.getMaterialMedicationName());//物料类型名称
|
||||
nuInvoicingNuCrkLog.setMaterialName(item.getMaterialName());//物料名称
|
||||
nuInvoicingNuCrkLog.setMaterialUnits(item.getMaterialUnits());//物料单位
|
||||
nuInvoicingNuCrkLog.setMaterialNo(item.getMaterialNo());//物料编码
|
||||
nuInvoicingNuCrkLog.setSpecificationModel(item.getSpecificationModel());//规格型号
|
||||
nuInvoicingNuCrkLog.setMaterialImg(item.getMaterialImg());//物料图片
|
||||
nuInvoicingNuCrkLog.setSalesUnitPrice(item.getSalesUnitPrice());//物料销售单价
|
||||
nuCrkLogList.add(nuInvoicingNuCrkLog);
|
||||
});
|
||||
invoicingNuCrkLogService.saveBatch(nuCrkLogList);
|
||||
|
||||
//护理单元货品修改对应现有数量
|
||||
QueryWrapper<NuInvoicingNuKcsl> nuKcslQW = new QueryWrapper<>();
|
||||
nuKcslQW.eq("nu_id", main.getNuId());
|
||||
nuKcslQW.eq("elder_id", main.getElderId());
|
||||
List<NuInvoicingNuKcsl> nuKcslList = invoicingNuKcslService.list(nuKcslQW);
|
||||
List<NuInvoicingNuKcsl> needUpdateList = Lists.newArrayList();
|
||||
if (!CollectionUtils.isEmpty(nuKcslList)) {
|
||||
Map<String, NuInvoicingNuKcsl> nuKcslMap = nuKcslList.stream().collect(Collectors.toMap(NuInvoicingNuKcsl::getWlId, kcsl -> kcsl));
|
||||
infoList.stream().forEach(item -> {
|
||||
NuInvoicingNuKcsl nuInvoicingNuKcsl = new NuInvoicingNuKcsl();
|
||||
nuInvoicingNuKcsl.setNuId(item.getNuId());
|
||||
nuInvoicingNuKcsl.setElderId(item.getElderId());
|
||||
nuInvoicingNuKcsl.setWlId(item.getWlId());
|
||||
nuInvoicingNuKcsl.setKfId((item.getKfId()));
|
||||
|
||||
if (nuKcslMap.containsKey(item.getWlId())) {
|
||||
NuInvoicingNuKcsl existingKcsl = nuKcslMap.get(item.getWlId());
|
||||
nuInvoicingNuKcsl.setWlNum(existingKcsl.getWlNum() - item.getThNum());
|
||||
needUpdateList.add(nuInvoicingNuKcsl);
|
||||
} else {
|
||||
//护理单元已有物料 不包含 本次退货物料(极其低概率 可以理解为不会发生) 上面已经做了退货物料检测
|
||||
throw new RuntimeException("入库失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(needUpdateList)) {
|
||||
needUpdateList.stream().forEach(item -> {
|
||||
UpdateWrapper<NuInvoicingNuKcsl> nuKcslUW = new UpdateWrapper<>();
|
||||
nuKcslUW.eq("nu_id", item.getNuId());
|
||||
nuKcslUW.eq("elder_id", item.getElderId());
|
||||
nuKcslUW.eq("wl_id", item.getWlId());
|
||||
invoicingNuKcslService.update(item, nuKcslUW);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity();
|
||||
|
|
@ -642,10 +642,10 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, String> requireTH(InvoicingThdMainEntity dto) {
|
||||
Map<String, String> map = new HashMap();
|
||||
map.put("error_code", "0");
|
||||
map.put("msg", "操作成功");
|
||||
public Map<String,String> requireTH(InvoicingThdMainEntity dto) {
|
||||
Map<String,String> map = new HashMap();
|
||||
map.put("error_code","0");
|
||||
map.put("msg","操作成功");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String status = "0";//发起待执行
|
||||
|
||||
|
|
@ -654,9 +654,9 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
qw.eq("elder_id", dto.getElderId());
|
||||
qw.eq("status", status);
|
||||
NuInvoicingThdMain qwMain = thdMainMapper.selectOne(qw);
|
||||
if (qwMain != null) {
|
||||
map.put("error_code", "1");
|
||||
map.put("msg", "退货单已存在");
|
||||
if(qwMain!=null){
|
||||
map.put("error_code","1");
|
||||
map.put("msg","退货单已存在");
|
||||
}
|
||||
|
||||
NuInvoicingThdMain main = new NuInvoicingThdMain();
|
||||
|
|
|
|||
Loading…
Reference in New Issue