|
|
@@ -66,6 +66,7 @@ public class InventoryService extends GenericProvider {
|
|
|
ReagentConsumablesTransaction transaction = reagentConsumablesTransactionRepository.newInstance();
|
|
|
item.getTransaction().setInventoryId(inventory.getId());
|
|
|
item.getTransaction().setFlow("not");
|
|
|
+ item.getTransaction().setStatus("入库");
|
|
|
transaction.setData(item.getTransaction());
|
|
|
transaction.save();
|
|
|
}
|
|
|
@@ -73,39 +74,38 @@ public class InventoryService extends GenericProvider {
|
|
|
}
|
|
|
|
|
|
public void issue(String id, String type, String status) throws Exception {
|
|
|
+ logger.warn("com.lc.ibps.components.reagent.service.InventoryService.issue()--->id={},status={},type={}", id, status, type);
|
|
|
status = StrUtil.str(status);
|
|
|
if ("return".equals(type)) {
|
|
|
- returnStock(id, status,"退货");
|
|
|
+ type = "退货";
|
|
|
+ handleOperation(status , type , storeService.queryThRecord(id));
|
|
|
} else if ("scrap".equals(type)) {
|
|
|
- scrap(id, status,"报废");
|
|
|
- } else if ("withdraw".equals(type)) {
|
|
|
- decrementStock(id, status,"领用");
|
|
|
+ type = "报废";
|
|
|
+ handleOperation(status , type , storeService.queryBfRecord(id));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void scrap(String id, String status,String type) throws Exception {
|
|
|
- logger.warn("com.lc.ibps.components.reagent.service.InventoryService.scrap()--->id={},status={},type={}", id, status, type);
|
|
|
- handleOperation(status, type, storeService.queryBfRecord(id));
|
|
|
- }
|
|
|
-
|
|
|
- public void returnStock(String id, String status,String type) throws Exception {
|
|
|
- logger.warn("com.lc.ibps.components.reagent.service.InventoryService.returnStock()--->id={},status={},type={}", id, status, type);
|
|
|
- handleOperation(status, type, storeService.queryThRecord(id));
|
|
|
- }
|
|
|
-
|
|
|
- public void decrementStock(String id, String status,String type) throws Exception {
|
|
|
- logger.warn("com.lc.ibps.components.reagent.service.InventoryService.decrementStock()--->id={},status={},type={}", id, status, type);
|
|
|
- handleOperation(status, type, storeService.queryLingYongRecord(id));
|
|
|
+ public void back(String id, String type, String operate) throws Exception {
|
|
|
+ logger.warn("com.lc.ibps.components.reagent.service.InventoryService.back()--->id={},type={},operate={}", id, type, operate);
|
|
|
+ List<Map<String,Object>> records = new ArrayList<>();
|
|
|
+ if ("return".equals(type)) {
|
|
|
+ type = "退货";
|
|
|
+ records = storeService.queryThRecord(id);
|
|
|
+ } else if ("scrap".equals(type)) {
|
|
|
+ type = "报废";
|
|
|
+ records = storeService.queryBfRecord(id);
|
|
|
+ }
|
|
|
+ if ("back".equals(operate) || "stop".equals(operate)) {
|
|
|
+ List<String> ids = records.stream().map(record -> record.get("id_").toString()).collect(Collectors.toList());
|
|
|
+ String quotedIds = ids.stream().map(currentId -> "'" + currentId + "'").collect(Collectors.joining(","));
|
|
|
+ returnService.updateBillAndInventory(quotedIds,type);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void handleOperation(String status, String operationType, List<Map<String, Object>> records) throws Exception {
|
|
|
if (records == null || records.isEmpty()) {
|
|
|
- throw new Exception("未查询到对应的" + operationType + "记录,操作失败!");
|
|
|
+ throw new Exception("未查询到对应的 "+operationType+" 记录,操作失败!");
|
|
|
}
|
|
|
-
|
|
|
- List<String> ids = records.stream().map(record -> record.get("id_").toString()).collect(Collectors.toList());
|
|
|
- returnService.updateBillAndInventory(String.join(",",ids),operationType);
|
|
|
-
|
|
|
for (Map<String, Object> record : records) {
|
|
|
record.put("type", operationType);
|
|
|
record.put("status", status);
|
|
|
@@ -115,19 +115,12 @@ public class InventoryService extends GenericProvider {
|
|
|
record.put("ming_cheng_", reagentName);
|
|
|
String batchNum = StrUtil.str(record.get("pi_hao_"));
|
|
|
String reagentCode = StrUtil.str(record.get("bian_ma_"));
|
|
|
- String position = operationType.equals("领用") ? StrUtil.str(record.get("cang_ku_id_")) : "";
|
|
|
String kcId = StrUtil.str(record.get("inventory_id"));
|
|
|
|
|
|
List<Map<String, Object>> inventoryList;
|
|
|
if (BeanUtils.isNotEmpty(kcId)) {
|
|
|
inventoryList = storeService.queryInventoryById(kcId);
|
|
|
- }else if (operationType.equals("领用")) {
|
|
|
- Map<String, Object> queryParams = new HashMap<>();
|
|
|
- queryParams.put("batch_num", batchNum);
|
|
|
- queryParams.put("reagent_code", reagentCode);
|
|
|
- queryParams.put("position", position);
|
|
|
- inventoryList = storeService.queryInventoryByLingYong(queryParams);
|
|
|
- } else {
|
|
|
+ }else {
|
|
|
inventoryList = storeService.queryInventoryByPhAndCode(batchNum, reagentCode);
|
|
|
}
|
|
|
|
|
|
@@ -246,7 +239,7 @@ public class InventoryService extends GenericProvider {
|
|
|
}
|
|
|
|
|
|
public void updateStock(StockDto stockDto) throws Exception {
|
|
|
- logger.warn("com.lc.ibps.components.reagent.service.InventoryService.updateStock()--->stockDto={}", stockDto);
|
|
|
+ logger.warn("com.lc.ibps.components.reagent.service.InventoryService.updateStock()--->type={},kcList={}", stockDto.getType(),stockDto.getKcList());
|
|
|
if (Collections.isEmpty(stockDto.getKcList())){
|
|
|
return;
|
|
|
}
|