|
|
@ -86,17 +86,15 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@DS("#header.poolName")
|
|
|
|
@DS("#header.poolName")
|
|
|
|
public AjaxResult insertEquSpareApply(EquSpareApply equSpareApply) {
|
|
|
|
public AjaxResult insertEquSpareApply(EquSpareApply equSpareApply) {
|
|
|
|
try {
|
|
|
|
if(equSpareApply.getSpareApplyLists() != null){
|
|
|
|
//equSpareApply.getSpareApplyLists().size() 是在维修申领备件的时候进行的操作 批量新增
|
|
|
|
|
|
|
|
if(equSpareApply.getSpareApplyLists().size() >= 1){
|
|
|
|
|
|
|
|
List<EquSpareApply> list = equSpareApply.getSpareApplyLists();
|
|
|
|
List<EquSpareApply> list = equSpareApply.getSpareApplyLists();
|
|
|
|
for(EquSpareApply applyList:list){
|
|
|
|
for(EquSpareApply applyList:list){
|
|
|
|
applyList.setApplyId(IdUtils.fastSimpleUUID());
|
|
|
|
applyList.setApplyId(IdUtils.fastSimpleUUID());
|
|
|
|
//生成领料单code //申领单号
|
|
|
|
|
|
|
|
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
|
|
|
|
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
|
|
|
|
String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + applyList.getWorkCode().substring(2);
|
|
|
|
if(applyList.getWorkCode() != null){
|
|
|
|
//申领单号
|
|
|
|
String code = applyList.getWorkCode();
|
|
|
|
equSpareApply.setApplyCode("AW" + code + serialNum);
|
|
|
|
applyList.setApplyCode("AW" + code.substring(2) + serialNum);
|
|
|
|
|
|
|
|
}
|
|
|
|
//领用时间
|
|
|
|
//领用时间
|
|
|
|
applyList.setApplyTime(DateUtils.getNowDate());
|
|
|
|
applyList.setApplyTime(DateUtils.getNowDate());
|
|
|
|
//申领人
|
|
|
|
//申领人
|
|
|
@ -117,17 +115,15 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
|
|
|
|
sparePartsLedger.setAmount(amount.subtract(applyNum));
|
|
|
|
sparePartsLedger.setAmount(amount.subtract(applyNum));
|
|
|
|
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
|
|
|
|
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
}else if(equSpareApply.getSpareApplyLists() == null){
|
|
|
|
equSpareApply.setApplyId(IdUtils.fastSimpleUUID());
|
|
|
|
equSpareApply.setApplyId(IdUtils.fastSimpleUUID());
|
|
|
|
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
|
|
|
|
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
|
|
|
|
if(equSpareApply.getWorkCode().length() == 12){
|
|
|
|
if(equSpareApply.getWorkCode() != null){
|
|
|
|
//生成领料单code 十五位单号
|
|
|
|
String code = equSpareApply.getWorkCode();
|
|
|
|
equSpareApply.setApplyCode("A" + equSpareApply.getWorkCode() + serialNum);
|
|
|
|
equSpareApply.setApplyCode("AW" + code.substring(2) + serialNum);
|
|
|
|
}else if(equSpareApply.getWorkCode().length() > 12){
|
|
|
|
|
|
|
|
equSpareApply.setApplyCode("AW" + equSpareApply.getWorkCode().substring(2) + serialNum);
|
|
|
|
|
|
|
|
} else{
|
|
|
|
} else{
|
|
|
|
//普通申领单
|
|
|
|
//普通申领单
|
|
|
|
equSpareApply.setApplyCode("AN" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equSpareApply.getSpareUseEquipment() + serialNum);
|
|
|
|
equSpareApply.setApplyCode("AW" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equSpareApply.getSpareUseEquipment() + serialNum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//领用时间
|
|
|
|
//领用时间
|
|
|
|
equSpareApply.setApplyTime(DateUtils.getNowDate());
|
|
|
|
equSpareApply.setApplyTime(DateUtils.getNowDate());
|
|
|
@ -151,9 +147,6 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
|
|
|
|
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
|
|
|
|
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return success("新增申领记录成功!");
|
|
|
|
return success("新增申领记录成功!");
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
return error();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|