|
@@ -11,6 +11,7 @@ import com.usoftchina.saas.commons.dto.DocBaseDTO;
|
|
|
import com.usoftchina.saas.commons.dto.ListReqDTO;
|
|
import com.usoftchina.saas.commons.dto.ListReqDTO;
|
|
|
import com.usoftchina.saas.commons.exception.BizExceptionCode;
|
|
import com.usoftchina.saas.commons.exception.BizExceptionCode;
|
|
|
import com.usoftchina.saas.commons.po.BillCodeSeq;
|
|
import com.usoftchina.saas.commons.po.BillCodeSeq;
|
|
|
|
|
+import com.usoftchina.saas.commons.po.Operation;
|
|
|
import com.usoftchina.saas.commons.po.Status;
|
|
import com.usoftchina.saas.commons.po.Status;
|
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
|
import com.usoftchina.saas.document.api.WarehouseApi;
|
|
import com.usoftchina.saas.document.api.WarehouseApi;
|
|
@@ -166,7 +167,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
//更新明细金额等
|
|
//更新明细金额等
|
|
|
setTotal(prodInOutNow);
|
|
setTotal(prodInOutNow);
|
|
|
//日志
|
|
//日志
|
|
|
- messageLogService.update(baseDTO);
|
|
|
|
|
|
|
+ messageLogService.update(baseDTO);
|
|
|
return baseDTO;
|
|
return baseDTO;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -191,7 +192,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
//更新明细金额等
|
|
//更新明细金额等
|
|
|
setTotal(prodInOut);
|
|
setTotal(prodInOut);
|
|
|
//日志
|
|
//日志
|
|
|
- messageLogService.deleteDetail(docBaseDTO);
|
|
|
|
|
|
|
+ messageLogService.deleteDetail(docBaseDTO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -203,7 +204,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
setTotal(prodInOut);
|
|
setTotal(prodInOut);
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class(),prodInOut.getPi_inoutno());
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class(),prodInOut.getPi_inoutno());
|
|
|
//日志
|
|
//日志
|
|
|
- messageLogService.deleteDetail(docBaseDTO);
|
|
|
|
|
|
|
+ messageLogService.deleteDetail(docBaseDTO);
|
|
|
return num;
|
|
return num;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -238,6 +239,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
singleAudit( formData.getMain());
|
|
singleAudit( formData.getMain());
|
|
|
}
|
|
}
|
|
|
baseDTO.setId(id);
|
|
baseDTO.setId(id);
|
|
|
|
|
+ baseDTO.setCode(formData.getMain().getPi_inoutno());
|
|
|
return baseDTO;
|
|
return baseDTO;
|
|
|
}
|
|
}
|
|
|
private void singleAudit(ProdInOutDTO prodInOutDTO) {
|
|
private void singleAudit(ProdInOutDTO prodInOutDTO) {
|
|
@@ -251,18 +253,17 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
map.put("inoutNo",pi_inoutno);
|
|
map.put("inoutNo",pi_inoutno);
|
|
|
map.put("class", pi_class);
|
|
map.put("class", pi_class);
|
|
|
map.put("commitid",BaseContextHolder.getUserId());
|
|
map.put("commitid",BaseContextHolder.getUserId());
|
|
|
- map.put("companyid",BaseContextHolder.getCompanyId());
|
|
|
|
|
|
|
+ map.put("companyId",BaseContextHolder.getCompanyId());
|
|
|
map.put("result","");
|
|
map.put("result","");
|
|
|
Result res = warehouseApi.post(map);
|
|
Result res = warehouseApi.post(map);
|
|
|
- Object result = res.getData();
|
|
|
|
|
- System.out.println("result:"+result);
|
|
|
|
|
|
|
+ Object result = res.getData();
|
|
|
if(!StringUtils.isEmpty(result)){
|
|
if(!StringUtils.isEmpty(result)){
|
|
|
throw new BizException(BizExceptionCode.SALEOUT_POST_ERROR.getCode(),result.toString());
|
|
throw new BizException(BizExceptionCode.SALEOUT_POST_ERROR.getCode(),result.toString());
|
|
|
}else{
|
|
}else{
|
|
|
//记录日志
|
|
//记录日志
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,pi_inoutno);
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,pi_inoutno);
|
|
|
//日志
|
|
//日志
|
|
|
- messageLogService.audit(docBaseDTO);
|
|
|
|
|
|
|
+ messageLogService.audit(docBaseDTO);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
@Override
|
|
@Override
|
|
@@ -304,7 +305,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
map.put("inoutNo", pi_inoutno);
|
|
map.put("inoutNo", pi_inoutno);
|
|
|
map.put("class", pi_class);
|
|
map.put("class", pi_class);
|
|
|
map.put("commitid",BaseContextHolder.getUserId());
|
|
map.put("commitid",BaseContextHolder.getUserId());
|
|
|
- map.put("companyid",BaseContextHolder.getCompanyId());
|
|
|
|
|
|
|
+ map.put("companyId",BaseContextHolder.getCompanyId());
|
|
|
map.put("result","");
|
|
map.put("result","");
|
|
|
Result res = warehouseApi.unPost(map);
|
|
Result res = warehouseApi.unPost(map);
|
|
|
Object result = res.getData();
|
|
Object result = res.getData();
|
|
@@ -374,6 +375,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
Integer count=0;
|
|
Integer count=0;
|
|
|
double pdOutqty=0;
|
|
double pdOutqty=0;
|
|
|
double pdYqty=0;
|
|
double pdYqty=0;
|
|
|
|
|
+ double pdSendPrice = 0.0;
|
|
|
|
|
+ double pdTaxrate = 0.0;
|
|
|
ProdInOut sourcePi = checkAndReturnOrder(id);
|
|
ProdInOut sourcePi = checkAndReturnOrder(id);
|
|
|
List<ProdIODetail> sourceDetails =prodIODetailMapper.selectByFK(id);
|
|
List<ProdIODetail> sourceDetails =prodIODetailMapper.selectByFK(id);
|
|
|
if (null == sourcePi || StringUtils.isEmpty(sourcePi.getPi_inoutno()) || sourceDetails.size() == 0) {
|
|
if (null == sourcePi || StringUtils.isEmpty(sourcePi.getPi_inoutno()) || sourceDetails.size() == 0) {
|
|
@@ -401,7 +404,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
//插入销售退货单主表
|
|
//插入销售退货单主表
|
|
|
ProdInOut targetPi = new ProdInOut();
|
|
ProdInOut targetPi = new ProdInOut();
|
|
|
//生成单号
|
|
//生成单号
|
|
|
- String piInoutno = maxnumberService.getMaxnumber(BillCodeSeq.SALEIN.getCaller(),true).getData();
|
|
|
|
|
|
|
+ String piInoutno = maxnumberService.getMaxnumber(BillCodeSeq.SALEIN.getCaller(),true).getData();
|
|
|
|
|
+ //BillCodeSeq.SALEIN.getCaller()+Math.abs(Math.random()*100);
|
|
|
|
|
+
|
|
|
//设置公司id
|
|
//设置公司id
|
|
|
targetPi.setCompanyId(sourcePi.getCompanyId());
|
|
targetPi.setCompanyId(sourcePi.getCompanyId());
|
|
|
targetPi.setCreateTime(new Date());
|
|
targetPi.setCreateTime(new Date());
|
|
@@ -430,6 +435,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
ProdIODetail targetPid = new ProdIODetail();
|
|
ProdIODetail targetPid = new ProdIODetail();
|
|
|
pdOutqty = sourcePid.getPd_outqty()==null?0.0:sourcePid.getPd_outqty();
|
|
pdOutqty = sourcePid.getPd_outqty()==null?0.0:sourcePid.getPd_outqty();
|
|
|
pdYqty = sourcePid.getPd_yqty()==null?0.0:sourcePid.getPd_yqty();
|
|
pdYqty = sourcePid.getPd_yqty()==null?0.0:sourcePid.getPd_yqty();
|
|
|
|
|
+ pdSendPrice = sourcePid.getPd_sendprice()==null?0.0:sourcePid.getPd_sendprice();
|
|
|
|
|
+ pdTaxrate = sourcePid.getPd_taxrate()==null?0.0:sourcePid.getPd_taxrate();
|
|
|
if(pdOutqty-pdYqty>0){
|
|
if(pdOutqty-pdYqty>0){
|
|
|
//公司id
|
|
//公司id
|
|
|
targetPid.setCompanyId(sourcePid.getCompanyId());
|
|
targetPid.setCompanyId(sourcePid.getCompanyId());
|
|
@@ -443,7 +450,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
targetPid.setPd_orderdetno(sourcePid.getPd_orderdetno());
|
|
targetPid.setPd_orderdetno(sourcePid.getPd_orderdetno());
|
|
|
|
|
|
|
|
targetPid.setPd_sdid(sourcePid.getPd_sdid());
|
|
targetPid.setPd_sdid(sourcePid.getPd_sdid());
|
|
|
- targetPid.setPd_sendprice(sourcePid.getPd_sendprice());
|
|
|
|
|
|
|
+ targetPid.setPd_sendprice(pdSendPrice);
|
|
|
|
|
+ targetPid.setPd_taxrate(pdTaxrate);
|
|
|
|
|
|
|
|
|
|
|
|
|
targetPid.setPd_prodid(sourcePid.getPd_prodid());
|
|
targetPid.setPd_prodid(sourcePid.getPd_prodid());
|
|
@@ -454,6 +462,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
|
|
|
|
|
//本次转单数
|
|
//本次转单数
|
|
|
targetPid.setPd_inqty(pdOutqty-pdYqty);
|
|
targetPid.setPd_inqty(pdOutqty-pdYqty);
|
|
|
|
|
+ targetPid.setPd_total((pdOutqty-pdYqty)*pdSendPrice);
|
|
|
|
|
+ targetPid.setPd_nettotal((pdOutqty-pdYqty)*(pdSendPrice/(1+pdTaxrate/100)));
|
|
|
prodIODetailMapper.insertSelective(targetPid);
|
|
prodIODetailMapper.insertSelective(targetPid);
|
|
|
//更新已转数
|
|
//更新已转数
|
|
|
sourcePid.setPd_yqty(pdOutqty);
|
|
sourcePid.setPd_yqty(pdOutqty);
|
|
@@ -461,9 +471,12 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //更新明细金额等
|
|
|
|
|
+ setTotal(targetPi);
|
|
|
|
|
+
|
|
|
//日志记录
|
|
//日志记录
|
|
|
- DocBaseDTO baseDTO = new DocBaseDTO(pi_id, piInoutno, BillCodeSeq.SALEIN.getCaller());
|
|
|
|
|
- //messageLogService.customizeLog(baseDTO, Operation.);
|
|
|
|
|
|
|
+ DocBaseDTO baseDTO = new DocBaseDTO(pi_id, piInoutno, BillCodeSeq.SALEIN.getName());
|
|
|
|
|
+ messageLogService.customizeLog(baseDTO, Operation.TURNPRODOUTRETURN);
|
|
|
return baseDTO;
|
|
return baseDTO;
|
|
|
|
|
|
|
|
}
|
|
}
|