采购计划、出入信息

scpwxyy
zane 7 months ago
parent fe58e8fcaa
commit d5b568ff8a

@ -20,6 +20,7 @@ import com.glxp.mipsdl.client.ctqyy.entity.InvCodeResultEntity;
import com.glxp.mipsdl.client.ctqyy.entity.InvProjectResultEntity;
import com.glxp.mipsdl.client.ctqyy.entity.InvResultEntity;
import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.constant.BusTypeConstant;
import com.glxp.mipsdl.constant.ConstantType;
import com.glxp.mipsdl.constant.Constants;
import com.glxp.mipsdl.dao.auth.AuthUserDao;
@ -53,6 +54,7 @@ import com.glxp.mipsdl.service.order.OrderUploadLogService;
import com.glxp.mipsdl.service.system.SysParamConfigService;
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService;
import com.glxp.mipsdl.thirddao.ctqyy.VYpzsIoInfoMapper;
import com.glxp.mipsdl.thirddao.ctqyy.VYpzsPhysicDictMapper;
import com.glxp.mipsdl.thirddao.ctqyy.VYpzsPlanInfoMapper;
import com.glxp.mipsdl.thirddao.ctqyy.VYpzsPresInfoMapper;
@ -124,6 +126,8 @@ public class CtqyyClient extends CommonHttpClient {
private VYpzsPresInfoMapper vYpzsPresInfoMapper;
@Resource
private VYpzsPlanInfoMapper vYpzsPlanInfoMapper;
@Resource
private VYpzsIoInfoMapper vYpzsIoInfoMapper;
/**
@ -1424,28 +1428,89 @@ public class CtqyyClient extends CommonHttpClient {
*/
@Override
public BaseResponse getThrOrders(UdiwmsThrOrderRequest udiwmsThrOrderRequest) {
LambdaQueryWrapper<VYpzsPlanInfo> wrapper = new LambdaQueryWrapper<>();
//补充其他查询条件
IPage<VYpzsPlanInfo> page = vYpzsPlanInfoMapper.selectPage(new Page<VYpzsPlanInfo>(udiwmsThrOrderRequest.getPage(), udiwmsThrOrderRequest.getLimit()), wrapper);
List<VYpzsPlanInfo> planInfoEntities = page.getRecords();
List<ThrOrderResponse> thrOrderResponses = null;
if (CollUtil.isNotEmpty(planInfoEntities)) {
//数据处理以thr_orderthr_order_detail 主子返回
thrOrderResponses = planInfoEntities.stream().map(plan -> {
ThrOrderResponse thrOrderResponse = new ThrOrderResponse();
List<ThrOrderDetailEntity> detailList = new ArrayList<>();
ThrOrderDetailEntity detail = new ThrOrderDetailEntity();
//TODO 封装数据
detailList.add(detail);
thrOrderResponse.setDetailList(detailList);
return thrOrderResponse;
}).collect(Collectors.toList());
}
PageSimpleResponse<ThrOrderResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(thrOrderResponses);
if(udiwmsThrOrderRequest.getBusType().equals(BusTypeConstant.CGJH001.getBusType())){
LambdaQueryWrapper<VYpzsPlanInfo> wrapper = new LambdaQueryWrapper<>();
//补充其他查询条件
wrapper.eq(StrUtil.isNotBlank(udiwmsThrOrderRequest.getBillNo()),VYpzsPlanInfo::getCGDBH,udiwmsThrOrderRequest.getBillNo());
IPage<VYpzsPlanInfo> page = vYpzsPlanInfoMapper.selectPage(new Page<VYpzsPlanInfo>(udiwmsThrOrderRequest.getPage(), udiwmsThrOrderRequest.getLimit()), wrapper);
List<VYpzsPlanInfo> planInfos = page.getRecords();
List<ThrOrderResponse> thrOrderResponses = new ArrayList<>();
if (CollUtil.isNotEmpty(planInfos)) {
//数据处理以thr_orderthr_order_detail 主子返回
Map<String, List<VYpzsPlanInfo>> groupedByBz = planInfos.stream()
.collect(Collectors.groupingBy(VYpzsPlanInfo::getCGDBH));
groupedByBz.forEach((key,value) ->{
VYpzsPlanInfo planInfo = value.get(0);
ThrOrderResponse thrOrderResponse = new ThrOrderResponse();
thrOrderResponse.setBillNo(planInfo.getCGDBH());
thrOrderResponse.setBilldate(planInfo.getSCQYMC());
thrOrderResponse.setCorpId(planInfo.getSCQYBM());
thrOrderResponse.setCorpName(planInfo.getSCQYMC());
thrOrderResponse.setThirdPartyDate(1);
thrOrderResponse.setCreateTime(new Date());
thrOrderResponse.setUpdateTime(new Date());
List<ThrOrderDetailEntity> detailList = new ArrayList<>();
value.forEach(entity -> {
ThrOrderDetailEntity detail = new ThrOrderDetailEntity();
detail.setProductId(entity.getYPBM());
detail.setProductName(entity.getYPMC());
detail.setBatchNo(entity.getYPBM());
detail.setSpec(entity.getGGMC());
detail.setCount(String.valueOf(entity.getZHB()));
detail.setOrderIdFk(thrOrderResponse.getBillNo());
detail.setPrice(entity.getTPJG());
detailList.add(detail);
});
thrOrderResponse.setDetailList(detailList);
thrOrderResponses.add(thrOrderResponse);
});
}
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(thrOrderResponses);
}else if(udiwmsThrOrderRequest.getBusType().equals(BusTypeConstant.LYRK.getBusType())
|| udiwmsThrOrderRequest.getBusType().equals(BusTypeConstant.GMRK.getBusType())
|| udiwmsThrOrderRequest.getBusType().equals(BusTypeConstant.LYCK.getBusType())){
LambdaQueryWrapper<VYpzsIoInfo> wrapper = new LambdaQueryWrapper<>();
//补充其他查询条件
wrapper.eq(StrUtil.isNotBlank(udiwmsThrOrderRequest.getBillNo()),VYpzsIoInfo::getPHYSIC_CODE,udiwmsThrOrderRequest.getBillNo());
wrapper.eq(StrUtil.isNotBlank(udiwmsThrOrderRequest.getBusType()),VYpzsIoInfo::getSORT_NAME,BusTypeConstant.valueOf(udiwmsThrOrderRequest.getBusType()).getName());
Page<VYpzsIoInfo> page = vYpzsIoInfoMapper.selectPage(new Page<VYpzsIoInfo>(udiwmsThrOrderRequest.getPage(), udiwmsThrOrderRequest.getLimit()), wrapper);
List<VYpzsIoInfo> ioInfos = page.getRecords();
List<ThrOrderResponse> thrOrderResponses = new ArrayList<>();
if (CollUtil.isNotEmpty(ioInfos)) {
//数据处理以thr_orderthr_order_detail 主子返回
Map<String, List<VYpzsIoInfo>> groupedByPhysicCode = ioInfos.stream()
.collect(Collectors.groupingBy(VYpzsIoInfo::getPHYSIC_CODE));
groupedByPhysicCode.forEach((key, value)->{
VYpzsIoInfo info = value.get(0);
ThrOrderResponse thrOrderResponse = new ThrOrderResponse();
thrOrderResponse.setBillNo(info.getPHYSIC_CODE());
thrOrderResponse.setBilldate(DateUtil.formatDate(info.getKEEP_BOOK_TIME(),"yyyy-MM-dd HH:mm:ss"));
thrOrderResponse.setCorpId(info.getCONSIGNOR());
thrOrderResponse.setCorpName(info.getCONSIGNOR_NAME());
thrOrderResponse.setThirdPartyDate(1);
thrOrderResponse.setCreateTime(new Date());
thrOrderResponse.setUpdateTime(new Date());
List<ThrOrderDetailEntity> detailList = new ArrayList<>();
value.forEach(entity -> {
ThrOrderDetailEntity detail = new ThrOrderDetailEntity();
detail.setProductId(null);
detail.setProductName(null);
detail.setBatchNo(entity.getBATCH_NO());
detail.setSpec(null);
detail.setCount(String.valueOf(entity.getQUANTITY()));
detail.setOrderIdFk(thrOrderResponse.getBillNo());
detail.setPrice(entity.getRETAIL_PRICE());
detailList.add(detail);
});
thrOrderResponse.setDetailList(detailList);
thrOrderResponses.add(thrOrderResponse);
});
}
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(thrOrderResponses);
}
return ResultVOUtils.success(pageSimpleResponse);
}

@ -0,0 +1,38 @@
package com.glxp.mipsdl.constant;
public enum BusTypeConstant {
YPCF002("药品处方单","YPCF002"),
CGJH001("采购计划","CGJH001"),
LYRK("领药入库","LYRK"),
GMRK("购买入库","GMRK"),
LYCK("领药出库","LYCK"),
;
private String name;
private String busType;
BusTypeConstant(String name, String busType) {
this.name = name;
this.busType = busType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBusType() {
return busType;
}
public void setBusType(String busType) {
this.busType = busType;
}
public static void main(String[] args) {
}
}

@ -89,7 +89,7 @@ public class YbApiController {
// password = SecureUtil.md5(password).toUpperCase();
// signRequest.setPassword(password);
String jsonStr = JSONUtil.toJsonStr(baseYbRequest);
log.error("【1201】医药机构信息获取请求参数" + jsonStr);
log.error("【9001】医药机构信息获取请求参数" + jsonStr);
JSONObject dataJson = JSONObject.parseObject(jsonStr);
return ResultVOUtils.success(ybClient.ybPost("9001", dataJson));
}

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
@Data
@TableName(value = "V_YPZS_PLAN_INFO")
public class VYpzsPlanInfo {
@ -31,7 +33,7 @@ public class VYpzsPlanInfo {
private String ZXSYDW;
@TableField(value = "ZHB")
private String ZHB;
private Integer ZHB;
@TableField(value = "SCQYBM")
private String SCQYBM;
@ -46,13 +48,13 @@ public class VYpzsPlanInfo {
private String YKMC;
@TableField(value = "ZBJ")
private String ZBJ;
private BigDecimal ZBJ;
@TableField(value = "GJJ")
private String GJJ;
private BigDecimal GJJ;
@TableField(value = "GMSL")
private String GMSL;
private Integer GMSL;
@TableField(value = "PSQYBM")
private String PSQYBM;
@ -64,7 +66,7 @@ public class VYpzsPlanInfo {
private String BZ;
@TableField(value = "TPJG")
private String TPJG;
private BigDecimal TPJG;
}

@ -141,7 +141,7 @@ public class ThrOrderResponse {
/**
* 1 2
*/
private Byte thirdPartyDate;
private Integer thirdPartyDate;
/**
*

Loading…
Cancel
Save