|
|
@@ -4,16 +4,22 @@ 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.dto.BatchDealBaseDTO;
|
|
|
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
|
|
|
import com.usoftchina.saas.commons.dto.DocSavedDTO;
|
|
|
import com.usoftchina.saas.document.api.WarehouseApi;
|
|
|
import com.usoftchina.saas.exception.BizException;
|
|
|
+import com.usoftchina.saas.exception.ExceptionCode;
|
|
|
import com.usoftchina.saas.page.PageRequest;
|
|
|
import com.usoftchina.saas.purchase.dto.ProdIODetailDTO;
|
|
|
import com.usoftchina.saas.purchase.dto.ProdInOutDTO;
|
|
|
import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
|
|
|
import com.usoftchina.saas.purchase.dto.ProdInOutReqDTO;
|
|
|
import com.usoftchina.saas.purchase.mapper.*;
|
|
|
-import com.usoftchina.saas.purchase.po.*;
|
|
|
+import com.usoftchina.saas.purchase.po.ProdIODetail;
|
|
|
+import com.usoftchina.saas.purchase.po.ProdIODetailExample;
|
|
|
+import com.usoftchina.saas.purchase.po.ProdInOut;
|
|
|
+import com.usoftchina.saas.purchase.po.ProdInOutList;
|
|
|
import com.usoftchina.saas.purchase.service.ProdInOutService;
|
|
|
import com.usoftchina.saas.utils.BeanMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -214,6 +220,16 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
singleAudit(prodInOutDTO);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void batchAudit(BatchDealBaseDTO baseDTOs) {
|
|
|
+ for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
|
|
|
+ Long id = base.getId();
|
|
|
+ ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
|
|
|
+ ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
|
|
|
+ singleAudit(prodInOutDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void singleAudit(ProdInOutDTO prodInOutDTO) {
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
|
|
|
@@ -224,9 +240,12 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
warehouseApi.callProcedure(map);
|
|
|
Object result = map.get("result");
|
|
|
System.out.println("result");
|
|
|
- if (!StringUtils.isEmpty(result))
|
|
|
- System.out.println(result);
|
|
|
//记录日志
|
|
|
+
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(result))
|
|
|
+ throw new BizException(500, "存在已审核单据,单据编号:" + result);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -238,6 +257,16 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
updateYqty(prodInOut.getId(),prodInOut.getPi_class());
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void batchDelete(BatchDealBaseDTO baseDTOs) {
|
|
|
+ if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
|
|
|
+ baseDTOs.getBaseDTOs().size() == 0)
|
|
|
+ return;
|
|
|
+ for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
|
|
|
+ singleDelete(base.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void updateYqty(Long id,String piclass) {
|
|
|
//更新已转数
|
|
|
prodIODetailMapper.updatePurchaseYqty(id);
|
|
|
@@ -254,9 +283,37 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
|
|
|
@Override
|
|
|
public Result turnProdOut(Long id) {
|
|
|
- ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
|
|
|
+ ProdInOut sourcePi = getMapper().selectByPrimaryKey(id);
|
|
|
|
|
|
|
|
|
+ Integer count=0;
|
|
|
+ double pdInqty=0, pdYqty=0;
|
|
|
+
|
|
|
+ ProdIODetailExample prodIODetailExample = new ProdIODetailExample();
|
|
|
+ ProdIODetailExample.Criteria cta = prodIODetailExample.createCriteria();
|
|
|
+ cta.andPd_piidEqualTo(id.intValue());
|
|
|
+ List<ProdIODetail> sourcePids =prodIODetailMapper.selectByExample(prodIODetailExample);
|
|
|
+
|
|
|
+ //检查从表
|
|
|
+ for (ProdIODetail prodIODetail : sourcePids) {
|
|
|
+ pdInqty = prodIODetail.getPd_inqty();
|
|
|
+ pdYqty = prodIODetail.getPd_yqty();
|
|
|
+ if (pdInqty-pdYqty>0){
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //判断可转数
|
|
|
+ if (count==0) {
|
|
|
+ return Result.error(ExceptionCode.TURNINNUM_NOT_EXIST);
|
|
|
+ }
|
|
|
+ //插入验退单主表
|
|
|
+ ProdInOut targetPi = new ProdInOut();
|
|
|
+ //生成单号
|
|
|
+// String
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
return null;
|