|
|
|
@ -81,7 +81,7 @@ public class EquSparepartsInOutImpl implements IEquSparepartsInOutService {
|
|
|
|
|
}
|
|
|
|
|
}else{//出库
|
|
|
|
|
if(sparePartsLedger.getAmount() != null){
|
|
|
|
|
if(sparePartsLedger.getAmount().compareTo(equSparepartsInOut.getAmount()) <= 0){
|
|
|
|
|
if(equSparepartsInOut.getAmount().compareTo(sparePartsLedger.getAmount()) == 1){
|
|
|
|
|
return AjaxResult.error("出库数量大于库存数量!");
|
|
|
|
|
}else{
|
|
|
|
|
BigDecimal result = sparePartsLedger.getAmount().subtract(equSparepartsInOut.getAmount());
|
|
|
|
@ -102,7 +102,7 @@ public class EquSparepartsInOutImpl implements IEquSparepartsInOutService {
|
|
|
|
|
String serialNum = String.format("%04d", equSparepartsInOutMapper.selectSerialNumber());
|
|
|
|
|
equSparepartsInOut.setOrderNo(date + serialNum);
|
|
|
|
|
equSparepartsInOutMapper.insertEquSparepartsInOut(equSparepartsInOut);
|
|
|
|
|
return AjaxResult.success("新增成功!");
|
|
|
|
|
return AjaxResult.success("新增出入库记录成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -137,8 +137,8 @@ public class EquSparepartsInOutImpl implements IEquSparepartsInOutService {
|
|
|
|
|
if(sparePartsLedger != null){
|
|
|
|
|
if(equSparepartsInOut.getInOutType().equals("type_in")){//入库
|
|
|
|
|
if(sparePartsLedger.getAmount() != null){
|
|
|
|
|
if(sparePartsLedger.getAmount().compareTo(equSparepartsInOut.getAmount()) <= 0){
|
|
|
|
|
return AjaxResult.error("备品备件台账的备品备件数量小于当时的入库数量!");
|
|
|
|
|
if(sparePartsLedger.getAmount().compareTo(equSparepartsInOut.getAmount()) == -1){
|
|
|
|
|
return AjaxResult.error("目前该备品备件的库存数量,小于您选择的入库数量,无法还原库存!");
|
|
|
|
|
}else{
|
|
|
|
|
BigDecimal result = sparePartsLedger.getAmount().subtract(equSparepartsInOut.getAmount());
|
|
|
|
|
//修改
|
|
|
|
@ -163,7 +163,7 @@ public class EquSparepartsInOutImpl implements IEquSparepartsInOutService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
equSparepartsInOutMapper.deleteEquSparepartsInOutByIds(ids);
|
|
|
|
|
return AjaxResult.success("删除成功");
|
|
|
|
|
return AjaxResult.success("删除成功,该备品备件库存已还原!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -181,8 +181,8 @@ public class EquSparepartsInOutImpl implements IEquSparepartsInOutService {
|
|
|
|
|
if(sparePartsLedger != null){
|
|
|
|
|
if(equSparepartsInOut.getInOutType().equals("type_in")){//入库
|
|
|
|
|
if(sparePartsLedger.getAmount() != null){
|
|
|
|
|
if(sparePartsLedger.getAmount().compareTo(equSparepartsInOut.getAmount()) <= 0){
|
|
|
|
|
return AjaxResult.error("备品备件台账的备品备件数量小于当时的入库数量!");
|
|
|
|
|
if(sparePartsLedger.getAmount().compareTo(equSparepartsInOut.getAmount()) == -1){
|
|
|
|
|
return AjaxResult.error("目前该备品备件的库存数量,小于您选择的入库数量,无法还原库存!");
|
|
|
|
|
}else{
|
|
|
|
|
BigDecimal result = sparePartsLedger.getAmount().subtract(equSparepartsInOut.getAmount());
|
|
|
|
|
//修改
|
|
|
|
@ -207,6 +207,6 @@ public class EquSparepartsInOutImpl implements IEquSparepartsInOutService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
equSparepartsInOutMapper.deleteEquSparepartsInOutById(id);
|
|
|
|
|
return AjaxResult.success("删除成功");
|
|
|
|
|
return AjaxResult.success("删除成功,该备品备件库存已还原!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|