|
@@ -438,16 +438,25 @@ public class YpTracCodgService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有销售数量,请检查!");
|
|
|
}
|
|
|
List<SelinfoSold> selinfoS = new ArrayList<>();
|
|
|
+ int fail = 0;
|
|
|
for(YpSelinfoSold yp : list){
|
|
|
SelinfoSold pb = new SelinfoSold();
|
|
|
yp.setIsTy("0");
|
|
|
String msg = callYpCodgInfo(yp, "0");
|
|
|
if(StringUtils.isNotBlank(msg)){
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, msg);
|
|
|
+ yp.setMsgErr(msg);
|
|
|
+ yp.setUploadFlag("0");
|
|
|
+ fail++;
|
|
|
+ continue;
|
|
|
}
|
|
|
BeanUtils.copyProperties(yp, pb);
|
|
|
selinfoS.add(pb);
|
|
|
}
|
|
|
+ if(selinfoS.isEmpty()){
|
|
|
+ soldService.updateYpSelinfoSoldBatch(list);
|
|
|
+ resultMap.put("msg", "批量上传药品销售信息结果: 成功【" + (list.size() - fail) + "】条,失败【" + fail + "】条。");
|
|
|
+ return ResultVoUtil.success(resultMap);
|
|
|
+ }
|
|
|
ResultVo<JSONObject> str = sv.saleGoods(selinfoS);
|
|
|
if(YpDictConstant.ERROR_STATUS == str.getCode()){
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "批量上传药品销售信息失败:" + str.getMessage());
|
|
@@ -456,12 +465,11 @@ public class YpTracCodgService {
|
|
|
JSONObject output = result.getJSONObject("output");
|
|
|
JSONArray s = output.getJSONArray("selinfoDetail");
|
|
|
List<Map> sd = s.toJavaList(Map.class);
|
|
|
- boolean status = false;
|
|
|
for(Map m : sd){
|
|
|
String retRslt = String.valueOf(m.get("retRslt"));
|
|
|
String fixmedinsBchno = String.valueOf(m.get("fixmedins_bchno"));
|
|
|
if(YpDictConstant.UPLOAD_ERROR.equals(retRslt)){
|
|
|
- status = true;
|
|
|
+ fail++;
|
|
|
}
|
|
|
for(YpSelinfoSold in : list){
|
|
|
if(in.getFixmedinsBchno().equals(fixmedinsBchno)){
|
|
@@ -472,11 +480,7 @@ public class YpTracCodgService {
|
|
|
}
|
|
|
}
|
|
|
soldService.updateYpSelinfoSoldBatch(list);
|
|
|
- if(status){
|
|
|
- resultMap.put("msg", "批量上传药品销售信息存在失败情况,请检查!");
|
|
|
- } else {
|
|
|
- resultMap.put("msg", "批量上传药品销售信息全部成功!");
|
|
|
- }
|
|
|
+ resultMap.put("msg", "批量上传药品销售信息结果: 成功【" + (list.size() - fail) + "】条,失败【" + fail + "】条。");
|
|
|
return ResultVoUtil.success(resultMap);
|
|
|
}
|
|
|
|
|
@@ -495,6 +499,7 @@ public class YpTracCodgService {
|
|
|
List<DrugTracCodg> list = new ArrayList<>();
|
|
|
String ypCodg = "";
|
|
|
String errCodg = "";
|
|
|
+ String confirmTime = "";
|
|
|
for(Map<String, String> map : zsmList){
|
|
|
String c = map.get("ypCodg");
|
|
|
if(null != c && c.length() != 20){
|
|
@@ -503,6 +508,7 @@ public class YpTracCodgService {
|
|
|
}
|
|
|
if(StringUtils.isBlank(ypCodg)){
|
|
|
ypCodg = c;
|
|
|
+ confirmTime = map.get("confirmTime");
|
|
|
}
|
|
|
DrugTracCodg codg = new DrugTracCodg();
|
|
|
codg.setDrugTracCodg(c);
|
|
@@ -540,23 +546,32 @@ public class YpTracCodgService {
|
|
|
}
|
|
|
ResultVo<Map<String, Object>> resultVo = tbService.queryCodeDetail(ypCodg);
|
|
|
Map<String, Object> map = resultVo.getData();
|
|
|
+ if(null == map){
|
|
|
+ return resultVo.getMessage();
|
|
|
+ }
|
|
|
List<AlibabaAlihealthDrugtraceTopYljgQueryCodedetailResponse.CodeFullInfoDto> ss = (List<AlibabaAlihealthDrugtraceTopYljgQueryCodedetailResponse.CodeFullInfoDto>) map.get("data");
|
|
|
yp.setManuDate(ss.get(0).getCodeProduceInfoDTO().getProduceInfoList().get(0).getProduceDateStr());
|
|
|
yp.setManuLotnum(ss.get(0).getCodeProduceInfoDTO().getProduceInfoList().get(0).getBatchNo());
|
|
|
yp.setExpyEnd(ss.get(0).getCodeProduceInfoDTO().getProduceInfoList().get(0).getExpireDate());
|
|
|
- YpInDetl inDetl = dao.selectCodgInfoProdTime(yp.getChargeCode(), yp.getSerial(), yp.getManuLotnum());
|
|
|
+ YpInDetl inDetl = dao.selectCodgInfoProdTime(yp.getChargeCode(), yp.getSerial(), yp.getManuLotnum(), confirmTime);
|
|
|
|
|
|
if(null == inDetl){
|
|
|
if(YpDictConstant.SERIAL_01.equals(yp.getSerial())){
|
|
|
- YpInDetl deal = dao.selectCodgInfoProdTime(yp.getChargeCode(), YpDictConstant.SERIAL_99, yp.getManuLotnum());
|
|
|
+ YpInDetl deal = dao.selectCodgInfoProdTime(yp.getChargeCode(), YpDictConstant.SERIAL_99, yp.getManuLotnum(), confirmTime);
|
|
|
if(null == deal){
|
|
|
- return "批量上传药品销售失败,根据追溯码【" + ypCodg + "】查出药品【" + ss.get(0).getDrugEntBaseDTO().getPhysicName() + "】品名与销售药品【" + yp.getChargeName() + "】品名不符合,请核对!" ;
|
|
|
+ return "批量上传药品销售失败,根据追溯码【" + ypCodg +
|
|
|
+ "】查出药品【" + ss.get(0).getDrugEntBaseDTO().getPhysicName() + "】品名,生产批号【"
|
|
|
+ + ss.get(0).getCodeProduceInfoDTO().getProduceInfoList().get(0).getBatchNo()
|
|
|
+ + "】与销售药品【" + yp.getChargeName() + "】品名不符合或者生产批号不存在,请核对!" ;
|
|
|
} else {
|
|
|
yp.setTrdnFlag("1");
|
|
|
yp.setFixmedinsBchno(StringUtils.trim(deal.getInDocuNo()) + "_" + deal.getInSeri());
|
|
|
}
|
|
|
} else {
|
|
|
- return "批量上传药品销售失败,根据追溯码【" + ypCodg + "】查出药品【" + ss.get(0).getDrugEntBaseDTO().getPhysicName() + "】品名与销售药品【" + yp.getChargeName() + "】品名不符合,请核对!" ;
|
|
|
+ return "批量上传药品销售失败,根据追溯码【" + ypCodg +
|
|
|
+ "】查出药品【" + ss.get(0).getDrugEntBaseDTO().getPhysicName() + "】品名,生产批号【"
|
|
|
+ + ss.get(0).getCodeProduceInfoDTO().getProduceInfoList().get(0).getBatchNo()
|
|
|
+ + "】与销售药品【" + yp.getChargeName() + "】品名不符合或者生产批号不存在,请核对!" ;
|
|
|
}
|
|
|
} else {
|
|
|
yp.setTrdnFlag("0");
|
|
@@ -566,7 +581,7 @@ public class YpTracCodgService {
|
|
|
} else {
|
|
|
YpOutDetl outDetl = dao.selectCodgInfoManu(yp.getChargeCode(), yp.getGroupNo());
|
|
|
if(null != outDetl){
|
|
|
- YpInDetl inDetl = dao.selectCodgInfoProdTime(outDetl.getChargeCode(), outDetl.getSerial(), outDetl.getManuNo());
|
|
|
+ YpInDetl inDetl = dao.selectCodgInfoProdTime(outDetl.getChargeCode(), outDetl.getSerial(), outDetl.getManuNo(), DateUtil.formatDate(outDetl.getConfirmDate(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
if(null != inDetl){
|
|
|
yp.setManuLotnum(StringUtils.trim(inDetl.getManuNo()));
|
|
|
yp.setManuDate(DateUtil.formatDate(inDetl.getProducingDate(), "yyyy-MM-dd"));
|
|
@@ -655,6 +670,10 @@ public class YpTracCodgService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "查询药品库存变更信息, 请选择库存变更类型!");
|
|
|
}
|
|
|
List<YpInvinfoModify> invinfoList = new ArrayList<>();
|
|
|
+ if(StringUtils.isNotEmpty(dto.getDocuNo())){
|
|
|
+ dto.setStartTime(null);
|
|
|
+ dto.setEndTime(null);
|
|
|
+ }
|
|
|
List<YpInvinfoModify> invinfoRk = dao.selectYpInvinfoModifyDetailRk(dto);
|
|
|
if(null != invinfoRk && !invinfoRk.isEmpty()){
|
|
|
for (YpInvinfoModify mo : invinfoRk){
|