盘点入库youhua
This commit is contained in:
parent
2412194ab7
commit
a73dbcf24c
|
|
@ -60,13 +60,11 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
}
|
||||
}
|
||||
}
|
||||
int res = 0;
|
||||
int res;
|
||||
try {
|
||||
//1. 判断是数量还是编号入库,保存到不同表
|
||||
//1.1 如果是编号入库
|
||||
if (dto.getIsCode()) {
|
||||
/*插入ma_machine、ma_machine_label和ma_label_bind以及
|
||||
ma_type_put_in_storage_info表和ma_type_put_in_storage_details表*/
|
||||
res = insertMaMachineInfo(dto, codeList);
|
||||
if (res == 0) {
|
||||
log.error("insertMaMachineInfo方法插入异常");
|
||||
|
|
@ -87,11 +85,9 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
log.error("保存入库盘点异常:{}",e.getMessage());
|
||||
// 添加事务回滚逻辑
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
if (res == 0) {
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
return AjaxResult.success(res);
|
||||
|
|
@ -113,7 +109,7 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
* @return
|
||||
*/
|
||||
private int insertMaMachineInfo(SavePutInfoDto dto, List<String> codeList) {
|
||||
int num = 0;
|
||||
int res = 0;
|
||||
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
|
||||
String code = codeList.get(i);
|
||||
|
|
@ -125,21 +121,22 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
machIneDto.setPutInType(dto.getPutInType());
|
||||
machIneDto.setNum(dto.getNum());
|
||||
machIneDto.setCheckMan(dto.getCheckMan());
|
||||
num = inventoryAndWarehousingMapper.insertMachine(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_machine表失败");
|
||||
}
|
||||
num = inventoryAndWarehousingMapper.insertMachineLabel(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_machine_label表失败");
|
||||
}
|
||||
num = inventoryAndWarehousingMapper.insertLabelBind(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_label_bind表失败");
|
||||
}
|
||||
num = getAnInt(machIneDto);
|
||||
res += insertMachineInfo(machIneDto);
|
||||
}
|
||||
return num;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取,保持到ma_machine、ma_machine_label和ma_label_bind
|
||||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
private int insertMachineInfo(MachIneDto machIneDto) {
|
||||
int res = inventoryAndWarehousingMapper.insertMachine(machIneDto);
|
||||
res += inventoryAndWarehousingMapper.insertMachineLabel(machIneDto);
|
||||
res += inventoryAndWarehousingMapper.insertLabelBind(machIneDto);
|
||||
res += insertTypePutInStorageInfo(machIneDto);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -147,19 +144,12 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
private int getAnInt(MachIneDto machIneDto) {
|
||||
int num;
|
||||
private int insertTypePutInStorageInfo(MachIneDto machIneDto) {
|
||||
//插入ma_type_put_in_storage_info表,返回主键id
|
||||
num = inventoryAndWarehousingMapper.saveInfo(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_type_put_in_storage_info表失败");
|
||||
}
|
||||
int res = inventoryAndWarehousingMapper.saveInfo(machIneDto);
|
||||
//ma_type_put_in_storage_details表
|
||||
num = inventoryAndWarehousingMapper.saveDetails(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_type_put_in_storage_details表失败");
|
||||
}
|
||||
return num;
|
||||
res += inventoryAndWarehousingMapper.saveDetails(machIneDto);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -180,16 +170,16 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
* @return
|
||||
*/
|
||||
private int insertPutInfo(SavePutInfoDto dto) {
|
||||
int num = 0;
|
||||
int res = 0;
|
||||
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
machIneDto.setPutInType(dto.getPutInType());
|
||||
machIneDto.setRemarks(dto.getRemarks());
|
||||
getAnInt(machIneDto);
|
||||
res += insertTypePutInStorageInfo(machIneDto);
|
||||
//根据类型追加ma_type表里面的num
|
||||
num = updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum());
|
||||
res += updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum());
|
||||
}
|
||||
return num;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue