增加强制结单-以销定购的接口
This commit is contained in:
@@ -128,6 +128,19 @@ public class DepotHeadController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/forceClosePurchaseBatch")
|
||||||
|
@ApiOperation(value = "强制结单-以销定购")
|
||||||
|
public String forceClosePurchaseBatch(@RequestBody JSONObject jsonObject, HttpServletRequest request)throws Exception {
|
||||||
|
Map<String, Object> objectMap = new HashMap<>();
|
||||||
|
String ids = jsonObject.getString("ids");
|
||||||
|
int res = depotHeadService.batchForceClosePurchase(ids, request);
|
||||||
|
if(res > 0) {
|
||||||
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||||
|
} else {
|
||||||
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量设置状态-审核或者反审核
|
* 批量设置状态-审核或者反审核
|
||||||
* @param jsonObject
|
* @param jsonObject
|
||||||
|
|||||||
@@ -632,6 +632,41 @@ public class DepotHeadService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
|
public int batchForceClosePurchase(String ids, HttpServletRequest request) throws Exception {
|
||||||
|
int result = 0;
|
||||||
|
StringBuilder billNoStr = new StringBuilder();
|
||||||
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
|
for(Long id: idList) {
|
||||||
|
DepotHead depotHead = getDepotHead(id);
|
||||||
|
//状态里面不包含部分不能强制结单
|
||||||
|
if(!"3".equals(depotHead.getPurchaseStatus())) {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_FORCE_CLOSE_FAILED_CODE,
|
||||||
|
String.format(ExceptionConstants.DEPOT_HEAD_FORCE_CLOSE_FAILED_MSG, depotHead.getNumber()));
|
||||||
|
} else {
|
||||||
|
billNoStr.append(depotHead.getNumber()).append(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(idList.size()>0) {
|
||||||
|
DepotHead depotHead = new DepotHead();
|
||||||
|
//完成状态
|
||||||
|
depotHead.setPurchaseStatus("2");
|
||||||
|
//给备注后面追加:强制结单-以销定购
|
||||||
|
String remark = StringUtil.isNotEmpty(depotHead.getRemark())? depotHead.getRemark() + "[强制结单-以销定购]": "[强制结单-以销定购]";
|
||||||
|
depotHead.setRemark(remark);
|
||||||
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
|
example.createCriteria().andIdIn(idList);
|
||||||
|
result = depotHeadMapper.updateByExampleSelective(depotHead, example);
|
||||||
|
//记录日志
|
||||||
|
String billNos = billNoStr.toString();
|
||||||
|
if(StringUtil.isNotEmpty(billNos)) {
|
||||||
|
logService.insertLog("单据", "强制结单-以销定购:" + billNos,
|
||||||
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchSetStatus(String status, String depotHeadIDs)throws Exception {
|
public int batchSetStatus(String status, String depotHeadIDs)throws Exception {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user