|
@@ -12,10 +12,14 @@ import com.platform.common.yongyou.response.*;
|
|
|
import com.platform.dao.bean.MyVOPage;
|
|
|
import com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO;
|
|
|
import com.platform.dao.dto.store.SpareStoreDTO;
|
|
|
+import com.platform.dao.entity.sb.SbInfo;
|
|
|
+import com.platform.dao.entity.sb.SbModelSpareBom;
|
|
|
import com.platform.dao.entity.store.OutStoreDetail;
|
|
|
import com.platform.dao.entity.store.OutStoreForm;
|
|
|
import com.platform.dao.enums.OutStoreStatusEnum;
|
|
|
import com.platform.dao.enums.YesNoEnum;
|
|
|
+import com.platform.dao.mapper.sb.SbInfoMapper;
|
|
|
+import com.platform.dao.mapper.sb.SbModelSpareBomMapper;
|
|
|
import com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO;
|
|
|
import com.platform.dao.vo.query.store.OutStoreDetailVO;
|
|
|
import com.platform.dao.vo.query.store.OutStoreFormVO;
|
|
@@ -37,6 +41,7 @@ import java.time.LocalDate;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description 用友 service 实现类
|
|
@@ -51,6 +56,10 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
private OutStoreFormService outStoreFormService;
|
|
|
@Resource
|
|
|
private OutStoreDetailService outStoreDetailService;
|
|
|
+ @Resource
|
|
|
+ private SbInfoMapper sbInfoMapper;
|
|
|
+ @Resource
|
|
|
+ private SbModelSpareBomMapper sbModelSpareBomMapper;
|
|
|
private String token_key = "yongyou-token";
|
|
|
private String Conn_key = "yongyou-Conn";
|
|
|
private String cAcc_ID_key = "yongyou-cAcc_ID";
|
|
@@ -252,6 +261,108 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
myVOPage.setRows(partInfoVOS);
|
|
|
return myVOPage;
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public AbstractPageResultBean<SpareStoreVO> selectPageList2(SpareStoreDTO record, int pageNum, int pageSize) {
|
|
|
+ List<String> spareIds = null;
|
|
|
+ if (record.getSbId()!=null){
|
|
|
+ SbInfo sbInfo = new SbInfo();
|
|
|
+ sbInfo.setId(record.getSbId());
|
|
|
+ sbInfo = sbInfoMapper.selectByPrimaryKey(sbInfo);
|
|
|
+ List<SbModelSpareBom> sbModelSpareBoms = new ArrayList<>();
|
|
|
+ if (sbInfo!=null){
|
|
|
+ SbModelSpareBom bom = new SbModelSpareBom();
|
|
|
+ bom.setSbId(sbInfo.getId());
|
|
|
+ sbModelSpareBoms = sbModelSpareBomMapper.select(bom);
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("系统有误,请查验!");
|
|
|
+ }
|
|
|
+ spareIds = sbModelSpareBoms.stream().map(SbModelSpareBom::getSpareId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ // 已生成情况,直接推送
|
|
|
+ GetCurrentStockHandler handler = new GetCurrentStockHandler();
|
|
|
+ GetCurrentStockRequest req = new GetCurrentStockRequest();
|
|
|
+ req.setToken(geToken(record.getTokenType()));
|
|
|
+ req.setConn(getConn2(record.getTokenType()));
|
|
|
+ if (record.getTokenType()==1){
|
|
|
+ req.setCAcc_ID("005");
|
|
|
+ }else if (record.getTokenType()==2){
|
|
|
+ req.setCAcc_ID("004");
|
|
|
+ }
|
|
|
+// req.setCAcc_ID(getCAccId());
|
|
|
+ req.setPageNum(pageNum);
|
|
|
+ req.setPageSize(pageSize);
|
|
|
+ StringBuffer whereStr = new StringBuffer(" 1=1 ");
|
|
|
+ // 仓库编码搜索
|
|
|
+ if (StringUtils.isNotBlank(record.getStoreNo())) {
|
|
|
+ whereStr.append(" and cWhCode like '%" + record.getStoreNo() + "%' ");
|
|
|
+ }
|
|
|
+ // 仓库名称搜索
|
|
|
+ if (StringUtils.isNotBlank(record.getStoreName())) {
|
|
|
+ whereStr.append(" and cWhName like '%" + record.getStoreName() + "%' ");
|
|
|
+ }
|
|
|
+ // 存货编码搜索
|
|
|
+ if (StringUtils.isNotBlank(record.getSpareNo())) {
|
|
|
+ whereStr.append(" and cInvCode like '%" + record.getSpareNo() + "%' ");
|
|
|
+ }
|
|
|
+ // 存货名称搜索
|
|
|
+ if (StringUtils.isNotBlank(record.getSpareName())) {
|
|
|
+ whereStr.append(" and cInvName like '%" + record.getSpareName() + "%' ");
|
|
|
+ }
|
|
|
+ // 规格型号搜索
|
|
|
+ if (StringUtils.isNotBlank(record.getGgxh())) {
|
|
|
+ whereStr.append(" and cInvStd like '%" + record.getGgxh() + "%' ");
|
|
|
+ }
|
|
|
+ String sqlStr = "";
|
|
|
+ if (spareIds!=null&&spareIds.size()>0){
|
|
|
+ whereStr.append(" and spareId in (");
|
|
|
+ for (String spareId:spareIds){
|
|
|
+ whereStr.append(spareId+",");
|
|
|
+ }
|
|
|
+ whereStr.toString().substring(0,whereStr.toString().length()-1);
|
|
|
+ sqlStr+=")";
|
|
|
+ }
|
|
|
+ if (!sqlStr.equals("")){
|
|
|
+ req.setStrWhere(sqlStr);
|
|
|
+ }else {
|
|
|
+ req.setStrWhere(whereStr.toString());
|
|
|
+ }
|
|
|
+ handler.setRequest(req);
|
|
|
+ String responseStr = handler.handler();
|
|
|
+ GetCurrentStockResponse response = JSONObject.parseObject(responseStr, GetCurrentStockResponse.class);
|
|
|
+ if (!response.getResult()) {
|
|
|
+ throw new BusinessException(response.getMsg());
|
|
|
+ }
|
|
|
+ GetCurrentStockResponseData data = response.getData();
|
|
|
+ List<GetCurrentStock> stocks = data.getStock();
|
|
|
+ List<SpareStoreVO> partInfoVOS = new ArrayList<>();
|
|
|
+ for (GetCurrentStock stockResponse : stocks) {
|
|
|
+ SpareStoreVO partInfoVO = new SpareStoreVO();
|
|
|
+ partInfoVO.setId(stockResponse.getAutoId() + "");
|
|
|
+ partInfoVO.setNo(stockResponse.getCInvCode());
|
|
|
+ partInfoVO.setSpareId(stockResponse.getPartId() + "");
|
|
|
+ partInfoVO.setSpareName(stockResponse.getCInvName());
|
|
|
+ partInfoVO.setGgxh(stockResponse.getCInvStd());
|
|
|
+ partInfoVO.setNum(stockResponse.getIQuantity());
|
|
|
+ partInfoVO.setStoreName(stockResponse.getCWhName());
|
|
|
+ partInfoVO.setStoreId(stockResponse.getCWhCode());
|
|
|
+ partInfoVO.setUnit(stockResponse.getCComUnitName());
|
|
|
+ partInfoVO.setCBatch(stockResponse.getCBatch());
|
|
|
+ partInfoVO.setAutoId(stockResponse.getAutoId());
|
|
|
+ partInfoVO.setStorePosition(stockResponse.getCInvDefine1());
|
|
|
+ partInfoVOS.add(partInfoVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ //PageHelper.startPage(pageNum, pageSize);
|
|
|
+ MyVOPage<SpareStoreVO> myVOPage = new MyVOPage<>();
|
|
|
+ myVOPage.setPageNum(pageNum);
|
|
|
+ myVOPage.setPageSize(pageSize);
|
|
|
+ Page page = new Page(pageNum, pageSize);
|
|
|
+ page.setTotal(data.getTotal());
|
|
|
+ myVOPage.setPages(data.getPages().intValue());
|
|
|
+ myVOPage.setTotal(page.getTotal());
|
|
|
+ myVOPage.setRows(partInfoVOS);
|
|
|
+ return myVOPage;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 查询物资分页
|