导入,整箱入库,整箱出库

main
FOAM 2025-08-19 14:27:45 +08:00
parent f1300f45ab
commit ca698284e8
53 changed files with 659 additions and 308 deletions

View File

@ -73,24 +73,22 @@ public interface BomAccountRepository extends JpaRepository<BomAccount, Long>, J
Long getItemAreaId( Long item_id); Long getItemAreaId( Long item_id);
//获得所有BOM标签 //获得所有BOM标签
@Query(value = "select CONCAT(it.code,'/',ba.ns) ns,it.name pm,ba.xz,ba.srs,ba.bonded,ba.supplier,GROUP_CONCAT(bi.master_name) jxs ,GROUP_CONCAT(ba.singles) tyls,\n" + //SUBSTRING(bi.master_name, 1, CEIL(CHAR_LENGTH(bi.master_name)/2))
"CONCAT('code:',it.code,'ns:',ba.ns,'sb:',ba.bonded,'kw:',point.code) ewm\n" + @Query(value = "select it.code, ba.ns,it.name pm,point.code hw,ba.xz,ba.srs,ba.bonded,ba.supplier," +
// "GROUP_CONCAT(SUBSTRING(bi.master_name, 1, CEIL(CHAR_LENGTH(bi.master_name)/2))) jxs ,GROUP_CONCAT(ba.singles) tyls " +
"GROUP_CONCAT(bi.master_name) jxs ,GROUP_CONCAT(ba.singles) tyls " +
"from base_bom_account ba \n" + "from base_bom_account ba \n" +
"LEFT JOIN base_big_item bi on bi.id=ba.big_item_id\n" + "LEFT JOIN base_big_item bi on bi.id=ba.big_item_id\n" +
"left join base_item it on it.id=ba.item_id\n" + "left join base_item it on it.id=ba.item_id\n" +
"left join base_point point on point.id=ba.z_point_id" + "left join base_point point on point.id=ba.z_point_id" +
" where (it.code=:itemCode or :itemCode is null) and (point.code=:hw or :hw is null) and (ba.ns=:ns or :ns is null)" + " left join base_area area on area.id=ba.r_area_id" +
"GROUP BY it.code,it.name,ba.ns,ba.xz,ba.srs,ba.bonded,ba.supplier,point.code ", nativeQuery = true) " where ba.bp_type=:dxw and (it.code=:itemCode or :itemCode is null) and (point.code=:hw or :hw is null) " +
List<BomPrint> queryPrintAll(String itemCode, String hw, String ns); " and (area.code=:kq or :kq is null) and (ba.ns=:ns or :ns is null)" +
"GROUP BY it.code,it.name,ba.ns,ba.xz,ba.srs,ba.bonded,ba.supplier,point.code " +
"order by point.code ", nativeQuery = true)
List<BomPrint> queryPrintAll(String itemCode, String hw, String ns,String kq,String dxw);
@Query(value = "select CONCAT(it.code,'/',ba.ns) ns,it.name pm,ba.xz,ba.srs,ba.bonded,ba.supplier,GROUP_CONCAT(bi.master_name) jxs ,GROUP_CONCAT(ba.singles) tyls,\n" +
"CONCAT('code:',it.code,'ns:',ba.ns,'sb:',ba.bonded,'kw:',point.code) ewm\n" +
"from base_bom_account ba \n" +
"LEFT JOIN base_big_item bi on bi.id=ba.big_item_id\n" +
"left join base_item it on it.id=ba.item_id\n" +
"left join base_point point on point.id=ba.z_point_id\n" +
"GROUP BY it.code,it.name,ba.ns,ba.xz,ba.srs,ba.bonded,ba.supplier,point.code ", nativeQuery = true)
List<BomPrint> queryPrintAll();
} }

View File

@ -36,6 +36,9 @@ public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecific
public List<Point> getPointList(String type); public List<Point> getPointList(String type);
@Query(value = "SELECT p.* FROM base_point p WHERE p.code=?1", nativeQuery = true) @Query(value = "SELECT p.* FROM base_point p WHERE p.code=?1", nativeQuery = true)
Point findByCode(String code); Point findByCode(String code);
@Query(value = "SELECT p.* FROM base_point p WHERE p.code=:code and p.type=:type", nativeQuery = true)
Point findByCodeType(String code,String type);
/*@Query(value = "SELECT p.* FROM base_point p WHERE p.code=?1", nativeQuery = true) /*@Query(value = "SELECT p.* FROM base_point p WHERE p.code=?1", nativeQuery = true)
List<Point> findByCodes(String code);*/ List<Point> findByCodes(String code);*/

View File

@ -64,10 +64,7 @@ public class AreaController {
private final AreaService areaService; private final AreaService areaService;
private final PointService pointService; private final PointService pointService;
private final DeptService deptService;
private final DeptMapper deptMapper;
private final PointRepository pointRepository; private final PointRepository pointRepository;
private final AreaMapper areaMapper;
private final AreaRepository areaRepository; private final AreaRepository areaRepository;
@PostMapping("/getAreas") @PostMapping("/getAreas")

View File

@ -51,6 +51,7 @@ import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -98,53 +99,64 @@ public class BomAccountController {
} }
@GetMapping("/queryBomPrintList") @GetMapping("/queryBomPrintListD")
@Log("查询bom打印标签") @Log("查询中大物标签")
@ApiOperation("查询bom打印标签") @ApiOperation("查询中大物标签")
@AnonymousAccess @AnonymousAccess
public ResponseEntity<Object> queryBomPrintList(BomAccountQueryCriteria criteria){ public ResponseEntity<Object> queryBomPrintListD(BomAccountQueryCriteria criteria){
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
redisUtils.del(SecurityUtils.getCurrentUsername()+"_BiaoQian"); redisUtils.del(SecurityUtils.getCurrentUsername()+"_BiaoQian_D");
List<BomPrint> list=bomAccountService.queryPrintAll(criteria); List<BomPrint> list=bomAccountService.queryPrintAll(criteria,"中大物标签");
boolean isok=redisUtils.set(SecurityUtils.getCurrentUsername()+"_BiaoQian", JsonUtil.toJson(list)); redisUtils.set(SecurityUtils.getCurrentUsername()+"_BiaoQian_D",JsonUtil.toJson(list));
log.info(SecurityUtils.getCurrentUsername()+"_BiaoQian"+"-----isok:"+isok);
String json=(String)redisUtils.get(SecurityUtils.getCurrentUsername()+"_BiaoQian");
log.info(SecurityUtils.getCurrentUsername()+"_BiaoQian"+"-----"+json);
List<BomPrint_BiaoQian2> list2= JSONUtil.toList(json, BomPrint_BiaoQian2.class);
for(BomPrint_BiaoQian2 l:list2){
log.info(l.getNs());
}
return new ResponseEntity<>(list,HttpStatus.OK); return new ResponseEntity<>(list,HttpStatus.OK);
} }
@GetMapping("/bomPrintBiaoQianList") @GetMapping("/queryBomPrintListX")
@Log("查询小物标签")
@ApiOperation("查询小物标签")
@AnonymousAccess
public ResponseEntity<Object> queryBomPrintListX(BomAccountQueryCriteria criteria){
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
redisUtils.del(SecurityUtils.getCurrentUsername()+"_BiaoQian_X");
List<BomPrint> list=bomAccountService.queryPrintAll(criteria,"小物标签");
redisUtils.set(SecurityUtils.getCurrentUsername()+"_BiaoQian_X",JsonUtil.toJson(list));
return new ResponseEntity<>(list,HttpStatus.OK);
}
@GetMapping("/bomPrintBiaoQianList/{dxw}")
@Log("获取Bom中库位标签") @Log("获取Bom中库位标签")
@ApiOperation("获取Bom中库位标签") @ApiOperation("获取Bom中库位标签")
@AnonymousAccess @AnonymousAccess
public ResponseEntity<Object> bomPrintBiaoQianList(){ public ResponseEntity<Object> bomPrintBiaoQianList(@PathVariable("dxw") String dxw){
log.info(SecurityUtils.getCurrentUsername()+"_BiaoQian");
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
String json=(String)redisUtils.get(SecurityUtils.getCurrentUsername()+dxw);
String json=(String)redisUtils.get(SecurityUtils.getCurrentUsername()+"_BiaoQian"); log.info(SecurityUtils.getCurrentUsername()+dxw+"-----"+json);
log.info(SecurityUtils.getCurrentUsername()+"_BiaoQian"+"-----"+json);
List<BomPrint_BiaoQian2> list= JSONUtil.toList(json, BomPrint_BiaoQian2.class); List<BomPrint_BiaoQian2> list= JSONUtil.toList(json, BomPrint_BiaoQian2.class);
List<BomPrint_BiaoQian> list2=new ArrayList<>(); List<BomPrint_BiaoQian> list2=new ArrayList<>();
for(BomPrint_BiaoQian2 l:list){ for(BomPrint_BiaoQian2 l:list){
BomPrint_BiaoQian bq=new BomPrint_BiaoQian(); BomPrint_BiaoQian bq=new BomPrint_BiaoQian();
bq.setNs(l.getNs()); String code=l.getCode().substring(0,5)+"-"+l.getCode().substring(5,l.getCode().length());
bq.setHw(l.getHw()); bq.setNs(l.getNs()+"/"+code);
bq.setCode(code);
String hw=l.getHw();
hw=hw.substring(0,3)+"-"+hw.substring(3,hw.length());
bq.setHw(hw);
bq.setPm(l.getPm()); bq.setPm(l.getPm());
bq.setEwm(l.getEwm()); bq.setEwm(l.getCode()+";"+l.getNs()+";"+l.getBonded()+";"+l.getHw());
bq.setBonded(l.getBonded()); bq.setBonded(l.getBonded());
bq.setSrs(l.getSrs()); bq.setSrs(l.getSrs());
bq.setXz(l.getXz());
bq.setSupplier(l.getSupplier()); bq.setSupplier(l.getSupplier());
bq.setJxs(l.getJxs()==null?null:l.getJxs().split(",")); if(dxw.equals("_BiaoQian_D")){
bq.setJxs(l.getJxs() == null ? null :
Arrays.stream(l.getJxs().split(","))
.map(s -> s.length() > 10 ? s.substring(0, 10) : s)
.toArray(String[]::new));
}else {
bq.setJxs(l.getJxs() == null ? null : l.getJxs().split(","));
}
bq.setTyls(l.getTyls()==null?null:l.getTyls().split(",")); bq.setTyls(l.getTyls()==null?null:l.getTyls().split(","));
list2.add(bq); list2.add(bq);
} }

View File

@ -51,7 +51,7 @@ public interface BomAccountService {
*/ */
List<BomAccountDto> queryAll(BomAccountQueryCriteria criteria); List<BomAccountDto> queryAll(BomAccountQueryCriteria criteria);
List<BomPrint> queryPrintAll(BomAccountQueryCriteria criteria); List<BomPrint> queryPrintAll(BomAccountQueryCriteria criteria,String dxw);
/** /**
* ID * ID

View File

@ -58,4 +58,8 @@ public class BomAccountQueryCriteria{
@Query @Query
private String outType; private String outType;
@Query
private String ns;
@Query
private String bp_type;
} }

View File

@ -88,15 +88,12 @@ public class BomAccountServiceImpl implements BomAccountService {
return bomAccountMapper.toDto(bomAccountRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); return bomAccountMapper.toDto(bomAccountRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
} }
public List<BomPrint> queryPrintAll(BomAccountQueryCriteria criteria){ public List<BomPrint> queryPrintAll(BomAccountQueryCriteria criteria,String dxw){
List<BomPrint> bomPrints=bomAccountRepository.queryPrintAll(criteria.getItemCode(),criteria.getZPointCode(),criteria.getNs(),criteria.getRAreaCode(),dxw);
List<BomPrint> bomPrints=bomAccountRepository.queryPrintAll(criteria.getItemCode(),null,null);
// List<BomPrint> bomPrints=bomAccountRepository.queryPrintAll();
log.info(bomPrints.toString());
return bomPrints; return bomPrints;
} }
@Override @Override
@Transactional @Transactional
@Cacheable(key = "'id:' + #p0") @Cacheable(key = "'id:' + #p0")

View File

@ -76,7 +76,7 @@ public class BoxServiceImpl implements BoxService {
private final PointService pointService; private final PointService pointService;
private final StockService stockService; private final StockService stockService;
private final ItemService itemService; private final ItemService itemService;
private final AsnDetailService asnDetailService; // private final AsnDetailService asnDetailService;
private final ItemKeyService itemKeyService; private final ItemKeyService itemKeyService;
private final TaskService taskService; private final TaskService taskService;
private final InventoryService inventoryService; private final InventoryService inventoryService;
@ -322,10 +322,10 @@ public class BoxServiceImpl implements BoxService {
Date date = cn.hutool.core.date.DateUtil.date(); Date date = cn.hutool.core.date.DateUtil.date();
String propC1 = DateUtil.format(date, "yyyyMMdd"); String propC1 = DateUtil.format(date, "yyyyMMdd");
asnDetail.setPropC1(propC1); asnDetail.setPropC1(propC1);
asnDetailService.create(asnDetail); // asnDetailService.create(asnDetail);
//生成Itemkey //生成Itemkey
ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1()); ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1(),asnDetail.getPropC2());
//生成入库记录 //生成入库记录

View File

@ -12,6 +12,7 @@ import com.youchain.businessdata.inputJson.imports.invoicePackingImport;
import com.youchain.businessdata.repository.*; import com.youchain.businessdata.repository.*;
import com.youchain.businessdata.service.*; import com.youchain.businessdata.service.*;
import com.youchain.exception.BadRequestException; import com.youchain.exception.BadRequestException;
import com.youchain.modules.system.domain.Dept;
import com.youchain.utils.*; import com.youchain.utils.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -41,6 +42,8 @@ public class ImportAsnServiceImpl implements ImportAsnService {
private final AsnService asnService; private final AsnService asnService;
private final CodeUtils codeUtils;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void importAsn(MultipartFile file, String templateType) { public void importAsn(MultipartFile file, String templateType) {
@ -119,14 +122,17 @@ public class ImportAsnServiceImpl implements ImportAsnService {
log.info("处理批量导入,数据条数: {}", dataList.size()); log.info("处理批量导入,数据条数: {}", dataList.size());
//获取文件中所有的托盘号 //获取文件中所有的托盘号
List<String> codes = dataList.stream().map(BaseImport::getCNo).collect(Collectors.toList()); List<String> cusCodes = dataList.stream().map(BaseImport::getCNo).collect(Collectors.toList());
cusCodes = cusCodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
//验证托盘号 //验证托盘号
validateAsn(codes); validateAsn(cusCodes);
//获取文件中所有的品番 //获取文件中所有的品番
List<String> itemCodes = dataList.stream().map(BaseImport::getPartNo).collect(Collectors.toList()); // List<String> itemCodes = dataList.stream().map(BaseImport::getPartNo).collect(Collectors.toList());
List<String> itemCodes = dataList.stream()
.map(item -> item.getPartNo().replace("-", ""))
.collect(Collectors.toList());
itemCodes = itemCodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
//验证品番 //验证品番
Map<String, Item> exitItemMap = validateItem(itemCodes); Map<String, Item> exitItemMap = validateItem(itemCodes);
@ -134,8 +140,8 @@ public class ImportAsnServiceImpl implements ImportAsnService {
Area area = areaService.findByCode(BaseStatus.DEFAULT_AREA); Area area = areaService.findByCode(BaseStatus.DEFAULT_AREA);
//单据类型 //单据类型
BillType billType = billTypeRepository.findByName(BaseStatus.RK); BillType billType = billTypeRepository.findByName(BaseStatus.XDRK);
Dept dept=UserUtils.getDept();
Map<String, Asn> asnMap = new HashMap<>(); Map<String, Asn> asnMap = new HashMap<>();
List<Asn> insertToAsn = new ArrayList<>();//批量新增ASN List<Asn> insertToAsn = new ArrayList<>();//批量新增ASN
List<AsnDetail> insertToAsnDetail = new ArrayList<>();//批量新增asnDetail List<AsnDetail> insertToAsnDetail = new ArrayList<>();//批量新增asnDetail
@ -147,9 +153,8 @@ public class ImportAsnServiceImpl implements ImportAsnService {
String remark = data.getDescription();//描述 String remark = data.getDescription();//描述
String orderQty = data.getQty();//数量 String orderQty = data.getQty();//数量
String code = data.getCNo();//托盘号 String code = data.getCNo();//托盘号
//品番 //品番
Item item = exitItemMap.get(itemCode); Item item = exitItemMap.get(itemCode.replace("-", ""));
Asn asn; Asn asn;
if (asnMap.containsKey(code)) { if (asnMap.containsKey(code)) {
@ -158,8 +163,8 @@ public class ImportAsnServiceImpl implements ImportAsnService {
} else { } else {
asn = Asn.builder() asn = Asn.builder()
.relatedBill1(relatedBill1) .relatedBill1(relatedBill1)
.code(code) .code(codeUtils.getCode_yyMMdd(billType.getPrefix()+'-', 3))
.area(area) .cusCode(code)
.status(BizStatus.OPEN) .status(BizStatus.OPEN)
.orderDate(new Timestamp(new Date().getTime())) .orderDate(new Timestamp(new Date().getTime()))
.orderQuantity(Double.parseDouble(orderQty)) .orderQuantity(Double.parseDouble(orderQty))
@ -184,7 +189,7 @@ public class ImportAsnServiceImpl implements ImportAsnService {
.putQty(0d) .putQty(0d)
.weight(0d) .weight(0d)
.volume(0d) .volume(0d)
.dept(item.getDept()) .dept(dept)
.build(); .build();
insertToAsnDetail.add(asnDetail); insertToAsnDetail.add(asnDetail);
} }
@ -215,11 +220,11 @@ public class ImportAsnServiceImpl implements ImportAsnService {
} }
//验证ASN单号 //验证ASN单号
private void validateAsn(List<String> codes) { private void validateAsn(List<String> cusCodes) {
Map<String, Asn> exitAsnMap = asnService.queryByasnCodesToMap(codes); Map<String, Asn> exitAsnMap = asnService.queryByCusCodesToMap(cusCodes);
List<String> existingAsnCodes = new ArrayList<>(exitAsnMap.keySet()); List<String> existCusCodes = new ArrayList<>(exitAsnMap.keySet());
// 获取两个集合的交集说明ASN重复导入了直接提示 // 获取两个集合的交集说明ASN重复导入了直接提示
List<String> difference = SmartStringUtil.getIntersection(codes, existingAsnCodes); List<String> difference = SmartStringUtil.getIntersection(cusCodes, existCusCodes);
if (CollectionUtils.isNotEmpty(difference)) { if (CollectionUtils.isNotEmpty(difference)) {
//去重difference //去重difference
difference = difference.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList()); difference = difference.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());

View File

@ -33,13 +33,10 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
private final ItemService itemService; private final ItemService itemService;
private final BigItemService bigItemService; private final BigItemService bigItemService;
private final PointService pointService; private final PointService pointService;
private final AsnService asnService;
private final AreaService areaService;
private final ItemRepository itemRepository; private final ItemRepository itemRepository;
private final BigItemRepository bigItemRepository; private final BigItemRepository bigItemRepository;
private final PointRepository pointRepository;
private final BomAccountRepository bomAccountRepository; private final BomAccountRepository bomAccountRepository;
private final AreaRepository areaRepository; private final BomAccountLogService bomAccountLogService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -79,7 +76,7 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
it.setPm(data.getPm()); it.setPm(data.getPm());
it.setSrs(data.getSrs()); it.setSrs(data.getSrs());
itemEntitys.put(data.getPf(),it); itemEntitys.put(data.getPf(),it);
bomEntitys=batchBomEntitys(data,bomEntitys); bomEntitys=batchBomEntitys(data,bomEntitys);
} }
//验证品番 //验证品番
@ -113,6 +110,13 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
BomAccount ba = this.BaEntity(existBom, entity, bigItem,item, point, entity.tyl,null); BomAccount ba = this.BaEntity(existBom, entity, bigItem,item, point, entity.tyl,null);
createBomList.add(ba); createBomList.add(ba);
} }
// if (isNew) {
// bomAccountService.create(bomAccount);
// bomAccountLogService.copyBomAccount(bomAccount.getId(), "import_add");
// } else {
// bomAccountService.update(bomAccount);
// bomAccountLogService.copyBomAccount(bomAccount.getId(), "import_update");
// }
if(CollectionUtils.isNotEmpty(createBomList)){ if(CollectionUtils.isNotEmpty(createBomList)){
bomAccountRepository.saveAll(createBomList); bomAccountRepository.saveAll(createBomList);
} }
@ -120,7 +124,6 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
bomAccountRepository.saveAll(updateBomList); bomAccountRepository.saveAll(updateBomList);
} }
} }
} }
//验证品番 //验证品番
@ -219,18 +222,22 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
"货位", "货位",
"箱种", "箱种",
"收容数", "收容数",
"台车库位", "工程(台车库位)",
"大小物", "大小物",
"税别", "税别",
// 机型1-38 及对应的台用量 "机型",
"机型1", "台用量1", "机型2", "台用量2", "机型3", "台用量3", "机型4", "台用量4", "机型5", "台用量5", "机型代码",
"机型6", "台用量6", "机型7", "台用量7", "机型8", "台用量8", "机型9", "台用量9", "机型10", "台用量10", "组顺/刻印号前2位",
"机型11", "台用量11", "机型12", "台用量12", "机型13", "台用量13", "机型14", "台用量14", "机型15", "台用量15", "台用量"
"机型16", "台用量16", "机型17", "台用量17", "机型18", "台用量18", "机型19", "台用量19", "机型20", "台用量20", // // 机型1-38 及对应的台用量
"机型21", "台用量21", "机型22", "台用量22", "机型23", "台用量23", "机型24", "台用量24", "机型25", "台用量25", // "机型1", "台用量1", "机型2", "台用量2", "机型3", "台用量3", "机型4", "台用量4", "机型5", "台用量5",
"机型26", "台用量26", "机型27", "台用量27", "机型28", "台用量28", "机型29", "台用量29", "机型30", "台用量30", // "机型6", "台用量6", "机型7", "台用量7", "机型8", "台用量8", "机型9", "台用量9", "机型10", "台用量10",
"机型31", "台用量31", "机型32", "台用量32", "机型33", "台用量33", "机型34", "台用量34", "机型35", "台用量35", // "机型11", "台用量11", "机型12", "台用量12", "机型13", "台用量13", "机型14", "台用量14", "机型15", "台用量15",
"机型36", "台用量36", "机型37", "台用量37", "机型38", "台用量38" // "机型16", "台用量16", "机型17", "台用量17", "机型18", "台用量18", "机型19", "台用量19", "机型20", "台用量20",
// "机型21", "台用量21", "机型22", "台用量22", "机型23", "台用量23", "机型24", "台用量24", "机型25", "台用量25",
// "机型26", "台用量26", "机型27", "台用量27", "机型28", "台用量28", "机型29", "台用量29", "机型30", "台用量30",
// "机型31", "台用量31", "机型32", "台用量32", "机型33", "台用量33", "机型34", "台用量34", "机型35", "台用量35",
// "机型36", "台用量36", "机型37", "台用量37", "机型38", "台用量38"
); );
List<String> headers = FastExcelUtil.readHeadContent(file, requiredColumns, 0, 0); List<String> headers = FastExcelUtil.readHeadContent(file, requiredColumns, 0, 0);
if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) { if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {

View File

@ -51,19 +51,14 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class ImportDataServiceImpl implements ImportDataService { public class ImportDataServiceImpl implements ImportDataService {
private final FileProperties properties;
private final BigItemRepository bigItemRepository; private final BigItemRepository bigItemRepository;
private final AreaRepository areaRepository; private final AreaRepository areaRepository;
private final ItemRepository itemRepository; private final ItemRepository itemRepository;
private final DictDetailRepository dictDetailRepository; private final DictDetailRepository dictDetailRepository;
private final PointRepository pointRepository; private final PointRepository pointRepository;
private final AsnRepository asnRepository;
private final AsnDetailRepository asnDetailRepository;
private final PointService pointService;
private final AreaService areaService;
private final BomAccountRepository bomAccountRepository; private final BomAccountRepository bomAccountRepository;
private final AreaMapper areaMapper;
private final PointMapper pointMapper; private final PointService pointService;
private final ItemService itemService; private final ItemService itemService;
private final AsnDetailService asnDetailService; private final AsnDetailService asnDetailService;
private final AsnService asnService; private final AsnService asnService;

View File

@ -58,7 +58,7 @@ public class Asn extends BaseEntity implements Serializable {
private String code; private String code;
@OneToOne @OneToOne
@JoinColumn(name = "`area_id`",nullable = false) @JoinColumn(name = "`area_id`")
@NotNull @NotNull
@ApiModelProperty(value = "库区") @ApiModelProperty(value = "库区")
private Area area; private Area area;

View File

@ -144,7 +144,6 @@ public class Inventory extends BaseEntity implements Serializable {
@ApiModelProperty(value = "制造库位") @ApiModelProperty(value = "制造库位")
private Point zzkw; private Point zzkw;
public void copy(Inventory source) { public void copy(Inventory source) {
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
} }

View File

@ -0,0 +1,17 @@
package com.youchain.businessdata.inputJson;
import lombok.Data;
import java.util.List;
@Data
public class PutawayRequest {
private List<Long> ids; // 使用 List 更通用
private Long pointId;
String stockCode;//托盘号
String pointCode;//库位号
String dstPointCode;//目标库位
//1.校验托盘号2.校验库位3.上架确认;
// 4.箱单出库检索6.箱单出库确认7.箱单移位
int checkType;
}

View File

@ -7,7 +7,7 @@ import java.util.List;
@Data @Data
public class PickTicketButton { public class PickTicketButton {
//拣货确认按钮号 1整单拣货 2单一拣货 3批量拣货 4取消拣货 5拣货整单取消 6拣货批量取消 7现品票拣货 //拣货确认按钮号 1整单拣货 2单一拣货 3批量拣货 4取消拣货 5拣货整单取消 6拣货批量取消 7现品票拣货,8 App箱单拣货
private int pickConfirmNo; private int pickConfirmNo;
//单一拣货 输入数量 //单一拣货 输入数量
private int onePickConfirmNumber; private int onePickConfirmNumber;

View File

@ -32,4 +32,7 @@ import java.util.List;
public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, JpaSpecificationExecutor<AsnDetail> { public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, JpaSpecificationExecutor<AsnDetail> {
@Query(value = "SELECT * FROM `data_asn_detail` asnDetail WHERE asn_id = :id order by create_time DESC", nativeQuery = true) @Query(value = "SELECT * FROM `data_asn_detail` asnDetail WHERE asn_id = :id order by create_time DESC", nativeQuery = true)
List<AsnDetail> queryByAsnId(@Param("id") Long id); List<AsnDetail> queryByAsnId(@Param("id") Long id);
@Query(value = "SELECT asnDetail.id FROM `data_asn_detail` asnDetail WHERE asn_id = :id", nativeQuery = true)
List<Long> queryIdsByAsn(@Param("id") Long id);
} }

View File

@ -39,6 +39,9 @@ public interface AsnRepository extends JpaRepository<Asn, Long>, JpaSpecificatio
@Query(value = "SELECT * FROM `data_asn` asn ORDER BY asn.create_time DESC LIMIT 0,1", nativeQuery = true) @Query(value = "SELECT * FROM `data_asn` asn ORDER BY asn.create_time DESC LIMIT 0,1", nativeQuery = true)
Asn queryMaxCode(); Asn queryMaxCode();
@Query("from Asn asn where asn.code in (:asnCodes) ") @Query("from Asn asn where asn.cusCode in (:cusCodes)")
List<Asn> queryByAsnCodes(List<String> asnCodes); List<Asn> queryByCusCodes(List<String> cusCodes);
@Query("from Asn asn where asn.cusCode=:cusCode and asn.status='OPEN'")
List<Asn> queryByCusCode(String cusCode);
} }

View File

@ -60,4 +60,9 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
" and p.type='CH'" , nativeQuery = true) " and p.type='CH'" , nativeQuery = true)
List<Inventory> queryInventoryArea2(long areaId); List<Inventory> queryInventoryArea2(long areaId);
@Query(value = "SELECT * from data_inventory inv \n" +
"left join base_point p on inv.point_id=p.id\n" +
"WHERE inv.quantity>0 and p.type='CH' and inv.stock_code=:stockCode" , nativeQuery = true)
List<Inventory> queryInvStockCode(String stockCode);
} }

View File

@ -18,6 +18,7 @@ package com.youchain.businessdata.repository;
import com.youchain.businessdata.domain.Asn; import com.youchain.businessdata.domain.Asn;
import com.youchain.businessdata.domain.PickTicket; import com.youchain.businessdata.domain.PickTicket;
import com.youchain.businessdata.domain.PlanPickDetail; import com.youchain.businessdata.domain.PlanPickDetail;
import com.youchain.utils.BizStatus;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
@ -59,6 +60,9 @@ public interface PickTicketRepository extends JpaRepository<PickTicket, Long>, J
@Query(value = "SELECT * FROM `data_pick_ticket` dpt where dpt.`status` = :status and dpt.`related_bill1` like :code", nativeQuery = true) @Query(value = "SELECT * FROM `data_pick_ticket` dpt where dpt.`status` = :status and dpt.`related_bill1` like :code", nativeQuery = true)
List<PickTicket> queryPickTicketByCodeAll(@Param("status") String status, @Param("code") String code); List<PickTicket> queryPickTicketByCodeAll(@Param("status") String status, @Param("code") String code);
@Query("from PickTicket pt where pt.cusCode=:cusCode and pt.status='ALLOCATE'")
List<PickTicket> queryByCusCode(String cusCode);
@Transactional //也可以只标注在上层调用者方法上 @Transactional //也可以只标注在上层调用者方法上
@Modifying @Modifying
@Query(value = "UPDATE data_pick_ticket dpt set dpt.order_quantity = :orderQuantity where dpt.id= :id", nativeQuery = true) @Query(value = "UPDATE data_pick_ticket dpt set dpt.order_quantity = :orderQuantity where dpt.id= :id", nativeQuery = true)

View File

@ -15,14 +15,27 @@
*/ */
package com.youchain.businessdata.rest; package com.youchain.businessdata.rest;
import cn.hutool.json.JSONArray;
import com.youchain.DuplicateSubmission.DuplicateSubmission;
import com.youchain.annotation.AnonymousAccess; import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log; import com.youchain.annotation.Log;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.repository.PointRepository;
import com.youchain.basicdata.service.dto.BillTypeQueryCriteria; import com.youchain.basicdata.service.dto.BillTypeQueryCriteria;
import com.youchain.businessdata.domain.Asn; import com.youchain.businessdata.domain.Asn;
import com.youchain.businessdata.domain.AsnDetail;
import com.youchain.businessdata.inputJson.PutawayRequest;
import com.youchain.businessdata.repository.AsnDetailRepository;
import com.youchain.businessdata.repository.AsnRepository; import com.youchain.businessdata.repository.AsnRepository;
import com.youchain.businessdata.returnJson.PutawayRet;
import com.youchain.businessdata.service.AsnDetailService;
import com.youchain.businessdata.service.AsnService; import com.youchain.businessdata.service.AsnService;
import com.youchain.businessdata.service.dto.AsnDetailDto;
import com.youchain.businessdata.service.dto.AsnQueryCriteria; import com.youchain.businessdata.service.dto.AsnQueryCriteria;
import com.youchain.exception.BadRequestException;
import com.youchain.exception.handler.ApiResult; import com.youchain.exception.handler.ApiResult;
import com.youchain.utils.BaseStatus;
import com.youchain.utils.BizStatus;
import com.youchain.utils.CodeUtils; import com.youchain.utils.CodeUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@ -30,6 +43,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -37,8 +51,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.*;
import java.util.Objects;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.OK;
@ -57,7 +70,10 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
public class AsnController { public class AsnController {
private final AsnService asnService; private final AsnService asnService;
private final AsnDetailService asnDetailService;
private final AsnRepository asnRepository; private final AsnRepository asnRepository;
private final AsnDetailRepository asnDetailRepository;
private final PointRepository pointRepository;
private final CodeUtils codeUtils; private final CodeUtils codeUtils;
@ -69,14 +85,6 @@ public class AsnController {
asnService.download(asnService.queryAll(criteria), response); asnService.download(asnService.queryAll(criteria), response);
} }
@GetMapping(value = "/maxNo")
@Log("查询最大的单号")
@ApiOperation("查询最大单号")
@AnonymousAccess
public ResponseEntity<Object> maxNo(@RequestParam("code") String code) {
return new ResponseEntity<>(codeUtils.getCode_yyMMdd(code, 3), HttpStatus.OK);
}
@GetMapping @GetMapping
@Log("查询asn") @Log("查询asn")
@ -128,4 +136,89 @@ public class AsnController {
asnService.deleteAll(ids); asnService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@PostMapping("/checkPutawayApp")
@Log("校验托盘号-APP")
@ApiOperation("校验托盘号-APP")
@PreAuthorize("@el.check('super:man')")
@Transactional(rollbackFor = Exception.class)
@DuplicateSubmission
public ResponseEntity<Object> checkPutawayApp(@RequestBody PutawayRequest request) {
String stockCode = request.getStockCode();
int checkType=request.getCheckType();
String pointCode= request.getPointCode();
if(checkType==1) {
List<Asn> asns = asnRepository.queryByCusCode(stockCode);
if (asns.size() <= 0) {
throw new BadRequestException(stockCode + "不存在");
}else{
Long asnId=asns.get(0).getId();
List<AsnDetail> ads=asnDetailRepository.queryByAsnId(asnId);
List<PutawayRet> rets=new ArrayList<>();
for(AsnDetail ad:ads){
PutawayRet ret=new PutawayRet();
ret.createPutawayRet(asnId,ad.getId(),ad.getItem().getCode(),ad.getItem().getName(),ad.getOrderQty(),ad.getPropC2(),ad.getPo());
// ret.setBonded(ad.getPropC2());
// ret.setPo(ad.getPo());
// ret.setQty(ad.getOrderQty());
// ret.setItemCode(ad.getItem().getCode());
// ret.setItemName(ad.getItem().getName());
rets.add(ret);
}
return new ResponseEntity<>(rets, HttpStatus.OK);
}
} else if (checkType==2) {
Point point=pointRepository.findByCodeType(pointCode, BaseStatus.CH);
if(point==null){
throw new BadRequestException(pointCode + "不存在");
}
}
return new ResponseEntity<>("操作成功", HttpStatus.OK);
}
@PostMapping("/putawayApp")
@Log("上架确认-APP")
@ApiOperation("上架确认-APP")
@PreAuthorize("@el.check('super:man')")
@Transactional(rollbackFor = Exception.class)
@DuplicateSubmission
public ResponseEntity<Object> putawayApp(@RequestBody PutawayRequest request) {
String stockCode = request.getStockCode();
int checkType=request.getCheckType();
String pointCode= request.getPointCode();
Point point=pointRepository.findByCodeType(pointCode, BaseStatus.CH);
if(point==null){
throw new BadRequestException(pointCode + "不存在");
}
List<Asn> asns = asnRepository.queryByCusCode(stockCode);
if (asns.size() <= 0) {
throw new BadRequestException(stockCode + "不存在");
}
Long asnId=asns.get(0).getId();
List<Long> detailIds=asnDetailRepository.queryIdsByAsn(asnId);
for(Long detailId:detailIds) {
AsnDetail d=asnDetailRepository.getById(detailId);
asnDetailService.putawayInv(detailId,null,point.getId(),d.getOrderQty()-d.getReceivedQty(),null);
}
return new ResponseEntity<>("操作成功", HttpStatus.OK);
}
@PostMapping("/mutilPutawaySys")
@Log("上架确认-系统")
@ApiOperation("上架确认-系统")
@PreAuthorize("@el.check('super:man')")
@Transactional(rollbackFor = Exception.class)
@DuplicateSubmission
public ResponseEntity<Object> mutilPutawaySys(@RequestBody PutawayRequest request) {
Long[] ids = request.getIds().toArray(new Long[0]);
Long pointId = request.getPointId();
for (Long id:ids){
List<Long> detailIds=asnDetailRepository.queryIdsByAsn(id);
for(Long detailId:detailIds) {
AsnDetail d=asnDetailRepository.getById(detailId);
asnDetailService.putawayInv(detailId,null,pointId,d.getOrderQty()-d.getReceivedQty(),null);
}
}
return new ResponseEntity<>("操作成功", HttpStatus.OK);
}
} }

View File

@ -246,8 +246,7 @@ public class AsnDetailController {
} }
} }
Area area=point.getArea(); Area area=point.getArea();
putawayInv(d.getId(),area.getId(),point.getId(),s.getQty(),ewm); asnDetailService.putawayInv(d.getId(),area.getId(),point.getId(),s.getQty(),ewm);
//直接上架确认
} }
return new ResponseEntity<>("操作成功", HttpStatus.OK); return new ResponseEntity<>("操作成功", HttpStatus.OK);
} }
@ -261,16 +260,7 @@ public class AsnDetailController {
public ResponseEntity<Object> putawayXppApp(@RequestBody IRkPut s) { public ResponseEntity<Object> putawayXppApp(@RequestBody IRkPut s) {
int seq=s.getSeq(); int seq=s.getSeq();
if(seq==1){ if(seq==1){
XppRecord xppRecord =null; RRkXpp map = xppRecordService.xppAnalysis(s.getEwm());
String ewm = s.getEwm();
xppRecord = xppRecordRepository.findByCode(ewm);
if(xppRecord==null){
return new ResponseEntity<>(ewm + "二维码未采集", BAD_REQUEST);
}
if(!xppRecord.getStatus().equals(BizStatus.RECEIVED)&&!xppRecord.getStatus().equals(BizStatus.RETENTION_IN)){
throw new BadRequestException(xppRecord.getItem().getCode()+"现品票状态不正确");
}
RRkXpp map = xppRecordService.xppAnalysis(xppRecord);
return new ResponseEntity<>(map, HttpStatus.OK); return new ResponseEntity<>(map, HttpStatus.OK);
} }
if (seq==2) { if (seq==2) {
@ -284,12 +274,10 @@ public class AsnDetailController {
} }
Area area=point.getArea(); Area area=point.getArea();
for(String ewm:s.getEwms()){ for(String ewm:s.getEwms()){
XppRecord xppRecord=xppRecordRepository.findByCode(ewm); XppRecord xppRecord = xppRecordService.saveXppRecord(ewm);
if(!xppRecord.getStatus().equals(BizStatus.RECEIVED)&&!xppRecord.getStatus().equals(BizStatus.RETENTION_IN)){ AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord);
throw new BadRequestException(xppRecord.getItem().getCode()+"现品票状态不正确"); asnDetailService.putawayInv(asnDetail.getId(),area.getId(),point.getId(),xppRecord.getNrs(),xppRecord.getEwm());
}
AsnDetail d = xppRecordService.addAsnDetail(xppRecord);
putawayInv(d.getId(), area.getId(), point.getId(), d.getOrderQty(),ewm);
} }
} }
return new ResponseEntity<>("操作成功", HttpStatus.OK); return new ResponseEntity<>("操作成功", HttpStatus.OK);
@ -305,7 +293,7 @@ public class AsnDetailController {
Long pointId=Long.parseLong(rk.get("pointId").toString()); Long pointId=Long.parseLong(rk.get("pointId").toString());
AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord); AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord);
Point point=pointService.findEntityById(pointId); Point point=pointService.findEntityById(pointId);
putawayInv(asnDetail.getId(),point.getArea().getId(),pointId,xppRecord.getNrs(),xppRecord.getEwm()); asnDetailService.putawayInv(asnDetail.getId(),point.getArea().getId(),pointId,xppRecord.getNrs(),xppRecord.getEwm());
return new ResponseEntity<>("操作成功", HttpStatus.OK); return new ResponseEntity<>("操作成功", HttpStatus.OK);
} }
@ -320,7 +308,7 @@ public class AsnDetailController {
Long asnDetailId=Long.parseLong(rk.get("detailId").toString()); Long asnDetailId=Long.parseLong(rk.get("detailId").toString());
AsnDetailDto dto= asnDetailService.findById(asnDetailId); AsnDetailDto dto= asnDetailService.findById(asnDetailId);
Double recQty=dto.getOrderQty()-dto.getReceivedQty(); Double recQty=dto.getOrderQty()-dto.getReceivedQty();
putawayInv(asnDetailId, Long.parseLong(rk.get("areaId").toString()) asnDetailService.putawayInv(asnDetailId, Long.parseLong(rk.get("areaId").toString())
, Long.parseLong(rk.get("pointId").toString()),recQty,null); , Long.parseLong(rk.get("pointId").toString()),recQty,null);
return new ResponseEntity<>("操作成功", HttpStatus.OK); return new ResponseEntity<>("操作成功", HttpStatus.OK);
} }
@ -439,7 +427,7 @@ public class AsnDetailController {
List<AsnDetail> asnDetails =asnDetailService.findAsnDetails(asnId,"1"); List<AsnDetail> asnDetails =asnDetailService.findAsnDetails(asnId,"1");
if (!asnDetails.isEmpty()) { if (!asnDetails.isEmpty()) {
for (AsnDetail d : asnDetails) { for (AsnDetail d : asnDetails) {
this.putawayInv(d.getId(), byId.getArea().getId(), d.getPoint()==null?null:d.getPoint().getId(),(d.getOrderQty()-d.getReceivedQty()),null); asnDetailService.putawayInv(d.getId(), byId.getArea().getId(), d.getPoint()==null?null:d.getPoint().getId(),(d.getOrderQty()-d.getReceivedQty()),null);
byId.setReceivedDate(new Timestamp(System.currentTimeMillis())); byId.setReceivedDate(new Timestamp(System.currentTimeMillis()));
byId.setReceivedQuantity(byId.getReceivedQuantity() + d.getOrderQty()); byId.setReceivedQuantity(byId.getReceivedQuantity() + d.getOrderQty());
@ -467,7 +455,7 @@ public class AsnDetailController {
// 通用异常,使用自定义状态码 // 通用异常,使用自定义状态码
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "库区未填写"); throw new BadRequestException(HttpStatus.NOT_FOUND, id + "库区未填写");
} }
putawayInv(id,area.getId(),asnDetailButton.getOneRPoint().getId(),qty,null); asnDetailService.putawayInv(id,area.getId(),asnDetailButton.getOneRPoint().getId(),qty,null);
} else if (asnDetailButton.getButton() == 3) { } else if (asnDetailButton.getButton() == 3) {
long id = asnDetailButton.getId(); long id = asnDetailButton.getId();
AsnDto byId = asnService.findById(id); AsnDto byId = asnService.findById(id);
@ -538,7 +526,7 @@ public class AsnDetailController {
// 通用异常,使用自定义状态码 // 通用异常,使用自定义状态码
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "的副表" + asnDetailData.getId() + "的物料已经单一入库无法使用整单入库"); throw new BadRequestException(HttpStatus.NOT_FOUND, id + "的副表" + asnDetailData.getId() + "的物料已经单一入库无法使用整单入库");
} }
this.putawayInv(asnDetailData.getId(), byId.getArea().getId(), asnDetailData.getPoint().getId(),(asnDetailData.getOrderQty()-asnDetailData.getReceivedQty()),null); asnDetailService.putawayInv(asnDetailData.getId(), byId.getArea().getId(), asnDetailData.getPoint().getId(),(asnDetailData.getOrderQty()-asnDetailData.getReceivedQty()),null);
} }
if (apiResult.getStatus() == 200) { if (apiResult.getStatus() == 200) {
@ -563,95 +551,5 @@ public class AsnDetailController {
} }
public void putawayInv(@RequestBody Long asnDetailId, Long areaId, Long pointId,double recQty,String ewm) {
AsnDetail d = asnDetailService.getEntity(asnDetailId);
Area area = areaService.findEntityById(areaId);
Point point = null;
if(pointId!=null){
point = pointService.findEntityById(pointId);
}
Point zzkw=null;
if(area.getBexb()){
point= pointService.getPoint(area.getPointCode(), null, BaseStatus.HCKW, null);//取默认线边库位
zzkw=d.getPoint();
if(zzkw==null){
//取默认制造库位
zzkw= pointService.getPoint("ZZKW", null, null, null);
}
}
if(point==null){
throw new BadRequestException("请选择入库库位");
}
double unRecQty=d.getOrderQty() - d.getReceivedQty();
if ( recQty<=unRecQty) {
String pc1=null;
//现品票确认将任务id回写到现品票表中
XppRecord xppRecord = xppRecordRepository.findByCode(ewm);
ItemKey ik=null;
if(xppRecord!=null){
if(!xppRecord.getStatus().equals(BizStatus.RECEIVED)&&!xppRecord.getStatus().equals(BizStatus.RETENTION_IN)){
throw new BadRequestException(d.getItem().getCode()+"现品票状态不正确");
}
pc1=DateUtil.dateYmdz();//DateUtil.dateYmd(new Date());
ik=xppRecord.getItemKey();
}
if(ik==null){
ik = itemKeyService.getItemKey(d.getItem(), pc1);
}
Task t = taskService.storeTask(d, null, area, ik, point, point,recQty);
if(xppRecord!=null) {
xppRecord.setRkTask(t);
xppRecord.setInvPoint(point);
xppRecord.setStatus(BizStatus.PUTAWAY);
xppRecord.setItemKey(ik);
xppRecord.setSjr(SecurityUtils.getCurrentUsername());
xppRecord.setSjDate(new Timestamp(new Date().getTime()));
ewm=xppRecord.getEwm();
xppRecordService.update(xppRecord);
}
d.setReceivedQty(d.getReceivedQty()+recQty);
if(d.getReceivedQty().intValue()>=d.getOrderQty().intValue()){
d.setStatus(BizStatus.PUTAWAY);
}else if(d.getReceivedQty().intValue()>0){
d.setStatus(BizStatus.PUTAWAY);
}
asnDetailService.update(d);
point.setStatus(BaseStatus.USED);
pointService.update(point);
Inventory inv = invService.getInventory(ik, area, point, zzkw, d.getDept(), BizStatus.RECEIVING_UP);
t.setInvId(inv.getId());
taskService.update(t);
double srcQty = inv.getQuantity();
inv.addQty(recQty);
invService.update(inv);
String billCode=null;
if(d.getAsn()!=null){
Asn asn=d.getAsn();
billCode=asn.getCode();
asn.setReceivedQuantity(asn.getReceivedQuantity()+recQty);
if(asn.getReceivedQuantity().intValue()>=asn.getOrderQuantity().intValue()) {
asnService.update(asn);
}
}
Point srcPoint = pointService.getPoint(null, null, BaseStatus.SHZC, null);
InventoryLog log=invLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, billCode, area, ik, srcPoint, point, zzkw, srcQty, recQty,ewm,
BizStatus.ASN, d.getId(), inv.getId(), d.getRemark());
//根据账号增加耗用
String userName=SecurityUtils.getCurrentUsername();
if(userName!=null&&(userName.equals("楚友刚")||userName.equals("李栓荣")||userName.equals("颜建斌"))){
BigItem bigItem=bigItemRepository.findByCode(ik.getItem().getCode());
if(bigItem!=null){//自动生成耗用计划
List<Long> jsAreaIds=bomAccountRepository.getJsAreaList(bigItem.getId());
for(Long id:jsAreaIds){
AreaDto areaDto=areaService.findById(id);
Spareparts spareparts=sparepartsServiceImpl.createSpareparts(areaDto.getWorkingStation(),bigItem,xppRecord.getNrs(),"收货上架耗用");
sparepartsServiceImpl.hySpareParts(spareparts.getId());
}
}
}
} else {
throw new BadRequestException(d.getItem().getCode() + "收货数量不能大于未收数量");
}
}
} }

View File

@ -213,7 +213,7 @@ public class PickDetailController {
for (Long picktickId : picktickIds) { for (Long picktickId : picktickIds) {
List<PickDetail> pickDetailList = pickDetailService.queryPickDetailList(picktickId); List<PickDetail> pickDetailList = pickDetailService.queryPickDetailList(picktickId);
for (PickDetail pd : pickDetailList) { for (PickDetail pd : pickDetailList) {
pickDetailService.allocate(pd.getId(), pd.getOrderQty() - pd.getAllocatedQty()); pickDetailService.allocate(pd.getId(), pd.getOrderQty() - pd.getAllocatedQty(),pd.getPo());
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -269,7 +269,7 @@ public class PickDetailController {
newD.setAc(bomAccount.getAc()); newD.setAc(bomAccount.getAc());
newD.setSupplier(bomAccount.getSupplier()); newD.setSupplier(bomAccount.getSupplier());
newD.setPoint(bomAccount.getZPoint()); newD.setPoint(bomAccount.getZPoint());
pickDetailService.allocate(newD.getId(), newD.getOrderQty() - newD.getAllocatedQty()); pickDetailService.allocate(newD.getId(), newD.getOrderQty() - newD.getAllocatedQty(),oldD.getPo());
oldD.setOrderQty(oldD.getOrderQty()-sbQty); oldD.setOrderQty(oldD.getOrderQty()-sbQty);
oldD.setSourceId(newD.getId()); oldD.setSourceId(newD.getId());
pickDetailService.update(oldD); pickDetailService.update(oldD);
@ -400,6 +400,7 @@ public class PickDetailController {
double orderQty = oldDetail.getOrderQty() - oldDetail.getAllocatedQty() - oldDetail.getBcQty(); double orderQty = oldDetail.getOrderQty() - oldDetail.getAllocatedQty() - oldDetail.getBcQty();
PickDetail pickDetail = pickDetailService.createPickDetail(pickTicket, oldDetail.getItem(), null, orderQty, oldDetail.getSupplier()); PickDetail pickDetail = pickDetailService.createPickDetail(pickTicket, oldDetail.getItem(), null, orderQty, oldDetail.getSupplier());
pickDetail.setPoint(oldDetail.getPoint()); pickDetail.setPoint(oldDetail.getPoint());
pickDetail.setPo(oldDetail.getPo());
pickDetail.setPropC3(oldDetail.getPropC3()); pickDetail.setPropC3(oldDetail.getPropC3());
pickDetail.setAc(oldDetail.getAc()); pickDetail.setAc(oldDetail.getAc());
pickDetail.setContents(oldDetail.getContents()); pickDetail.setContents(oldDetail.getContents());
@ -409,7 +410,7 @@ public class PickDetailController {
pickDetail.setArea(oldDetail.getArea()); pickDetail.setArea(oldDetail.getArea());
pickDetail.setShArea(oldDetail.getShArea()); pickDetail.setShArea(oldDetail.getShArea());
pickDetailService.update(pickDetail); pickDetailService.update(pickDetail);
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty()); pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty(),pickDetail.getPo());
double bcQty = pickDetail.getAllocatedQty(); double bcQty = pickDetail.getAllocatedQty();
//将出单数写入到订单数 //将出单数写入到订单数
pickDetail.setOrderQty(bcQty); pickDetail.setOrderQty(bcQty);

View File

@ -408,7 +408,7 @@ public class PickOutController {
return; return;
} }
//扣库存 //扣库存
Inventory inventory = inventoryService.getInventory(log.getItemKey(),pt.getArea(),log.getDstPoint(),pd.getPoint(),log.getDept(),BizStatus.SHIPPING); Inventory inventory = inventoryService.getInventory(log.getItemKey(),pt.getArea(),log.getDstPoint(),pd.getPoint(),log.getDept(),BizStatus.SHIPPING,null);
if (inventory==null) { if (inventory==null) {
throw new BadRequestException(HttpStatus.NOT_FOUND, log.getItem().getCode() + "未发现库存数据"); throw new BadRequestException(HttpStatus.NOT_FOUND, log.getItem().getCode() + "未发现库存数据");
} }
@ -525,8 +525,8 @@ public class PickOutController {
// Point point=pickOut.getShArea().getPoint(); // Point point=pickOut.getShArea().getPoint();
Point point = pointService.findEntityById(pickDetail.getShArea().getPointId()); Point point = pointService.findEntityById(pickDetail.getShArea().getPointId());
//线边接收不需要管理到批次重新生成itemKey //线边接收不需要管理到批次重新生成itemKey
ItemKey itemKey = itemKeyService.getItemKey(tasklog.getItemKey().getItem(), null); ItemKey itemKey = itemKeyService.getItemKey(tasklog.getItemKey().getItem(), null,task.getItemKey().getPropC2());
Inventory inventory = inventoryService.getInventory(itemKey, pickDetail.getShArea(), point, pickDetail.getPoint(), dept, BizStatus.SL_ALL); Inventory inventory = inventoryService.getInventory(itemKey, pickDetail.getShArea(), point, pickDetail.getPoint(), dept, BizStatus.SL_ALL,null);
double srcQty = inventory.getQuantity(); double srcQty = inventory.getQuantity();
inventory.setQuantity(inventory.getQuantity() + tasklog.getSlQty()); inventory.setQuantity(inventory.getQuantity() + tasklog.getSlQty());
inventoryService.update(inventory); inventoryService.update(inventory);

View File

@ -18,14 +18,19 @@ package com.youchain.businessdata.rest;
import com.youchain.DuplicateSubmission.DuplicateSubmission; import com.youchain.DuplicateSubmission.DuplicateSubmission;
import com.youchain.annotation.AnonymousAccess; import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log; import com.youchain.annotation.Log;
import com.youchain.basicdata.domain.Area;
import com.youchain.basicdata.domain.BillType;
import com.youchain.basicdata.domain.Item; import com.youchain.basicdata.domain.Item;
import com.youchain.basicdata.domain.Point; import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.repository.BillTypeRepository;
import com.youchain.basicdata.service.PointService; import com.youchain.basicdata.service.PointService;
import com.youchain.businessdata.domain.*; import com.youchain.businessdata.domain.*;
import com.youchain.businessdata.inputJson.IPTask; import com.youchain.businessdata.inputJson.IPTask;
import com.youchain.businessdata.inputJson.IScanPut; import com.youchain.businessdata.inputJson.IScanPut;
import com.youchain.businessdata.inputJson.PutawayRequest;
import com.youchain.businessdata.inputJson.buttenJson.PickTicketButton; import com.youchain.businessdata.inputJson.buttenJson.PickTicketButton;
import com.youchain.businessdata.repository.*; import com.youchain.businessdata.repository.*;
import com.youchain.businessdata.returnJson.PutawayRet;
import com.youchain.businessdata.returnJson.RPPickList; import com.youchain.businessdata.returnJson.RPPickList;
import com.youchain.businessdata.returnJson.RPTaskList; import com.youchain.businessdata.returnJson.RPTaskList;
import com.youchain.businessdata.service.*; import com.youchain.businessdata.service.*;
@ -52,6 +57,8 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
/** /**
* @website https://eladmin.vip * @website https://eladmin.vip
* @author JiangKun * @author JiangKun
@ -70,6 +77,8 @@ public class PickTicketController {
private final TaskLogRepository taskLogRepository; private final TaskLogRepository taskLogRepository;
private final XppRecordService xppRecordService; private final XppRecordService xppRecordService;
private final XppRecordRepository xppRecordRepository; private final XppRecordRepository xppRecordRepository;
private final InventoryRepository inventoryRepository;
private final BillTypeRepository billTypeRepository;
private final TaskService taskService; private final TaskService taskService;
private final TaskLogService taskLogService; private final TaskLogService taskLogService;
private final InventoryService inventoryService; private final InventoryService inventoryService;
@ -190,16 +199,54 @@ public class PickTicketController {
pickTicketService.pickingOperation(resources); pickTicketService.pickingOperation(resources);
return new ResponseEntity<>("操作成功",HttpStatus.OK); return new ResponseEntity<>("操作成功",HttpStatus.OK);
} }
@PostMapping("/xdckPick")
@Log("箱单出库创建")
@ApiOperation("箱单出库创建")
@PreAuthorize("@el.check('super:man')")
public ResponseEntity<Object> xdckPick(@RequestBody String stockCode){
//检查该托盘是否还有库存
List<Inventory> invs=inventoryRepository.queryInvStockCode(stockCode);
if(invs.size()<=0){
return new ResponseEntity<>("没有对应的库存",HttpStatus.BAD_REQUEST);
}
BillType bt=billTypeRepository.findByName(BaseStatus.XDBH);
if(bt==null){
throw new BadRequestException("维护箱单出库"+BaseStatus.XDBH+"类型");
}
Area outArea=invs.get(0).getArea();
PickTicket pickTicket=pickTicketService.storePick(bt,null,outArea,"大",stockCode);
double orderQty=0;
//生成出库明细
for (Inventory inv:invs){
PickDetail detail=pickDetailService.createPickDetail(pickTicket,inv.getItemKey().getItem(), stockCode,inv.getQuantity(),null);
orderQty+=detail.getOrderQty();
//分配
pickDetailService.allocate(detail.getId(), detail.getOrderQty(),stockCode);
}
pickTicket.setOrderQuantity(orderQty);
pickTicketService.update(pickTicket);
return new ResponseEntity<>("操作成功",HttpStatus.OK);
}
@PostMapping("/pickWhole") @PostMapping("/pickWhole")
@Log("备货操作-整单拣货") @Log("备货操作-整单拣货")
@ApiOperation("备货操作-整单拣货") @ApiOperation("备货操作-整单拣货")
@PreAuthorize("@el.check('super:man')") @PreAuthorize("@el.check('super:man')")
@Transactional @Transactional
public ResponseEntity<Object> pickWhole(@RequestBody Long ptId){ public ResponseEntity<Object> pickWhole(@RequestBody PickTicketButton resources){
String bhr=SecurityUtils.getCurrentUsername(); String bhr=SecurityUtils.getCurrentUsername();
List<Task> ts=taskRepository.getNotPickTask(ptId); String stockCode=resources.getStockCode();
if(resources.getPickConfirmNo()==8){
List<PickTicket> pts=pickTicketRepository.queryByCusCode(stockCode);
if(pts.size()<=0){
throw new BadRequestException("没找到需要下架的箱单");
}
resources.setPickTicketId(pts.get(0).getId());
}
List<Task> ts=taskRepository.getNotPickTask(resources.getPickTicketId());
if(ts.size()<=0){ if(ts.size()<=0){
return new ResponseEntity<>("没有需要拣货的明细",HttpStatus.BAD_REQUEST); throw new BadRequestException("没有需要拣货的明细");
} }
for(Task t:ts) { for(Task t:ts) {
pickTicketService.pickForTask(t.getId(), t.getSrcStockCode(), t.getPlanQty()-t.getMoveQty(), null, bhr); pickTicketService.pickForTask(t.getId(), t.getSrcStockCode(), t.getPlanQty()-t.getMoveQty(), null, bhr);
@ -207,6 +254,55 @@ public class PickTicketController {
return new ResponseEntity<>("操作成功",HttpStatus.OK); return new ResponseEntity<>("操作成功",HttpStatus.OK);
} }
@PostMapping("/pickWholeApp")
@Log("箱单出库APP")
@ApiOperation("箱单出库APP")
@PreAuthorize("@el.check('super:man')")
@Transactional
public ResponseEntity<Object> pickWholeApp(@RequestBody PutawayRequest request){
String bhr=SecurityUtils.getCurrentUsername();
String stockCode=request.getStockCode();
List<PutawayRet> rets=new ArrayList<>();
if(request.getCheckType()==4){
List<PickTicket> pts=pickTicketRepository.queryByCusCode(stockCode);
if(pts.size()<=0){
throw new BadRequestException("没找到需要下架的箱单");
}
Long pickId=pts.get(0).getId();
List<Task> ts=taskRepository.getNotPickTask(pickId);
if(ts.size()<=0){
throw new BadRequestException("没有需要拣货的明细");
}
for(Task t:ts) {
PickDetail pd=t.getPickDetail();
PutawayRet ret=new PutawayRet();
ret.createPutawayRet(pickId,pd.getId(),pd.getItem().getCode(),pd.getItem().getName(),t.getPlanQty(),t.getItemKey().getPropC2(),pd.getPo());
rets.add(ret);
}
return new ResponseEntity<>(rets,HttpStatus.OK);
}else if(request.getCheckType()==6){
List<PickTicket> pts=pickTicketRepository.queryByCusCode(stockCode);
if(pts.size()<=0){
throw new BadRequestException("没找到需要下架的箱单");
}
Long pickId=pts.get(0).getId();
List<Task> ts=taskRepository.getNotPickTask(pickId);
if(ts.size()<=0){
throw new BadRequestException("没有需要拣货的明细");
}
for(Task t:ts) {
PickDetail pd=t.getPickDetail();
PutawayRet ret=new PutawayRet();
ret.createPutawayRet(pickId,pd.getId(),pd.getItem().getCode(),pd.getItem().getName(),t.getPlanQty(),t.getItemKey().getPropC2(),pd.getPo());
rets.add(ret);
pickTicketService.pickForTask(t.getId(), t.getSrcStockCode(), t.getPlanQty()-t.getMoveQty(), null, bhr);
}
}
return new ResponseEntity<>("操作成功",HttpStatus.OK);
}
@PostMapping("/pickBatch") @PostMapping("/pickBatch")
@Log("备货操作-批量拣货") @Log("备货操作-批量拣货")
@ApiOperation("备货操作-批量拣货") @ApiOperation("备货操作-批量拣货")
@ -375,8 +471,8 @@ public class PickTicketController {
Point point=pointService.findEntityById(pt.getShArea().getPointId()); Point point=pointService.findEntityById(pt.getShArea().getPointId());
Dept dept= UserUtils.getDept(); Dept dept= UserUtils.getDept();
//线边接收不需要管理到批次重新生成itemKey //线边接收不需要管理到批次重新生成itemKey
ItemKey itemKey=itemKeyService.getItemKey(log.getItemKey().getItem(),null); ItemKey itemKey=itemKeyService.getItemKey(log.getItemKey().getItem(),null,task.getItemKey().getPropC2());
Inventory inventory=inventoryService.getInventory(itemKey,pt.getShArea(),point,pickDetail.getPoint(),dept,BizStatus.SL_ALL); Inventory inventory=inventoryService.getInventory(itemKey,pt.getShArea(),point,pickDetail.getPoint(),dept,BizStatus.SL_ALL,null);
double srcQty=inventory.getQuantity(); double srcQty=inventory.getQuantity();
inventory.setQuantity(inventory.getQuantity()+log.getSlQty()); inventory.setQuantity(inventory.getQuantity()+log.getSlQty());
inventoryService.update(inventory); inventoryService.update(inventory);

View File

@ -368,7 +368,7 @@ public class XppRecordController {
inventoryLogService.storeInventoryLog(BizStatus.ZZKW_TL, BizStatus.REDUCE, "制造库位投料", shArea, srcInv.getItemKey(), srcPoint, dstPoint, inventoryLogService.storeInventoryLog(BizStatus.ZZKW_TL, BizStatus.REDUCE, "制造库位投料", shArea, srcInv.getItemKey(), srcPoint, dstPoint,
zzkw,srcQty1, occurQty, xppRecord.getEwm(), BizStatus.ZZKW_TL, xppRecord.getId(), srcInv.getId(), "制造库位投料"); zzkw,srcQty1, occurQty, xppRecord.getEwm(), BizStatus.ZZKW_TL, xppRecord.getId(), srcInv.getId(), "制造库位投料");
//制造库位增加库存 //制造库位增加库存
Inventory dstInv=inventoryService.getInventory(srcInv.getItemKey(),shArea,dstPoint,zzkw,srcInv.getDept(),BizStatus.ZZKW_TL); Inventory dstInv=inventoryService.getInventory(srcInv.getItemKey(),shArea,dstPoint,zzkw,srcInv.getDept(),BizStatus.ZZKW_TL,null);
double srcQty2=dstInv.getQuantity(); double srcQty2=dstInv.getQuantity();
dstInv.addQty(occurQty); dstInv.addQty(occurQty);
inventoryService.update(dstInv); inventoryService.update(dstInv);
@ -465,7 +465,7 @@ public class XppRecordController {
} }
} }
String pc1=DateUtil.dateYmd(new Date()); String pc1=DateUtil.dateYmd(new Date());
ItemKey ik = itemKeyService.getItemKey(xppRecord.getItem(), DateUtil.dateYmdz()); ItemKey ik = itemKeyService.getItemKey(xppRecord.getItem(), DateUtil.dateYmdz(),BaseStatus.KS);
xppRecord.setItemKey(ik); xppRecord.setItemKey(ik);
if(type==1) { if(type==1) {
inventoryLogService.storeInventoryLog(BizStatus.RECEIVING, BizStatus.ADD, "现品票采集", area, ik, srcPoint, srcPoint, null, 0d, xppRecord.getNrs() + 0d, ewm, inventoryLogService.storeInventoryLog(BizStatus.RECEIVING, BizStatus.ADD, "现品票采集", area, ik, srcPoint, srcPoint, null, 0d, xppRecord.getNrs() + 0d, ewm,
@ -689,8 +689,8 @@ public class XppRecordController {
//扣除库存 //扣除库存
xppRecordService.xppShipOut(id,xppRecord.getInvPoint().getArea(),xppRecord.getInvPoint(),zzkw,BizStatus.YK_OUT,"现品票直接移库接收","现品票直接移库接收"); xppRecordService.xppShipOut(id,xppRecord.getInvPoint().getArea(),xppRecord.getInvPoint(),zzkw,BizStatus.YK_OUT,"现品票直接移库接收","现品票直接移库接收");
//增加库存,线边接收不需要管理到批次重新生成itemKey //增加库存,线边接收不需要管理到批次重新生成itemKey
ItemKey itemKey=itemKeyService.getItemKey(ik.getItem(),null); ItemKey itemKey=itemKeyService.getItemKey(ik.getItem(),null,ik.getPropC2());
Inventory inventory=inventoryService.getInventory(itemKey,shArea,jskw,zzkw,dept,BizStatus.YK_JS); Inventory inventory=inventoryService.getInventory(itemKey,shArea,jskw,zzkw,dept,BizStatus.YK_JS,null);
double srcQty=inventory.getQuantity(); double srcQty=inventory.getQuantity();
inventory.setQuantity(inventory.getQuantity()+xppRecord.getNrs()); inventory.setQuantity(inventory.getQuantity()+xppRecord.getNrs());
inventoryService.update(inventory); inventoryService.update(inventory);
@ -739,7 +739,7 @@ public class XppRecordController {
ItemKey ik = xppRecord.getItemKey(); ItemKey ik = xppRecord.getItemKey();
Point srcPoint=xppRecord.getInvPoint(); Point srcPoint=xppRecord.getInvPoint();
Area srcArea=srcPoint.getArea(); Area srcArea=srcPoint.getArea();
Inventory inventory=inventoryService.getInventory(ik,srcArea,srcPoint,zzkw,srcArea.getDept(),BizStatus.MOVE); Inventory inventory=inventoryService.getInventory(ik,srcArea,srcPoint,zzkw,srcArea.getDept(),BizStatus.MOVE,null);
if(inventory==null){ if(inventory==null){
throw new BadRequestException(itemCode+"该库位无该批次库存"); throw new BadRequestException(itemCode+"该库位无该批次库存");
} }
@ -753,7 +753,7 @@ public class XppRecordController {
inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.REDUCE, "现品票移位", srcArea, ik, srcPoint, dstPoint, null, srcQty, xppRecord.getNrs()+0d,xppRecord.getEwm(), inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.REDUCE, "现品票移位", srcArea, ik, srcPoint, dstPoint, null, srcQty, xppRecord.getNrs()+0d,xppRecord.getEwm(),
BizStatus.MOVE, xppRecord.getId(), inventory.getId(), "现品票移位"); BizStatus.MOVE, xppRecord.getId(), inventory.getId(), "现品票移位");
//目标库位增加 //目标库位增加
Inventory dstInv=inventoryService.getInventory(ik,dstArea,dstPoint,zzkw,dstArea.getDept(),BizStatus.MOVE); Inventory dstInv=inventoryService.getInventory(ik,dstArea,dstPoint,zzkw,dstArea.getDept(),BizStatus.MOVE,null);
inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.ADD, "现品票移位", dstArea, ik, srcPoint, dstPoint, null, dstInv.getQuantity(), xppRecord.getNrs()+0d,xppRecord.getEwm(), inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.ADD, "现品票移位", dstArea, ik, srcPoint, dstPoint, null, dstInv.getQuantity(), xppRecord.getNrs()+0d,xppRecord.getEwm(),
BizStatus.MOVE, xppRecord.getId(), dstInv.getId(), "现品票移位"); BizStatus.MOVE, xppRecord.getId(), dstInv.getId(), "现品票移位");
dstInv.addQty(xppRecord.getNrs()); dstInv.addQty(xppRecord.getNrs());

View File

@ -14,6 +14,7 @@ import javax.persistence.Entity;
*/ */
public interface BomPrint { public interface BomPrint {
String getNs(); String getNs();
String getCode();
String getXz(); String getXz();
String getPm(); String getPm();
String getSupplier(); String getSupplier();

View File

@ -12,6 +12,8 @@ public class BomPrint_BiaoQian {
private String ns; private String ns;
private String code;
//"箱种" //"箱种"
private String xz; private String xz;

View File

@ -12,6 +12,8 @@ public class BomPrint_BiaoQian2 {
private String ns; private String ns;
private String code;
//"箱种" //"箱种"
private String xz; private String xz;

View File

@ -0,0 +1,29 @@
package com.youchain.businessdata.returnJson;
import com.youchain.businessdata.inputJson.PutawayRequest;
import lombok.Data;
import java.util.List;
@Data
public class PutawayRet {
Long asnId;
Long detailId;
String itemCode;//品番
String itemName;//品名
double qty;//数量
String bonded;//税别
String po;//PO
public PutawayRet createPutawayRet(Long asnId,Long detailId,String itemCode,String itemName ,double qty,String bonded,String po){
this.setBonded(bonded);
this.setPo(po);
this.setQty(qty);
this.setItemCode(itemCode);
this.setItemName(itemName);
this.setAsnId(asnId);
this.setDetailId(detailId);
return this;
}
}

View File

@ -24,6 +24,8 @@ import com.youchain.businessdata.domain.XppRecord;
import com.youchain.businessdata.service.dto.AsnDetailDto; import com.youchain.businessdata.service.dto.AsnDetailDto;
import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria; import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
import java.io.IOException; import java.io.IOException;
@ -128,4 +130,13 @@ public interface AsnDetailService {
* @return * @return
*/ */
List<AsnDetail> findAsnDetails(Long asnId,String type); List<AsnDetail> findAsnDetails(Long asnId,String type);
/**
*
* @param asnDetailId
* @param pointId
*/
void putAwayDetial(Long asnDetailId, Long pointId);
void putawayInv(@RequestBody Long asnDetailId, Long areaId, Long pointId, double recQty, String ewm);
} }

View File

@ -86,7 +86,7 @@ public interface AsnService {
*/ */
void download(List<AsnDto> all, HttpServletResponse response) throws Exception, Exception; void download(List<AsnDto> all, HttpServletResponse response) throws Exception, Exception;
List<Asn> queryByAsnCodes(List<String> asnCodes); List<Asn> queryByCusCodes(List<String> cusCodes);
Map<String, Asn> queryByasnCodesToMap(List<String> asnCodes); Map<String, Asn> queryByCusCodesToMap(List<String> cusCodes);
} }

View File

@ -101,7 +101,7 @@ public interface InventoryService {
void downloadZz(List<InventoryDto> all, HttpServletResponse response) throws Exception, Exception; void downloadZz(List<InventoryDto> all, HttpServletResponse response) throws Exception, Exception;
List<Inventory> queryInventoryAllocate(long itemId,long areaId,Long zzkwId); List<Inventory> queryInventoryAllocate(long itemId,long areaId,Long zzkwId,String stockCode);
/** /**
* 线 * 线
@ -114,7 +114,7 @@ public interface InventoryService {
List<Inventory> queryInventory(Long areaId,Long pointId,Long itemKeyId); List<Inventory> queryInventory(Long areaId,Long pointId,Long itemKeyId);
Inventory getInventory(ItemKey itemKey, Area area, Point point,Point zzkw, Dept dept, String type); Inventory getInventory(ItemKey itemKey, Area area, Point point,Point zzkw, Dept dept, String type,String stockCode);
/** /**
* 线 * 线

View File

@ -86,7 +86,7 @@ public interface ItemKeyService {
*/ */
void download(List<ItemKeyDto> all, HttpServletResponse response) throws Exception, Exception; void download(List<ItemKeyDto> all, HttpServletResponse response) throws Exception, Exception;
ItemKey getItemKey(Item item, String propC1); ItemKey getItemKey(Item item, String propC1,String propC2);
} }

View File

@ -107,7 +107,7 @@ public interface PickDetailService {
/** /**
* *
*/ */
void allocate(long id,double quantity); void allocate(long id,double quantity,String stockCode);
/** /**
* *

View File

@ -126,6 +126,7 @@ public interface PickTicketService {
* *
*/ */
void pickingOperation(PickTicketButton pickTicketButton); void pickingOperation(PickTicketButton pickTicketButton);
/** /**
* *
*/ */

View File

@ -97,7 +97,7 @@ public interface TaskService {
/** /**
* *
* */ * */
Task storeTask(AsnDetail d, PickDetail p, Area area, ItemKey ik, Point srcPoint, Point dstPoint,double qty); Task storeTask(AsnDetail d, PickDetail p, Area area, ItemKey ik, Point srcPoint, Point dstPoint,double qty,String stockCode);
/** /**
* Task * Task
* @param id * @param id

View File

@ -40,4 +40,7 @@ public class AsnQueryCriteria{
/** 模糊 */ /** 模糊 */
@Query(type = Query.Type.EQUAL) @Query(type = Query.Type.EQUAL)
private String status; private String status;
@Query(joinName = "billType", propName="code",type = Query.Type.EQUAL)
private String billTypeCode;
} }

View File

@ -86,4 +86,8 @@ public class InventoryQueryCriteria{
@Query(joinName = "area",propName = "bexb",type = Query.Type.EQUAL) @Query(joinName = "area",propName = "bexb",type = Query.Type.EQUAL)
private Boolean bexb; private Boolean bexb;
/** 模糊 */
@Query(type = Query.Type.INNER_LIKE)
private String stockCode;
} }

View File

@ -34,6 +34,8 @@ public class PickTicketQueryCriteria{
@Query(type = Query.Type.INNER_LIKE) @Query(type = Query.Type.INNER_LIKE)
private String gcCode; private String gcCode;
@Query(type = Query.Type.INNER_LIKE)
private String cusCode;
/** 模糊 */ /** 模糊 */
@Query(type = Query.Type.EQUAL,propName="code") @Query(type = Query.Type.EQUAL,propName="code")
private String code1; private String code1;

View File

@ -15,22 +15,23 @@
*/ */
package com.youchain.businessdata.service.impl; package com.youchain.businessdata.service.impl;
import com.youchain.basicdata.domain.Item; import com.youchain.basicdata.domain.*;
import com.youchain.basicdata.domain.Point; import com.youchain.basicdata.repository.PointRepository;
import com.youchain.basicdata.domain.Stock; import com.youchain.basicdata.service.AreaService;
import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.StockService; import com.youchain.basicdata.service.StockService;
import com.youchain.basicdata.service.dto.AreaDto;
import com.youchain.businessdata.domain.*; import com.youchain.businessdata.domain.*;
import com.youchain.businessdata.repository.InventoryRepository;
import com.youchain.businessdata.repository.TaskRepository; import com.youchain.businessdata.repository.TaskRepository;
import com.youchain.businessdata.service.AsnService; import com.youchain.businessdata.repository.XppRecordRepository;
import com.youchain.businessdata.service.InventoryLogService; import com.youchain.businessdata.service.*;
import com.youchain.businessdata.service.InventoryService;
import com.youchain.businessdata.service.dto.AsnDto; import com.youchain.businessdata.service.dto.AsnDto;
import com.youchain.businessdata.service.mapstruct.AsnMapper; import com.youchain.businessdata.service.mapstruct.AsnMapper;
import com.youchain.exception.BadRequestException; import com.youchain.exception.BadRequestException;
import com.youchain.utils.*; import com.youchain.utils.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import com.youchain.businessdata.repository.AsnDetailRepository; import com.youchain.businessdata.repository.AsnDetailRepository;
import com.youchain.businessdata.service.AsnDetailService;
import com.youchain.businessdata.service.dto.AsnDetailDto; import com.youchain.businessdata.service.dto.AsnDetailDto;
import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria; import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria;
import com.youchain.businessdata.service.mapstruct.AsnDetailMapper; import com.youchain.businessdata.service.mapstruct.AsnDetailMapper;
@ -38,14 +39,14 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.List; import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;
import java.sql.Timestamp;
import java.util.*;
import java.io.IOException; import java.io.IOException;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.Query; import javax.persistence.Query;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
/** /**
* @website https://eladmin.vip * @website https://eladmin.vip
@ -58,13 +59,23 @@ import java.util.LinkedHashMap;
public class AsnDetailServiceImpl implements AsnDetailService { public class AsnDetailServiceImpl implements AsnDetailService {
private final AsnDetailRepository asnDetailRepository; private final AsnDetailRepository asnDetailRepository;
private final PointRepository pointRepository;
private final XppRecordRepository xppRecordRepository;
private final InventoryRepository inventoryRepository;
private final AsnDetailMapper asnDetailMapper; private final AsnDetailMapper asnDetailMapper;
private final EntityManager entityMapper; private final EntityManager entityMapper;
private final TaskRepository taskRepository; private final TaskRepository taskRepository;
private final AsnService asnService; private final AsnService asnService;
private final AsnMapper asnMapper; private final XppRecordService xppRecordService;
private final InventoryService inventoryService; private final InventoryService inventoryService;
private final InventoryLogService inventoryLogService; private final InventoryLogService inventoryLogService;
private final PointService pointService;
private final AreaService areaService;
private final ItemKeyService itemKeyService;
private final TaskService taskService;
private final AsnMapper asnMapper;
@Override @Override
public Map<String,Object> queryAll(AsnDetailQueryCriteria criteria, Pageable pageable){ public Map<String,Object> queryAll(AsnDetailQueryCriteria criteria, Pageable pageable){
@ -139,7 +150,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
ewm=xppRecord.getEwm(); ewm=xppRecord.getEwm();
srcPoint=xppRecord.getInvPoint(); srcPoint=xppRecord.getInvPoint();
} }
Inventory inventory=inventoryService.getInventory(t.getItemKey(),xppRecord.getArea(),srcPoint,t.getAsnDetail().getPoint(),t.getArea().getDept(),BizStatus.RECEIVING_CANCEL); Inventory inventory=inventoryService.getInventory(t.getItemKey(),xppRecord.getArea(),srcPoint,t.getAsnDetail().getPoint(),t.getArea().getDept(),BizStatus.RECEIVING_CANCEL,asn.getCusCode());
if(inventory==null){ if(inventory==null){
throw new BadRequestException("找不到对应库存"); throw new BadRequestException("找不到对应库存");
} }
@ -215,4 +226,113 @@ public class AsnDetailServiceImpl implements AsnDetailService {
List<AsnDetail> ds=query.getResultList(); List<AsnDetail> ds=query.getResultList();
return ds; return ds;
} }
@Override
public void putAwayDetial(Long asnDetailId, Long pointId) {
AsnDetail ad=asnDetailRepository.getById(asnDetailId);
Point point=pointRepository.getById(pointId);
}
@Override
public void putawayInv(@RequestBody Long asnDetailId, Long areaId, Long pointId, double recQty, String ewm) {
AsnDetail d = asnDetailRepository.getById(asnDetailId);
String propC2="课税";
if(d.getPropC2()!=null){
if(d.getPropC2().equals("EXP -")||d.getPropC2().equals("课税")){
propC2="课税";
}else if(d.getPropC2().equals("保税")){
propC2="保税";
}else{
propC2="保税";
}
}
Area area =null;
Point point = null;
if(pointId!=null){
point = pointService.findEntityById(pointId);
if( point.getType().equals(BaseStatus.CH)){
area=point.getArea();
}
}
if(areaId!=null){
area = areaService.findEntityById(areaId);
}
Point zzkw=null;
String pc1=null;
if(area.getBexb()){
point= pointService.getPoint(area.getPointCode(), null, BaseStatus.HCKW, null);//取默认线边库位
zzkw=d.getPoint();
if(zzkw==null){
//取默认制造库位
zzkw= pointService.getPoint("ZZKW", null, null, null);
}
}else{
pc1=DateUtil.dateYmdz();
}
if(point==null){
throw new BadRequestException("请选择入库库位");
}
double unRecQty=d.getOrderQty() - d.getReceivedQty();
if ( recQty<=unRecQty) {
//现品票确认将任务id回写到现品票表中
XppRecord xppRecord = xppRecordRepository.findByCode(ewm);
ItemKey ik=null;
if(xppRecord!=null){
if(!xppRecord.getStatus().equals(BizStatus.RECEIVED)&&!xppRecord.getStatus().equals(BizStatus.RETENTION_IN)){
throw new BadRequestException(d.getItem().getCode()+"现品票状态不正确");
}
ik=xppRecord.getItemKey();
}
if(ik==null){
ik = itemKeyService.getItemKey(d.getItem(), pc1,propC2);
}
String billCode=null;
String stockCode=null;
if(d.getAsn()!=null){
Asn asn=d.getAsn();
billCode=asn.getCode();
asn.setReceivedQuantity(asn.getReceivedQuantity()+recQty);
if(asn.getReceivedQuantity().intValue()>=asn.getOrderQuantity().intValue()) {
asn.setStatus(BizStatus.PUTAWAY);
}
asnService.update(asn);
stockCode=asn.getCusCode();
}
Task t = taskService.storeTask(d, null, area, ik, point, point,recQty,stockCode);
if(xppRecord!=null) {
xppRecord.setRkTask(t);
xppRecord.setInvPoint(point);
xppRecord.setStatus(BizStatus.PUTAWAY);
xppRecord.setItemKey(ik);
xppRecord.setSjr(SecurityUtils.getCurrentUsername());
xppRecord.setSjDate(new Timestamp(new Date().getTime()));
ewm=xppRecord.getEwm();
xppRecordService.update(xppRecord);
}
d.setReceivedQty(d.getReceivedQty()+recQty);
if(d.getReceivedQty().intValue()>=d.getOrderQty().intValue()){
d.setStatus(BizStatus.PUTAWAY);
}else if(d.getReceivedQty().intValue()>0){
d.setStatus(BizStatus.PUTAWAY);
}
this.update(d);
point.setStatus(BaseStatus.USED);
pointService.update(point);
Inventory inv = inventoryService.getInventory(ik, area, point, zzkw, d.getDept(), BizStatus.RECEIVING_UP,stockCode);
t.setInvId(inv.getId());
taskService.update(t);
double srcQty = inv.getQuantity();
inv.addQty(recQty);
inventoryService.update(inv);
Point srcPoint = pointService.getPoint(null, null, BaseStatus.SHZC, null);
InventoryLog log=inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, billCode, area, ik, srcPoint, point, zzkw, srcQty, recQty,ewm,
BizStatus.ASN, d.getId(), inv.getId(), d.getRemark());
log.setDstStockCode(inv.getStockCode());
inventoryLogService.update(log);
} else {
throw new BadRequestException(d.getItem().getCode() + "收货数量不能大于未收数量");
}
}
} }

View File

@ -147,22 +147,22 @@ public class AsnServiceImpl implements AsnService {
} }
@Override @Override
public List<Asn> queryByAsnCodes(List<String> asnCodes) { public List<Asn> queryByCusCodes(List<String> asnCodes) {
if (CollectionUtils.isEmpty(asnCodes)) { if (CollectionUtils.isEmpty(asnCodes)) {
return Collections.emptyList(); return Collections.emptyList();
} }
//去重 //去重
asnCodes = asnCodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList()); asnCodes = asnCodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
return asnRepository.queryByAsnCodes(asnCodes); return asnRepository.queryByCusCodes(asnCodes);
} }
@Override @Override
public Map<String, Asn> queryByasnCodesToMap(List<String> asnCodes) { public Map<String, Asn> queryByCusCodesToMap(List<String> cusCodes) {
List<Asn> asnList = queryByAsnCodes(asnCodes); List<Asn> asnList = queryByCusCodes(cusCodes);
//封装成map //封装成map
Map<String, Asn> asnMap = Maps.newHashMap(); Map<String, Asn> asnMap = Maps.newHashMap();
for (Asn asn : asnList) { for (Asn asn : asnList) {
asnMap.put(asn.getCode(), asn); asnMap.put(asn.getCusCode(), asn);
} }
return asnMap; return asnMap;
} }

View File

@ -187,7 +187,7 @@ public class CountMoveServiceImpl implements CountMoveService {
countMoveDetailRecord.setStatus(BizStatus.OPEN); countMoveDetailRecord.setStatus(BizStatus.OPEN);
countMoveDetailRecordService.create(countMoveDetailRecord); countMoveDetailRecordService.create(countMoveDetailRecord);
//查找目标库位是否有库存,有则数量累加,没有新建 //查找目标库位是否有库存,有则数量累加,没有新建
Inventory newInv=inventoryService.getInventory(itemKey,d.getDstPoint().getArea(),d.getDstPoint(),inv.getZzkw(),dept,BizStatus.COUNT_MOVE); Inventory newInv=inventoryService.getInventory(itemKey,d.getDstPoint().getArea(),d.getDstPoint(),inv.getZzkw(),dept,BizStatus.COUNT_MOVE,null);
newInv.setQuantity(newInv.getQuantity()+xpp.getNrs()); newInv.setQuantity(newInv.getQuantity()+xpp.getNrs());
inventoryService.update(newInv); inventoryService.update(newInv);
inv.setQuantity(inv.getQuantity()-xpp.getNrs()); inv.setQuantity(inv.getQuantity()-xpp.getNrs());
@ -294,7 +294,7 @@ public class CountMoveServiceImpl implements CountMoveService {
countMoveDetailRecord.setStatus(BizStatus.OPEN); countMoveDetailRecord.setStatus(BizStatus.OPEN);
countMoveDetailRecordService.create(countMoveDetailRecord); countMoveDetailRecordService.create(countMoveDetailRecord);
//查找目标库位是否有库存,有则数量累加,没有新建 //查找目标库位是否有库存,有则数量累加,没有新建
Inventory newInv = inventoryService.getInventory(itemKey, d.getDstPoint().getArea(), d.getDstPoint(), inv.getZzkw(), dept, BizStatus.COUNT_MOVE); Inventory newInv = inventoryService.getInventory(itemKey, d.getDstPoint().getArea(), d.getDstPoint(), inv.getZzkw(), dept, BizStatus.COUNT_MOVE,null);
newInv.setQuantity(newInv.getQuantity() + xpp.getNrs()); newInv.setQuantity(newInv.getQuantity() + xpp.getNrs());
inventoryService.update(newInv); inventoryService.update(newInv);
inv.setQuantity(inv.getQuantity() - xpp.getNrs()); inv.setQuantity(inv.getQuantity() - xpp.getNrs());

View File

@ -149,7 +149,7 @@ public class InventoryServiceImpl implements InventoryService {
} }
@Override @Override
public List<Inventory> queryInventoryAllocate(long itemId, long areaId,Long zzkwId) { public List<Inventory> queryInventoryAllocate(long itemId, long areaId,Long zzkwId,String stockCode) {
String hql = " from Inventory inv where 1=1 " + String hql = " from Inventory inv where 1=1 " +
" and inv.itemKey.item.id=" + itemId + " " + " and inv.itemKey.item.id=" + itemId + " " +
" and inv.area.id=" + areaId + " " + " and inv.area.id=" + areaId + " " +
@ -160,6 +160,11 @@ public class InventoryServiceImpl implements InventoryService {
}else{ }else{
hql+="and inv.point.type='"+BaseStatus.CH+"' "; hql+="and inv.point.type='"+BaseStatus.CH+"' ";
} }
if(stockCode!=null){
hql+=" and inv.stockCode='"+stockCode+"'";
}else{
hql+=" and inv.stockCode is null";
}
hql+= " order by inv.itemKey.propC1 asc "; hql+= " order by inv.itemKey.propC1 asc ";
Query query = entityManager.createQuery(hql); Query query = entityManager.createQuery(hql);
List<Inventory> inventoryList = query.getResultList(); List<Inventory> inventoryList = query.getResultList();
@ -193,7 +198,7 @@ public class InventoryServiceImpl implements InventoryService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Inventory getInventory(ItemKey itemKey, Area area, Point point, Point zzkw, Dept dept, String type) { public Inventory getInventory(ItemKey itemKey, Area area, Point point, Point zzkw, Dept dept, String type,String stockCode) {
//生成Inventory //生成Inventory
String hql = " from Inventory inv where 1=1 "; String hql = " from Inventory inv where 1=1 ";
if(type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.ZZKW_TL)||type.equals(BizStatus.YK_JS)){ if(type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.ZZKW_TL)||type.equals(BizStatus.YK_JS)){
@ -230,6 +235,11 @@ public class InventoryServiceImpl implements InventoryService {
throw new BadRequestException(HttpStatus.NOT_FOUND, "线边仓制造库位必填"); throw new BadRequestException(HttpStatus.NOT_FOUND, "线边仓制造库位必填");
} }
} }
if(stockCode!=null){
hql += " and inv.stockCode='" + stockCode + "' ";
} else {
hql += " and inv.stockCode is null";
}
Query query = entityManager.createQuery(hql); Query query = entityManager.createQuery(hql);
List<Inventory> inventoryList = query.getResultList(); List<Inventory> inventoryList = query.getResultList();
@ -246,7 +256,8 @@ public class InventoryServiceImpl implements InventoryService {
if(zzkw==null){ if(zzkw==null){
zzkw=pointService.getPoint("ZZKW",null,null,null); zzkw=pointService.getPoint("ZZKW",null,null,null);
} }
inventory.setZzkw(zzkw); inventory.setStockCode(stockCode);
inventory.setZzkw(zzkw);
// inventory.setStock(stock); // inventory.setStock(stock);
// inventory.setStockCode(stock.getCode()); // inventory.setStockCode(stock.getCode());
inventory.setDept(dept); inventory.setDept(dept);
@ -326,7 +337,7 @@ public class InventoryServiceImpl implements InventoryService {
//原点位=之前记录的库位,目标库位=选择的库位 库区、品番、暂存库位、制造库位都取inv上的。 原数量取原纪录,目标数量取移出后的数量, 发生数量=输入的移位数量 //原点位=之前记录的库位,目标库位=选择的库位 库区、品番、暂存库位、制造库位都取inv上的。 原数量取原纪录,目标数量取移出后的数量, 发生数量=输入的移位数量
//操作类型=库存调整,增加/减少=根据实际数量判断,大于原数量为增加,小于原数量为减少,其他的类似上面数据 //操作类型=库存调整,增加/减少=根据实际数量判断,大于原数量为增加,小于原数量为减少,其他的类似上面数据
//移位时,加入目标库位之前没有这个记录,则自动生成 //移位时,加入目标库位之前没有这个记录,则自动生成
//库存唯一键areapointitemKeyzzkw //库存唯一键areapointitemKeyzzkw,stockCode
//位移所需要的数据 //位移所需要的数据
InventoryYW inventoryYW = inventoryButton.getInventoryYW(); InventoryYW inventoryYW = inventoryButton.getInventoryYW();
//原数据 //原数据
@ -337,7 +348,7 @@ public class InventoryServiceImpl implements InventoryService {
double rmNum = inventoryOld.getQuantity() - rmNumber; double rmNum = inventoryOld.getQuantity() - rmNumber;
if (rmNum > 0) {//移除数量小于库存数量 if (rmNum > 0) {//移除数量小于库存数量
//生成库存或生成记录 //生成库存或生成记录
Inventory inventory = this.getInventory(inventoryOld.getItemKey(), inventoryOld.getArea(), inventoryYW.getDstPoint(), inventoryOld.getZzkw(), inventoryOld.getDept(), BizStatus.MOVE); Inventory inventory = this.getInventory(inventoryOld.getItemKey(), inventoryOld.getArea(), inventoryYW.getDstPoint(), inventoryOld.getZzkw(), inventoryOld.getDept(), BizStatus.MOVE,null);
//生成移除的日志 //生成移除的日志
invLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.REDUCE, null, inventoryOld.getArea(), inventoryOld.getItemKey(), inventoryOld.getPoint(), inventoryYW.getDstPoint(), inventoryOld.getStock(), inventoryOld.getStock(), inventoryOld.getQuantity(), rmNumber, invLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.REDUCE, null, inventoryOld.getArea(), inventoryOld.getItemKey(), inventoryOld.getPoint(), inventoryYW.getDstPoint(), inventoryOld.getStock(), inventoryOld.getStock(), inventoryOld.getQuantity(), rmNumber,
null,null, BizStatus.MOVE, inventoryOld.getId(), inventoryOld.getId(), inventoryOld.getDescription()); null,null, BizStatus.MOVE, inventoryOld.getId(), inventoryOld.getId(), inventoryOld.getDescription());
@ -354,7 +365,7 @@ public class InventoryServiceImpl implements InventoryService {
throw new BadRequestException(HttpStatus.NOT_FOUND, "移除数量大于库存数量"); throw new BadRequestException(HttpStatus.NOT_FOUND, "移除数量大于库存数量");
} else {//移除数量等于库存数量 } else {//移除数量等于库存数量
//生成库存或生成记录 //生成库存或生成记录
Inventory inventory = this.getInventory(inventoryOld.getItemKey(), inventoryOld.getArea(), inventoryYW.getDstPoint(), inventoryOld.getZzkw(), inventoryOld.getDept(), BizStatus.MOVE); Inventory inventory = this.getInventory(inventoryOld.getItemKey(), inventoryOld.getArea(), inventoryYW.getDstPoint(), inventoryOld.getZzkw(), inventoryOld.getDept(), BizStatus.MOVE,null);
//生成移除的日志 //生成移除的日志
invLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.REDUCE, null, inventoryOld.getArea(), inventoryOld.getItemKey(), inventoryOld.getPoint(), inventoryYW.getDstPoint(), inventoryOld.getStock(), inventoryOld.getStock(), inventoryOld.getQuantity(), rmNumber, invLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.REDUCE, null, inventoryOld.getArea(), inventoryOld.getItemKey(), inventoryOld.getPoint(), inventoryYW.getDstPoint(), inventoryOld.getStock(), inventoryOld.getStock(), inventoryOld.getQuantity(), rmNumber,
null,null,BizStatus.MOVE, inventoryOld.getId(), inventoryOld.getId(), inventoryOld.getDescription()); null,null,BizStatus.MOVE, inventoryOld.getId(), inventoryOld.getId(), inventoryOld.getDescription());

View File

@ -121,7 +121,7 @@ public class ItemKeyServiceImpl implements ItemKeyService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ItemKey getItemKey(Item item, String propC1) { public ItemKey getItemKey(Item item, String propC1, String propC2) {
//生成itemKey //生成itemKey
String hql = " from ItemKey ik where 1=1 "; String hql = " from ItemKey ik where 1=1 ";
if (item != null) { if (item != null) {
@ -132,6 +132,11 @@ public class ItemKeyServiceImpl implements ItemKeyService {
}else{ }else{
hql += " and ik.propC1 is null"; hql += " and ik.propC1 is null";
} }
if (propC2 != null && propC2.length() > 0) {
hql += " and ik.propC2='" + propC2 + "' ";
}else{
hql += " and ik.propC2 is null";
}
// if (propD1 != null) { // if (propD1 != null) {
// hql += " and DATE(ik.propD1) ='" + propD1 +"'"; // hql += " and DATE(ik.propD1) ='" + propD1 +"'";
// }else{ // }else{
@ -148,6 +153,7 @@ public class ItemKeyServiceImpl implements ItemKeyService {
itemKey.setItem(item); itemKey.setItem(item);
itemKey.setDept(item.getDept()); itemKey.setDept(item.getDept());
itemKey.setPropC1(propC1); itemKey.setPropC1(propC1);
itemKey.setPropC2(propC2);
this.create(itemKey); this.create(itemKey);
} }
return itemKey; return itemKey;

View File

@ -192,7 +192,7 @@ public class PickDetailServiceImpl implements PickDetailService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public synchronized void allocate(long id, double quantity){ public synchronized void allocate(long id, double quantity,String stockCode){
PickDetailDto pickDetailDto = findById(id); PickDetailDto pickDetailDto = findById(id);
PickDetail pd = toEntity(pickDetailDto);//Dto转实体 PickDetail pd = toEntity(pickDetailDto);//Dto转实体
PickTicket pickTicket = pd.getPickTicket(); PickTicket pickTicket = pd.getPickTicket();
@ -203,17 +203,14 @@ public class PickDetailServiceImpl implements PickDetailService {
if(pd.getPoint()!=null&&pickTicket.getArea().getBexb()){ if(pd.getPoint()!=null&&pickTicket.getArea().getBexb()){
zzkwId=pd.getPoint().getId(); zzkwId=pd.getPoint().getId();
} }
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(), pickTicket.getArea().getId(),zzkwId); List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(), pickTicket.getArea().getId(),zzkwId,stockCode);
if (invs.size() > 0) { if (invs.size() > 0) {
double allocateQty = 0; double allocateQty = 0;
double unQty = quantity;//未分配数量 double unQty = quantity;//未分配数量
double srs=item.getExtendD3(); double srs=item.getExtendD3();
for (Inventory inv : invs) { for (Inventory inv : invs) {
Point startPoint = inv.getPoint();//原库位 Point startPoint = inv.getPoint();//原库位
String areaCode="S仓"; String areaCode=BaseStatus.DEFAULT_AREA;
if(startPoint.getArea().equals("A仓")){
areaCode="A仓";
}
Point endPoint = pointService.getPoint(null, null, BaseStatus.BHZC, areaCode);//目标库位 Point endPoint = pointService.getPoint(null, null, BaseStatus.BHZC, areaCode);//目标库位
if(endPoint==null){ if(endPoint==null){
throw new BadRequestException(HttpStatus.NOT_FOUND, "请维护备货暂存区"); throw new BadRequestException(HttpStatus.NOT_FOUND, "请维护备货暂存区");
@ -251,7 +248,7 @@ public class PickDetailServiceImpl implements PickDetailService {
//备货表上出单日期(审核写) //备货表上出单日期(审核写)
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime())); pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
pickTicketRepository.save(pickTicket); pickTicketRepository.save(pickTicket);
Task task = taskService.storeTask(null,pd,pickTicket.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty); Task task = taskService.storeTask(null,pd,pickTicket.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty,inv.getStockCode());
//修改占用数,写入日志 //修改占用数,写入日志
inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.ADD, pickTicket.getCode(), inv.getArea(), inv.getItemKey(), inv.getPoint(), inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.ADD, pickTicket.getCode(), inv.getArea(), inv.getItemKey(), inv.getPoint(),
inv.getPoint(), inv.getZzkw(), (inv.getQueuedQty()-allocateQty), allocateQty, null, BizStatus.PICK, inv.getPoint(), inv.getZzkw(), (inv.getQueuedQty()-allocateQty), allocateQty, null, BizStatus.PICK,
@ -280,7 +277,7 @@ public class PickDetailServiceImpl implements PickDetailService {
//根据Taskz找到对应的库存 //根据Taskz找到对应的库存
double quantity=task.getPlanQty(); double quantity=task.getPlanQty();
// Inventory inv = inventoryRepository.findById(task.getInvId()).get(); // Inventory inv = inventoryRepository.findById(task.getInvId()).get();
Inventory inv=inventoryService.getInventory(task.getItemKey(),pd.getPickTicket().getArea(),task.getSrcPoint(),task.getZzkw(),pd.getPickTicket().getDept(),BizStatus.CANCEL); Inventory inv=inventoryService.getInventory(task.getItemKey(),pd.getPickTicket().getArea(),task.getSrcPoint(),task.getZzkw(),pd.getPickTicket().getDept(),BizStatus.CANCEL,task.getDstStockCode());
//修改占用数,写入日志 //修改占用数,写入日志
inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.REDUCE, task.getBillCode(), inv.getArea(), inv.getItemKey(), inv.getPoint(), inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.REDUCE, task.getBillCode(), inv.getArea(), inv.getItemKey(), inv.getPoint(),
inv.getPoint(), inv.getZzkw(), inv.getQueuedQty(), quantity, null, BizStatus.PICK, inv.getPoint(), inv.getZzkw(), inv.getQueuedQty(), quantity, null, BizStatus.PICK,

View File

@ -192,7 +192,7 @@ public class PickInstructionServiceImpl implements PickInstructionService {
} }
} }
PickDetail pickDetailDto = pickDetailRepository.save(pickDetail); PickDetail pickDetailDto = pickDetailRepository.save(pickDetail);
pickDetailService.allocate(pickDetailDto.getId(), pickDetailDto.getOrderQty()); pickDetailService.allocate(pickDetailDto.getId(), pickDetailDto.getOrderQty(),null);
bcAllocatedQty = pickDetail.getAllocatedQty(); bcAllocatedQty = pickDetail.getAllocatedQty();
//回写 //回写
pickInstruction.setAllocatedQty(pickInstruction.getAllocatedQty()+bcAllocatedQty); pickInstruction.setAllocatedQty(pickInstruction.getAllocatedQty()+bcAllocatedQty);

View File

@ -181,19 +181,22 @@ public class PickTicketServiceImpl implements PickTicketService {
@Override @Override
public PickTicket storePick(BillType bt, Area shArea, Area outArea, String bpType, String jhCode) { public PickTicket storePick(BillType bt, Area shArea, Area outArea, String bpType, String jhCode) {
PickTicket p = new PickTicket(); PickTicket p = new PickTicket();
p.setCode(codeUtils.getCode_yyMMdd(bt.getPrefix()+'-', 3)); p.setCode(codeUtils.getCode_yyMMdd(bt.getPrefix(), 3));
p.setBillType(bt); p.setBillType(bt);
p.setShArea(shArea); p.setShArea(shArea);
p.setArea(outArea); p.setArea(outArea);
p.setDept(UserUtils.getDept()); p.setDept(UserUtils.getDept());
p.setOrderDate(new Timestamp(System.currentTimeMillis())); p.setOrderDate(new Timestamp(System.currentTimeMillis()));
p.setBpType(bpType); p.setBpType(bpType);
p.setDept(UserUtils.getDept());
p.setRelatedBill1(jhCode); p.setRelatedBill1(jhCode);
p.setCusCode(jhCode);
p.setStatus(BizStatus.OPEN); p.setStatus(BizStatus.OPEN);
pickTicketRepository.save(p); pickTicketRepository.save(p);
return p; return p;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void pickingOperation(PickTicketButton pickTicketButton) { public void pickingOperation(PickTicketButton pickTicketButton) {
@ -259,7 +262,7 @@ public class PickTicketServiceImpl implements PickTicketService {
inventory.setQueuedQty(inventory.getQueuedQty() - taskDto.getPlanQty()); inventory.setQueuedQty(inventory.getQueuedQty() - taskDto.getPlanQty());
//存储拣货确认的库存数据 //存储拣货确认的库存数据
Task task = taskMapper.toEntity(taskDto); Task task = taskMapper.toEntity(taskDto);
Inventory inventory1 = inventoryService.getInventory(inventory.getItemKey(), inventory.getArea(), task.getDstPoint(), task.getZzkw(), inventory.getDept(), BizStatus.RECEIVING_UP); Inventory inventory1 = inventoryService.getInventory(inventory.getItemKey(), inventory.getArea(), task.getDstPoint(), task.getZzkw(), inventory.getDept(), BizStatus.RECEIVING_UP,task.getDstStockCode());
invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, task.getBillCode(), inventory1.getArea(), inventory1.getItemKey(), inventory1.getPoint(), inventory1.getPoint(), inventory1.getStock(), inventory1.getStock(), inventory1.getQuantity(), kcNum, invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, task.getBillCode(), inventory1.getArea(), inventory1.getItemKey(), inventory1.getPoint(), inventory1.getPoint(), inventory1.getStock(), inventory1.getStock(), inventory1.getQuantity(), kcNum,
null, null, BizStatus.PICK_DOWN, inventory1.getId(), inventory1.getId(), inventory1.getDescription()); null, null, BizStatus.PICK_DOWN, inventory1.getId(), inventory1.getId(), inventory1.getDescription());
inventory1.setQuantity(inventory1.getQuantity() + kcNum); inventory1.setQuantity(inventory1.getQuantity() + kcNum);
@ -277,7 +280,7 @@ public class PickTicketServiceImpl implements PickTicketService {
taskLogService.createTaskLogData(taskDto, taskDto.getPlanQty()); taskLogService.createTaskLogData(taskDto, taskDto.getPlanQty());
//存储拣货确认的库存数据 //存储拣货确认的库存数据
Task task = taskMapper.toEntity(taskDto); Task task = taskMapper.toEntity(taskDto);
Inventory inventory1 = inventoryService.getInventory(inventory.getItemKey(), inventory.getArea(), task.getDstPoint(), task.getZzkw(), inventory.getDept(), BizStatus.RECEIVING_UP); Inventory inventory1 = inventoryService.getInventory(inventory.getItemKey(), inventory.getArea(), task.getDstPoint(), task.getZzkw(), inventory.getDept(), BizStatus.RECEIVING_UP,task.getDstStockCode());
invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, task.getBillCode(), inventory1.getArea(), inventory1.getItemKey(), inventory1.getPoint(), inventory1.getPoint(), inventory1.getStock(), inventory1.getStock(), inventory1.getQuantity(), kcNum, invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, task.getBillCode(), inventory1.getArea(), inventory1.getItemKey(), inventory1.getPoint(), inventory1.getPoint(), inventory1.getStock(), inventory1.getStock(), inventory1.getQuantity(), kcNum,
null, null, BizStatus.PICK_DOWN, inventory1.getId(), inventory1.getId(), inventory1.getDescription()); null, null, BizStatus.PICK_DOWN, inventory1.getId(), inventory1.getId(), inventory1.getDescription());
inventory1.setQuantity(inventory1.getQuantity() + kcNum); inventory1.setQuantity(inventory1.getQuantity() + kcNum);
@ -376,7 +379,7 @@ public class PickTicketServiceImpl implements PickTicketService {
inventory1.setQueuedQty(inventory1.getQueuedQty() - taskDto1.getPlanQty()); inventory1.setQueuedQty(inventory1.getQueuedQty() - taskDto1.getPlanQty());
//存储拣货确认的库存数据 //存储拣货确认的库存数据
Task task = taskMapper.toEntity(taskDto1); Task task = taskMapper.toEntity(taskDto1);
Inventory inventory11 = inventoryService.getInventory(inventory1.getItemKey(), inventory1.getArea(), task.getDstPoint(), task.getZzkw(), inventory1.getDept(), BizStatus.RECEIVING_UP); Inventory inventory11 = inventoryService.getInventory(inventory1.getItemKey(), inventory1.getArea(), task.getDstPoint(), task.getZzkw(), inventory1.getDept(), BizStatus.RECEIVING_UP,task.getDstStockCode());
invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, null, inventory11.getArea(), inventory11.getItemKey(), inventory11.getPoint(), inventory11.getPoint(), inventory11.getStock(), inventory11.getStock(), inventory11.getQuantity(), kcNum1, invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, null, inventory11.getArea(), inventory11.getItemKey(), inventory11.getPoint(), inventory11.getPoint(), inventory11.getStock(), inventory11.getStock(), inventory11.getQuantity(), kcNum1,
null, null, BizStatus.PICK_DOWN, inventory11.getId(), inventory11.getId(), inventory11.getDescription()); null, null, BizStatus.PICK_DOWN, inventory11.getId(), inventory11.getId(), inventory11.getDescription());
inventory11.setQuantity(inventory11.getQuantity() + kcNum1); inventory11.setQuantity(inventory11.getQuantity() + kcNum1);
@ -394,7 +397,7 @@ public class PickTicketServiceImpl implements PickTicketService {
taskLogService.createTaskLogData(taskDto1, taskDto1.getPlanQty()); taskLogService.createTaskLogData(taskDto1, taskDto1.getPlanQty());
//存储拣货确认的库存数据 //存储拣货确认的库存数据
Task task = taskMapper.toEntity(taskDto1); Task task = taskMapper.toEntity(taskDto1);
Inventory inventory11 = inventoryService.getInventory(inventory1.getItemKey(), inventory1.getArea(), task.getDstPoint(), task.getZzkw(), inventory1.getDept(), BizStatus.RECEIVING_UP); Inventory inventory11 = inventoryService.getInventory(inventory1.getItemKey(), inventory1.getArea(), task.getDstPoint(), task.getZzkw(), inventory1.getDept(), BizStatus.RECEIVING_UP,task.getDstStockCode());
invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, null, inventory11.getArea(), inventory11.getItemKey(), inventory11.getPoint(), inventory11.getPoint(), inventory11.getStock(), inventory11.getStock(), inventory11.getQuantity(), kcNum1, invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, null, inventory11.getArea(), inventory11.getItemKey(), inventory11.getPoint(), inventory11.getPoint(), inventory11.getStock(), inventory11.getStock(), inventory11.getQuantity(), kcNum1,
null, null, BizStatus.PICK_DOWN, inventory11.getId(), inventory11.getId(), inventory11.getDescription()); null, null, BizStatus.PICK_DOWN, inventory11.getId(), inventory11.getId(), inventory11.getDescription());
inventory11.setQuantity(inventory11.getQuantity() + kcNum1); inventory11.setQuantity(inventory11.getQuantity() + kcNum1);
@ -488,7 +491,7 @@ public class PickTicketServiceImpl implements PickTicketService {
PickTicket pt = pd.getPickTicket(); PickTicket pt = pd.getPickTicket();
Point zzkw=pd.getPoint(); Point zzkw=pd.getPoint();
//大部品的库存不能进去 //大部品的库存不能进去
Inventory srcInv = inventoryService.getInventory(task.getItemKey(),pt.getArea(),task.getSrcPoint(),zzkw,pt.getArea().getDept(),BizStatus.PICK_DOWN); Inventory srcInv = inventoryService.getInventory(task.getItemKey(),pt.getArea(),task.getSrcPoint(),zzkw,pt.getArea().getDept(),BizStatus.PICK_DOWN,task.getDstStockCode());
if (srcInv==null) { if (srcInv==null) {
throw new BadRequestException(HttpStatus.NOT_FOUND, task.getItem().getCode() + "未发现库存数据"); throw new BadRequestException(HttpStatus.NOT_FOUND, task.getItem().getCode() + "未发现库存数据");
} }
@ -539,12 +542,12 @@ public class PickTicketServiceImpl implements PickTicketService {
invLogService.update(invLog); invLogService.update(invLog);
//生成备货库存,备货库存也不需要线边 //生成备货库存,备货库存也不需要线边
Inventory dstInv = inventoryService.getInventory(srcInv.getItemKey(), srcInv.getArea(), task.getDstPoint(), zzkw, srcInv.getDept(), BizStatus.PICK_DOWN); /** Inventory dstInv = inventoryService.getInventory(srcInv.getItemKey(), srcInv.getArea(), task.getDstPoint(), zzkw, srcInv.getDept(), BizStatus.PICK_DOWN,task.getDstStockCode());
invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, pt.getCode(), dstInv.getArea(), dstInv.getItemKey(), dstInv.getPoint(), dstInv.getPoint(), invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, pt.getCode(), dstInv.getArea(), dstInv.getItemKey(), dstInv.getPoint(), dstInv.getPoint(),
zzkw, dstInv.getQuantity(), kcNum, barCode, BizStatus.PICK_DOWN, taskLog.getId(), zzkw, dstInv.getQuantity(), kcNum, barCode, BizStatus.PICK_DOWN, taskLog.getId(),
dstInv.getId(), pd.getRemark()); dstInv.getId(), pd.getRemark());
dstInv.setQuantity(dstInv.getQuantity() + kcNum); dstInv.setQuantity(dstInv.getQuantity() + kcNum);
inventoryService.update(dstInv); inventoryService.update(dstInv); **/
pd.setPickedQty(pd.getPickedQty() + pickQty); pd.setPickedQty(pd.getPickedQty() + pickQty);
pickDetailService.update(pd); pickDetailService.update(pd);
//拣货数量 //拣货数量
@ -731,7 +734,7 @@ public class PickTicketServiceImpl implements PickTicketService {
PickDetail pd = task.getPickDetail(); PickDetail pd = task.getPickDetail();
Point zzkw = pd.getPoint();//pointService.findByCode("ZZKW",null,null,null,null); Point zzkw = pd.getPoint();//pointService.findByCode("ZZKW",null,null,null,null);
//源库存增加,目标减少 //源库存增加,目标减少
Inventory srcInv = inventoryService.getInventory(taskLog.getItemKey(), area, taskLog.getSrcPoint(), zzkw, taskLog.getDept(), BizStatus.PICK_CANCEL); Inventory srcInv = inventoryService.getInventory(taskLog.getItemKey(), area, taskLog.getSrcPoint(), zzkw, taskLog.getDept(), BizStatus.PICK_CANCEL,task.getDstStockCode());
//添加物料 //添加物料
srcInv.setQuantity(srcInv.getQuantity() + cancelNum); srcInv.setQuantity(srcInv.getQuantity() + cancelNum);
//修改占用数,写入日志 //修改占用数,写入日志
@ -754,7 +757,7 @@ public class PickTicketServiceImpl implements PickTicketService {
pd.setPickedQty(pd.getPickedQty() - cancelNum); pd.setPickedQty(pd.getPickedQty() - cancelNum);
pickDetailService.update(pd); pickDetailService.update(pd);
//扣库存 //扣库存
Inventory dstInv = inventoryService.getInventory(taskLog.getItemKey(), area, taskLog.getDstPoint(), zzkw, taskLog.getDept(), BizStatus.PICK_CANCEL); Inventory dstInv = inventoryService.getInventory(taskLog.getItemKey(), area, taskLog.getDstPoint(), zzkw, taskLog.getDept(), BizStatus.PICK_CANCEL,null);
if (dstInv==null) { if (dstInv==null) {
throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "未发现库存数据"); throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "未发现库存数据");
} }
@ -791,7 +794,7 @@ public class PickTicketServiceImpl implements PickTicketService {
PickDetail pd = task.getPickDetail(); PickDetail pd = task.getPickDetail();
Point zzkw = pd.getPoint(); Point zzkw = pd.getPoint();
//源库存增加 //源库存增加
Inventory srcInv = inventoryService.getInventory(taskLog.getItemKey(), area, taskLog.getDstPoint(), zzkw, taskLog.getDept(), BizStatus.SHIP_CANCEL); Inventory srcInv = inventoryService.getInventory(taskLog.getItemKey(), area, taskLog.getDstPoint(), zzkw, taskLog.getDept(), BizStatus.SHIP_CANCEL,null);
srcInv.setQuantity(srcInv.getQuantity() + cancelNum); srcInv.setQuantity(srcInv.getQuantity() + cancelNum);
srcInv.setQueuedQty(srcInv.getQueuedQty() + cancelNum); srcInv.setQueuedQty(srcInv.getQueuedQty() + cancelNum);
inventoryService.update(srcInv); inventoryService.update(srcInv);

View File

@ -186,7 +186,7 @@ public class SparepartsServiceImpl implements SparepartsService {
if(point==null){ if(point==null){
throw new BadRequestException(ba.getRArea().getCode()+"库区无对应待投料库位"); throw new BadRequestException(ba.getRArea().getCode()+"库区无对应待投料库位");
} }
ItemKey itemKey=itemKeyService.getItemKey(ba.getItem(),null); ItemKey itemKey=itemKeyService.getItemKey(ba.getItem(),null,ba.getBonded());
Inventory inventory = new Inventory(); Inventory inventory = new Inventory();
inventory.setItemKey(itemKey); inventory.setItemKey(itemKey);
inventory.setPoint(point); inventory.setPoint(point);

View File

@ -60,11 +60,11 @@ import javax.servlet.http.HttpServletResponse;
@Slf4j @Slf4j
public class TaskServiceImpl implements TaskService { public class TaskServiceImpl implements TaskService {
private final InventoryLogService inventoryLogService;
private final TaskRepository taskRepository; private final TaskRepository taskRepository;
private final TaskMapper taskMapper; private final TaskMapper taskMapper;
private final InventoryRepository inventoryRepository; private final InventoryRepository inventoryRepository;
private final PickDetailRepository pickDetailRepository; private final PickDetailRepository pickDetailRepository;
private final InventoryLogService inventoryLogService;
private final EntityManager entityMapper; private final EntityManager entityMapper;
private final StockRepository stockRepository; private final StockRepository stockRepository;
@Override @Override
@ -159,7 +159,7 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Task storeTask(AsnDetail d, PickDetail p, Area area, ItemKey ik, Point srcPoint, Point dstPoint,double qty) { public Task storeTask(AsnDetail d, PickDetail p, Area area, ItemKey ik, Point srcPoint, Point dstPoint,double qty,String stockCode) {
Task t = new Task(); Task t = new Task();
t.setAsnDetail(d); t.setAsnDetail(d);
t.setPickDetail(p); t.setPickDetail(p);
@ -189,6 +189,7 @@ public class TaskServiceImpl implements TaskService {
t.setDstPoint(dstPoint); t.setDstPoint(dstPoint);
t.setDstPointCode(dstPoint.getCode()); t.setDstPointCode(dstPoint.getCode());
} }
t.setDstStockCode(stockCode);
this.create(t); this.create(t);
return t; return t;
} }

View File

@ -71,15 +71,16 @@ public class XppRecordServiceImpl implements XppRecordService {
private final XppRecordMapper xppRecordMapper; private final XppRecordMapper xppRecordMapper;
private final ItemRepository itemRepository; private final ItemRepository itemRepository;
private final AsnDetailRepository asnDetailRepository; private final AsnDetailRepository asnDetailRepository;
private final PointRepository pointRepository;
private final RedisUtils redisUtils;
private final InventoryLogService inventoryLogService;
private final EntityManager entityManager;
private final BomAccountRepository bomAccountRepository;
private final AreaRepository areaRepository; private final AreaRepository areaRepository;
private final JobRepository jobRepository; private final JobRepository jobRepository;
private final InventoryLogService inventoryLogService;
private final InventoryService inventoryService; private final InventoryService inventoryService;
private final EntityManager entityManager;
private final RedisUtils redisUtils;
@Override @Override
public Map<String, Object> queryAll(XppRecordQueryCriteria criteria, Pageable pageable) { public Map<String, Object> queryAll(XppRecordQueryCriteria criteria, Pageable pageable) {
int pageNum=pageable.getPageNumber();//当前页 int pageNum=pageable.getPageNumber();//当前页
@ -508,7 +509,7 @@ public class XppRecordServiceImpl implements XppRecordService {
} }
this.update(xppRecord); this.update(xppRecord);
String itemCode=xppRecord.getItem().getCode(); String itemCode=xppRecord.getItem().getCode();
Inventory inventory=inventoryService.getInventory(ik,area,srcPoint,zzkw,area.getDept(),type); Inventory inventory=inventoryService.getInventory(ik,area,srcPoint,zzkw,area.getDept(),type,null);
if(inventory==null){ if(inventory==null){
throw new BadRequestException(itemCode+"该库位无该批次库存"); throw new BadRequestException(itemCode+"该库位无该批次库存");
} }

View File

@ -61,7 +61,7 @@ public interface BaseStatus {
/** /**
* *
*/ */
public static String DEFAULT_AREA = "久荣协同S仓库"; public static String DEFAULT_AREA = "CGK";
public static String AREA_S = "S仓"; public static String AREA_S = "S仓";
@ -86,10 +86,30 @@ public interface BaseStatus {
* - * -
*/ */
public static String BT_DD = "单点"; public static String BT_DD = "单点";
/**
* -
*/
public static String XDRK = "箱单入库";
/**
* -
*/
public static String XDBH = "箱单备货";
/** /**
* - * -
*/ */
public static String RK = "正常入库"; public static String XBRK = "线边入库";
/**
* -
*/
public static String KS = "课税";
/**
* -
*/
public static String BS = "保税";
} }

View File

@ -4,7 +4,7 @@ spring:
druid: druid:
db-type: com.alibaba.druid.pool.DruidDataSource db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:53306}/${DB_NAME:kams4_prod}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:53306}/${DB_NAME:wxjbt}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: ${DB_USER:root} username: ${DB_USER:root}
password: ${DB_PWD:Youchain@56} password: ${DB_PWD:Youchain@56}
# 初始连接数 # 初始连接数

View File

@ -7,8 +7,8 @@ spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
#active: prod active: prod
active: dev #active: dev
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data: