no message
							parent
							
								
									8d901caf5f
								
							
						
					
					
						commit
						3c8a28ad7c
					
				| 
						 | 
					@ -1,18 +1,18 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
*  Copyright 2019-2020 Zheng Jie
 | 
					 *  Copyright 2019-2020 Zheng Jie
 | 
				
			||||||
*
 | 
					 *
 | 
				
			||||||
*  Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 *  Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
*  you may not use this file except in compliance with the License.
 | 
					 *  you may not use this file except in compliance with the License.
 | 
				
			||||||
*  You may obtain a copy of the License at
 | 
					 *  You may obtain a copy of the License at
 | 
				
			||||||
*
 | 
					 *
 | 
				
			||||||
*  http://www.apache.org/licenses/LICENSE-2.0
 | 
					 *  http://www.apache.org/licenses/LICENSE-2.0
 | 
				
			||||||
*
 | 
					 *
 | 
				
			||||||
*  Unless required by applicable law or agreed to in writing, software
 | 
					 *  Unless required by applicable law or agreed to in writing, software
 | 
				
			||||||
*  distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 *  distributed under the License is distributed on an "AS IS" BASIS,
 | 
				
			||||||
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
				
			||||||
*  See the License for the specific language governing permissions and
 | 
					 *  See the License for the specific language governing permissions and
 | 
				
			||||||
*  limitations under the License.
 | 
					 *  limitations under the License.
 | 
				
			||||||
*/
 | 
					 */
 | 
				
			||||||
package com.youchain.basicdata.rest;
 | 
					package com.youchain.basicdata.rest;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import cn.hutool.poi.excel.ExcelReader;
 | 
					import cn.hutool.poi.excel.ExcelReader;
 | 
				
			||||||
| 
						 | 
					@ -73,10 +73,10 @@ import static org.springframework.http.HttpStatus.OK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
* @website https://eladmin.vip
 | 
					 * @author houjianlan
 | 
				
			||||||
* @author houjianlan
 | 
					 * @website https://eladmin.vip
 | 
				
			||||||
* @date 2023-08-16
 | 
					 * @date 2023-08-16
 | 
				
			||||||
**/
 | 
					 **/
 | 
				
			||||||
@RestController
 | 
					@RestController
 | 
				
			||||||
@RequiredArgsConstructor
 | 
					@RequiredArgsConstructor
 | 
				
			||||||
@Api(tags = "导入管理")
 | 
					@Api(tags = "导入管理")
 | 
				
			||||||
| 
						 | 
					@ -91,51 +91,54 @@ public class ImportDataController {
 | 
				
			||||||
    private final PickTicketService pickTicketService;
 | 
					    private final PickTicketService pickTicketService;
 | 
				
			||||||
    private final PickDetailService pickDetailService;
 | 
					    private final PickDetailService pickDetailService;
 | 
				
			||||||
    private final CodeUtils codeUtils;
 | 
					    private final CodeUtils codeUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Log("导入完成品品番")
 | 
					    @Log("导入完成品品番")
 | 
				
			||||||
    @ApiOperation("导入完成品品番")
 | 
					    @ApiOperation("导入完成品品番")
 | 
				
			||||||
    @PostMapping(value = "/bigItem")
 | 
					    @PostMapping(value = "/bigItem")
 | 
				
			||||||
    @Transactional
 | 
					    @Transactional
 | 
				
			||||||
    @AnonymousAccess
 | 
					    @AnonymousAccess
 | 
				
			||||||
    public ResponseEntity<Object> importBigItem( @RequestParam("file") MultipartFile multipartFile) {
 | 
					    public ResponseEntity<Object> importBigItem(@RequestParam("file") MultipartFile multipartFile) {
 | 
				
			||||||
        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
					        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
				
			||||||
        int a=0;//新增
 | 
					        int a = 0;//新增
 | 
				
			||||||
        int b=0;//修改
 | 
					        int b = 0;//修改
 | 
				
			||||||
        int c=0;//错误
 | 
					        int c = 0;//错误
 | 
				
			||||||
        int d=0;//执行
 | 
					        int d = 0;//执行
 | 
				
			||||||
        List<String> cList=new ArrayList<>();
 | 
					        List<String> cList = new ArrayList<>();
 | 
				
			||||||
        for (int i = 0; i < readAll.size(); i++) {
 | 
					        for (int i = 0; i < readAll.size(); i++) {
 | 
				
			||||||
            String code =readAll.get(i).get("完成品品番")==null?null:readAll.get(i).get("完成品品番").toString();
 | 
					            String code = readAll.get(i).get("完成品品番") == null ? null : readAll.get(i).get("完成品品番").toString();
 | 
				
			||||||
            if(code==null||code.equals("")){
 | 
					            if (code == null || code.equals("")) {
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            String re = importDataService.importBigItem(readAll.get(i));
 | 
					            String re = importDataService.importBigItem(readAll.get(i));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return new ResponseEntity("导入成功",HttpStatus.OK);
 | 
					        return new ResponseEntity("导入成功", HttpStatus.OK);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Log("导入部品品番")
 | 
					    @Log("导入部品品番")
 | 
				
			||||||
    @ApiOperation("导入部品品番")
 | 
					    @ApiOperation("导入部品品番")
 | 
				
			||||||
    @PostMapping(value = "/item")
 | 
					    @PostMapping(value = "/item")
 | 
				
			||||||
    @Transactional
 | 
					    @Transactional
 | 
				
			||||||
    @AnonymousAccess
 | 
					    @AnonymousAccess
 | 
				
			||||||
    public ResponseEntity<Object> importItem( @RequestParam("file") MultipartFile multipartFile) {
 | 
					    public ResponseEntity<Object> importItem(@RequestParam("file") MultipartFile multipartFile) {
 | 
				
			||||||
        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
					        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
				
			||||||
        int a=0;//新增
 | 
					        int a = 0;//新增
 | 
				
			||||||
        int b=0;//修改
 | 
					        int b = 0;//修改
 | 
				
			||||||
        for (int i = 0; i < readAll.size(); i++) {
 | 
					        for (int i = 0; i < readAll.size(); i++) {
 | 
				
			||||||
            Map<String, Object> map=readAll.get(i);
 | 
					            Map<String, Object> map = readAll.get(i);
 | 
				
			||||||
            String code =(String) map.get("品番");
 | 
					            String code = (String) map.get("品番");
 | 
				
			||||||
            if(code==null||code.equals("")){
 | 
					            if (code == null || code.equals("")) {
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            String re = importDataService.importItem(map);
 | 
					            String re = importDataService.importItem(map);
 | 
				
			||||||
            if (re.equals("a")){
 | 
					            if (re.equals("a")) {
 | 
				
			||||||
                a=a+1;
 | 
					                a = a + 1;
 | 
				
			||||||
            }else if (re.equals("b")){
 | 
					            } else if (re.equals("b")) {
 | 
				
			||||||
                b=b+1;
 | 
					                b = b + 1;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return new ResponseEntity("导入成功:执行"+(a+b)+"行 新增"+a+"行,修改"+b+"行",HttpStatus.OK);
 | 
					        return new ResponseEntity("导入成功:执行" + (a + b) + "行 新增" + a + "行,修改" + b + "行", HttpStatus.OK);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Log("导入其他入库")
 | 
					    @Log("导入其他入库")
 | 
				
			||||||
    @ApiOperation("导入其他入库")
 | 
					    @ApiOperation("导入其他入库")
 | 
				
			||||||
    @PostMapping(value = "/importAsnDetail")
 | 
					    @PostMapping(value = "/importAsnDetail")
 | 
				
			||||||
| 
						 | 
					@ -143,23 +146,23 @@ public class ImportDataController {
 | 
				
			||||||
    @AnonymousAccess
 | 
					    @AnonymousAccess
 | 
				
			||||||
    public ResponseEntity<Object> importAsnDetail(@RequestParam Long asnId, @RequestParam("file") MultipartFile multipartFile) {
 | 
					    public ResponseEntity<Object> importAsnDetail(@RequestParam Long asnId, @RequestParam("file") MultipartFile multipartFile) {
 | 
				
			||||||
        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
					        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
				
			||||||
        List<String> cList=new ArrayList<>();
 | 
					        List<String> cList = new ArrayList<>();
 | 
				
			||||||
        Asn asn=asnService.getEntity(asnId);
 | 
					        Asn asn = asnService.getEntity(asnId);
 | 
				
			||||||
        if(asn==null){
 | 
					        if (asn == null) {
 | 
				
			||||||
            throw new BadRequestException(HttpStatus.NOT_FOUND,  "该单据不存在");
 | 
					            throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据不存在");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(!asn.getStatus().equals(BizStatus.OPEN))
 | 
					        if (!asn.getStatus().equals(BizStatus.OPEN)) {
 | 
				
			||||||
        {
 | 
					            throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据状态不正确");
 | 
				
			||||||
            throw new BadRequestException(HttpStatus.NOT_FOUND,  "该单据状态不正确");
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        for (int i = 0; i < readAll.size(); i++) {
 | 
					        for (int i = 0; i < readAll.size(); i++) {
 | 
				
			||||||
            String re = importDataService.importAsnDetail(readAll.get(i),asn);
 | 
					            String re = importDataService.importAsnDetail(readAll.get(i), asn);
 | 
				
			||||||
            if(re!=null&&!re.equals("")){
 | 
					            if (re != null && !re.equals("")) {
 | 
				
			||||||
                throw new BadRequestException(HttpStatus.NOT_FOUND, (i+1)+"行"+re);
 | 
					                throw new BadRequestException(HttpStatus.NOT_FOUND, (i + 1) + "行" + re);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return new ResponseEntity("导入成功", HttpStatus.OK);
 | 
					        return new ResponseEntity("导入成功", HttpStatus.OK);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Log("导入其他出库")
 | 
					    @Log("导入其他出库")
 | 
				
			||||||
    @ApiOperation("导入其他出库")
 | 
					    @ApiOperation("导入其他出库")
 | 
				
			||||||
    @PostMapping(value = "/importPickDetail")
 | 
					    @PostMapping(value = "/importPickDetail")
 | 
				
			||||||
| 
						 | 
					@ -167,22 +170,21 @@ public class ImportDataController {
 | 
				
			||||||
    @AnonymousAccess
 | 
					    @AnonymousAccess
 | 
				
			||||||
    public ResponseEntity<Object> importPickDetail(@RequestParam Long ptId, @RequestParam("file") MultipartFile multipartFile) {
 | 
					    public ResponseEntity<Object> importPickDetail(@RequestParam Long ptId, @RequestParam("file") MultipartFile multipartFile) {
 | 
				
			||||||
        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
					        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
				
			||||||
        List<String> cList=new ArrayList<>();
 | 
					        List<String> cList = new ArrayList<>();
 | 
				
			||||||
        PickTicket pt=pickTicketService.getEntity(ptId);
 | 
					        PickTicket pt = pickTicketService.getEntity(ptId);
 | 
				
			||||||
        if(pt==null){
 | 
					        if (pt == null) {
 | 
				
			||||||
            throw new BadRequestException(HttpStatus.NOT_FOUND,  "该单据不存在");
 | 
					            throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据不存在");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(!pt.getStatus().equals(BizStatus.OPEN)&&!pt.getStatus().equals(BizStatus.ALLOCATE))
 | 
					        if (!pt.getStatus().equals(BizStatus.OPEN) && !pt.getStatus().equals(BizStatus.ALLOCATE)) {
 | 
				
			||||||
        {
 | 
					            throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据状态不正确");
 | 
				
			||||||
            throw new BadRequestException(HttpStatus.NOT_FOUND,  "该单据状态不正确");
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        for (int i = 0; i < readAll.size(); i++) {
 | 
					        for (int i = 0; i < readAll.size(); i++) {
 | 
				
			||||||
            String re = importDataService.importPickDetail(readAll.get(i),pt);
 | 
					            String re = importDataService.importPickDetail(readAll.get(i), pt);
 | 
				
			||||||
            if(re!=null&&!re.equals("")){
 | 
					            if (re != null && !re.equals("")) {
 | 
				
			||||||
                throw new BadRequestException(HttpStatus.NOT_FOUND, (i+1)+"行"+re);
 | 
					                throw new BadRequestException(HttpStatus.NOT_FOUND, (i + 1) + "行" + re);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        List<PickDetail> ds=pickDetailService.queryPickDetailList(pt.getId());
 | 
					        List<PickDetail> ds = pickDetailService.queryPickDetailList(pt.getId());
 | 
				
			||||||
//        for(PickDetail d:ds) {
 | 
					//        for(PickDetail d:ds) {
 | 
				
			||||||
//            pickDetailService.allocate(d.getId(),d.getOrderQty());
 | 
					//            pickDetailService.allocate(d.getId(),d.getOrderQty());
 | 
				
			||||||
//        }
 | 
					//        }
 | 
				
			||||||
| 
						 | 
					@ -205,9 +207,9 @@ public class ImportDataController {
 | 
				
			||||||
    @PostMapping(value = "/importCountMoveDetail")
 | 
					    @PostMapping(value = "/importCountMoveDetail")
 | 
				
			||||||
    @Transactional
 | 
					    @Transactional
 | 
				
			||||||
    @AnonymousAccess
 | 
					    @AnonymousAccess
 | 
				
			||||||
    public ResponseEntity<Object> importCountMoveDetail(@RequestParam Long countId,@RequestParam("file") MultipartFile multipartFile) {
 | 
					    public ResponseEntity<Object> importCountMoveDetail(@RequestParam Long countId, @RequestParam("file") MultipartFile multipartFile) {
 | 
				
			||||||
        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
					        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
				
			||||||
        importDataService.importCountMoveDetail(countId,readAll);
 | 
					        importDataService.importCountMoveDetail(countId, readAll);
 | 
				
			||||||
        return new ResponseEntity("导入成功", HttpStatus.OK);
 | 
					        return new ResponseEntity("导入成功", HttpStatus.OK);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -216,17 +218,18 @@ public class ImportDataController {
 | 
				
			||||||
    @PostMapping(value = "/bomAccount")
 | 
					    @PostMapping(value = "/bomAccount")
 | 
				
			||||||
    @Transactional
 | 
					    @Transactional
 | 
				
			||||||
    @AnonymousAccess
 | 
					    @AnonymousAccess
 | 
				
			||||||
    public ResponseEntity<Object> importBomAccount( @RequestParam("file") MultipartFile multipartFile) {
 | 
					    public ResponseEntity<Object> importBomAccount(@RequestParam("file") MultipartFile multipartFile) {
 | 
				
			||||||
        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
					        List<Map<String, Object>> readAll = getMaps(multipartFile);
 | 
				
			||||||
        for (int i = 0; i < readAll.size(); i++) {
 | 
					        for (int i = 0; i < readAll.size(); i++) {
 | 
				
			||||||
            importDataService.importBomAccount(i,readAll.get(i));
 | 
					            importDataService.importBomAccount(i, readAll.get(i));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return new ResponseEntity("导入成功"+ readAll.size()+"行", HttpStatus.OK);
 | 
					        return new ResponseEntity("导入成功" + readAll.size() + "行", HttpStatus.OK);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 解析导入文件
 | 
					     * 解析导入文件
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
     * @param multipartFile
 | 
					     * @param multipartFile
 | 
				
			||||||
     * @return
 | 
					     * @return
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -248,12 +251,11 @@ public class ImportDataController {
 | 
				
			||||||
    @ApiOperation("导入asn")
 | 
					    @ApiOperation("导入asn")
 | 
				
			||||||
    @AnonymousAccess
 | 
					    @AnonymousAccess
 | 
				
			||||||
    public ResponseEntity<Object> importAsn(@RequestParam("file") MultipartFile file, @RequestParam("templateType") String templateType) {
 | 
					    public ResponseEntity<Object> importAsn(@RequestParam("file") MultipartFile file, @RequestParam("templateType") String templateType) {
 | 
				
			||||||
        try {
 | 
					        log.info("开始导入");
 | 
				
			||||||
            log.info("导入开始");
 | 
					        long start = System.currentTimeMillis();
 | 
				
			||||||
            importDataService.importAsn(file, templateType);
 | 
					        importDataService.importAsn(file, templateType);
 | 
				
			||||||
            return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), HttpStatus.OK);
 | 
					        log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), HttpStatus.OK);
 | 
				
			||||||
            return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), null), HttpStatus.BAD_REQUEST);
 | 
					
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -435,10 +435,6 @@ public class ImportDataServiceImpl implements ImportDataService {
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
    public void importAsn(MultipartFile file, String templateType) {
 | 
					    public void importAsn(MultipartFile file, String templateType) {
 | 
				
			||||||
        // 验证模板类型
 | 
					 | 
				
			||||||
        if (StringUtils.isEmpty(templateType)) {
 | 
					 | 
				
			||||||
            throw new BadRequestException("模板类型不能为空");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 验证模板类型是否有效
 | 
					        // 验证模板类型是否有效
 | 
				
			||||||
        if (!isValidTemplateType(templateType)) {
 | 
					        if (!isValidTemplateType(templateType)) {
 | 
				
			||||||
| 
						 | 
					@ -489,17 +485,23 @@ public class ImportDataServiceImpl implements ImportDataService {
 | 
				
			||||||
        // TODO: 实现标准导入逻辑
 | 
					        // TODO: 实现标准导入逻辑
 | 
				
			||||||
        log.info("处理标准导入,数据条数: {}", dataList.size());
 | 
					        log.info("处理标准导入,数据条数: {}", dataList.size());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //获取文件中所有的托盘号
 | 
				
			||||||
 | 
					        List<String> codes = dataList.stream().map(AsnImportForm::getCNo).collect(Collectors.toList());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //验证托盘号
 | 
				
			||||||
 | 
					        validateAsn(codes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //获取文件中所有的品番
 | 
					        //获取文件中所有的品番
 | 
				
			||||||
        List<String> itemCodes = dataList.stream().map(AsnImportForm::getPartNo).collect(Collectors.toList());
 | 
					        List<String> itemCodes = dataList.stream().map(AsnImportForm::getPartNo).collect(Collectors.toList());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //验证品番
 | 
					        //验证品番
 | 
				
			||||||
        Map<String, Item> exitItemMap = validateItem(itemCodes);
 | 
					        Map<String, Item> exitItemMap = validateItem(itemCodes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //获取文件中所有的托盘号
 | 
					        //库区
 | 
				
			||||||
        List<String> codes = dataList.stream().map(AsnImportForm::getCNo).collect(Collectors.toList());
 | 
					        Area area=areaService.findByCode(BaseStatus.DEFAULT_AREA);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //验证托盘号
 | 
					        //单据类型
 | 
				
			||||||
        validateAsn(codes);
 | 
					        BillType billType=billTypeRepository.findByName(BaseStatus.RK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Map<String, Asn> asnMap = new HashMap<>();
 | 
					        Map<String, Asn> asnMap = new HashMap<>();
 | 
				
			||||||
        List<Asn> insertToAsn=new ArrayList<>();//批量新增ASN
 | 
					        List<Asn> insertToAsn=new ArrayList<>();//批量新增ASN
 | 
				
			||||||
| 
						 | 
					@ -513,17 +515,25 @@ public class ImportDataServiceImpl implements ImportDataService {
 | 
				
			||||||
            Double orderQty = data.getQty();//数量
 | 
					            Double orderQty = data.getQty();//数量
 | 
				
			||||||
            String code = data.getCNo();//托盘号
 | 
					            String code = data.getCNo();//托盘号
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //品番
 | 
				
			||||||
 | 
					            Item item=exitItemMap.get(itemCode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Asn asn = null;
 | 
					            Asn asn = null;
 | 
				
			||||||
            if (asnMap.containsKey(code)) {
 | 
					            if (asnMap.containsKey(code)) {
 | 
				
			||||||
                asn=asnMap.get(code);
 | 
					                asn=asnMap.get(code);
 | 
				
			||||||
                asn.setOrderQuantity(asn.getOrderQuantity() + orderQty);
 | 
					                asn.setOrderQuantity(asn.getOrderQuantity() + orderQty);
 | 
				
			||||||
            }else{
 | 
					            }else{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                asn = Asn.builder()
 | 
					                asn = Asn.builder()
 | 
				
			||||||
                        .relatedBill1(relatedBill1)
 | 
					                        .relatedBill1(relatedBill1)
 | 
				
			||||||
                        .code(code)
 | 
					                        .code(code)
 | 
				
			||||||
 | 
					                        .area(area)
 | 
				
			||||||
                        .status(BizStatus.OPEN)
 | 
					                        .status(BizStatus.OPEN)
 | 
				
			||||||
                        .orderDate(new Timestamp(new Date().getTime()))
 | 
					                        .orderDate(new Timestamp(new Date().getTime()))
 | 
				
			||||||
                        .orderQuantity(orderQty)
 | 
					                        .orderQuantity(orderQty)
 | 
				
			||||||
 | 
					                        .billType(billType)
 | 
				
			||||||
 | 
					                        .receivedQuantity(0d)
 | 
				
			||||||
 | 
					                        .putawayQuantity(0d)
 | 
				
			||||||
                        .build();
 | 
					                        .build();
 | 
				
			||||||
                asnMap.put(code, asn);
 | 
					                asnMap.put(code, asn);
 | 
				
			||||||
                insertToAsn.add(asn);
 | 
					                insertToAsn.add(asn);
 | 
				
			||||||
| 
						 | 
					@ -532,10 +542,17 @@ public class ImportDataServiceImpl implements ImportDataService {
 | 
				
			||||||
            AsnDetail asnDetail = AsnDetail.builder()
 | 
					            AsnDetail asnDetail = AsnDetail.builder()
 | 
				
			||||||
                    .propC2(propC2)
 | 
					                    .propC2(propC2)
 | 
				
			||||||
                    .po(po)
 | 
					                    .po(po)
 | 
				
			||||||
                    .item(exitItemMap.get(itemCode))
 | 
					                    .item(item)
 | 
				
			||||||
                    .remark( remark)
 | 
					                    .remark( remark)
 | 
				
			||||||
                    .orderQty(orderQty)
 | 
					                    .orderQty(orderQty)
 | 
				
			||||||
                    .asn(asn)
 | 
					                    .asn(asn)
 | 
				
			||||||
 | 
					                    .status(BizStatus.OPEN)
 | 
				
			||||||
 | 
					                    .receivedQty(0d)
 | 
				
			||||||
 | 
					                    .moveQty(0d)
 | 
				
			||||||
 | 
					                    .putQty(0d)
 | 
				
			||||||
 | 
					                    .weight(0d)
 | 
				
			||||||
 | 
					                    .volume(0d)
 | 
				
			||||||
 | 
					                    .dept(item.getDept())
 | 
				
			||||||
                    .build();
 | 
					                    .build();
 | 
				
			||||||
            insertToAsnDetail.add(asnDetail);
 | 
					            insertToAsnDetail.add(asnDetail);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -590,6 +607,8 @@ public class ImportDataServiceImpl implements ImportDataService {
 | 
				
			||||||
        // 获取两个集合的交集说明ASN重复导入了,直接提示
 | 
					        // 获取两个集合的交集说明ASN重复导入了,直接提示
 | 
				
			||||||
        List<String> difference = SmartStringUtil.getIntersection(codes, existingAsnCodes);
 | 
					        List<String> difference = SmartStringUtil.getIntersection(codes, existingAsnCodes);
 | 
				
			||||||
        if (CollectionUtils.isNotEmpty(difference)) {
 | 
					        if (CollectionUtils.isNotEmpty(difference)) {
 | 
				
			||||||
 | 
					            //去重difference
 | 
				
			||||||
 | 
					            difference = difference.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
 | 
				
			||||||
            throw new BadRequestException(difference + "托盘号已导入,请勿重复导入");
 | 
					            throw new BadRequestException(difference + "托盘号已导入,请勿重复导入");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,5 +82,10 @@ public interface BaseStatus {
 | 
				
			||||||
     * 单据类型-单点
 | 
					     * 单据类型-单点
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static String BT_DD = "单点";
 | 
					    public static String BT_DD = "单点";
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 单据类型-正常入库
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static String RK = "正常入库";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue