main
parent
c89fc2449a
commit
20fa61bb34
|
|
@ -58,6 +58,10 @@ public interface BomAccountRepository extends JpaRepository<BomAccount, Long>, J
|
|||
@Query(value = "SELECT IFNULL(sum(pc_qty),0) FROM `base_bom_account` b where b.r_area_id=?1 and b.item_id=?2 and b.z_point_id=?3", nativeQuery = true)
|
||||
Double getPcQty(Long area_id, Long item_id, Long point_id);
|
||||
|
||||
/**固定库位二维码解析*/
|
||||
@Query(value = "SELECT * FROM `base_bom_account` b where b.item_id=:item_id and b.z_point_id=:z_point_id and b.bonded=:bonded", nativeQuery = true)
|
||||
List<BomAccount> queryEwmJx(Long item_id, Long z_point_id,String bonded);
|
||||
|
||||
@Query(value = "SELECT * FROM `base_bom_account` b where b.r_area_id=?1 and b.item_id=?2", nativeQuery = true)
|
||||
List<BomAccount> getBomList(Long area_id, Long item_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ public class ImportDataController {
|
|||
private final ImportProductionPlanService importProductionPlanService;
|
||||
private final ImportAsnDetailService importAsnDetailService;
|
||||
private final ImportPickDetailService importPickDetailService;
|
||||
private final ImportCountDetailService importCountDetailService;
|
||||
|
||||
@Log("导入完成品品番")
|
||||
@ApiOperation("导入完成品品番")
|
||||
|
|
@ -148,16 +149,16 @@ public class ImportDataController {
|
|||
return new ResponseEntity("导入成功", OK);
|
||||
}
|
||||
|
||||
@Log("导入移位明细")
|
||||
@ApiOperation("导入移位明细")
|
||||
@PostMapping(value = "/importCountMoveDetail")
|
||||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importCountMoveDetail(@RequestParam Long countId, @RequestParam("file") MultipartFile multipartFile) {
|
||||
List<Map<String, Object>> readAll = getMaps(multipartFile);
|
||||
importDataService.importCountMoveDetail(countId, readAll);
|
||||
return new ResponseEntity("导入成功", OK);
|
||||
}
|
||||
// @Log("导入移位明细")
|
||||
// @ApiOperation("导入移位明细")
|
||||
// @PostMapping(value = "/importCountMoveDetail")
|
||||
// @Transactional
|
||||
// @AnonymousAccess
|
||||
// public ResponseEntity<Object> importCountMoveDetail(@RequestParam Long countId, @RequestParam("file") MultipartFile multipartFile) {
|
||||
// List<Map<String, Object>> readAll = getMaps(multipartFile);
|
||||
// importDataService.importCountMoveDetail(countId, readAll);
|
||||
// return new ResponseEntity("导入成功", OK);
|
||||
// }
|
||||
|
||||
@Log("导入BOM工位清单")
|
||||
@ApiOperation("导入BOM工位清单")
|
||||
|
|
@ -244,8 +245,8 @@ public class ImportDataController {
|
|||
return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), OK);
|
||||
}
|
||||
|
||||
@Log("导入Point")
|
||||
@ApiOperation("导入Point")
|
||||
@Log("导入库位")
|
||||
@ApiOperation("导入库位")
|
||||
@PostMapping(value = "/importPoint")
|
||||
@Transactional
|
||||
@AnonymousAccess
|
||||
|
|
@ -254,7 +255,31 @@ public class ImportDataController {
|
|||
long start = System.currentTimeMillis();
|
||||
importPointService.importPoint(multipartFile);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), OK);
|
||||
return new ResponseEntity("导入成功", OK);
|
||||
}
|
||||
@Log("导入库位更新")
|
||||
@ApiOperation("导入库位更新")
|
||||
@PostMapping(value = "/importPointUpdate")
|
||||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importPointUpdate(@RequestParam("file") MultipartFile multipartFile) {
|
||||
log.info("开始导入点位");
|
||||
long start = System.currentTimeMillis();
|
||||
importPointService.importPointUpdate(multipartFile);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
return new ResponseEntity("导入成功", OK);
|
||||
}
|
||||
@Log("导入移位明细")
|
||||
@ApiOperation("导入移位明细")
|
||||
@PostMapping(value = "/importCountMoveDetail")
|
||||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importCountMoveDetail(@RequestParam Long countId, @RequestParam("file") MultipartFile multipartFile) {
|
||||
log.info("开始导入移位明细");
|
||||
long start = System.currentTimeMillis();
|
||||
importCountDetailService.importData(countId, multipartFile);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
return new ResponseEntity("导入成功", OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -187,6 +187,7 @@ public class ItemController {
|
|||
@ApiOperation("修改item")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
public ResponseEntity<Object> updateItem(@Validated @RequestBody Item resources){
|
||||
resources.setSrs(resources.getExtendD3().intValue());
|
||||
itemService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package com.youchain.basicdata.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface ImportCountDetailService {
|
||||
/**
|
||||
* 批量导入
|
||||
* @param file 文件
|
||||
*/
|
||||
void importData(Long asnId,MultipartFile file);
|
||||
}
|
||||
|
|
@ -8,4 +8,6 @@ public interface ImportPointService {
|
|||
* @param file 文件
|
||||
*/
|
||||
void importPoint(MultipartFile file);
|
||||
|
||||
void importPointUpdate(MultipartFile file);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.youchain.basicdata.domain.BigItem;
|
|||
import com.youchain.basicdata.domain.BomAccount;
|
||||
import com.youchain.basicdata.domain.BomAccountLog;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.service.BomAccountLogService;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.basicdata.service.dto.*;
|
||||
|
|
@ -69,6 +70,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class BomAccountServiceImpl implements BomAccountService {
|
||||
|
||||
private final BomAccountRepository bomAccountRepository;
|
||||
private final ItemRepository itemRepository;
|
||||
private final BomAccountMapper bomAccountMapper;
|
||||
private final PointService pointService;
|
||||
private final EntityManager entityManager;
|
||||
|
|
@ -143,6 +145,14 @@ public class BomAccountServiceImpl implements BomAccountService {
|
|||
ValidationUtil.isNull( bomAccount.getId(),"BomAccount","id",resources.getId());
|
||||
bomAccount.copy(resources);
|
||||
bomAccountRepository.save(bomAccount);
|
||||
//更新物料收容数
|
||||
Item it=resources.getItem();
|
||||
it.setSrs(bomAccount.getSrs());
|
||||
it.setExtendD3(resources.getSrs()+0d);
|
||||
it.setXz(bomAccount.getXz());
|
||||
it.setAc(bomAccount.getAc());
|
||||
it.setContents(bomAccount.getContents());
|
||||
itemRepository.save(it);
|
||||
delCaches();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,196 @@
|
|||
package com.youchain.basicdata.service.impl;
|
||||
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.service.ImportCountDetailService;
|
||||
import com.youchain.basicdata.service.ImportPickDetailService;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.inputJson.imports.CountDetailImport;
|
||||
import com.youchain.businessdata.inputJson.imports.PickDetailImport;
|
||||
import com.youchain.businessdata.repository.*;
|
||||
import com.youchain.businessdata.service.*;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ImportCountDetailServiceImpl implements ImportCountDetailService {
|
||||
|
||||
private final ItemRepository itemRepository;
|
||||
|
||||
private final ItemKeyRepository itemKeyRepository;
|
||||
|
||||
private final InventoryRepository inventoryRepository;
|
||||
|
||||
private final CountMoveDetailRepository countMoveDetailRepository;
|
||||
|
||||
private final CountMoveRepository countMoveRepository;
|
||||
|
||||
private final ItemService itemService;
|
||||
|
||||
private final ItemKeyService itemKeyService;
|
||||
|
||||
private final PointService pointService;
|
||||
|
||||
private final CountDetailService countDetailService;
|
||||
|
||||
private final CountMoveService countMoveService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importData(Long moveId,MultipartFile file) {
|
||||
|
||||
// 验证模板类型是否正确
|
||||
isValidTemplateType(file);
|
||||
|
||||
// 根据模板类型进行不同的处理
|
||||
baseImportTemplate(moveId,file);
|
||||
}
|
||||
|
||||
// 处理标准模板
|
||||
@Transactional
|
||||
public void baseImportTemplate(Long moveId,MultipartFile file) {
|
||||
// 读取sheet数据
|
||||
List<CountDetailImport> dataList = FastExcelUtil.readExcelData(file, CountDetailImport.class, 0, 1);
|
||||
|
||||
//批量导入
|
||||
importData(moveId,dataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理批量导入
|
||||
*/
|
||||
private void importData(Long moveId,List<CountDetailImport> dataList) {
|
||||
// TODO: 实现批量导入逻辑
|
||||
log.info("处理批量导入,数据条数: {}", dataList.size());
|
||||
|
||||
CountMove countMove=countMoveRepository.getById(moveId);
|
||||
if(countMove==null||!countMove.getStatus().equals(BizStatus.OPEN)){
|
||||
throw new BadRequestException("移位单据状态不正确");
|
||||
}
|
||||
//获取文件中所有的品番编码
|
||||
List<String> itemcodes = dataList.stream().map(CountDetailImport::getItemCode).collect(Collectors.toList());
|
||||
itemcodes = itemcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
Map<String, Item> exitItemMap = validateItem(itemcodes);
|
||||
|
||||
//获取文件中所有的库位编码
|
||||
List<String> srcPointcodes = dataList.stream().map(CountDetailImport::getSrcPointCode).collect(Collectors.toList());
|
||||
srcPointcodes = srcPointcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
Map<String, Point> exitSrcPointMap = validatePoint(srcPointcodes);
|
||||
|
||||
//获取文件中所有目标的库位编码
|
||||
List<String> dstPointcodes = dataList.stream().map(CountDetailImport::getDstPointCode).collect(Collectors.toList());
|
||||
dstPointcodes = dstPointcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
Map<String, Point> exitDstPointMap = validatePoint(dstPointcodes);
|
||||
|
||||
Dept dept=UserUtils.getDept();
|
||||
Double orderQty=countMove.getOrderQty();
|
||||
int i=1;
|
||||
for (CountDetailImport data : dataList) {
|
||||
i++;
|
||||
String bonded=data.getBonded();
|
||||
String pch=data.getPc();
|
||||
String stockCode=data.getStockCode();
|
||||
if(data.getBonded()==null){
|
||||
throw new BadRequestException("税别不能为空");
|
||||
}
|
||||
Item item = exitItemMap.get(data.getItemCode());
|
||||
Point srcPoint=exitSrcPointMap.get(data.getSrcPointCode());
|
||||
Point dstPoint=exitDstPointMap.get(data.getDstPointCode());
|
||||
List<ItemKey> itemKeyList = new ArrayList<>();
|
||||
if(srcPoint.getType().equals(BaseStatus.ZZKW)){
|
||||
itemKeyList=itemKeyRepository.getItemKeyNotPc(item.getId(),bonded);
|
||||
}else{
|
||||
itemKeyList=itemKeyRepository.getItemKeyPc(item.getId(),pch,bonded);
|
||||
}
|
||||
if (itemKeyList.size() == 0) {
|
||||
throw new BadRequestException(i + "行" + data.getItemCode() + "不存在库存");
|
||||
}
|
||||
ItemKey ik = itemKeyList.get(0);
|
||||
//查找库存
|
||||
List<Inventory> inventoryList = new ArrayList<>();
|
||||
if(srcPoint.getType().equals(BaseStatus.ZZKW)){
|
||||
inventoryList=inventoryRepository.queryInvPdNotXd(srcPoint.getId(),ik.getId(),BaseStatus.ZZKW);
|
||||
}else{
|
||||
if(stockCode!=null&&!stockCode.equals("")){
|
||||
inventoryList=inventoryRepository.queryInvPdXd(srcPoint.getId(),ik.getId(),BaseStatus.CH,stockCode);
|
||||
}else{
|
||||
inventoryList=inventoryRepository.queryInvPdNotXd(srcPoint.getId(),ik.getId(),BaseStatus.CH);
|
||||
}
|
||||
}
|
||||
if (inventoryList.size() == 0) {
|
||||
throw new BadRequestException( i + "行" + data.getItemCode() + "不存在库存");
|
||||
}
|
||||
Inventory inventory= inventoryList.get(0);
|
||||
if(inventory.getQueuedQty()>0){
|
||||
throw new BadRequestException(i + "行" + data.getItemCode() + "有占用,不能移位");
|
||||
}
|
||||
countMoveService.createCountDetail(countMove,inventory, ik, dstPoint);
|
||||
}
|
||||
}
|
||||
|
||||
//验证库位
|
||||
private Map<String, Item> validateItem(List<String> codes) {
|
||||
Map<String, Item> existMap = itemService.queryByItemCodesToMap(codes);
|
||||
if (existMap.isEmpty()) {
|
||||
throw new BadRequestException("品番代码不存在或已失效");
|
||||
}
|
||||
List<String> existCodes = new ArrayList(existMap.keySet());
|
||||
// 获取两个集合的非交集说明品番不存在或失效,直接提示
|
||||
List<String> difference = SmartStringUtil.getDifference(codes, existCodes);
|
||||
if (CollectionUtils.isNotEmpty(difference)) {
|
||||
throw new BadRequestException(difference + "品番不存在或已失效");
|
||||
}
|
||||
return existMap;
|
||||
}
|
||||
|
||||
//验证库位
|
||||
private Map<String, Point> validatePoint(List<String> codes) {
|
||||
Map<String, Point> existMap = pointService.queryByPointCodesToMap(codes);
|
||||
if (existMap.isEmpty()) {
|
||||
throw new BadRequestException("库位代码不存在或已失效");
|
||||
}
|
||||
List<String> existCodes = new ArrayList(existMap.keySet());
|
||||
// 获取两个集合的非交集说明品番不存在或失效,直接提示
|
||||
List<String> difference = SmartStringUtil.getDifference(codes, existCodes);
|
||||
if (CollectionUtils.isNotEmpty(difference)) {
|
||||
throw new BadRequestException(difference + "库位不存在或已失效");
|
||||
}
|
||||
return existMap;
|
||||
}
|
||||
|
||||
|
||||
//验证模板是否使用正确
|
||||
private void isValidTemplateType(MultipartFile file) {
|
||||
// 根据模板类型进行不同的处理
|
||||
List<String> requiredColumns = Arrays.asList(
|
||||
"品番",
|
||||
"源库位",
|
||||
"目标库位",
|
||||
"批次号",
|
||||
"箱单号",
|
||||
"税别"
|
||||
);
|
||||
List<String> headers = FastExcelUtil.readHeadContent(file, 0, 0);
|
||||
if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {
|
||||
throw new BadRequestException("标准导入模板不正确,请确认模板信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.youchain.basicdata.service.impl;
|
|||
|
||||
import com.youchain.basicdata.domain.Area;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.repository.AreaRepository;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.basicdata.service.*;
|
||||
import com.youchain.businessdata.inputJson.imports.PointImport;
|
||||
|
|
@ -25,6 +26,8 @@ public class ImportPointServiceImpl implements ImportPointService {
|
|||
|
||||
private final PointRepository pointRepository;
|
||||
|
||||
private final AreaRepository areaRepository;
|
||||
|
||||
private final PointService pointService;
|
||||
|
||||
private final AreaService areaService;
|
||||
|
|
@ -33,24 +36,62 @@ public class ImportPointServiceImpl implements ImportPointService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importPoint(MultipartFile file) {
|
||||
|
||||
// 根据模板类型进行不同的处理
|
||||
List<String> requiredColumns = Arrays.asList(
|
||||
"库位号",
|
||||
"库区",
|
||||
"存储类型",
|
||||
"品番",
|
||||
"库存下限",
|
||||
"纳所",
|
||||
"标签类型"
|
||||
// ,
|
||||
// "总分类型",
|
||||
// "关联总库位"
|
||||
);
|
||||
// 验证模板类型是否正确
|
||||
isValidTemplateType(file);
|
||||
isValidTemplateType(file,requiredColumns);
|
||||
|
||||
// 根据模板类型进行不同的处理
|
||||
baseImportTemplate(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importPointUpdate(MultipartFile file) {
|
||||
|
||||
// 根据模板类型进行不同的处理
|
||||
List<String> requiredColumns = Arrays.asList(
|
||||
"序号"
|
||||
);
|
||||
// 验证模板类型是否正确
|
||||
List<String> headers=isValidTemplateType(file,requiredColumns);
|
||||
Map<String,Boolean> headersMap=new HashMap<>();
|
||||
for(String header:headers){
|
||||
headersMap.put(header,Boolean.TRUE);
|
||||
}
|
||||
// 根据模板类型进行不同的处理
|
||||
baseImportTemplateUpdate(file,headersMap);
|
||||
}
|
||||
|
||||
// 处理标准模板
|
||||
@Transactional
|
||||
public void baseImportTemplate(MultipartFile file) {
|
||||
// 读取sheet数据
|
||||
List<PointImport> dataList = FastExcelUtil.readExcelData(file, PointImport.class, 0, 1);
|
||||
|
||||
//批量导入
|
||||
importPointData(dataList);
|
||||
}
|
||||
|
||||
// 处理更新导入模板
|
||||
@Transactional
|
||||
public void baseImportTemplateUpdate(MultipartFile file,Map<String,Boolean> headersMap) {
|
||||
// 读取sheet数据
|
||||
List<PointImport> dataList = FastExcelUtil.readExcelData(file, PointImport.class, 0, 1);
|
||||
//批量导入
|
||||
importPointDataUpdate(dataList,headersMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理批量导入
|
||||
*/
|
||||
|
|
@ -66,41 +107,117 @@ public class ImportPointServiceImpl implements ImportPointService {
|
|||
for(Point p:pointAll){
|
||||
exitPointMap.put(p.getCode(),p);
|
||||
}
|
||||
//
|
||||
// //获取文件中所有的库区名称
|
||||
// List<String> areaNames = dataList.stream().map(PointImport::getAreaName).collect(Collectors.toList());
|
||||
// areaNames = areaNames.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
// Map<String, Area> exitAreaMap = validateArea(areaNames);
|
||||
|
||||
//获取文件中所有的库区名称
|
||||
List<String> areaNames = dataList.stream().map(PointImport::getAreaName).collect(Collectors.toList());
|
||||
areaNames = areaNames.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
Map<String, Area> exitAreaMap = validateArea(areaNames);
|
||||
|
||||
for (PointImport data : dataList) {
|
||||
log.info(data.getAreaName()+"===="+data.getCode());
|
||||
Point point = exitPointMap.get(data.getCode());
|
||||
point.setCode(data.getAreaName());
|
||||
// if (point == null) {
|
||||
// point=new Point();
|
||||
// point.setCode(data.getCode());
|
||||
// point.setDept(UserUtils.getDept());
|
||||
// point.setCreateBy(SecurityUtils.getCurrentUsername());
|
||||
// point.setCreateTime(new Timestamp(new Date().getTime()));
|
||||
// point.setEnabled(Boolean.TRUE);
|
||||
// }
|
||||
// point.setArea(exitAreaMap.get(data.getAreaName()));
|
||||
// String lx = data.getType();
|
||||
// if (lx.equals("材管库位")) {
|
||||
// lx = BaseStatus.CH;
|
||||
// } else if (lx.equals("制造库位")) {
|
||||
// lx = BaseStatus.ZZKW;
|
||||
// }else if (lx.equals("缓存库位")) {
|
||||
// lx = BaseStatus.HCKW;
|
||||
// }
|
||||
// point.setType(lx);
|
||||
// point.setBeatCode(data.getNs());
|
||||
// point.setDescription(data.getBqlx());
|
||||
// point.setItemCode(data.getItemCode());
|
||||
// point.setZflx(data.getZflx());
|
||||
// point.setBqlx(data.getBqlx());
|
||||
// point.setGlzkw(data.getGlzkw());
|
||||
// point.setInvMin(Integer.parseInt(data.getKcxx()));
|
||||
if (point == null) {
|
||||
point=new Point();
|
||||
point.setCode(data.getCode());
|
||||
point.setDept(UserUtils.getDept());
|
||||
point.setCreateBy(SecurityUtils.getCurrentUsername());
|
||||
point.setCreateTime(new Timestamp(new Date().getTime()));
|
||||
point.setEnabled(Boolean.TRUE);
|
||||
}
|
||||
point.setArea(exitAreaMap.get(data.getAreaName()));
|
||||
String lx = data.getType();
|
||||
if (lx.equals("材管库位")) {
|
||||
lx = BaseStatus.CH;
|
||||
} else if (lx.equals("制造库位")) {
|
||||
lx = BaseStatus.ZZKW;
|
||||
}else if (lx.equals("缓存库位")) {
|
||||
lx = BaseStatus.HCKW;
|
||||
}
|
||||
point.setType(lx);
|
||||
point.setBeatCode(data.getNs());
|
||||
point.setDescription(data.getBqlx());
|
||||
point.setItemCode(data.getItemCode());
|
||||
point.setZflx(data.getZflx());
|
||||
point.setBqlx(data.getBqlx());
|
||||
point.setGlzkw(data.getGlzkw());
|
||||
point.setInvMin(Integer.parseInt(data.getKcxx()));
|
||||
pointRepository.save(point);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理批量更新导入
|
||||
*/
|
||||
private void importPointDataUpdate(List<PointImport> dataList,Map<String,Boolean> headersMap) {
|
||||
// TODO: 实现批量导入逻辑
|
||||
log.info("处理批量导入,数据条数: {}", dataList.size());
|
||||
List<Point> pointList=pointRepository.findAll();
|
||||
Map<String, Point> pointCodeMap = new HashMap<>();
|
||||
Map<Long, Point> pointIdMap = new HashMap<>();
|
||||
for(Point point:pointList){
|
||||
pointCodeMap.put(point.getCode(),point);
|
||||
pointIdMap.put(point.getId(),point);
|
||||
}
|
||||
List<Area> areaList=areaRepository.findAll();
|
||||
Map<String, Area> areaCodeMap = new HashMap<>();
|
||||
Map<Long, Area> areaIdMap = new HashMap<>();
|
||||
for(Area area:areaList){
|
||||
areaCodeMap.put(area.getCode(),area);
|
||||
areaIdMap.put(area.getId(),area);
|
||||
}
|
||||
Map<String, String> pointTypeMap = new HashMap<>();
|
||||
pointTypeMap.put("材管库位",BaseStatus.CH);
|
||||
pointTypeMap.put("制造库位",BaseStatus.ZZKW);
|
||||
pointTypeMap.put("缓存库位",BaseStatus.HCKW);
|
||||
Map<String, String> bqTypeMap = new HashMap<>();
|
||||
bqTypeMap.put("中大物标签","中大物标签");
|
||||
bqTypeMap.put("小物标签","小物标签");
|
||||
for (PointImport data : dataList) {
|
||||
String code=data.getCode();
|
||||
String areaName=data.getAreaName();
|
||||
String type= data.getType();
|
||||
String kcxx= data.getKcxx();
|
||||
String itemCode= data.getItemCode();
|
||||
String ns= data.getNs();
|
||||
String bqlx= data.getBqlx();
|
||||
Point point = pointIdMap.get(data.getId());
|
||||
if(point==null){
|
||||
throw new BadRequestException("库位不存在");
|
||||
}
|
||||
if(headersMap.containsKey("库位号")) {
|
||||
Point point2 = pointCodeMap.get(code);
|
||||
if(point2!=null){
|
||||
throw new BadRequestException(code+"库位已存在,不能重复更新");
|
||||
}
|
||||
point.setCode(code);
|
||||
}
|
||||
if(headersMap.containsKey("库区")) {
|
||||
Area area=areaCodeMap.get(areaName);
|
||||
if(area==null){
|
||||
throw new BadRequestException("库区不存在");
|
||||
}
|
||||
point.setArea(area);
|
||||
}
|
||||
if(headersMap.containsKey("存储类型")) {
|
||||
if(!pointTypeMap.containsKey(type)){
|
||||
throw new BadRequestException("存储类型填写错误");
|
||||
}
|
||||
point.setType(pointTypeMap.get(type));
|
||||
}
|
||||
if(headersMap.containsKey("库存下限")) {
|
||||
point.setInvMin(Integer.parseInt(kcxx));
|
||||
}
|
||||
if(headersMap.containsKey("品番")) {
|
||||
point.setItemCode(itemCode);
|
||||
}
|
||||
if(headersMap.containsKey("纳所")) {
|
||||
point.setBeatCode(ns);
|
||||
}
|
||||
if(headersMap.containsKey("标签类型")) {
|
||||
if(!bqTypeMap.containsKey(bqlx)){
|
||||
throw new BadRequestException("标签类型填写错误");
|
||||
}
|
||||
point.setType(bqTypeMap.get(bqlx));
|
||||
}
|
||||
pointRepository.save(point);
|
||||
}
|
||||
}
|
||||
|
|
@ -127,23 +244,13 @@ public class ImportPointServiceImpl implements ImportPointService {
|
|||
}
|
||||
|
||||
//验证模板是否使用正确
|
||||
private void isValidTemplateType(MultipartFile file) {
|
||||
// 根据模板类型进行不同的处理
|
||||
List<String> requiredColumns = Arrays.asList(
|
||||
"库位号",
|
||||
"库区"
|
||||
// "存储类型",
|
||||
// "品番",
|
||||
// "库存下限",
|
||||
// "纳所",
|
||||
// "标签类型"
|
||||
// ,
|
||||
// "总分类型",
|
||||
// "关联总库位"
|
||||
);
|
||||
private List<String> isValidTemplateType(MultipartFile file,List<String> requiredColumns) {
|
||||
List<String> headers = FastExcelUtil.readHeadContent(file, 0, 0);
|
||||
if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {
|
||||
throw new BadRequestException("标准导入模板不正确,请确认模板信息");
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package com.youchain.businessdata.inputJson;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ZzkwMoveReq {//制造库位移位入参
|
||||
String srcPointCode;
|
||||
String dstPointCode;
|
||||
double moveQty;
|
||||
String type;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.youchain.businessdata.inputJson.imports;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: 基础导入
|
||||
* @author: youzhi.gao
|
||||
* @date: 2020-04-01 15:01
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CountDetailImport {
|
||||
@ExcelProperty("品番")
|
||||
private String itemCode;
|
||||
@ExcelProperty("箱单号")
|
||||
private String stockCode;
|
||||
@ExcelProperty("批次号")
|
||||
private String pc;
|
||||
@ExcelProperty("源库位")
|
||||
private String srcPointCode;
|
||||
@ExcelProperty("目标库位")
|
||||
private String dstPointCode;
|
||||
@ExcelProperty("税别")
|
||||
private String bonded;
|
||||
}
|
||||
|
|
@ -16,6 +16,8 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PointImport {
|
||||
@ExcelProperty("序号")
|
||||
private Long id;
|
||||
@ExcelProperty("库位号")
|
||||
private String code;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
|||
|
||||
@Query(value = "SELECT * FROM data_inventory inv " +
|
||||
"left join base_point p on inv.point_id=p.id " +
|
||||
" WHERE inv.quantity>0 and inv.area_id=?1" +
|
||||
" and p.type='CH'" , nativeQuery = true)
|
||||
List<Inventory> queryInventoryArea2(long areaId);
|
||||
" WHERE inv.quantity>0 and inv.area_id=:areaId" +
|
||||
" and p.type=:point_type" , nativeQuery = true)
|
||||
List<Inventory> queryInventoryArea2(long areaId,String point_type);
|
||||
|
||||
@Query(value = "SELECT * from data_inventory inv \n" +
|
||||
"left join base_point p on inv.point_id=p.id\n" +
|
||||
|
|
@ -72,4 +72,16 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
|||
"WHERE inv.quantity>0 and p.type='CH' and inv.stock_code=:stockCode and it.code=:itemCode" , nativeQuery = true)
|
||||
List<Inventory> queryInvStockItemCode(String stockCode,String itemCode);
|
||||
|
||||
@Query(value = "SELECT * FROM data_inventory inv " +
|
||||
"left join base_point p on inv.point_id=p.id " +
|
||||
" WHERE inv.quantity>0 " +
|
||||
" and inv.point_id=:point_id and inv.item_key_id=:item_key_id and p.type=:point_type and inv.stock_code is null" , nativeQuery = true)
|
||||
List<Inventory> queryInvPdNotXd(long point_id,Long item_key_id,String point_type);
|
||||
|
||||
@Query(value = "SELECT * FROM data_inventory inv " +
|
||||
"left join base_point p on inv.point_id=p.id " +
|
||||
" WHERE inv.quantity>0 " +
|
||||
" and inv.point_id=:point_id and inv.item_key_id=:item_key_id and p.type=:point_type and inv.stock_code=:stockCode" , nativeQuery = true)
|
||||
List<Inventory> queryInvPdXd(long point_id,Long item_key_id,String point_type,String stockCode);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,4 +30,8 @@ import java.util.List;
|
|||
public interface ItemKeyRepository extends JpaRepository<ItemKey, Long>, JpaSpecificationExecutor<ItemKey> {
|
||||
@Query(value = "SELECT * FROM data_item_key ik where ik.item_id =?1 and ik.prop_c1 =?2" , nativeQuery = true)
|
||||
List<ItemKey> queryItemKey(Long item_id,String prop_c1);
|
||||
@Query(value = "SELECT * FROM data_item_key ik where ik.item_id =:item_id and ik.prop_c1 =:prop_c1 and ik.prop_c2 =:bonded" , nativeQuery = true)
|
||||
List<ItemKey> getItemKeyPc(Long item_id,String prop_c1,String bonded);
|
||||
@Query(value = "SELECT * FROM data_item_key ik where ik.item_id =:item_id and ik.prop_c2 =:bonded" , nativeQuery = true)
|
||||
List<ItemKey> getItemKeyNotPc(Long item_id,String bonded);
|
||||
}
|
||||
|
|
@ -151,8 +151,8 @@ public class CountMoveController {
|
|||
countMoveService.countCheck(countMove);
|
||||
}
|
||||
}
|
||||
String sql="INSERT into data_inventory_count_bak(count_id,bill_code,item_key_id,point_id,quantity,queued_qty,be_lock,be_reject,`status`,dept_id,area_id,zzkw,bf_date) \n" +
|
||||
"select "+countMove.getId()+",'"+countMove.getCode()+"',item_key_id,point_id,quantity,queued_qty,be_lock,be_reject,status,dept_id,area_id,zzkw,SYSDATE() from data_inventory inv where inv.quantity!=0";
|
||||
String sql="INSERT into data_inventory_count_bak(count_id,bill_code,item_key_id,stock_code,point_id,quantity,queued_qty,be_lock,be_reject,`status`,dept_id,area_id,zzkw,bf_date) \n" +
|
||||
"select "+countMove.getId()+",'"+countMove.getCode()+"',item_key_id,stock_code,point_id,quantity,queued_qty,be_lock,be_reject,status,dept_id,area_id,zzkw,SYSDATE() from data_inventory inv where inv.quantity!=0";
|
||||
Query query=entityManager.createNativeQuery(sql);
|
||||
query.executeUpdate();
|
||||
countMove.setStatus(BizStatus.COUNT);
|
||||
|
|
|
|||
|
|
@ -20,11 +20,14 @@ import com.youchain.annotation.AnonymousAccess;
|
|||
import com.youchain.annotation.Log;
|
||||
import com.youchain.appupdate.inputJson.ScanItemCode;
|
||||
import com.youchain.basicdata.domain.BomAccount;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.repository.BomAccountRepository;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.inputJson.XdMoveReq;
|
||||
import com.youchain.businessdata.inputJson.ZzkwMoveReq;
|
||||
import com.youchain.businessdata.inputJson.buttenJson.InvYW;
|
||||
import com.youchain.businessdata.inputJson.buttenJson.InventoryButton;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
|
|
@ -38,6 +41,7 @@ import com.youchain.businessdata.service.dto.*;
|
|||
import com.youchain.businessdata.service.dto.jsonDto.CxjlDto;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.BillParmType;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -52,6 +56,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import io.swagger.annotations.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -74,6 +79,7 @@ public class InventoryController {
|
|||
private final InventoryLogService inventoryLogService;
|
||||
private final TaskRepository taskRepository;
|
||||
private final PointRepository pointRepository;
|
||||
private final ItemRepository itemRepository;
|
||||
private final BomAccountRepository bomAccountRepository;
|
||||
private final ItemKeyService itemKeyService;
|
||||
|
||||
|
|
@ -288,6 +294,108 @@ public class InventoryController {
|
|||
return new ResponseEntity<>("操作成功",HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/zzkwMoveInvApp")
|
||||
@Log("制造库位移位App")
|
||||
@ApiOperation("制造库位移位App")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
@AnonymousAccess
|
||||
@DuplicateSubmission(5)
|
||||
public ResponseEntity<Object> zzkwMoveInvApp(@RequestBody ZzkwMoveReq zzkwMoveReq) throws Exception {
|
||||
String type=zzkwMoveReq.getType();
|
||||
String srcPointCode=zzkwMoveReq.getSrcPointCode();
|
||||
String dstPointCode=zzkwMoveReq.getDstPointCode();
|
||||
Point srcPoint=null;
|
||||
Point dstPoint=null;
|
||||
List<BomAccount> bs=new ArrayList<>();
|
||||
if(srcPointCode==null||srcPointCode.equals("")){
|
||||
throw new BadRequestException("请扫描源库位");
|
||||
}
|
||||
//解析二维码内容
|
||||
String[] srcStr=srcPointCode.split("]");
|
||||
if(srcStr.length>=3) {//固定库位标签
|
||||
String pointCode = srcStr[3];
|
||||
String bomItemCode=srcStr[0];
|
||||
String bonded=srcStr[2];
|
||||
srcPoint=pointRepository.findByCode(pointCode);
|
||||
Item item=itemRepository.findByCode(bomItemCode);
|
||||
bs=bomAccountRepository.queryEwmJx(item.getId(),srcPoint.getId(),bonded);
|
||||
}else {
|
||||
srcPoint=pointRepository.findByCode(srcPointCode);
|
||||
}
|
||||
if(dstPointCode!=null&&!dstPointCode.equals("")) {
|
||||
String[] dstStr=dstPointCode.split("]");
|
||||
if(dstStr.length>=3) {//固定库位标签
|
||||
String pointCode = dstStr[3];
|
||||
String bomItemCode=dstStr[0];
|
||||
String bonded=dstStr[2];
|
||||
dstPoint=pointRepository.findByCode(pointCode);
|
||||
Item item=itemRepository.findByCode(bomItemCode);
|
||||
bs=bomAccountRepository.queryEwmJx(item.getId(),dstPoint.getId(),bonded);
|
||||
}else {
|
||||
dstPoint=pointRepository.findByCode(dstPointCode);
|
||||
}
|
||||
}
|
||||
if(bs.size()>0) {
|
||||
BomAccount bomAccount=bs.get(0);
|
||||
CxjlDto cxjlDto=new CxjlDto();
|
||||
//查询BOM,寻找收容数
|
||||
cxjlDto.setRk_id(bomAccount.getRArea().getId());
|
||||
cxjlDto.setItem_id(bomAccount.getItem().getId());
|
||||
cxjlDto.setZzkw_id(bomAccount.getZPoint().getId());
|
||||
cxjlDto.setBonded(bomAccount.getBonded());
|
||||
cxjlDto.setArea_name(bomAccount.getRArea().getName());
|
||||
cxjlDto.setPoint_code(bomAccount.getZPoint().getCode());
|
||||
cxjlDto.setItem_name(bomAccount.getItem().getName());
|
||||
cxjlDto.setItem_code(bomAccount.getItem().getCode());
|
||||
if(!type.equals("zzkc_move")) {
|
||||
return new ResponseEntity<>(cxjlDto, HttpStatus.OK);
|
||||
}
|
||||
}else{
|
||||
return new ResponseEntity<>("扫描成功", HttpStatus.OK);
|
||||
}
|
||||
if(type.equals("zzkc_move")) {
|
||||
if(bs.size()<=0) {
|
||||
throw new BadRequestException("源库位或目标库位为制造库位");
|
||||
}
|
||||
if(srcPoint==null||dstPoint==null) {
|
||||
throw new BadRequestException("请扫描库位");
|
||||
}
|
||||
if(!srcPoint.getType().equals(BaseStatus.ZZKW)&&!srcPoint.getType().equals(BaseStatus.HCKW)&&(srcPoint.getArea().getName()).indexOf("盘点")<0) {
|
||||
throw new BadRequestException(srcPoint.getCode()+"该功能仅限于制造库位或缓存库位或盘点库位");
|
||||
}
|
||||
if(!dstPoint.getType().equals(BaseStatus.ZZKW)&&!dstPoint.getType().equals(BaseStatus.HCKW)&&(dstPoint.getArea().getName()).indexOf("盘点")<0) {
|
||||
throw new BadRequestException(dstPoint.getCode()+"该功能仅限于制造库位或缓存库位或盘点库位");
|
||||
}
|
||||
BomAccount bomAccount=bs.get(0);
|
||||
Item item=bomAccount.getItem();
|
||||
double move_qty=zzkwMoveReq.getMoveQty();
|
||||
ItemKey itemKey = itemKeyService.getItemKey(item, null, bomAccount.getBonded());
|
||||
Inventory srcInventory = inventoryService.getInventory(itemKey, srcPoint.getArea(), srcPoint, srcPoint, srcPoint.getDept(), BizStatus.MOVE, null);
|
||||
if(srcInventory==null){
|
||||
throw new BadRequestException(item.getCode()+"该库位无该批次库存");
|
||||
}
|
||||
int invQty=(int)(srcInventory.getQuantity()- srcInventory.getQueuedQty());
|
||||
if(invQty<move_qty){
|
||||
throw new BadRequestException(item.getCode()+"库存可用不足");
|
||||
}
|
||||
double srcQty = srcInventory.getQuantity();
|
||||
srcInventory.setQuantity(srcInventory.getQuantity() - move_qty);
|
||||
inventoryService.update(srcInventory);
|
||||
InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.ADD, "制造入库APP", srcPoint.getArea(), itemKey, srcInventory.getPoint(), srcInventory.getPoint(), null, null, srcQty, move_qty + 0d, null, null,
|
||||
BizStatus.ZZKW_TL, null, srcInventory.getId(), "制造移位APP");
|
||||
|
||||
Inventory dstInventory = inventoryService.getInventory(itemKey, dstPoint.getArea(), dstPoint, dstPoint, dstPoint.getDept(), BizStatus.MOVE, null);
|
||||
double srcQty2 = dstInventory.getQuantity();
|
||||
dstInventory.setQuantity(dstInventory.getQuantity() + move_qty);
|
||||
inventoryService.update(dstInventory);
|
||||
InventoryLog dstInventoryLog = inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.ADD, "制造入库APP", dstPoint.getArea(), itemKey, dstInventory.getPoint(), dstInventory.getPoint(), null, null, srcQty2, move_qty + 0d, null, null,
|
||||
BizStatus.ZZKW_TL, null, dstInventory.getId(), "制造移位APP");
|
||||
|
||||
}
|
||||
|
||||
return new ResponseEntity<>("操作成功",HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/xdMoveInv")
|
||||
@Log("箱单移位")
|
||||
@ApiOperation("箱单移位")
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ public class PickDetailController {
|
|||
if(point==null||!point.getType().equals("ZZKW")){
|
||||
throw new BadRequestException("制造库位错误");
|
||||
}
|
||||
List<BomAccount> bomAccounts=bomAccountRepository.queryEwmJx(item.getId(),point.getId(),bonded);
|
||||
//查询BOM,寻找收容数
|
||||
cxjldto.setRk_id(point.getArea().getId());
|
||||
cxjldto.setItem_id(item.getId());
|
||||
|
|
@ -235,7 +236,10 @@ public class PickDetailController {
|
|||
cxjldto.setPoint_code(point.getCode());
|
||||
cxjldto.setItem_name(item.getName());
|
||||
cxjldto.setItem_code(item.getCode());
|
||||
cxjldto.setOrder_qty(item.getSrs());
|
||||
cxjldto.setOrder_qty(item.getExtendD3().intValue());
|
||||
if(bomAccounts.size()>0){
|
||||
cxjldto.setOrder_qty(bomAccounts.get(0).getSrs());
|
||||
}
|
||||
return new ResponseEntity<>(cxjldto,HttpStatus.OK);
|
||||
}else{
|
||||
throw new BadRequestException("扫描错误");
|
||||
|
|
@ -345,7 +349,7 @@ public class PickDetailController {
|
|||
}
|
||||
JSONArray array=new JSONArray();
|
||||
//查询是否有Task或者库存
|
||||
List<Task> tasks=taskRepository.getPickDetailTasks(pickDetail.getId());
|
||||
List<Task> tasks=taskRepository.getPickNotAllTask(pickDetail.getId());
|
||||
String view_type="01";
|
||||
String view_des="无库存";
|
||||
String view_name="箱单号";
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class CountMoveDetailDto implements Serializable {
|
|||
/** 修改人 */
|
||||
private String updateBy;
|
||||
|
||||
private String src_stock_code;
|
||||
private String srcStockCode;
|
||||
|
||||
/** 创建时间 */
|
||||
private Timestamp createTime;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public class XppRecordViewDto implements Serializable {
|
|||
*/
|
||||
private String jsr;
|
||||
/**
|
||||
* 制造投料人
|
||||
* 人
|
||||
*/
|
||||
private String zztlr;
|
||||
|
||||
|
|
|
|||
|
|
@ -120,18 +120,18 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
List<Inventory> inventoryList=inventoryRepository.queryInventoryArea(countMove.getSrcArea().getId());
|
||||
for(Inventory inv:inventoryList) {
|
||||
ItemKey itemKey = inv.getItemKey();
|
||||
if(inv.getStockCode()==null) {//非箱单库存根据纳入数调整库存数
|
||||
int nrs = xppRecordRepository.queryXppItemKeyPointNrs(itemKey.getId(), inv.getPoint().getId());
|
||||
if (inv.getQueuedQty() > 0) {
|
||||
throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数");
|
||||
}
|
||||
if (inv.getQuantity().intValue() != nrs) {
|
||||
inventoryLogService.storeInventoryLog(BizStatus.COUNT_MOVE, BizStatus.INVARIANT, countMove.getCode(), countMove.getDstArea(), itemKey, inv.getPoint(), inv.getPoint(), null, inv.getQuantity() + 0d, nrs + 0d, null,
|
||||
BizStatus.COUNT, null, inv.getId(), "调整库存数量,和现品票匹配");
|
||||
inv.setQuantity(nrs + 0d);
|
||||
inventoryService.update(inv);
|
||||
}
|
||||
}
|
||||
// if(inv.getStockCode()==null) {//非箱单库存根据纳入数调整库存数
|
||||
// int nrs = xppRecordRepository.queryXppItemKeyPointNrs(itemKey.getId(), inv.getPoint().getId());
|
||||
// if (inv.getQueuedQty() > 0) {
|
||||
// throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数");
|
||||
// }
|
||||
// if (inv.getQuantity().intValue() != nrs) {
|
||||
// inventoryLogService.storeInventoryLog(BizStatus.COUNT_MOVE, BizStatus.INVARIANT, countMove.getCode(), countMove.getDstArea(), itemKey, inv.getPoint(), inv.getPoint(), null, inv.getQuantity() + 0d, nrs + 0d, null,
|
||||
// BizStatus.COUNT, null, inv.getId(), "调整库存数量,和现品票匹配");
|
||||
// inv.setQuantity(nrs + 0d);
|
||||
// inventoryService.update(inv);
|
||||
// }
|
||||
// }
|
||||
createCountDetail(countMove,inv,itemKey,countMove.getDstPoint());
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
countMoveDetail.setSrcPoint(inv.getPoint());
|
||||
countMoveDetail.setOrderQty(inv.getQuantity());
|
||||
countMoveDetail.setCountQty(0d);
|
||||
countMoveDetail.setSrcStockCode(inv.getStockCode());
|
||||
countMoveDetail.setSrcStockCode(inv.getStockCode());//箱单号
|
||||
countMoveDetail.setDstPoint(dstPoint);
|
||||
countMoveDetailService.create(countMoveDetail);
|
||||
countMove.setOrderQty(countMove.getOrderQty()+inv.getQuantity());
|
||||
|
|
@ -217,7 +217,11 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
log.info("countMoveDetailList:"+countMoveDetailObjs.size());
|
||||
|
||||
//得到盘点库区下所有库存
|
||||
List<Inventory> inventoryListAll=inventoryRepository.queryInventoryArea2(countMove.getSrcArea().getId());
|
||||
String point_type=BaseStatus.CH;
|
||||
if(countMove.getSrcArea().getBexb()){
|
||||
point_type=BaseStatus.ZZKW;
|
||||
}
|
||||
List<Inventory> inventoryListAll=inventoryRepository.queryInventoryArea2(countMove.getSrcArea().getId(),point_type);
|
||||
log.info("inventoryListAll:"+inventoryListAll.size());
|
||||
Map<String,List<Inventory>> map_inventory=new HashMap<>();
|
||||
for (Inventory inv :inventoryListAll ) {
|
||||
|
|
@ -239,7 +243,10 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
log.info("map_inventory:"+map_inventory.keySet().size());
|
||||
|
||||
log.info("xppRecordListAll:");
|
||||
List<XppRecord> xppRecordListAll = xppRecordRepository.queryXppItemKeyPoint2();
|
||||
List<XppRecord> xppRecordListAll = new ArrayList<>();
|
||||
if(!countMove.getSrcArea().getBexb()) {
|
||||
xppRecordRepository.queryXppItemKeyPoint2();
|
||||
}
|
||||
Map<String,List<XppRecord>> map_xppRecord=new HashMap<>();
|
||||
log.info("xppRecordListAll:"+xppRecordListAll.size());
|
||||
for (XppRecord xpp :xppRecordListAll ) {
|
||||
|
|
@ -312,8 +319,11 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
inventoryService.update(newInv);
|
||||
inv.setQuantity(inv.getQuantity() - xpp.getNrs());
|
||||
inventoryService.update(inv);
|
||||
countMove.setCountQty(countMove.getCountQty()+d.getCountQty());
|
||||
}
|
||||
}else{
|
||||
d.setCountQty(d.getCountQty() + d.getOrderQty());
|
||||
countMoveDetailService.update(d);
|
||||
createCountMoveDetailRecord(countMove,d,null);
|
||||
//查找目标库位是否有库存,有则数量累加,没有新建
|
||||
Inventory newInv = inventoryService.getInventory(itemKey, d.getDstPoint().getArea(), d.getDstPoint(), inv.getZzkw(), dept, BizStatus.COUNT_MOVE, d.getSrcStockCode());
|
||||
|
|
@ -357,12 +367,15 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
countMoveDetailRecord.setXppEwm(xpp.getEwm());
|
||||
countMoveDetailRecord.setCountQty(xpp.getNrs() + 0d);
|
||||
countMoveDetailRecord.setXpp(xpp);
|
||||
}else{
|
||||
countMoveDetailRecord.setCountQty(d.getCountQty());
|
||||
}
|
||||
countMoveDetailRecord.setSrcPoint(d.getSrcPoint());
|
||||
countMoveDetailRecord.setCountPoint(d.getDstPoint());
|
||||
countMoveDetailRecord.setItemKey(d.getItemKey());
|
||||
countMoveDetailRecord.setStatus(BizStatus.OPEN);
|
||||
countMoveDetailRecord.setSrcStockCode(d.getSrcStockCode());
|
||||
countMove.setCountQty(countMove.getCountQty()+countMoveDetailRecord.getCountQty());
|
||||
return countMoveDetailRecordService.create(countMoveDetailRecord);
|
||||
}
|
||||
}
|
||||
|
|
@ -178,11 +178,10 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
hql += " and inv.stockCode is null";
|
||||
}
|
||||
}
|
||||
|
||||
if(propC2!=null){
|
||||
hql+=" and inv.itemKey.propC2='"+propC2+"'";
|
||||
}
|
||||
|
||||
hql+=" and inv.area.code not like '%盘点%'";
|
||||
hql+= " order by inv.itemKey.propC1 asc,inv.stockCode asc ";
|
||||
Query query = entityManager.createQuery(hql);
|
||||
List<Inventory> inventoryList = query.getResultList();
|
||||
|
|
@ -365,7 +364,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
inventory = inventoryList.get(0);
|
||||
} else {
|
||||
//创建Inventory
|
||||
if (type.equals(BizStatus.ZZKW_TL) ||type.equals(BizStatus.RECEIVING_UP) || type.equals(BizStatus.MOVE)||type.equals(BizStatus.PICK_DOWN)||type.equals(BizStatus.PICK_CANCEL)||type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.COUNT_MOVE)||type.equals(BizStatus.YK_JS)) {
|
||||
if (type.equals(BizStatus.ZZKW_MOVE) ||type.equals(BizStatus.ZZKW_TL) ||type.equals(BizStatus.RECEIVING_UP) || type.equals(BizStatus.MOVE)||type.equals(BizStatus.PICK_DOWN)||type.equals(BizStatus.PICK_CANCEL)||type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.COUNT_MOVE)||type.equals(BizStatus.YK_JS)) {
|
||||
inventory = new Inventory();
|
||||
inventory.setItemKey(itemKey);
|
||||
inventory.setPoint(point);
|
||||
|
|
|
|||
|
|
@ -247,6 +247,11 @@ public class BizStatus {
|
|||
*/
|
||||
public static String ZZKW_TL = "ZZKW_TL";
|
||||
|
||||
/**
|
||||
* 制造库位移位
|
||||
*/
|
||||
public static String ZZKW_MOVE = "ZZKW_MOVE";
|
||||
|
||||
/**
|
||||
* 制造库位入库
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -238,6 +238,7 @@ public class FastExcelUtil {
|
|||
public static List<String> readHeadContent(MultipartFile file, int sheetNo, int headRowNumber) {
|
||||
try {
|
||||
//判断头部内容是否包含所有必填列
|
||||
log.info(file.getInputStream()+"");
|
||||
return readHeadContent(file.getInputStream(), sheetNo, headRowNumber);
|
||||
} catch (IOException e) {
|
||||
throw new BadRequestException("数据格式存在问题,无法读取");
|
||||
|
|
|
|||
Loading…
Reference in New Issue