|
|
@@ -2,6 +2,7 @@ package com.usoftchina.saas.storage.service.impl;
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.usoftchina.saas.base.Result;
|
|
|
import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
|
|
|
import com.usoftchina.saas.commons.api.MaxnumberService;
|
|
|
import com.usoftchina.saas.commons.api.MessageLogService;
|
|
|
@@ -185,10 +186,10 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
prodIODetailMapper.batchUpdate(updateDetails);
|
|
|
}
|
|
|
baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
|
|
|
- //更新已转数
|
|
|
+ //计算金额,未税单价,未税金额等
|
|
|
+ calcProdInout(pi_id,pi_class);
|
|
|
//日志记录
|
|
|
messageLogService.update(baseDTO);
|
|
|
-
|
|
|
return baseDTO;
|
|
|
}
|
|
|
|
|
|
@@ -220,95 +221,101 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
DocBaseDTO baseDTO = new DocBaseDTO();
|
|
|
if (null != formData) {
|
|
|
id = formData.getMain().getId();
|
|
|
- if (StringUtils.isEmpty(id)) {
|
|
|
+ if (StringUtils.isEmpty(id)|| "0".equals(String.valueOf(id))) {
|
|
|
baseDTO = saveFormData(formData);
|
|
|
id = baseDTO.getId();
|
|
|
}
|
|
|
- String res = singleAudit(formData.getMain());
|
|
|
- if(res!=null){
|
|
|
- new BizException(501,res);
|
|
|
- }
|
|
|
+ singleAudit(formData.getMain());
|
|
|
}
|
|
|
baseDTO.setId(id);
|
|
|
return baseDTO;
|
|
|
}
|
|
|
|
|
|
- private String singleAudit(ProdInOutDTO prodInOutDTO) {
|
|
|
+ private void singleAudit(ProdInOutDTO prodInOutDTO) {
|
|
|
String pi_class= prodInOutDTO.getPi_class();
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
|
|
|
map.put("class", pi_class);
|
|
|
map.put("commitid",BaseContextHolder.getUserId());
|
|
|
- map.put("companyid",BaseContextHolder.getCompanyId());
|
|
|
+ map.put("companyId",BaseContextHolder.getCompanyId());
|
|
|
map.put("result","");
|
|
|
- warehouseApi.post(map);
|
|
|
- Object result = map.get("result");
|
|
|
- if(result!=null){
|
|
|
- return result.toString();
|
|
|
+ Result res = warehouseApi.post(map);
|
|
|
+ Object result = res.getData();
|
|
|
+ if(!StringUtils.isEmpty(result)){
|
|
|
+ throw new BizException(BizExceptionCode.SALEOUT_POST_ERROR.getCode(),result.toString());
|
|
|
}else{
|
|
|
//记录日志
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,prodInOutDTO.getPi_inoutno());
|
|
|
//日志
|
|
|
messageLogService.audit(docBaseDTO);
|
|
|
- return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void batchAudit(BatchDealBaseDTO baseDTOs) {
|
|
|
+ public String batchAudit(BatchDealBaseDTO baseDTOs) {
|
|
|
if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
|
|
|
baseDTOs.getBaseDTOs().size() == 0) {
|
|
|
- return;
|
|
|
+ return "没有可审核单据。";
|
|
|
}
|
|
|
+ StringBuffer errorMsg = new StringBuffer();
|
|
|
for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
|
|
|
- Long id = base.getId();
|
|
|
- ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
|
|
|
- ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
|
|
|
- singleAudit(prodInOutDTO);
|
|
|
+ try {
|
|
|
+ Long id = base.getId();
|
|
|
+ ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
|
|
|
+ ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
|
|
|
+ singleAudit(prodInOutDTO);
|
|
|
+ } catch (Exception e){
|
|
|
+ errorMsg.append("编号:" + base.getCode() + "处理失败," + e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
+ return errorMsg.toString();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void unAudit(Long id) {
|
|
|
ProdInOut prodInOut =checkAndReturnOrder(id);
|
|
|
ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut, ProdInOutDTO.class);
|
|
|
- String res = singleUnAudit(prodInOutDTO);
|
|
|
-
|
|
|
+ singleUnAudit(prodInOutDTO);
|
|
|
}
|
|
|
|
|
|
- private String singleUnAudit(ProdInOutDTO prodInOutDTO) {
|
|
|
+ private void singleUnAudit(ProdInOutDTO prodInOutDTO) {
|
|
|
String pi_class= prodInOutDTO.getPi_class();
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
|
|
|
map.put("class", pi_class);
|
|
|
map.put("commitid",BaseContextHolder.getUserId());
|
|
|
- map.put("companyid",BaseContextHolder.getCompanyId());
|
|
|
+ map.put("companyId",BaseContextHolder.getCompanyId());
|
|
|
map.put("result","");
|
|
|
- warehouseApi.unPost(map);
|
|
|
- Object result = map.get("result");
|
|
|
- if(result!=null){
|
|
|
- return result.toString();
|
|
|
+ Result res = warehouseApi.unPost(map);
|
|
|
+ Object result = res.getData();
|
|
|
+ if(!StringUtils.isEmpty(result)){
|
|
|
+ throw new BizException(BizExceptionCode.SALEOUT_POST_ERROR.getCode(),result.toString());
|
|
|
}else{
|
|
|
//记录日志
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,prodInOutDTO.getPi_inoutno());
|
|
|
//日志
|
|
|
messageLogService.unAudit(docBaseDTO);
|
|
|
- return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void batchUnAudit(BatchDealBaseDTO baseDTOs) {
|
|
|
+ public String batchUnAudit(BatchDealBaseDTO baseDTOs) {
|
|
|
if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
|
|
|
baseDTOs.getBaseDTOs().size() == 0) {
|
|
|
- return;
|
|
|
+ return "无可反审核单据。";
|
|
|
}
|
|
|
+ StringBuffer errorMsg = new StringBuffer();
|
|
|
for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
|
|
|
- Long id = base.getId();
|
|
|
- ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
|
|
|
- ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
|
|
|
- singleUnAudit(prodInOutDTO);
|
|
|
+ try {
|
|
|
+ Long id = base.getId();
|
|
|
+ ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
|
|
|
+ ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
|
|
|
+ singleUnAudit(prodInOutDTO);
|
|
|
+ }catch (Exception e) {
|
|
|
+ errorMsg.append("编号:" + base.getCode() + "处理失败," + e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
+ return errorMsg.toString();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -455,4 +462,13 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
}
|
|
|
return prodInOut;
|
|
|
}
|
|
|
+
|
|
|
+ private void calcProdInout(Long pi_id, String pi_class) {
|
|
|
+ if ("其它入库单".equals(pi_class)) {
|
|
|
+ prodIODetailMapper.calcProdIn(pi_id);
|
|
|
+ } else if ("其它出库单".equals(pi_class)) {
|
|
|
+ prodIODetailMapper.calcProdOut(pi_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|