Commit 05cae4a3 authored by 顾俭's avatar 顾俭

aship/aship#4 防伪码功能-送货审核:审核接口

parent 2e7c6223
...@@ -100,49 +100,51 @@ public class DeliveryOrderSendService implements IDeliveryOrderSendService { ...@@ -100,49 +100,51 @@ public class DeliveryOrderSendService implements IDeliveryOrderSendService {
Detail detail = Detail.of(doXmlDtlRecordList, "DTL"); Detail detail = Detail.of(doXmlDtlRecordList, "DTL");
doXmlDetailList.add(detail); doXmlDetailList.add(detail);
// 启用防伪码供应商没有箱标签dtl1
//Detail1 //Detail1
List<DoDtlProductLabelFile> doDtlProductLabelFileList = doDtlProductLabelFileDao.findAllByDoMstId(doMstId); if(!"Y".equals(doMstFile.getSupplier().getUseBarcode())) {
List<Record> doXmlDtl1RecordList = new ArrayList<>(); List<DoDtlProductLabelFile> doDtlProductLabelFileList = doDtlProductLabelFileDao.findAllByDoMstId(doMstId);
if (!doDtlProductLabelFileList.isEmpty()) { List<Record> doXmlDtl1RecordList = new ArrayList<>();
for (DoDtlProductLabelFile doDtlProductLabelFile : doDtlProductLabelFileList) { if (!doDtlProductLabelFileList.isEmpty()) {
List<Field> dtlFieldList = new ArrayList<>(); for (DoDtlProductLabelFile doDtlProductLabelFile : doDtlProductLabelFileList) {
dtlFieldList.add(Field.of("tc_rvc01", doMstFile.getDeliveryOrderUid())); List<Field> dtlFieldList = new ArrayList<>();
dtlFieldList.add(Field.of("tc_rvc02", doDtlProductLabelFile.getDoDtlProductRow().toString())); dtlFieldList.add(Field.of("tc_rvc01", doMstFile.getDeliveryOrderUid()));
if (doDtlProductLabelFile.getBoxIndex() == null) { dtlFieldList.add(Field.of("tc_rvc02", doDtlProductLabelFile.getDoDtlProductRow().toString()));
throw new IOneServiceException("tc_rvc03不能为空:送货单箱标签从表" + doDtlProductLabelFile.getId()); if (doDtlProductLabelFile.getBoxIndex() == null) {
} throw new IOneServiceException("tc_rvc03不能为空:送货单箱标签从表" + doDtlProductLabelFile.getId());
dtlFieldList.add(Field.of("tc_rvc03", doDtlProductLabelFile.getBoxIndex())); }
dtlFieldList.add(Field.of("tc_rvc04", doDtlProductLabelFile.getBoxCode())); dtlFieldList.add(Field.of("tc_rvc03", doDtlProductLabelFile.getBoxIndex()));
if (doDtlProductLabelFile.getAmountInCurrentBox() != null) { dtlFieldList.add(Field.of("tc_rvc04", doDtlProductLabelFile.getBoxCode()));
dtlFieldList.add(Field.of("tc_rvc05", doDtlProductLabelFile.getAmountInCurrentBox().toString())); if (doDtlProductLabelFile.getAmountInCurrentBox() != null) {
} else { dtlFieldList.add(Field.of("tc_rvc05", doDtlProductLabelFile.getAmountInCurrentBox().toString()));
dtlFieldList.add(Field.of("tc_rvc05", "0")); } else {
} dtlFieldList.add(Field.of("tc_rvc05", "0"));
}
dtlFieldList.add(Field.of("tc_rvc11", doDtlProductLabelFile.getSteelCoil())); dtlFieldList.add(Field.of("tc_rvc11", doDtlProductLabelFile.getSteelCoil()));
dtlFieldList.add(Field.of("tc_rvc12", doDtlProductLabelFile.getFurnaceNo())); dtlFieldList.add(Field.of("tc_rvc12", doDtlProductLabelFile.getFurnaceNo()));
dtlFieldList.add(Field.of("tc_rvc19", dateToString(doDtlProductLabelFile.getManufacturingDate()))); dtlFieldList.add(Field.of("tc_rvc19", dateToString(doDtlProductLabelFile.getManufacturingDate())));
String tcRvc06 = ""; String tcRvc06 = "";
if (doDtlProductLabelFile.getDoDtlProduct() != null) { if (doDtlProductLabelFile.getDoDtlProduct() != null) {
BaseProductFile productFile = doDtlProductLabelFile.getDoDtlProduct().getProduct(); BaseProductFile productFile = doDtlProductLabelFile.getDoDtlProduct().getProduct();
if (productFile != null) { if (productFile != null) {
tcRvc06 = productFile.getProductUid(); tcRvc06 = productFile.getProductUid();
}
} }
} dtlFieldList.add(Field.of("tc_rvc06", tcRvc06));
dtlFieldList.add(Field.of("tc_rvc06", tcRvc06));
if (doDtlProductLabelFile.getDoDtlProduct() == null || doDtlProductLabelFile.getDoDtlProduct().getBatchId() == null) { if (doDtlProductLabelFile.getDoDtlProduct() == null || doDtlProductLabelFile.getDoDtlProduct().getBatchId() == null) {
throw new IOneServiceException("找不到tc_rvc112批号:送货单箱标签从表" + doDtlProductLabelFile.getId()); throw new IOneServiceException("找不到tc_rvc112批号:送货单箱标签从表" + doDtlProductLabelFile.getId());
}
dtlFieldList.add(Field.of("tc_rvc112", doDtlProductLabelFile.getDoDtlProduct().getBatchId()));
Record dtlRecord = Record.of(dtlFieldList);
doXmlDtl1RecordList.add(dtlRecord);
} }
dtlFieldList.add(Field.of("tc_rvc112", doDtlProductLabelFile.getDoDtlProduct().getBatchId()));
Record dtlRecord = Record.of(dtlFieldList);
doXmlDtl1RecordList.add(dtlRecord);
} }
Detail detail1 = Detail.of(doXmlDtl1RecordList, "DTL1");
doXmlDetailList.add(detail1);
} }
Detail detail1 = Detail.of(doXmlDtl1RecordList, "DTL1");
doXmlDetailList.add(detail1);
RecordSet recordSet = RecordSet.of(String.valueOf(i + 1), mst, doXmlDetailList); RecordSet recordSet = RecordSet.of(String.valueOf(i + 1), mst, doXmlDetailList);
recordSetList.add(recordSet); recordSetList.add(recordSet);
} else { } else {
......
...@@ -14,12 +14,9 @@ import org.slf4j.Logger; ...@@ -14,12 +14,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tw.com.dsc.tiptop.tiptopservicegateway.SRMFahuoRequestSRMFahuoRequest; import tw.com.dsc.tiptop.tiptopservicegateway.*;
import tw.com.dsc.tiptop.tiptopservicegateway.SRMFahuoResponseSRMFahuoResponse;
import tw.com.dsc.tiptop.tiptopservicegateway.TIPTOPServiceGateWayPortType;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -43,6 +40,12 @@ public class DeliveryOrderSendClient extends WebServiceClient { ...@@ -43,6 +40,12 @@ public class DeliveryOrderSendClient extends WebServiceClient {
@Value("${srm.soapWs.wsUrl}") @Value("${srm.soapWs.wsUrl}")
private String WS_URL; private String WS_URL;
@Value("${srm.soapWs.fahuoConfirm}")
public String ERP_FAHUO_CONFIRM_OP;
@Value("${srm.soapWs.wsdlUrl}")
private String WSDL_URL;
private Logger logger = LoggerFactory.getLogger(DeliveryOrderSendClient.class); private Logger logger = LoggerFactory.getLogger(DeliveryOrderSendClient.class);
@Autowired @Autowired
...@@ -57,7 +60,7 @@ public class DeliveryOrderSendClient extends WebServiceClient { ...@@ -57,7 +60,7 @@ public class DeliveryOrderSendClient extends WebServiceClient {
/** /**
* Send released delivery orders to ERP every one min. * Send released delivery orders to ERP every one min.
*/ */
@Scheduled(fixedDelay = 3600000) // @Scheduled(fixedDelay = 3600000)
@Transactional @Transactional
public void autoSend() throws IOneServiceException { public void autoSend() throws IOneServiceException {
try { try {
...@@ -126,6 +129,24 @@ public class DeliveryOrderSendClient extends WebServiceClient { ...@@ -126,6 +129,24 @@ public class DeliveryOrderSendClient extends WebServiceClient {
} }
} }
// 防伪码审核发货 只有动态客户端
@Transactional
public SyncResponse createClientAndSendDoMstFileBarcode(DoMstFile doMstFile) {
try {
if (StringUtils.isBlank(WSDL_URL) || StringUtils.isBlank(ERP_FAHUO_CONFIRM_OP)) {
throw new IOneServiceException("WSDL_URL or ERP_FAHUO_CONFIRM_OP 不可为空");
} else {
Client client = getClient(WSDL_URL);
SyncResponse syncResponse = sendDoMstFileBarcode(doMstFile, client);
client.destroy();
return syncResponse;
}
} catch (Exception e) {
logger.error("error", e);
return SyncResponse.of(FAIL_CODE, e.getMessage());
}
}
@Transactional @Transactional
public SyncResponse sendDoMstFile1(DoMstFile doMstFile, Client client) { public SyncResponse sendDoMstFile1(DoMstFile doMstFile, Client client) {
try { try {
...@@ -151,6 +172,30 @@ public class DeliveryOrderSendClient extends WebServiceClient { ...@@ -151,6 +172,30 @@ public class DeliveryOrderSendClient extends WebServiceClient {
} }
} }
@Transactional
public SyncResponse sendDoMstFileBarcode(DoMstFile doMstFile, Client client) {
try {
SRMFahuoconfirmRequestSRMFahuoconfirmRequest request = prepareRequestBarcode(doMstFile);
Object[] objects;
try {
// 防伪码审核
objects = client.invoke(ERP_FAHUO_CONFIRM_OP, new Object[]{request});
} catch (Exception e) {
throw new IOneServiceException(e);
}
if (objects != null && objects.length > 0) {
logger.info(objects[0].toString());
SRMFahuoconfirmResponseSRMFahuoconfirmResponse originalResponse = (SRMFahuoconfirmResponseSRMFahuoconfirmResponse) objects[0];
return handleResponseBarcode(originalResponse, doMstFile);
} else {
updateSendToErpStatus(doMstFile, false, "ERP无响应.");
return SyncResponse.of(FAIL_CODE, "ERP无响应");
}
} catch (IOneServiceException e) {
return SyncResponse.of(FAIL_CODE, e.getMessage());
}
}
@Transactional @Transactional
public SyncResponse sendDoMstFile2(DoMstFile doMstFile) { public SyncResponse sendDoMstFile2(DoMstFile doMstFile) {
try { try {
...@@ -180,6 +225,21 @@ public class DeliveryOrderSendClient extends WebServiceClient { ...@@ -180,6 +225,21 @@ public class DeliveryOrderSendClient extends WebServiceClient {
return srmFahuoRequest; return srmFahuoRequest;
} }
@Transactional
public SRMFahuoconfirmRequestSRMFahuoconfirmRequest prepareRequestBarcode(DoMstFile doMstFile) throws IOneServiceException {
Request xml;
xml = deliveryOrderSendService.sendDoXml(Arrays.asList(doMstFile.getId()));
if (xml == null) {
updateSendToErpStatus(doMstFile, false, "无法生成XML结构.");
throw new IOneServiceException("无法生成XML结构");
}
SRMFahuoconfirmRequestSRMFahuoconfirmRequest request = new SRMFahuoconfirmRequestSRMFahuoconfirmRequest();
request.setRequest(covertObjectToXML(xml, Request.class));
logger.info(request.getRequest());
return request;
}
@Transactional @Transactional
public SyncResponse handleResponse(SRMFahuoResponseSRMFahuoResponse originalResponse, DoMstFile doMstFile) { public SyncResponse handleResponse(SRMFahuoResponseSRMFahuoResponse originalResponse, DoMstFile doMstFile) {
try { try {
...@@ -202,6 +262,28 @@ public class DeliveryOrderSendClient extends WebServiceClient { ...@@ -202,6 +262,28 @@ public class DeliveryOrderSendClient extends WebServiceClient {
} }
} }
@Transactional
public SyncResponse handleResponseBarcode(SRMFahuoconfirmResponseSRMFahuoconfirmResponse originalResponse, DoMstFile doMstFile) {
try {
logger.info(originalResponse.getResponse());
Response response = convertXMLToObject(originalResponse.getResponse(), Response.class);
if (response.getExecution().getStatus().getCode().equalsIgnoreCase("0")) {
updateSendToErpStatus(doMstFile, false, "提交审核成功");
return SyncResponse.of(SUCCESS_CODE, "提交审核成功");
} else {
String errorDetails = String.format("失败码:%s, 原因:%s,SQL:%s",
safeString(response.getExecution().getStatus().getCode()),
safeString(response.getExecution().getStatus().getDescription()),
safeString(response.getExecution().getStatus().getSqlcode()));
updateSendToErpStatus(doMstFile, false, errorDetails);
return SyncResponse.of(FAIL_CODE, errorDetails);
}
} catch (IOneServiceException e) {
return SyncResponse.of(FAIL_CODE, e.getMessage());
}
}
@Transactional @Transactional
public void updateSendToErpStatus(DoMstFile doMstFile, Boolean status, String details) throws IOneServiceException { public void updateSendToErpStatus(DoMstFile doMstFile, Boolean status, String details) throws IOneServiceException {
logger.info("DeliveryOrderSendClient-updateSendToErpStatus start,ID:{},DeliveryOrderUid:{},SentToErp:{},SentToErpInfo:{}", logger.info("DeliveryOrderSendClient-updateSendToErpStatus start,ID:{},DeliveryOrderUid:{},SentToErp:{},SentToErpInfo:{}",
...@@ -215,10 +297,6 @@ public class DeliveryOrderSendClient extends WebServiceClient { ...@@ -215,10 +297,6 @@ public class DeliveryOrderSendClient extends WebServiceClient {
doMstFileNew.getId(), doMstFileNew.getDeliveryOrderUid(), doMstFileNew.getSentToErp(), doMstFileNew.getSentToErpInfo()); doMstFileNew.getId(), doMstFileNew.getDeliveryOrderUid(), doMstFileNew.getSentToErp(), doMstFileNew.getSentToErpInfo());
String info = details + "ID: " + doMstFile.getId() + "DeliveryOrderUid: " + doMstFile.getDeliveryOrderUid(); String info = details + "ID: " + doMstFile.getId() + "DeliveryOrderUid: " + doMstFile.getDeliveryOrderUid();
if (!status) { logger.info(info);
logger.error(info);
} else {
logger.info(info);
}
} }
} }
\ No newline at end of file
...@@ -49,15 +49,20 @@ public class DoMstFileController extends AbstractController<DoMstFile, DoMstFile ...@@ -49,15 +49,20 @@ public class DoMstFileController extends AbstractController<DoMstFile, DoMstFile
@RequestMapping(value = "/release/{id}", method = RequestMethod.POST) @RequestMapping(value = "/release/{id}", method = RequestMethod.POST)
public SyncResponse release(@PathVariable Long id) throws IOneWebRestfulException { public SyncResponse release(@PathVariable Long id) throws IOneWebRestfulException {
try { try {
SyncResponse response;
DoMstFile doMstFile = service.get(id); DoMstFile doMstFile = service.get(id);
service.passOnlyUnreleased(doMstFile); service.passOnlyUnreleased(doMstFile);
if(doMstFile.getSentToErp()) { if (doMstFile.getSentToErp()) {
throw new IOneServiceException("该送货单已经同步成功,请重新获取查看"); throw new IOneServiceException("该送货单已经同步成功,请重新获取查看");
} }
service.release(doMstFile); if ("Y".equals(doMstFile.getSupplier().getUseBarcode())) {
SyncResponse response = deliveryOrderSendClient.createClientAndSendDoMstFile(doMstFile); response = deliveryOrderSendClient.createClientAndSendDoMstFileBarcode(doMstFile);
if (response != null && response.getCode().equals(FAIL_CODE)) { } else {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); service.release(doMstFile);
response = deliveryOrderSendClient.createClientAndSendDoMstFile(doMstFile);
if (response != null && response.getCode().equals(FAIL_CODE)) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
} }
return response; return response;
} catch (IOneServiceException e) { } catch (IOneServiceException e) {
...@@ -85,8 +90,13 @@ public class DoMstFileController extends AbstractController<DoMstFile, DoMstFile ...@@ -85,8 +90,13 @@ public class DoMstFileController extends AbstractController<DoMstFile, DoMstFile
@ResourcePermission(values={Resource.VIEW}) @ResourcePermission(values={Resource.VIEW})
@RequestMapping(value = "/checkDeliveryAmt/{id}", method = RequestMethod.GET) @RequestMapping(value = "/checkDeliveryAmt/{id}", method = RequestMethod.GET)
public Map getTest(@PathVariable Long id) throws IOneWebRestfulException { public Map checkDeliveryAmt(@PathVariable Long id) throws IOneWebRestfulException {
try { try {
// 防伪码没有生成箱标签
if ("Y".equals(service.get(id).getSupplier().getUseBarcode())) {
return ImmutableMap.of("message", "success");
}
List<Object[]> rows = service.checkDeliveryAmtByDoMstId(id); List<Object[]> rows = service.checkDeliveryAmtByDoMstId(id);
if (rows.size() > 0) { if (rows.size() > 0) {
String msg = ""; String msg = "";
......
...@@ -166,10 +166,17 @@ ...@@ -166,10 +166,17 @@
ng-if="queryCondition.poMst.supplier && queryCondition.poMst.supplier.useBarcode != 'Y'">修改箱标签 ng-if="queryCondition.poMst.supplier && queryCondition.poMst.supplier.useBarcode != 'Y'">修改箱标签
</button> </button>
<button class="btn btn-default mrs" ng-click="release()" ng-disabled="!currentDeliveryOrder || currentDeliveryOrder.released == '1' || uiOption.releasing" <button class="btn btn-default mrs" ng-click="release()" ng-disabled="!currentDeliveryOrder || currentDeliveryOrder.released == '1' || uiOption.releasing"
acl-check func=" 'DELIVERY_ORDER_FUNCTION' " resource=" 'RELEASE' ">发布 acl-check func=" 'DELIVERY_ORDER_FUNCTION' " resource=" 'RELEASE' "
ng-if="queryCondition.poMst.supplier.useBarcode !== 'Y'">发布
</button> </button>
<button class="btn btn-default mrs" ng-click="unrelease()" ng-disabled="!currentDeliveryOrder || currentDeliveryOrder.released == '0' || uiOption.unReleasing" <button class="btn btn-default mrs" ng-click="unrelease()" ng-disabled="!currentDeliveryOrder || currentDeliveryOrder.released == '0' || uiOption.unReleasing"
acl-check func=" 'DELIVERY_ORDER_FUNCTION' " resource=" 'UNDO_RELEASE' ">发布撤回 acl-check func=" 'DELIVERY_ORDER_FUNCTION' " resource=" 'UNDO_RELEASE' "
ng-if="queryCondition.poMst.supplier.useBarcode !== 'Y'">发布撤回
</button>
<button class="btn btn-default mrs" ng-click="release()"
ng-disabled="!currentDeliveryOrder || currentDeliveryOrder.released == '1' || uiOption.releasing"
acl-check func=" 'DELIVERY_ORDER_FUNCTION' " resource=" 'RELEASE' "
ng-if="queryCondition.poMst.supplier.useBarcode === 'Y'">审核
</button> </button>
<button class="btn btn-default mrs" ng-click="clickExport()" ng-disabled="gridOptions.data.length == 0" <button class="btn btn-default mrs" ng-click="clickExport()" ng-disabled="gridOptions.data.length == 0"
acl-check func=" 'DELIVERY_ORDER_FUNCTION' " resource=" 'EXPORT' ">导出 acl-check func=" 'DELIVERY_ORDER_FUNCTION' " resource=" 'EXPORT' ">导出
......
...@@ -59,7 +59,7 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco ...@@ -59,7 +59,7 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco
name: '操作', field: "doMst.deliveryOrderUid", name: '操作', field: "doMst.deliveryOrderUid",
cellTemplate: "<a ng-if='row.entity.doMst.released == \"1\"' href ng-click='grid.appScope.printDeliveryOrder(row.entity)' title='打印送货单'><i class='fa fa-print'></i></a> " + cellTemplate: "<a ng-if='row.entity.doMst.released == \"1\"' href ng-click='grid.appScope.printDeliveryOrder(row.entity)' title='打印送货单'><i class='fa fa-print'></i></a> " +
"<a ng-if='row.entity.doMst.released == \"1\"' href style='margin-left: 5px;' ng-click='grid.appScope.printDeliveryOrderLabels(row.entity)' title='打印箱A4版标签'><i class='fa fa-print'></i></a>" + "<a ng-if='row.entity.doMst.released == \"1\"' href style='margin-left: 5px;' ng-click='grid.appScope.printDeliveryOrderLabels(row.entity)' title='打印箱A4版标签'><i class='fa fa-print'></i></a>" +
"<a ng-if='row.entity.doMst.released == \"1\"' href style='margin-left: 10px;' ng-click='grid.appScope.printDeliveryOrderSingleLabel(row.entity)' title='打印箱条码标签'><i class='fa fa-print'></i></a>", "<a ng-if='row.entity.doMst.released == \"1\" && row.entity.doMst.supplier.useBarcode != \"Y\"' href style='margin-left: 10px;' ng-click='grid.appScope.printDeliveryOrderSingleLabel(row.entity)' title='打印箱条码标签'><i class='fa fa-print'></i></a>",
width: 100, cellClass: 'print-icon' width: 100, cellClass: 'print-icon'
}, },
{name: '送货单号', field: 'doMst.deliveryOrderUid', width: 120, cellTemplate: cellTemplate}, {name: '送货单号', field: 'doMst.deliveryOrderUid', width: 120, cellTemplate: cellTemplate},
...@@ -205,12 +205,7 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco ...@@ -205,12 +205,7 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco
return ($scope.pageOption.page - 1) * $scope.pageOption.size + index + 1; return ($scope.pageOption.page - 1) * $scope.pageOption.size + index + 1;
}; };
if (item.doMst.sentToErp == false && item.doMst.sentToErpInfo == null) { item.doMst.sentToErpStatus = item.doMst.sentToErp ? '已同步' : '未同步';
item.doMst.sentToErpInfo = '无法连接ERP或等待下一个同步周期.';
item.doMst.sentToErpStatus = '未同步'
} else {
item.doMst.sentToErpStatus = item.doMst.sentToErp ? '成功' : '失败';
}
}) })
}; };
...@@ -321,23 +316,25 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco ...@@ -321,23 +316,25 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco
return; return;
} }
if (results[1].data.length == 0) { if ($scope.queryCondition.poMst.supplier.useBarcode !== 'Y') {
UtilService.showError("未生成箱标签,无法发布。请创建箱标签。"); if (results[1].data.length == 0) {
$scope.uiOption.releasing = false; UtilService.showError("未生成箱标签,无法发布。请创建箱标签。");
return;
} else if (results[0].data[0]['steelCoil'] == '1') {
//check these only when it's steel coil.
var notEnoughData = false;
results[1].data.forEach(function (item) {
if (!item.steelCoil || !item.furnaceNo || !item.amountInCurrentBox) {
notEnoughData = true;
}
});
if (notEnoughData) {
UtilService.showError("箱标签的数据不完整,请维护箱标签数据。");
$scope.uiOption.releasing = false; $scope.uiOption.releasing = false;
return; return;
} else if (results[0].data[0]['steelCoil'] == '1') {
//check these only when it's steel coil.
var notEnoughData = false;
results[1].data.forEach(function (item) {
if (!item.steelCoil || !item.furnaceNo || !item.amountInCurrentBox) {
notEnoughData = true;
}
});
if (notEnoughData) {
UtilService.showError("箱标签的数据不完整,请维护箱标签数据。");
$scope.uiOption.releasing = false;
return;
}
} }
} }
...@@ -345,28 +342,21 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco ...@@ -345,28 +342,21 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco
if (checkResponse.data.message == 'success') { if (checkResponse.data.message == 'success') {
DoMstFileService.release($scope.currentDeliveryOrder.id).then(function (releaseResponse) { DoMstFileService.release($scope.currentDeliveryOrder.id).then(function (releaseResponse) {
if (releaseResponse.data.code == '0') { if (releaseResponse.data.code == '0') {
UtilService.showInfo("发布成功。"); UtilService.showInfo("成功。");
angular.forEach($scope.gridOptions.data, function (item) {
if (item.doMst.deliveryOrderUid === $scope.currentDeliveryOrder.deliveryOrderUid) {
item.doMst.released = '1';
item.doMst.releasedDate = new Date();
item.doMst.sentToErpStatus = '成功';
item.doMst.sentToErpInfo = '同步ERP成功';
}
});
$scope.uiOption.releasing = false; $scope.uiOption.releasing = false;
$scope.queryDeliveryOrderDetails();
} else { } else {
UtilService.showError("发布失败:<br>" + releaseResponse.data.message); UtilService.showError("失败:<br>" + releaseResponse.data.message);
$scope.uiOption.releasing = false; $scope.uiOption.releasing = false;
$scope.queryDeliveryOrderDetails(); $scope.queryDeliveryOrderDetails();
} }
}, function (releaseError) { }, function (releaseError) {
UtilService.showError("发布失败:<br>" + (releaseError.data.externalError || releaseError.data.error)); UtilService.showError("失败:<br>" + (releaseError.data.externalError || releaseError.data.error));
$scope.uiOption.releasing = false; $scope.uiOption.releasing = false;
$scope.queryDeliveryOrderDetails(); $scope.queryDeliveryOrderDetails();
}) })
} else { } else {
UtilService.showError("发布失败:<br>" + checkResponse.data.message); UtilService.showError("失败:<br>" + checkResponse.data.message);
$scope.uiOption.releasing = false; $scope.uiOption.releasing = false;
} }
}, function () { }, function () {
...@@ -397,7 +387,7 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco ...@@ -397,7 +387,7 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco
item.doMst.printer = null; item.doMst.printer = null;
item.doMst.sentToErp = false; item.doMst.sentToErp = false;
item.doMst.sentToErpStatus = '未同步'; item.doMst.sentToErpStatus = '未同步';
item.doMst.sentToErpInfo = '无法连接ERP或等待下一个同步周期.'; item.doMst.sentToErpInfo = '';
} }
}); });
} else { } else {
...@@ -417,12 +407,7 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco ...@@ -417,12 +407,7 @@ angular.module('IOne').controller('DeliveryOrderQueryController', function ($sco
$scope.clickExport = function () { $scope.clickExport = function () {
DoDtlFileService.getAllByExample($scope.queryCondition).then(function (response) { DoDtlFileService.getAllByExample($scope.queryCondition).then(function (response) {
var jsonData = response.data.map(function (item, index) { var jsonData = response.data.map(function (item, index) {
if (item.doMst.sentToErp == false && item.doMst.sentToErpInfo == null) { item.doMst.sentToErpStatus = item.doMst.sentToErp ? '已同步' : '未同步';
item.doMst.sentToErpInfo = '无法连接ERP或等待下一个同步周期.';
item.doMst.sentToErpStatus = '未同步'
} else {
item.doMst.sentToErpStatus = item.doMst.sentToErp ? '成功' : '失败';
}
return { return {
index: index + 1, index: index + 1,
deliveryOrderUid: item.doMst.deliveryOrderUid || ' ', deliveryOrderUid: item.doMst.deliveryOrderUid || ' ',
......
...@@ -75,8 +75,10 @@ ...@@ -75,8 +75,10 @@
<div class="button-bar"> <div class="button-bar">
<button class="btn btn-primary" ng-click="printDeliveryOrder()" ng-disabled="currentDeliveryOrder.released !='1'">打印送货单</button> <button class="btn btn-primary" ng-click="printDeliveryOrder()" ng-disabled="currentDeliveryOrder.released !='1'">打印送货单</button>
<button class="btn btn-primary" ng-click="printDeliveryOrderLabels()" ng-disabled="productGridOption.data.length == 0 || currentDeliveryOrder.released !='1'">打印A4标签</button> <button class="btn btn-primary" ng-click="printDeliveryOrderLabels()" ng-disabled="productGridOption.data.length == 0 || currentDeliveryOrder.released !='1'">打印A4标签</button>
<button class="btn btn-primary" ng-click="printDeliveryOrderSingleLabel()" ng-disabled="productGridOption.data.length == 0 || currentDeliveryOrder.released !='1'">打印条码标签</button> <button class="btn btn-primary" ng-click="printDeliveryOrderSingleLabel()" ng-disabled="productGridOption.data.length == 0 || currentDeliveryOrder.released !='1'"
<button class="btn btn-primary" ng-click="saveLabels()" ng-hide="labelGridOption.data.length == 0 || labelGridOption.data[0].doDtlProduct.steelCoil == '0'" ng-if="currentDeliveryOrder.supplier.useBarcode !=='Y'">打印条码标签
</button>
<button class=" btn btn-primary" ng-click="saveLabels()" ng-hide="labelGridOption.data.length == 0 || labelGridOption.data[0].doDtlProduct.steelCoil == '0'"
ng-disabled="currentDeliveryOrder.released =='1'" ng-disabled="currentDeliveryOrder.released =='1'"
ng-if="false">保存钢卷信息 ng-if="false">保存钢卷信息
</button> </button>
...@@ -90,7 +92,8 @@ ...@@ -90,7 +92,8 @@
<uib-tab index="1" heading="订单物料汇总"> <uib-tab index="1" heading="订单物料汇总">
<div ui-grid="productGridOption" ui-grid-selection ui-grid-resize-columns class="grid mts"></div> <div ui-grid="productGridOption" ui-grid-selection ui-grid-resize-columns class="grid mts"></div>
</uib-tab> </uib-tab>
<uib-tab index="2" heading="箱标签明细"> <uib-tab index="2" heading="箱标签明细"
ng-if="currentDeliveryOrder.supplier.useBarcode!='Y'">
<div ui-grid="labelGridOption" ui-grid-selection ui-grid-edit ui-grid-row-edit ui-grid-cellNav ui-grid-resize-columns class="grid mts"></div> <div ui-grid="labelGridOption" ui-grid-selection ui-grid-edit ui-grid-row-edit ui-grid-cellNav ui-grid-resize-columns class="grid mts"></div>
</uib-tab> </uib-tab>
</uib-tabset> </uib-tabset>
......
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