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