物资管理合同入库bug修改

dev
litao 2 years ago
parent 1d9dc9cfcc
commit 03842918ab
  1. 46
      lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ContractController.java
  2. 12
      lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/GoodsController.java
  3. 13
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java
  4. 8
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java
  5. 8
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/ExamineServiceImpl.java

@ -188,30 +188,38 @@ public class ContractController extends BladeController {
// queryWrapper1.eq("company_id", one.getId()); // queryWrapper1.eq("company_id", one.getId());
queryWrapper1.eq("name", contract.getGoodsName()); queryWrapper1.eq("name", contract.getGoodsName());
queryWrapper1.eq("brand", contract.getBrand()); queryWrapper1.eq("brand", contract.getBrand());
Goods one1 = goodsService.getOne(queryWrapper1); List<Goods> list = goodsService.list(queryWrapper1);
if (one1 == null) { if (CollectionUtils.isEmpty(list)) {
// 库存里没有这个物品,增个库存, ContractDetail detail = new ContractDetail();
Goods goods = new Goods(); // 计算本次导出数据中心已存在的同名称同品牌物品数量,如果已经有了则不新增
List<Goods> collect = goodsList.stream().filter(goods ->
contract.getGoodsName().equals(goods.getName())
&& contract.getBrand().equals(goods.getBrand())).collect(Collectors.toList());
Long goodIds = RandomUtil.randomLong(); Long goodIds = RandomUtil.randomLong();
goods.setId(goodIds); if (CollectionUtils.isEmpty(collect)) {
goods.setName(contract.getGoodsName()); // 库存里没有这个物品,增个库存,
goods.setCompanyId(one.getId()); Goods goods = new Goods();
goods.setCompany(one.getName()); goods.setId(goodIds);
goods.setXh(contract.getXh()); goods.setName(contract.getGoodsName());
goods.setRule(contract.getRule()); goods.setCompanyId(one.getId());
goods.setNum(0); goods.setCompany(one.getName());
goods.setUnit(contract.getUnit()); goods.setXh(contract.getXh());
goods.setBrand(contract.getBrand()); goods.setRule(contract.getRule());
goods.setYt(contract.getYt()); goods.setNum(0);
goods.setCreateTime(new Date()); goods.setUnit(contract.getUnit());
goodsList.add(goods); goods.setBrand(contract.getBrand());
goods.setYt(contract.getYt());
goods.setCreateTime(new Date());
goodsList.add(goods);
detail.setGoodsId(goodIds);
} else {
detail.setGoodsId(collect.get(0).getId());
}
ContractDetail detail = new ContractDetail();
detail.setContractId(contractId); detail.setContractId(contractId);
detail.setGoodsName(contract.getGoodsName()); detail.setGoodsName(contract.getGoodsName());
detail.setGoodsNum(contract.getGoodsNum()); detail.setGoodsNum(contract.getGoodsNum());
detail.setRemark(contract.getRemark()); detail.setRemark(contract.getRemark());
detail.setGoodsId(goodIds);
detail.setInNum(0); detail.setInNum(0);
detail.setNotNum(contract.getGoodsNum()); detail.setNotNum(contract.getGoodsNum());
detail.setStatus(0); detail.setStatus(0);
@ -222,7 +230,7 @@ public class ContractController extends BladeController {
detail.setRemark(contract.getRemark()); detail.setRemark(contract.getRemark());
detail.setGoodsNum(contract.getGoodsNum()); detail.setGoodsNum(contract.getGoodsNum());
detail.setGoodsName(contract.getGoodsName()); detail.setGoodsName(contract.getGoodsName());
detail.setGoodsId(one1.getId()); detail.setGoodsId(list.get(0).getId());
detail.setInNum(0); detail.setInNum(0);
detail.setNotNum(contract.getGoodsNum()); detail.setNotNum(contract.getGoodsNum());
detail.setStatus(0); detail.setStatus(0);

@ -132,13 +132,13 @@ public class GoodsController extends BladeController {
// 重名校验 // 重名校验
LambdaQueryWrapper<Goods> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Goods> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Goods::getName, goods.getName()); wrapper.eq(Goods::getName, goods.getName());
wrapper.eq(Goods::getCompanyId, goods.getCompanyId()); // wrapper.eq(Goods::getCompanyId, goods.getCompanyId());
wrapper.eq(Goods::getBrand, goods.getBrand()); wrapper.eq(Goods::getBrand, goods.getBrand());
wrapper.eq(Goods::getBigClassId, goods.getBigClassId()); // wrapper.eq(Goods::getBigClassId, goods.getBigClassId());
wrapper.eq(Goods::getXh, goods.getXh()); // wrapper.eq(Goods::getXh, goods.getXh());
wrapper.eq(Goods::getRule, goods.getRule()); // wrapper.eq(Goods::getRule, goods.getRule());
List<Goods> list2 = goodsService.list(wrapper); int count = goodsService.count(wrapper);
if (list2 != null && list2.size() > 0) { if (count > 0) {
throw new Exception("数据重复!"); throw new Exception("数据重复!");
} }
goods.setId(RandomUtils.nextLong()); goods.setId(RandomUtils.nextLong());

@ -622,11 +622,15 @@ public class EntrustController extends BladeController {
if (i == split.length - 1) { if (i == split.length - 1) {
name += reagent.getName(); name += reagent.getName();
manufacturer += reagent.getManufacturer(); manufacturer += reagent.getManufacturer();
batchNo += split1[1]; if (split1.length > 1) {
batchNo += split1[1];
}
} else { } else {
name += reagent.getName() + ","; name += reagent.getName() + ",";
manufacturer += reagent.getManufacturer() + ","; manufacturer += reagent.getManufacturer() + ",";
batchNo += split1[1] + ","; if (split1.length > 1) {
batchNo += split1[1] + ",";
}
} }
} }
} }
@ -666,8 +670,9 @@ public class EntrustController extends BladeController {
for (String batch : split3) { for (String batch : split3) {
String reagenId = batch.split("-")[0]; String reagenId = batch.split("-")[0];
String realBatch = ""; String realBatch = "";
if (StringUtils.isNotBlank(batch.split("-")[1])) { String[] split = batch.split("-");
realBatch = batch.split("-")[1]; if (split.length > 1) {
realBatch = split[1];
} }
List<String> list = tempListMap.get(reagenId); List<String> list = tempListMap.get(reagenId);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {

@ -403,20 +403,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) { if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) {
List<ExamineTemplate2Excel> list = JSON.parseArray(examineResult.getExamineDataArr(), ExamineTemplate2Excel.class); List<ExamineTemplate2Excel> list = JSON.parseArray(examineResult.getExamineDataArr(), ExamineTemplate2Excel.class);
System.out.println("list: " + list); System.out.println("list: " + list);
if (list != null && list.size() > 0) { if (CollectionUtils.isNotEmpty(list)) {
for (int i1 = 0; i1 < list.size(); i1++) { for (int i1 = 0; i1 < list.size(); i1++) {
ExamineTemplate2Excel excel = list.get(i1); ExamineTemplate2Excel excel = list.get(i1);
System.out.println("excel: " + excel); System.out.println("excel: " + excel);
ExamineResultVo resultVo = new ExamineResultVo(); ExamineResultVo resultVo = new ExamineResultVo();
// LambdaQueryWrapper<Simple> wrapper1 = new LambdaQueryWrapper<>();
// wrapper1.eq(Simple::getEntrustId, id);
// wrapper1.eq(Simple::getExperieNum, excel.getExperieNum());
// Simple simple = simpleService.getOne(wrapper1);
List<Simple> collect = simples.stream().filter(simple1 -> simple1.getExperieNum().equals(excel.getExperieNum())).collect(Collectors.toList()); List<Simple> collect = simples.stream().filter(simple1 -> simple1.getExperieNum().equals(excel.getExperieNum())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) { if (CollectionUtils.isNotEmpty(collect)) {
Simple simple = collect.get(0); Simple simple = collect.get(0);
// System.out.println("simple: " + simple);
if (simple != null) { if (simple != null) {
resultVo.setOriginalNum(simple.getOriginalNum()); resultVo.setOriginalNum(simple.getOriginalNum());
resultVo.setNum(simple.getExperieNum()); resultVo.setNum(simple.getExperieNum());

@ -6,7 +6,9 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils; import com.alibaba.nacos.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -229,6 +231,12 @@ public class ExamineServiceImpl extends BaseServiceImpl<ExamineMapper, Examine>
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean batchUpdate(Simple simple) { public boolean batchUpdate(Simple simple) {
// 已提交实验结果的实验数量
int count = this.count(Wrappers.<Examine>lambdaQuery().eq(Examine::getEntrustId, simple.getEntrustId()).eq(Examine::getIsFinished, "1"));
if (count > 0) {
throw new ServiceException("有检测已提交实验结果,不可修改!");
}
// 委托单id // 委托单id
Long entrustId = simple.getEntrustId(); Long entrustId = simple.getEntrustId();
// 要修改的检测编号前缀 // 要修改的检测编号前缀

Loading…
Cancel
Save