|
|
@@ -265,12 +265,16 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
}
|
|
|
@Override
|
|
|
public Result turnProdin(Long id) {
|
|
|
- ProdInOut sourcePi = getMapper().selectByPrimaryKey(id);
|
|
|
Integer count=0;
|
|
|
- double pdOutqty=0, pdYqty=0;
|
|
|
- List<ProdIODetail> sourcePids =prodIODetailMapper.selectByFK(id);
|
|
|
+ double pdOutqty=0;
|
|
|
+ double pdYqty=0;
|
|
|
+ ProdInOut sourcePi = prodInOutMapper.selectByPrimaryKey(id);
|
|
|
+ List<ProdIODetail> sourceDetails =prodIODetailMapper.selectByFK(id);
|
|
|
+ if (null == sourcePi || StringUtils.isEmpty(sourcePi.getPi_inoutno()) || sourceDetails.size() == 0) {
|
|
|
+ throw new BizException(BizExceptionCode.SALE_NULL_BILL);
|
|
|
+ }
|
|
|
//检查从表
|
|
|
- for (ProdIODetail prodIODetail : sourcePids) {
|
|
|
+ for (ProdIODetail prodIODetail : sourceDetails) {
|
|
|
pdOutqty = prodIODetail.getPd_outqty()==null?0.0:prodIODetail.getPd_outqty();
|
|
|
pdYqty = prodIODetail.getPd_yqty()==null?0.0:prodIODetail.getPd_yqty();
|
|
|
if (pdOutqty-pdYqty>0){
|
|
|
@@ -303,8 +307,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
getMapper().insertSelective(targetPi);
|
|
|
//插入销售退货单从表
|
|
|
long pi_id = targetPi.getId();
|
|
|
- for (int i = 0;i<sourcePids.size();i++){
|
|
|
- ProdIODetail sourcePid = sourcePids.get(i);
|
|
|
+ for (int i = 0;i<sourceDetails.size();i++){
|
|
|
+ ProdIODetail sourcePid = sourceDetails.get(i);
|
|
|
ProdIODetail targetPid = new ProdIODetail();
|
|
|
pdOutqty = sourcePid.getPd_outqty()==null?0.0:sourcePid.getPd_outqty();
|
|
|
pdYqty = sourcePid.getPd_yqty()==null?0.0:sourcePid.getPd_yqty();
|