Commit e66cbc18 authored by 顾俭's avatar 顾俭

恢复test 审核中发布

parent 223fd32d
package com.i1.erp.deo.service;
import com.i1.base.exception.IOneServiceException;
import com.i1.erp.base.service.IBaseFetchService;
import com.i1.erp.entity.response.Result;
import com.i1.erp.poChg.soap.PoChgService;
......@@ -10,9 +9,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
......@@ -35,11 +32,9 @@ public class DeliveryOrderReleaseService implements IDeliveryOrderReleaseService
@Autowired
private IBaseFetchService baseFetchService;
private Logger logger = LoggerFactory.getLogger(DeliveryOrderReleaseService.class);
private Logger logger = LoggerFactory.getLogger(PoChgService.class);
@Override
@Transactional
public String release(String xmlStream) {
LocalDateTime dateTime = LocalDateTime.now();
String dateTimeString = dateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
......@@ -49,7 +44,7 @@ public class DeliveryOrderReleaseService implements IDeliveryOrderReleaseService
logger.info("发布送货单xmlStream:{}", xmlStream);
Map map = baseFetchService.getMapFromXml(xmlStream);
List<Map<String, String>> mstList = (List) map.get("mstList");
String testUid = null;
StringBuilder stringBuilder = new StringBuilder("送货单");
for (Map<String, String> mst : mstList) {
logger.info("to handle doRelease: {}", mst);
......@@ -57,9 +52,6 @@ public class DeliveryOrderReleaseService implements IDeliveryOrderReleaseService
Optional<DoMstFile> doMstFileOptional = doMstFileService.findByDeliveryOrderUid(doUid);
if (doMstFileOptional.isPresent()) {
DoMstFile doMstFile = doMstFileOptional.get();
if (doMstFile.getReleased().equalsIgnoreCase(DoMstFile.RELEASED)) {
throw new Exception("该送货单已经发布,不允许再操作,请重新获取查看");
}
doMstFile.setReleased("1");
doMstFile.setReleasedDate(new Date());
doMstFile.setReleasor("ERP");
......@@ -68,17 +60,12 @@ public class DeliveryOrderReleaseService implements IDeliveryOrderReleaseService
doMstFileService.update(doMstFile);
stringBuilder.append(" ");
stringBuilder.append(doUid);
testUid = doUid;
} else {
throw new Exception("查无此送货单" + doUid);
}
}
result = Result.of(dateTimeString, "0", "", stringBuilder.append("发布成功").toString());
Optional<DoMstFile> newDoMstFileOptional = doMstFileService.findByDeliveryOrderUid(testUid);
DoMstFile newDoMstFile =newDoMstFileOptional.get();
logger.info("送货单{}发布查询:发布后发布状态{},审核状态{}", newDoMstFile.getDeliveryOrderUid(), newDoMstFile.getReleased(), newDoMstFile.getConfirm());
} catch (Exception e) {
logger.error("error:", e);
result = Result.of(dateTimeString, "1", "", e.getMessage());
......
......@@ -18,7 +18,6 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import tw.com.dsc.tiptop.tiptopservicegateway.*;
import javax.persistence.EntityManager;
import java.util.Arrays;
import java.util.List;
......@@ -51,9 +50,6 @@ public class DeliveryOrderSendClient extends WebServiceClient {
private Logger logger = LoggerFactory.getLogger(DeliveryOrderSendClient.class);
@Autowired
private EntityManager entityManager;
@Autowired
private IDeliveryOrderSendService deliveryOrderSendService;
......@@ -310,13 +306,10 @@ public class DeliveryOrderSendClient extends WebServiceClient {
@Transactional
public void updateConfirm(DoMstFile doMstFile, String confirm, String details) throws IOneServiceException {
// 因为调用ERP审核的时候,ERP调用了SRM发布接口,变成了已发布,所以重新获取一下,再更新审核状态
entityManager.refresh(doMstFile);
DoMstFile newDoMstFile = doMstFileService.get(doMstFile.getId());
entityManager.refresh(newDoMstFile);
logger.info("送货单{}审核更新:更新前发布状态{},审核状态{}", newDoMstFile.getDeliveryOrderUid(), newDoMstFile.getReleased(), newDoMstFile.getConfirm());
newDoMstFile.setConfirm(confirm);
newDoMstFile.setSentToErpInfo(details);
doMstFileService.updateNotCheckReleased(newDoMstFile);
entityManager.refresh(newDoMstFile);
doMstFileService.update(newDoMstFile);
}
}
\ No newline at end of file
......@@ -334,11 +334,11 @@ public class DoMstFileService extends AbstractService<DoMstFile> implements IDoM
}
}
// @Override
// public DoMstFile update(DoMstFile doMstFile) throws IOneServiceException {
// passOnlyUnreleased(get(doMstFile.getId()));
// return super.update(doMstFile);
// }
@Override
public DoMstFile update(DoMstFile doMstFile) throws IOneServiceException {
passOnlyUnreleased(get(doMstFile.getId()));
return super.update(doMstFile);
}
@Override
public DoMstFile updateNotCheckReleased(DoMstFile doMstFile) throws IOneServiceException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment