|
@@ -8,6 +8,10 @@ import cn.superdesk.app.base.LoginContext;
|
|
|
import cn.superdesk.app.base.model.LoginSession;
|
|
|
import cn.superdesk.app.base.model.PageResult;
|
|
|
import cn.superdesk.app.base.model.SelectOptGroup;
|
|
|
+import cn.superdesk.app.export.consts.function.fwzc.ExportInventoryFunctionConstants;
|
|
|
+import cn.superdesk.app.export.enums.ExportTaskEnum;
|
|
|
+import cn.superdesk.app.export.feign.ExportFeignClient;
|
|
|
+import cn.superdesk.app.export.param.ExportTaskSubmitParam;
|
|
|
import cn.superdesk.app.inventory.common.enums.InventoryCheckSheetLevelEnum;
|
|
|
import cn.superdesk.app.inventory.common.enums.InventoryCheckSheetStateEnum;
|
|
|
import cn.superdesk.app.inventory.dao.entity.InventoryCheckSheetDetailEntity;
|
|
@@ -31,6 +35,7 @@ import cn.superdesk.app.inventory.util.AdminUtils;
|
|
|
import cn.superdesk.app.inventory.util.DocNoUtils;
|
|
|
import cn.superdesk.libs.common.SuperdeskBaseException;
|
|
|
import cn.superdesk.libs.springweb.model.WrapperResponse;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -54,6 +59,7 @@ public class InventoryCheckService {
|
|
|
private final ProductInventoryEntityMapper productInventoryEntityMapper;
|
|
|
private final OrganizationFeignClient organizationFeignClient;
|
|
|
private final InventoryCheckSheetMergeHistoryEntityMapper inventoryCheckSheetMergeHistoryEntityMapper;
|
|
|
+ private final ExportFeignClient exportFeignClient;
|
|
|
|
|
|
|
|
|
* 保存盘点单
|
|
@@ -635,4 +641,49 @@ public class InventoryCheckService {
|
|
|
.build()
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ * 导出盘点单
|
|
|
+ * @param docNo 盘点单单号
|
|
|
+ */
|
|
|
+ public WrapperResponse<String> export(String docNo) {
|
|
|
+
|
|
|
+ InventoryCheckSheetEntity inventoryCheckSheetEntity = inventoryCheckSheetEntityMapper.selectOne(
|
|
|
+ InventoryCheckSheetEntity.builder()
|
|
|
+ .docNo(docNo)
|
|
|
+ .build()
|
|
|
+ );
|
|
|
+
|
|
|
+ if (inventoryCheckSheetEntity == null) {
|
|
|
+ throw new SuperdeskBaseException(500, "盘点单不存在");
|
|
|
+ }
|
|
|
+ if (!InventoryCheckSheetStateEnum.盘点完成.getCode().equals(inventoryCheckSheetEntity.getState())) {
|
|
|
+ throw new SuperdeskBaseException(500, "盘点单未完成,无法导出");
|
|
|
+ }
|
|
|
+
|
|
|
+ LoginSession loginSession = AdminUtils.hasPermission(inventoryCheckSheetEntity.getOrgId());
|
|
|
+
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ map.put("docNo", docNo);
|
|
|
+
|
|
|
+ WrapperResponse<String> submit = exportFeignClient.submit(ExportTaskSubmitParam.builder()
|
|
|
+ .platform(ExportTaskEnum.Platform.楼闪送.getCode())
|
|
|
+ .module(ExportTaskEnum.Module.盘点.getCode())
|
|
|
+ .function(ExportInventoryFunctionConstants.导出盘点单)
|
|
|
+ .moduleName(ExportTaskEnum.Module.盘点.getDesc())
|
|
|
+ .source(ExportTaskEnum.Module.盘点.getDesc())
|
|
|
+ .exportFormat(ExportTaskEnum.Format.XLSX.getCode())
|
|
|
+ .param(JSON.toJSONString(map))
|
|
|
+ .artifactName("盘点记录" + DateUtil.format(new Date(), "yyyyMMddHHmmss"))
|
|
|
+ .createUserId(loginSession.getUserId())
|
|
|
+ .createUserName(loginSession.getUserName())
|
|
|
+ .compress(1)
|
|
|
+ .build());
|
|
|
+ log.info("提交盘点单导出任务结果:{},docNo:{}", JSON.toJSONString(submit), docNo);
|
|
|
+ if (submit.getCode() != 200) {
|
|
|
+ throw new SuperdeskBaseException(500, "导出任务提交失败");
|
|
|
+ } else {
|
|
|
+ return new WrapperResponse<>(200, "导出任务提交成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|