功能完善
parent
4f992bf739
commit
f2f614aa29
|
|
@ -43,7 +43,7 @@ public class Point extends BaseEntity implements Serializable {
|
|||
private Long id;
|
||||
|
||||
@Column(name = "`code`")
|
||||
@ApiModelProperty(value = "RCS代码")
|
||||
@ApiModelProperty(value = "库位号")
|
||||
private String code;
|
||||
|
||||
@Column(name = "`name`")
|
||||
|
|
@ -96,7 +96,7 @@ public class Point extends BaseEntity implements Serializable {
|
|||
private Double posZ=0d;
|
||||
|
||||
@Column(name = "`type`")
|
||||
@ApiModelProperty(value = "类型")
|
||||
@ApiModelProperty(value = "存储类型")
|
||||
private String type;
|
||||
|
||||
@Column(name = "`heat`")
|
||||
|
|
@ -122,6 +122,15 @@ public class Point extends BaseEntity implements Serializable {
|
|||
@Column(name = "`inv_min`")
|
||||
@ApiModelProperty(value = "库存下限")
|
||||
private int invMin=0;
|
||||
@Column(name = "`bqlx`")
|
||||
@ApiModelProperty(value = "标签类型")
|
||||
private String bqlx;
|
||||
@Column(name = "`zflx`")
|
||||
@ApiModelProperty(value = "总分类型")
|
||||
private String zflx;
|
||||
@Column(name = "`glzkw`")
|
||||
@ApiModelProperty(value = "关联总库位")
|
||||
private String glzkw;
|
||||
public void copy(Point source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,8 @@ public interface BomAccountRepository extends JpaRepository<BomAccount, Long>, J
|
|||
" and (bi.code=:bigItemCode or :bigItemCode is null) and (ba.supplier=:supplier or :supplier is null)" +
|
||||
" and (ba.tckw=:tckw or :tckw is null) and ba.bp_type=:dxw" +
|
||||
" order by point.code, ba.ns,it.code,ba.bonded,bi.master_name ", nativeQuery = true)
|
||||
List<BomPrint> queryPrintAll(String bigItemCode,String itemCode, String hw, String ns,String kq,String bp_type,String tckw,
|
||||
List<BomPrint> queryPrintAll(String bigItemCode,String itemCode, String hw,
|
||||
String ns,String kq,String bp_type,String tckw,
|
||||
String supplier,String dxw);
|
||||
|
||||
|
||||
|
|
@ -114,13 +115,18 @@ public interface BomAccountRepository extends JpaRepository<BomAccount, Long>, J
|
|||
"left join base_point point on point.id=ba.z_point_id" +
|
||||
" left join base_area area on area.id=ba.r_area_id " +
|
||||
" LEFT JOIN bom_print_view v on v.item_id=ba.item_id and v.bonded=ba.bonded and v.z_point_id=ba.z_point_id and v.ns=ba.ns " +
|
||||
" where (ba.bp_type=:bp_type or :bp_type is null) and (it.code=:itemCode or :itemCode is null) and (point.code like CONCAT(:hw, '%') or :hw is null) " +
|
||||
" where (ba.bp_type=:bp_type or :bp_type is null) " +
|
||||
" and (it.code=:itemCode or :itemCode is null) " +
|
||||
" and (point.code like CONCAT(:hw, '%') or :hw is null) " +
|
||||
" and (area.code=:kq or :kq is null) and (ba.ns=:ns or :ns is null)" +
|
||||
" and (v.jxs LIKE CONCAT('%',:bigItemCode,'%') or :bigItemCode is null) and (ba.supplier=:supplier or :supplier is null)" +
|
||||
" and (v.jxs LIKE CONCAT('%',:bigItemCode,'%') or :bigItemCode is null) " +
|
||||
" and (ba.supplier=:supplier or :supplier is null)" +
|
||||
" and (ba.tckw=:tckw or :tckw is null)" +
|
||||
" and (point.code in :hws1 or :hws2 is null) " +
|
||||
" order by point.code, ba.ns,it.code,ba.bonded,bi.master_name ", nativeQuery = true)
|
||||
List<BomPrint> queryPrintAll(String bigItemCode,String itemCode, String hw, String ns,String kq,String bp_type,String tckw,
|
||||
String supplier);
|
||||
List<BomPrint> queryPrintAll(String bigItemCode,String itemCode, String hw,
|
||||
String ns,String kq,String bp_type,String tckw,
|
||||
String supplier,List<String> hws1,String hws2);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ public class BomAccountController {
|
|||
List<String> sortList=new ArrayList<>();
|
||||
for(BomPrint_BiaoQian2 l:list){
|
||||
String key=l.getCode()+"]"+l.getNs()+"]"+l.getBonded()+"]"+l.getHw();
|
||||
log.info(l.getHw());
|
||||
if(map.containsKey(key)){
|
||||
List<BomPrint_BiaoQian2> list2=map.get(key);
|
||||
list2.add(l);
|
||||
|
|
@ -285,9 +284,9 @@ public class BomAccountController {
|
|||
bq.setJxs(jxs);
|
||||
bq.setTyls(tyls);
|
||||
list2.add(bq);
|
||||
if(l.getDxw().equals("中大物标签")){
|
||||
if(l.getDxw()!=null&&l.getDxw().equals("中大物标签")){
|
||||
listd.add(bq);
|
||||
}else if(l.getDxw().equals("小物标签")){
|
||||
}else if(l.getDxw()!=null&&l.getDxw().equals("小物标签")){
|
||||
listx.add(bq);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import cn.hutool.poi.excel.ExcelUtil;
|
|||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.service.*;
|
||||
import com.youchain.basicdata.service.impl.ImportPickDetailServiceImpl;
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import com.youchain.businessdata.domain.PickDetail;
|
||||
import com.youchain.businessdata.domain.PickTicket;
|
||||
|
|
@ -72,6 +73,8 @@ public class ImportDataController {
|
|||
private final ImportPointService importPointService;
|
||||
private final ImportItemService importItemService;
|
||||
private final ImportProductionPlanService importProductionPlanService;
|
||||
private final ImportAsnDetailService importAsnDetailService;
|
||||
private final ImportPickDetailService importPickDetailService;
|
||||
|
||||
@Log("导入完成品品番")
|
||||
@ApiOperation("导入完成品品番")
|
||||
|
|
@ -114,22 +117,11 @@ public class ImportDataController {
|
|||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importAsnDetail(@RequestParam Long asnId, @RequestParam("file") MultipartFile multipartFile) {
|
||||
List<Map<String, Object>> readAll = getMaps(multipartFile);
|
||||
List<String> cList = new ArrayList<>();
|
||||
Asn asn = asnService.getEntity(asnId);
|
||||
if (asn == null) {
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据不存在");
|
||||
}
|
||||
if (!asn.getStatus().equals(BizStatus.OPEN)) {
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据状态不正确");
|
||||
}
|
||||
for (int i = 0; i < readAll.size(); i++) {
|
||||
String re = importDataService.importAsnDetail(readAll.get(i), asn);
|
||||
if (re != null && !re.equals("")) {
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, (i + 1) + "行" + re);
|
||||
}
|
||||
}
|
||||
return new ResponseEntity("导入成功", OK);
|
||||
log.info("开始导入");
|
||||
long start = System.currentTimeMillis();
|
||||
importAsnDetailService.importData(asnId,multipartFile);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), OK);
|
||||
}
|
||||
|
||||
@Log("导入其他出库")
|
||||
|
|
@ -138,26 +130,11 @@ public class ImportDataController {
|
|||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importPickDetail(@RequestParam Long ptId, @RequestParam("file") MultipartFile multipartFile) {
|
||||
List<Map<String, Object>> readAll = getMaps(multipartFile);
|
||||
List<String> cList = new ArrayList<>();
|
||||
PickTicket pt = pickTicketService.getEntity(ptId);
|
||||
if (pt == null) {
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据不存在");
|
||||
}
|
||||
if (!pt.getStatus().equals(BizStatus.OPEN) && !pt.getStatus().equals(BizStatus.ALLOCATE)) {
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据状态不正确");
|
||||
}
|
||||
for (int i = 0; i < readAll.size(); i++) {
|
||||
String re = importDataService.importPickDetail(readAll.get(i), pt);
|
||||
if (re != null && !re.equals("")) {
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, (i + 1) + "行" + re);
|
||||
}
|
||||
}
|
||||
List<PickDetail> ds = pickDetailService.queryPickDetailList(pt.getId());
|
||||
// for(PickDetail d:ds) {
|
||||
// pickDetailService.allocate(d.getId(),d.getOrderQty());
|
||||
// }
|
||||
return new ResponseEntity("导入成功", OK);
|
||||
log.info("开始导入出库明细");
|
||||
long start = System.currentTimeMillis();
|
||||
importPickDetailService.importData(ptId,multipartFile);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), OK);
|
||||
}
|
||||
|
||||
@Log("导入手工指示")
|
||||
|
|
@ -184,10 +161,10 @@ public class ImportDataController {
|
|||
|
||||
@Log("导入BOM工位清单")
|
||||
@ApiOperation("导入BOM工位清单")
|
||||
@PostMapping(value = "/bomAccount")
|
||||
@PostMapping(value = "/importBomAccountOld")
|
||||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importBomAccount(@RequestParam("file") MultipartFile multipartFile) {
|
||||
public ResponseEntity<Object> importBomAccountOld(@RequestParam("file") MultipartFile multipartFile) {
|
||||
List<Map<String, Object>> readAll = getMaps(multipartFile);
|
||||
for (int i = 0; i < readAll.size(); i++) {
|
||||
importDataService.importBomAccount(i, readAll.get(i));
|
||||
|
|
@ -220,7 +197,7 @@ public class ImportDataController {
|
|||
@ApiOperation("导入asn")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importAsn(@RequestParam("file") MultipartFile file, @RequestParam("templateType") String templateType) {
|
||||
log.info("开始导入");
|
||||
log.info("开始导入发票箱单");
|
||||
long start = System.currentTimeMillis();
|
||||
importAsnService.importAsn(file, templateType);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
|
|
@ -229,11 +206,24 @@ public class ImportDataController {
|
|||
|
||||
@Log("导入BOM多列")
|
||||
@ApiOperation("导入BOM多列")
|
||||
@PostMapping(value = "/bomAccountBatch")
|
||||
@PostMapping(value = "/importBomAccountBatch")
|
||||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> bomAccountBatch(@RequestParam("file") MultipartFile multipartFile) {
|
||||
log.info("开始导入");
|
||||
public ResponseEntity<Object> importBomAccountBatch(@RequestParam("file") MultipartFile multipartFile) {
|
||||
log.info("开始导入Bom工位清单批量");
|
||||
long start = System.currentTimeMillis();
|
||||
importBomAccountService.importBomAccountBatch(multipartFile);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), OK);
|
||||
}
|
||||
|
||||
@Log("导入BOM")
|
||||
@ApiOperation("导入BOM")
|
||||
@PostMapping(value = "/importBomAccount")
|
||||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importBomAccount(@RequestParam("file") MultipartFile multipartFile) {
|
||||
log.info("开始导入Bom工位清单");
|
||||
long start = System.currentTimeMillis();
|
||||
importBomAccountService.importBomAccount(multipartFile);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
|
|
@ -247,7 +237,7 @@ public class ImportDataController {
|
|||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importProductionPlan(@RequestParam("file") MultipartFile multipartFile) {
|
||||
log.info("开始导入");
|
||||
log.info("开始导入生产顺序计划");
|
||||
long start = System.currentTimeMillis();
|
||||
importProductionPlanService.importData(multipartFile);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
|
|
@ -260,7 +250,7 @@ public class ImportDataController {
|
|||
@Transactional
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importPoint(@RequestParam("file") MultipartFile multipartFile) {
|
||||
log.info("开始导入");
|
||||
log.info("开始导入点位");
|
||||
long start = System.currentTimeMillis();
|
||||
importPointService.importPoint(multipartFile);
|
||||
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package com.youchain.basicdata.rest;
|
|||
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.youchain.DuplicateSubmission.DuplicateSubmission;
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.domain.BigItem;
|
||||
|
|
@ -36,10 +37,7 @@ import com.youchain.exception.BadRequestException;
|
|||
import com.youchain.exception.handler.ApiError;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.DateUtil;
|
||||
import com.youchain.utils.FileUtil;
|
||||
import com.youchain.utils.OptionalUtils;
|
||||
import com.youchain.utils.UserUtils;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -184,13 +182,27 @@ public class ProductionPlanController {
|
|||
@Log("批量耗用")
|
||||
@Transactional
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
@DuplicateSubmission(5)
|
||||
public ResponseEntity<Object> piLiangHaoYong( @RequestBody ProductionPlanVo productionPlanVo){
|
||||
List<ProductionPlan> productionPlans = productionPlanService.piLiangHaoYong(productionPlanVo);
|
||||
if(productionPlans == null || productionPlans.size() < productionPlanVo.getNumber()){
|
||||
return new ResponseEntity(ApiResult.fail(400,"库存不够,无法批量耗用",""), HttpStatus.BAD_REQUEST);
|
||||
throw new BadRequestException("未耗用机型不足台数,无法批量耗用");
|
||||
}
|
||||
//如果第一条不是选择记录,则错误
|
||||
boolean temp=false;
|
||||
for(ProductionPlan p:productionPlans){
|
||||
if(p.getId().equals(productionPlanVo.getId())){
|
||||
temp=true;
|
||||
}
|
||||
if(p.getStatue().equals(BizStatus.CONSUME)){
|
||||
throw new BadRequestException("不能重复耗用");
|
||||
}
|
||||
}
|
||||
if(!temp){
|
||||
throw new BadRequestException("不能重复耗用");
|
||||
}
|
||||
productionPlanService.scsxHaoyong(productionPlans,productionPlanVo.getAreaId(),"生产顺序计划耗用");
|
||||
return new ResponseEntity<>(ApiResult.success("耗用成功!",""), HttpStatus.OK);
|
||||
return new ResponseEntity<>("耗用成功!",HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package com.youchain.basicdata.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface ImportAsnDetailService {
|
||||
/**
|
||||
* 批量导入
|
||||
* @param file 文件
|
||||
*/
|
||||
void importData(Long asnId,MultipartFile file);
|
||||
}
|
||||
|
|
@ -7,5 +7,7 @@ public interface ImportBomAccountService {
|
|||
* 批量导入
|
||||
* @param file 文件
|
||||
*/
|
||||
void importBomAccountBatch(MultipartFile file);
|
||||
|
||||
void importBomAccount(MultipartFile file);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package com.youchain.basicdata.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface ImportPickDetailService {
|
||||
/**
|
||||
* 批量导入
|
||||
* @param file 文件
|
||||
*/
|
||||
void importData(Long asnId,MultipartFile file);
|
||||
}
|
||||
|
|
@ -67,4 +67,7 @@ public class BomAccountQueryCriteria{
|
|||
@Query
|
||||
private String supplier;
|
||||
|
||||
@Query(joinName = "zPoint",propName = "code",type = Query.Type.IN)
|
||||
private List<String> zPointCodes;
|
||||
|
||||
}
|
||||
|
|
@ -50,6 +50,15 @@ public class PointDto implements Serializable {
|
|||
/** 物料编码 */
|
||||
private String itemCode;
|
||||
|
||||
/** 标签类型 */
|
||||
private String bqlx;
|
||||
|
||||
/** 总分类型 */
|
||||
private String zflx;
|
||||
|
||||
/** 关联总库位 */
|
||||
private String glzkw;
|
||||
|
||||
/** 库区ID */
|
||||
private AreaSmallDto area;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,11 +42,19 @@ public class PointQueryCriteria {
|
|||
@Query(type = Query.Type.EQUAL)
|
||||
private String status;
|
||||
|
||||
/** 物料编码 */
|
||||
/** 品番 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private String itemCode;
|
||||
|
||||
/** 类型 */
|
||||
/** 标签类型 */
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String bqlx;
|
||||
|
||||
/** 纳所 */
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String beatCode;
|
||||
|
||||
/** 存储类型 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private String type;
|
||||
|
||||
|
|
@ -61,6 +69,9 @@ public class PointQueryCriteria {
|
|||
@Query(joinName = "area", propName="name",type = Query.Type.EQUAL)
|
||||
private String areaName;
|
||||
|
||||
@Query(joinName = "area", propName="code",type = Query.Type.EQUAL)
|
||||
private String areaCode;
|
||||
|
||||
/** 状态:1启用、0禁用 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private Boolean enabled;
|
||||
|
|
|
|||
|
|
@ -95,8 +95,17 @@ public class BomAccountServiceImpl implements BomAccountService {
|
|||
}
|
||||
|
||||
public List<BomPrint> queryPrintAll(BomAccountQueryCriteria criteria){
|
||||
String hws2=null;
|
||||
List<String> hws1= criteria.getZPointCodes();
|
||||
if(hws1!=null&&hws1.size()>0){
|
||||
hws2=criteria.getZPointCodes().get(0);
|
||||
}else{
|
||||
hws1=new ArrayList<>();
|
||||
hws1.add("XXX");
|
||||
}
|
||||
List<BomPrint> bomPrints=bomAccountRepository.queryPrintAll(criteria.getBigItemCode(),criteria.getItemCode(),criteria.getZPointCode(),
|
||||
criteria.getNs(),criteria.getRAreaCode(),criteria.getBp_type(),criteria.getTckw(),criteria.getSupplier());
|
||||
criteria.getNs(),criteria.getRAreaCode(),criteria.getBp_type(),criteria.getTckw(),
|
||||
criteria.getSupplier(),hws1,hws2);
|
||||
return bomPrints;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,162 @@
|
|||
package com.youchain.basicdata.service.impl;
|
||||
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.service.ImportAsnDetailService;
|
||||
import com.youchain.basicdata.service.ImportItemService;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.inputJson.imports.AsnDetailImport;
|
||||
import com.youchain.businessdata.inputJson.imports.ItemImport;
|
||||
import com.youchain.businessdata.inputJson.imports.PointImport;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
import com.youchain.businessdata.repository.AsnRepository;
|
||||
import com.youchain.businessdata.service.AsnDetailService;
|
||||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ImportAsnDetailServiceImpl implements ImportAsnDetailService {
|
||||
|
||||
private final ItemRepository itemRepository;
|
||||
|
||||
private final AsnRepository asnRepository;
|
||||
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
|
||||
private final ItemService itemService;
|
||||
|
||||
private final PointService pointService;
|
||||
|
||||
private final AsnService asnService;
|
||||
|
||||
private final AsnDetailService asnDetailService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importData(Long asnId,MultipartFile file) {
|
||||
|
||||
// 验证模板类型是否正确
|
||||
isValidTemplateType(file);
|
||||
|
||||
// 根据模板类型进行不同的处理
|
||||
baseImportTemplate(asnId,file);
|
||||
}
|
||||
|
||||
// 处理标准模板
|
||||
@Transactional
|
||||
public void baseImportTemplate(Long asnId,MultipartFile file) {
|
||||
// 读取sheet数据
|
||||
List<AsnDetailImport> dataList = FastExcelUtil.readExcelData(file, AsnDetailImport.class, 0, 1);
|
||||
|
||||
//批量导入
|
||||
importItemData(asnId,dataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理批量导入
|
||||
*/
|
||||
private void importItemData(Long asnId,List<AsnDetailImport> dataList) {
|
||||
// TODO: 实现批量导入逻辑
|
||||
log.info("处理批量导入,数据条数: {}", dataList.size());
|
||||
|
||||
Asn asn=asnRepository.getById(asnId);
|
||||
if(asn==null||!asn.getStatus().equals(BizStatus.OPEN)){
|
||||
throw new BadRequestException("入库单据状态不正确");
|
||||
}
|
||||
//获取文件中所有的品番编码
|
||||
List<String> itemcodes = dataList.stream().map(AsnDetailImport::getItemCode).collect(Collectors.toList());
|
||||
itemcodes = itemcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
Map<String, Item> exitItemMap = validateItem(itemcodes);
|
||||
|
||||
//获取文件中所有的库位编码
|
||||
List<String> pointcodes = dataList.stream().map(AsnDetailImport::getPointCode).collect(Collectors.toList());
|
||||
pointcodes = pointcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
Map<String, Point> exitPointMap = validatePoint(pointcodes);
|
||||
Dept dept=UserUtils.getDept();
|
||||
Double asnQty=asn.getOrderQuantity();
|
||||
for (AsnDetailImport data : dataList) {
|
||||
Item item = exitItemMap.get(data.getItemCode());
|
||||
Point point=exitPointMap.get(data.getPointCode());
|
||||
AsnDetail asnDetail=new AsnDetail();
|
||||
asnDetail.setAsn(asn);
|
||||
asnDetail.setItem(item);
|
||||
asnDetail.setPoint(point);
|
||||
asnDetail.setOrderQty(data.getQty()+0d);
|
||||
asnDetail.setPropC2(data.getBonded());
|
||||
asnDetail.setStatus(BizStatus.OPEN);
|
||||
asnDetail.setRemark(data.getRemark());
|
||||
asnDetail.setDept(dept);
|
||||
asnDetailRepository.save(asnDetail);
|
||||
asnQty+=asnDetail.getOrderQty();
|
||||
}
|
||||
asn.setOrderQuantity(asnQty);
|
||||
asnRepository.save(asn);
|
||||
}
|
||||
|
||||
//验证库位
|
||||
private Map<String, Item> validateItem(List<String> codes) {
|
||||
Map<String, Item> existMap = itemService.queryByItemCodesToMap(codes);
|
||||
if (existMap.isEmpty()) {
|
||||
throw new BadRequestException("品番代码不存在或已失效");
|
||||
}
|
||||
List<String> existCodes = new ArrayList(existMap.keySet());
|
||||
// 获取两个集合的非交集说明品番不存在或失效,直接提示
|
||||
List<String> difference = SmartStringUtil.getDifference(codes, existCodes);
|
||||
if (CollectionUtils.isNotEmpty(difference)) {
|
||||
throw new BadRequestException(difference + "品番不存在或已失效");
|
||||
}
|
||||
return existMap;
|
||||
}
|
||||
|
||||
//验证库位
|
||||
private Map<String, Point> validatePoint(List<String> codes) {
|
||||
Map<String, Point> existMap = pointService.queryByPointCodesToMap(codes);
|
||||
if (existMap.isEmpty()) {
|
||||
throw new BadRequestException("库位代码不存在或已失效");
|
||||
}
|
||||
List<String> existCodes = new ArrayList(existMap.keySet());
|
||||
// 获取两个集合的非交集说明品番不存在或失效,直接提示
|
||||
List<String> difference = SmartStringUtil.getDifference(codes, existCodes);
|
||||
if (CollectionUtils.isNotEmpty(difference)) {
|
||||
throw new BadRequestException(difference + "库位不存在或已失效");
|
||||
}
|
||||
return existMap;
|
||||
}
|
||||
|
||||
|
||||
//验证模板是否使用正确
|
||||
private void isValidTemplateType(MultipartFile file) {
|
||||
// 根据模板类型进行不同的处理
|
||||
List<String> requiredColumns = Arrays.asList(
|
||||
"品番",
|
||||
"税别",
|
||||
"制造库位",
|
||||
"数量",
|
||||
"备注"
|
||||
);
|
||||
List<String> headers = FastExcelUtil.readHeadContent(file, 0, 0);
|
||||
if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {
|
||||
throw new BadRequestException("标准导入模板不正确,请确认模板信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import com.youchain.basicdata.domain.*;
|
|||
import com.youchain.basicdata.repository.*;
|
||||
import com.youchain.basicdata.service.*;
|
||||
import com.youchain.businessdata.inputJson.imports.BomAccountImport;
|
||||
import com.youchain.businessdata.inputJson.imports.ItemImport;
|
||||
import com.youchain.domain.Log;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.utils.*;
|
||||
|
|
@ -33,7 +34,7 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importBomAccount(MultipartFile file) {
|
||||
public void importBomAccountBatch(MultipartFile file) {
|
||||
|
||||
// 验证模板类型是否正确
|
||||
isValidTemplateType(file);
|
||||
|
|
@ -41,6 +42,46 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
|
|||
baseImportTemplate(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importBomAccount(MultipartFile file) {
|
||||
|
||||
// 验证模板类型是否正确
|
||||
isValidTemplateType(file);
|
||||
|
||||
baseImportTemplate2(file);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void baseImportTemplate2(MultipartFile file) {
|
||||
// 读取sheet数据
|
||||
List<BomAccountImport> dataListBi = FastExcelUtil.readExcelData(file, BomAccountImport.class, 0, 1);
|
||||
List<BomEntity> dataList=new ArrayList<>();
|
||||
for(BomAccountImport bi:dataListBi){
|
||||
BomEntity be=new BomEntity();
|
||||
be.setPf(bi.getPf());
|
||||
be.setNs(bi.getNs());
|
||||
be.setPm(bi.getPm());
|
||||
be.setGys(bi.getGys());
|
||||
be.setAc(bi.getAc());
|
||||
be.setJgnr(bi.getJgnr());
|
||||
be.setZcfq(bi.getZcfq());
|
||||
be.setHw(bi.getHw());
|
||||
be.setXz(bi.getXz());
|
||||
be.setSrs(Integer.parseInt(bi.getSrs()));
|
||||
be.setTckw(bi.getTckw());
|
||||
be.setDxw(bi.getDxw());
|
||||
be.setSb(bi.getSb());
|
||||
be.setJx(bi.getJx());
|
||||
be.setJxdm(bi.getJxdm());
|
||||
be.setTyl(bi.getTyl());
|
||||
be.setKyh(bi.getKyh());
|
||||
dataList.add(be);
|
||||
}
|
||||
//批量导入
|
||||
importBomAccountData(dataList);
|
||||
}
|
||||
|
||||
// 处理标准模板
|
||||
@Transactional
|
||||
public void baseImportTemplate(MultipartFile file) {
|
||||
|
|
@ -323,8 +364,9 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
|
|||
"台用量"
|
||||
);
|
||||
List<String> headers = FastExcelUtil.readHeadContent(file, 0, 0);
|
||||
List<String> difference = SmartStringUtil.getDifference(requiredColumns, headers);
|
||||
if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {
|
||||
throw new BadRequestException("标准导入模板不正确,请确认模板信息");
|
||||
throw new BadRequestException(difference+"标准导入模板不正确,请确认模板信息");
|
||||
}
|
||||
}
|
||||
@Data
|
||||
|
|
|
|||
|
|
@ -0,0 +1,176 @@
|
|||
package com.youchain.basicdata.service.impl;
|
||||
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.service.ImportAsnDetailService;
|
||||
import com.youchain.basicdata.service.ImportPickDetailService;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.domain.PickDetail;
|
||||
import com.youchain.businessdata.domain.PickTicket;
|
||||
import com.youchain.businessdata.inputJson.imports.AsnDetailImport;
|
||||
import com.youchain.businessdata.inputJson.imports.PickDetailImport;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
import com.youchain.businessdata.repository.AsnRepository;
|
||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||
import com.youchain.businessdata.repository.PickTicketRepository;
|
||||
import com.youchain.businessdata.service.AsnDetailService;
|
||||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.businessdata.service.PickDetailService;
|
||||
import com.youchain.businessdata.service.PickTicketService;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import com.youchain.utils.FastExcelUtil;
|
||||
import com.youchain.utils.SmartStringUtil;
|
||||
import com.youchain.utils.UserUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ImportPickDetailServiceImpl implements ImportPickDetailService {
|
||||
|
||||
private final ItemRepository itemRepository;
|
||||
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
|
||||
private final PickTicketRepository pickTicketRepository;
|
||||
|
||||
private final ItemService itemService;
|
||||
|
||||
private final PointService pointService;
|
||||
|
||||
private final PickDetailService pickDetailService;
|
||||
|
||||
private final PickTicketService pickTicketService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importData(Long asnId,MultipartFile file) {
|
||||
|
||||
// 验证模板类型是否正确
|
||||
isValidTemplateType(file);
|
||||
|
||||
// 根据模板类型进行不同的处理
|
||||
baseImportTemplate(asnId,file);
|
||||
}
|
||||
|
||||
// 处理标准模板
|
||||
@Transactional
|
||||
public void baseImportTemplate(Long pickTicketId,MultipartFile file) {
|
||||
// 读取sheet数据
|
||||
List<PickDetailImport> dataList = FastExcelUtil.readExcelData(file, PickDetailImport.class, 0, 1);
|
||||
|
||||
//批量导入
|
||||
importData(pickTicketId,dataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理批量导入
|
||||
*/
|
||||
private void importData(Long pickTicketId,List<PickDetailImport> dataList) {
|
||||
// TODO: 实现批量导入逻辑
|
||||
log.info("处理批量导入,数据条数: {}", dataList.size());
|
||||
|
||||
PickTicket pickTicket=pickTicketRepository.getById(pickTicketId);
|
||||
if(pickTicket==null||!pickTicket.getStatus().equals(BizStatus.OPEN)){
|
||||
throw new BadRequestException("出库单据状态不正确");
|
||||
}
|
||||
//获取文件中所有的品番编码
|
||||
List<String> itemcodes = dataList.stream().map(PickDetailImport::getItemCode).collect(Collectors.toList());
|
||||
itemcodes = itemcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
Map<String, Item> exitItemMap = validateItem(itemcodes);
|
||||
|
||||
//获取文件中所有的库位编码
|
||||
List<String> pointcodes = dataList.stream().map(PickDetailImport::getPointCode).collect(Collectors.toList());
|
||||
pointcodes = pointcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
Map<String, Point> exitPointMap = validatePoint(pointcodes);
|
||||
Dept dept=UserUtils.getDept();
|
||||
Double orderQty=pickTicket.getOrderQuantity();
|
||||
for (PickDetailImport data : dataList) {
|
||||
if(data.getBonded()==null){
|
||||
throw new BadRequestException("税别不能为空");
|
||||
}
|
||||
Item item = exitItemMap.get(data.getItemCode());
|
||||
Point point=exitPointMap.get(data.getPointCode());
|
||||
PickDetail pickDetail=new PickDetail();
|
||||
pickDetail.setPickTicket(pickTicket);
|
||||
pickDetail.setItem(item);
|
||||
pickDetail.setPoint(point);
|
||||
pickDetail.setOrderQty(data.getQty()+0d);
|
||||
pickDetail.setPropC1(data.getPc());
|
||||
pickDetail.setPo(data.getStockCode());
|
||||
pickDetail.setPropC2(data.getBonded());
|
||||
pickDetail.setStatus(BizStatus.OPEN);
|
||||
pickDetail.setRemark(data.getRemark());
|
||||
pickDetail.setDept(dept);
|
||||
pickDetailRepository.save(pickDetail);
|
||||
orderQty+=pickDetail.getOrderQty();
|
||||
}
|
||||
pickTicket.setOrderQuantity(orderQty);
|
||||
pickTicketRepository.save(pickTicket);
|
||||
}
|
||||
|
||||
//验证库位
|
||||
private Map<String, Item> validateItem(List<String> codes) {
|
||||
Map<String, Item> existMap = itemService.queryByItemCodesToMap(codes);
|
||||
if (existMap.isEmpty()) {
|
||||
throw new BadRequestException("品番代码不存在或已失效");
|
||||
}
|
||||
List<String> existCodes = new ArrayList(existMap.keySet());
|
||||
// 获取两个集合的非交集说明品番不存在或失效,直接提示
|
||||
List<String> difference = SmartStringUtil.getDifference(codes, existCodes);
|
||||
if (CollectionUtils.isNotEmpty(difference)) {
|
||||
throw new BadRequestException(difference + "品番不存在或已失效");
|
||||
}
|
||||
return existMap;
|
||||
}
|
||||
|
||||
//验证库位
|
||||
private Map<String, Point> validatePoint(List<String> codes) {
|
||||
Map<String, Point> existMap = pointService.queryByPointCodesToMap(codes);
|
||||
if (existMap.isEmpty()) {
|
||||
throw new BadRequestException("库位代码不存在或已失效");
|
||||
}
|
||||
List<String> existCodes = new ArrayList(existMap.keySet());
|
||||
// 获取两个集合的非交集说明品番不存在或失效,直接提示
|
||||
List<String> difference = SmartStringUtil.getDifference(codes, existCodes);
|
||||
if (CollectionUtils.isNotEmpty(difference)) {
|
||||
throw new BadRequestException(difference + "库位不存在或已失效");
|
||||
}
|
||||
return existMap;
|
||||
}
|
||||
|
||||
|
||||
//验证模板是否使用正确
|
||||
private void isValidTemplateType(MultipartFile file) {
|
||||
// 根据模板类型进行不同的处理
|
||||
List<String> requiredColumns = Arrays.asList(
|
||||
"品番",
|
||||
"箱单",
|
||||
"批次",
|
||||
"税别",
|
||||
"出库库位",
|
||||
"数量",
|
||||
"备注"
|
||||
);
|
||||
List<String> headers = FastExcelUtil.readHeadContent(file, 0, 0);
|
||||
if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {
|
||||
throw new BadRequestException("标准导入模板不正确,请确认模板信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -87,10 +87,14 @@ public class ImportPointServiceImpl implements ImportPointService {
|
|||
}else if (lx.equals("缓存库位")) {
|
||||
lx = BaseStatus.HCKW;
|
||||
}
|
||||
point.setType(data.getType());
|
||||
point.setType(lx);
|
||||
point.setBeatCode(data.getNs());
|
||||
point.setDescription(data.getBqlx());
|
||||
point.setItemCode(data.getItemCode());
|
||||
point.setZflx(data.getZflx());
|
||||
point.setBqlx(data.getBqlx());
|
||||
point.setGlzkw(data.getGlzkw());
|
||||
point.setInvMin(Integer.parseInt(data.getKcxx()));
|
||||
pointRepository.save(point);
|
||||
}
|
||||
}
|
||||
|
|
@ -120,12 +124,15 @@ public class ImportPointServiceImpl implements ImportPointService {
|
|||
private void isValidTemplateType(MultipartFile file) {
|
||||
// 根据模板类型进行不同的处理
|
||||
List<String> requiredColumns = Arrays.asList(
|
||||
"编码",
|
||||
"库位号",
|
||||
"库区",
|
||||
"存储类型",
|
||||
"品番编码",
|
||||
"品番",
|
||||
"库存下限",
|
||||
"纳所",
|
||||
"标签类型"
|
||||
"标签类型",
|
||||
"总分类型",
|
||||
"关联总库位"
|
||||
);
|
||||
List<String> headers = FastExcelUtil.readHeadContent(file, 0, 0);
|
||||
if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {
|
||||
|
|
|
|||
|
|
@ -193,19 +193,26 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
|||
}
|
||||
public void scsxHaoyong(List<ProductionPlan> productionPlans,Long areaId,String des){
|
||||
for (ProductionPlan productionPlan: productionPlans){
|
||||
if(!productionPlan.getStatue().equals(BizStatus.UN_CONSUME)){
|
||||
throw new BadRequestException(productionPlan.getIdno()+"状态不正确,不能重复耗用");
|
||||
}
|
||||
productionPlan.setStatue(BizStatus.CONSUME);
|
||||
productionPlan.setTakeUpTime(new Timestamp(new Date().getTime()));
|
||||
this.update(productionPlan);
|
||||
}
|
||||
Map<String,Integer> map = new HashMap<>();
|
||||
Map<String,String> mapIds = new HashMap<>();
|
||||
for(ProductionPlan productionPlan : productionPlans){
|
||||
Long id = productionPlan.getBigItem().getId();
|
||||
String kyqz=productionPlan.getIdno()==null?null:productionPlan.getIdno().substring(0,2);
|
||||
String key=id+"]"+kyqz;
|
||||
|
||||
if(map.containsKey(key)){
|
||||
map.put(key,map.get(key)+1);
|
||||
mapIds.put(key,mapIds.get(key)+","+productionPlan.getId());
|
||||
}else {
|
||||
map.put(key,1);
|
||||
mapIds.put(key,productionPlan.getId()+"");
|
||||
}
|
||||
}
|
||||
for(String key : map.keySet()){
|
||||
|
|
@ -217,6 +224,7 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
|||
spareparts.setDate(new Timestamp(new Date().getTime()));
|
||||
String[] str=key.split("]");
|
||||
spareparts.setKyQz(str[1]);
|
||||
spareparts.setSourceId(mapIds.get(key));
|
||||
BigItem bigItem = bigItemRepository.getById(Long.parseLong(str[0]));
|
||||
// bigItem.setId(key);
|
||||
spareparts.setBigItemId(bigItem);
|
||||
|
|
|
|||
|
|
@ -80,6 +80,10 @@ public class CountMoveDetail extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "盘点状态")
|
||||
private String status;
|
||||
|
||||
@Column(name = "`src_stock_code`")
|
||||
@ApiModelProperty(value = "箱单号")
|
||||
private String srcStockCode;
|
||||
|
||||
@Column(name = "`remark`")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,10 @@ public class CountMoveDetailRecord extends BaseEntity implements Serializable
|
|||
@ApiModelProperty(value = "目标库位")
|
||||
private Point dstPoint;
|
||||
|
||||
@Column(name = "`src_stock_code`")
|
||||
@ApiModelProperty(value = "箱单号")
|
||||
private String srcStockCode;
|
||||
|
||||
@Column(name = "`plan_qty`")
|
||||
@ApiModelProperty(value = "计划数量")
|
||||
private Double planQty;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class PickTicket extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
@OneToOne
|
||||
@JoinColumn(name = "`area`", nullable = false)
|
||||
@JoinColumn(name = "`area`")
|
||||
@ApiModelProperty(value = "出库库区")
|
||||
private Area area;
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@ public class Spareparts extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "仓库ID")
|
||||
private Long deptId;
|
||||
|
||||
@Column(name = "`source_id`")
|
||||
@ApiModelProperty(value = "来源序号")
|
||||
private String sourceId;
|
||||
|
||||
public void copy(Spareparts source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,15 @@ public class IRkPut {
|
|||
String pointCode;
|
||||
/**二维码*/
|
||||
String ewm;
|
||||
/**类型*/
|
||||
String type;
|
||||
/**校验序号*/
|
||||
int seq=0;
|
||||
/**数量*/
|
||||
int qty=0;
|
||||
|
||||
String pageName;
|
||||
|
||||
Set<String> ewms;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package com.youchain.businessdata.inputJson.imports;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: 基础导入
|
||||
* @author: youzhi.gao
|
||||
* @date: 2020-04-01 15:01
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AsnDetailImport {
|
||||
@ExcelProperty("品番")
|
||||
private String itemCode;
|
||||
|
||||
@ExcelProperty("品名")
|
||||
private String itemName;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("制造库位")
|
||||
private String pointCode;
|
||||
|
||||
@ExcelProperty("税别")
|
||||
private String bonded;
|
||||
|
||||
@ExcelProperty("数量")
|
||||
private int qty=0;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
public class BomAccountImport {
|
||||
//箱种 收容数 台车库位 大小物 税别 机型1 台用量1 机型2 台用量2 机型3 台用量3 机型4 台用量4 机型5 台用量5 机型6 台用量6 机型7 台用量7 机型8 台用量8 机型9 台用量9 机型10 台用量10 机型11 台用量11 机型12 台用量12 机型13 台用量13 机型14 台用量14 机型15 台用量15 机型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
|
||||
@ExcelProperty("品番")
|
||||
@ExcelProperty("子品番")
|
||||
private String pf;
|
||||
|
||||
@ExcelProperty("纳所")
|
||||
|
|
@ -59,9 +59,13 @@ public class BomAccountImport {
|
|||
@ExcelProperty("税别")
|
||||
private String sb;
|
||||
|
||||
@ExcelProperty("机型")
|
||||
private String jx;
|
||||
@ExcelProperty("机型代码")
|
||||
private String jxdm;
|
||||
@ExcelProperty("组顺/刻印号前2位")
|
||||
private String kyh;
|
||||
@ExcelProperty("台用量")
|
||||
private String tyl;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package com.youchain.businessdata.inputJson.imports;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: 基础导入
|
||||
* @author: youzhi.gao
|
||||
* @date: 2020-04-01 15:01
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PickDetailImport {
|
||||
@ExcelProperty("品番")
|
||||
private String itemCode;
|
||||
|
||||
@ExcelProperty("品名")
|
||||
private String itemName;
|
||||
|
||||
@ExcelProperty("箱单")
|
||||
private String stockCode;
|
||||
|
||||
@ExcelProperty("批次")
|
||||
private String pc;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("出库库位")
|
||||
private String pointCode;
|
||||
|
||||
@ExcelProperty("税别")
|
||||
private String bonded;
|
||||
|
||||
@ExcelProperty("数量")
|
||||
private int qty=0;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PointImport {
|
||||
@ExcelProperty("编码")
|
||||
@ExcelProperty("库位号")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("库区")
|
||||
|
|
@ -25,13 +25,19 @@ public class PointImport {
|
|||
@ExcelProperty("存储类型")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("品番编码")
|
||||
@ExcelProperty("库存下限")
|
||||
private String kcxx;
|
||||
|
||||
@ExcelProperty("品番")
|
||||
private String itemCode;
|
||||
|
||||
@ExcelProperty("纳所")
|
||||
private String ns;
|
||||
|
||||
@ExcelProperty("标签类型")
|
||||
private String bqlx;
|
||||
@ExcelProperty("总分类型")
|
||||
private String zflx;
|
||||
@ExcelProperty("关联总库位")
|
||||
private String glzkw;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,10 +35,13 @@ public interface CountMoveDetailRepository extends JpaRepository<CountMoveDetail
|
|||
@Query(value = "SELECT * FROM data_count_move_detail d where d.count_move_id =?1" , nativeQuery = true)
|
||||
List<CountMoveDetail> queryDetails(Long count_move_id);
|
||||
|
||||
@Query(value = "SELECT * FROM data_count_move_detail d where d.count_move_id =?1 and d.item_key_id=?2 and d.dst_point_id=?3" , nativeQuery = true)
|
||||
List<CountMoveDetail> queryIkPDetails(Long count_move_id,Long item_key_id,Long dst_point_id);
|
||||
@Query(value = "SELECT * FROM data_count_move_detail d where d.count_move_id =:count_move_id" +
|
||||
" and d.item_key_id=:item_key_id and d.dst_point_id=:dst_point_id " +
|
||||
" and (d.src_stock_code=:stock_code or :stock_code is null )" , nativeQuery = true)
|
||||
List<CountMoveDetail> queryIkPDetails(Long count_move_id,Long item_key_id,Long dst_point_id,String stock_code);
|
||||
|
||||
@Query(value = "SELECT d.count_move_id,d.item_key_id,d.dst_point_id FROM data_count_move_detail d where d.count_move_id =?1 GROUP BY d.item_key_id,d.dst_point_id" , nativeQuery = true)
|
||||
@Query(value = "SELECT d.count_move_id,d.item_key_id,d.dst_point_id,d.src_stock_code FROM data_count_move_detail d where d.count_move_id =?1" +
|
||||
" GROUP BY d.item_key_id,d.dst_point_id,d.src_stock_code" , nativeQuery = true)
|
||||
List<Object[]> queryIkPGroupDetails(Long count_move_id);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -65,9 +65,11 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
|||
"WHERE inv.quantity>0 and p.type='CH' and inv.stock_code=:stockCode" , nativeQuery = true)
|
||||
List<Inventory> queryInvStockCode(String stockCode);
|
||||
|
||||
@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 and inv.itemKey.item.code=:itemCode" , nativeQuery = true)
|
||||
@Query(value = "SELECT inv.* from data_inventory inv \n" +
|
||||
"left join base_point p on inv.point_id=p.id " +
|
||||
"left JOIN data_item_key ik on ik.id=inv.item_key_id\n" +
|
||||
"left join base_item it on it.id=ik.item_id " +
|
||||
"WHERE inv.quantity>0 and p.type='CH' and inv.stock_code=:stockCode and it.code=:itemCode" , nativeQuery = true)
|
||||
List<Inventory> queryInvStockItemCode(String stockCode,String itemCode);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public interface XppRecordRepository extends JpaRepository<XppRecord, Long>, Jpa
|
|||
@Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.status='PUTAWAY'", nativeQuery = true)
|
||||
List<XppRecord> queryXppItemKeyPoint2();
|
||||
|
||||
@Query(value = "SELECT IFNULL(sum(xr.nrs),0) nrs FROM data_xpp_record xr WHERE xr.item_Key_id=?1 and xr.inv_Point_id=?2 and xr.status='PUTAWAY'", nativeQuery = true)
|
||||
@Query(value = "SELECT IFNULL(sum(xr.nrs),0) nrs FROM data_xpp_record xr " +
|
||||
"WHERE xr.item_Key_id=?1 and xr.inv_Point_id=?2 and xr.status='PUTAWAY'", nativeQuery = true)
|
||||
int queryXppItemKeyPointNrs(Long itemKeyId, Long invPointId);
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@ import com.youchain.businessdata.domain.*;
|
|||
import com.youchain.businessdata.inputJson.IScanPut;
|
||||
import com.youchain.businessdata.inputJson.buttenJson.AsnDetailButton;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
import com.youchain.businessdata.repository.AsnRepository;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.repository.XppRecordRepository;
|
||||
import com.youchain.businessdata.returnJson.RRkXpp;
|
||||
|
|
@ -107,6 +108,7 @@ public class AsnDetailController {
|
|||
private final FileProperties properties;
|
||||
private final AsnService asnService;
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
private final AsnRepository asnRepository;
|
||||
private final AsnMapper asnMapper;
|
||||
private final InventoryMapper inventoryMapper;
|
||||
private final XppRecordRepository xppRecordRepository;
|
||||
|
|
@ -260,7 +262,10 @@ public class AsnDetailController {
|
|||
public ResponseEntity<Object> putawayXppApp(@RequestBody IRkPut s) {
|
||||
int seq=s.getSeq();
|
||||
if(seq==1){
|
||||
RRkXpp map = xppRecordService.xppAnalysis(s.getEwm(),BillParmType.XPP_1001);
|
||||
// if(s.getPageName()!=null&&s.getPageName().equals("制造投料")) {
|
||||
// type=BillParmType.XPP_2001;
|
||||
// }
|
||||
RRkXpp map = xppRecordService.xppAnalysis(s.getEwm(), s.getType());
|
||||
return new ResponseEntity<>(map, HttpStatus.OK);
|
||||
}
|
||||
if (seq==2||seq==3) {//库存上架
|
||||
|
|
@ -274,15 +279,22 @@ public class AsnDetailController {
|
|||
bonded=str[2];
|
||||
}
|
||||
if (pointCode == null||pointCode.equals("")) {
|
||||
return new ResponseEntity<>( "库位不能为空", BAD_REQUEST);
|
||||
throw new BadRequestException( "库位不能为空");
|
||||
}
|
||||
Point point = pointService.getPoint(pointCode,null, null, null);
|
||||
if (point == null) {
|
||||
return new ResponseEntity<>(pointCode + "库位不存在", BAD_REQUEST);
|
||||
throw new BadRequestException(pointCode + "库位不存在");
|
||||
}
|
||||
if(bomItemCode==null){
|
||||
bomItemCode=point.getItemCode();
|
||||
}
|
||||
Area area=point.getArea();
|
||||
for(String ewm:s.getEwms()){
|
||||
if(seq==2) {//收货上架
|
||||
//只能材管库位
|
||||
if(!point.getType().equals(BaseStatus.CH)){
|
||||
throw new BadRequestException("库位不为材管库位");
|
||||
}
|
||||
XppRecord xppRecord = xppRecordService.saveXppRecord(ewm, point.getArea(), BillParmType.XPP_1001);
|
||||
AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord);
|
||||
String nrcs=xppRecord.getRelaCode();
|
||||
|
|
@ -294,6 +306,12 @@ public class AsnDetailController {
|
|||
asnDetailRepository.save(asnDetail);
|
||||
asnDetailService.putawayInv(asnDetail.getId(), area.getId(), point.getId(), xppRecord.getNrs(), xppRecord.getEwm());
|
||||
}else if(seq==3){//制造投料
|
||||
if(!point.getType().equals(BaseStatus.ZZKW)){
|
||||
throw new BadRequestException("库位不为制造库位");
|
||||
}
|
||||
if(bonded==null){
|
||||
throw new BadRequestException(bonded + "税别不能为空");
|
||||
}
|
||||
xppRecordService.xppPutaway(ewm,bonded,bomItemCode,point);
|
||||
}
|
||||
}
|
||||
|
|
@ -510,78 +528,27 @@ public class AsnDetailController {
|
|||
|
||||
@Log("入库确认")
|
||||
@ApiOperation("入库确认")
|
||||
@PostMapping(value = "/invVerify")
|
||||
@PostMapping(value = "/putawayAsn")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApiResult invVerify(@RequestBody Long[] ids) {
|
||||
public ResponseEntity putawayAsn(@RequestBody Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
AsnDto byId = asnService.findById(id);
|
||||
if (Objects.isNull(byId)) {
|
||||
// 通用异常,使用自定义状态码
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "未查到该数据");
|
||||
Asn asn = asnRepository.getById(id);
|
||||
if (!asn.getStatus().equals(BizStatus.OPEN)) {
|
||||
throw new BadRequestException(asn.getCode()+ "状态不正确");
|
||||
}
|
||||
//库区的判断
|
||||
AreaDto area = byId.getArea();
|
||||
if (Objects.isNull(area)) {
|
||||
// 通用异常,使用自定义状态码
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "库区未填写");
|
||||
}
|
||||
// if (!area.getBesh()){
|
||||
// // 通用异常,使用自定义状态码
|
||||
// throw new BadRequestException(HttpStatus.NOT_FOUND,id+"的库区的仓库不是接收仓库");
|
||||
// }
|
||||
//查询 那个明细需要确认
|
||||
List<AsnDetail> asnDetails = asnDetailRepository.queryByAsnId(id);
|
||||
if (!asnDetails.isEmpty()) {
|
||||
for (AsnDetail asnDetailData : asnDetails) {
|
||||
if (asnDetailData.getOrderQty() == asnDetailData.getReceivedQty()) {
|
||||
for (AsnDetail asnDetail : asnDetails) {
|
||||
if (asnDetail.getOrderQty() <= asnDetail.getReceivedQty()) {
|
||||
continue;
|
||||
}
|
||||
//1.库区为接收仓库,库位为每个detail上的库位,如果没有则提示
|
||||
//2.库区不为接收仓库,库位取item上维护的库位,如果没有则提示
|
||||
if (area.getBexb()) {//判断库区是否为接受仓库
|
||||
if (Objects.isNull(asnDetailData.getPoint())) {
|
||||
// 通用异常,使用自定义状态码
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "是接受仓库 副表" + asnDetailData.getId() + "的库位未填写");
|
||||
}
|
||||
} else {
|
||||
if (Objects.isNull(asnDetailData.getItem())) {
|
||||
// 通用异常,使用自定义状态码
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "是不是接受仓库 副表" + asnDetailData.getId() + "的物料未填写");
|
||||
}
|
||||
}
|
||||
ApiResult apiResult = null;
|
||||
if (Objects.isNull( asnDetailData.getPoint())){
|
||||
// apiResult = this.putawayInv(asnDetailData.getId(), byId.getArea().getId(), null);
|
||||
// 通用异常,使用自定义状态码
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, asnDetailData.getId() + "没有填写点位");
|
||||
}else {
|
||||
if (asnDetailData.getReceivedQty()>0){
|
||||
// 通用异常,使用自定义状态码
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "的副表" + asnDetailData.getId() + "的物料已经单一入库无法使用整单入库");
|
||||
}
|
||||
asnDetailService.putawayInv(asnDetailData.getId(), byId.getArea().getId(), asnDetailData.getPoint().getId(),(asnDetailData.getOrderQty()-asnDetailData.getReceivedQty()),null);
|
||||
}
|
||||
|
||||
if (apiResult.getStatus() == 200) {
|
||||
//收货日期改成当前日期 数量累计
|
||||
byId.setReceivedDate(new Timestamp(System.currentTimeMillis()));
|
||||
byId.setReceivedQuantity(byId.getReceivedQuantity() + asnDetailData.getOrderQty());
|
||||
} else {
|
||||
// 通用异常,使用自定义状态码
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, apiResult.getMessage());
|
||||
}
|
||||
double pd = byId.getOrderQuantity() - byId.getReceivedQuantity();
|
||||
if (pd == 0) {
|
||||
byId.setStatus(BizStatus.RECEIVED);
|
||||
} else if (pd > 0 && byId.getReceivedQuantity() > 0) {
|
||||
byId.setStatus(BizStatus.RECEIVING);
|
||||
}
|
||||
asnService.update(asnMapper.toEntity(byId));
|
||||
asnDetailService.putawayInv(asnDetail.getId(),asnDetail.getPoint().getArea().getId(),asnDetail.getPoint().getId(),asnDetail.getOrderQty()-asnDetail.getReceivedQty(),null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ApiResult.result(200, "入库确认成功", HttpStatus.OK);
|
||||
return new ResponseEntity("入库成功", HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public class CountMoveController {
|
|||
@ApiOperation("移位数据审核")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
@Transactional
|
||||
@DuplicateSubmission(5*60)
|
||||
@DuplicateSubmission(1*60)
|
||||
public ResponseEntity<Object> countCheck(@RequestBody Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
CountMove countMove=countMoveRepository.getById(id);
|
||||
|
|
@ -166,7 +166,7 @@ public class CountMoveController {
|
|||
@ApiOperation("移位完成")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
@Transactional
|
||||
@DuplicateSubmission(5*60)
|
||||
@DuplicateSubmission(1*60)
|
||||
public ResponseEntity<Object> countFinish(@RequestBody Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
CountMove countMove=countMoveRepository.getById(id);
|
||||
|
|
|
|||
|
|
@ -318,6 +318,8 @@ public class PickDetailController {
|
|||
@Log("制造叫料拣货确认")
|
||||
@ApiOperation("制造叫料拣货确认")
|
||||
@AnonymousAccess
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
@DuplicateSubmission(5)
|
||||
public ResponseEntity<Object> zzjlPickApp(@RequestBody ZzjlPickConfirm zzjlPick) throws Exception {
|
||||
String type= zzjlPick.getType();
|
||||
if(type.equals("zzjl_pick_001")){
|
||||
|
|
@ -334,10 +336,6 @@ public class PickDetailController {
|
|||
String view_type="01";
|
||||
String view_des="无库存";
|
||||
String view_name="箱单号";
|
||||
if(pickDetail.getBeXdPf()){
|
||||
view_name="箱单号(品番)";
|
||||
view_type="04";
|
||||
}
|
||||
ZzjlPickHead head=new ZzjlPickHead();
|
||||
List<ZzjlPickDetail> detail_list=new ArrayList<>();
|
||||
if(tasks.size()>=0){
|
||||
|
|
@ -370,6 +368,10 @@ public class PickDetailController {
|
|||
view_type="03";
|
||||
}
|
||||
}
|
||||
if(pickDetail.getBeXdPf()){
|
||||
view_name="箱单(品番)";
|
||||
view_type="04";
|
||||
}
|
||||
if(view_type.equals("01")){
|
||||
throw new BadRequestException( "无库存");
|
||||
}
|
||||
|
|
@ -390,8 +392,8 @@ public class PickDetailController {
|
|||
}
|
||||
}
|
||||
PickDetail pickDetail=pickDetailRepository.getById(zzjlPick.getDetail_id());
|
||||
if(stock_code!=null){
|
||||
if(zzjlPick.getView_type().equals("03")){//箱单出库
|
||||
if(stock_code!=null&&(zzjlPick.getView_type().equals("03")||zzjlPick.getView_type().equals("04"))){
|
||||
if(!pickDetail.getBeXdPf()){//箱单出库
|
||||
List<Inventory> invs = inventoryRepository.queryInvStockCode(stock_code);
|
||||
for (Inventory inv : invs) {
|
||||
//生成Task,生成出库扣减库存
|
||||
|
|
@ -401,9 +403,12 @@ public class PickDetailController {
|
|||
taskRepository.save(task);
|
||||
pickTicketService.pickForTask(task.getId(), task.getSrcStockCode(), task.getPlanQty()-task.getMoveQty(), null, SecurityUtils.getCurrentUsername());
|
||||
}
|
||||
}else if(zzjlPick.getView_type().equals("04")){//箱单品番出库
|
||||
//箱单内现品票
|
||||
}else{//箱单品番出库
|
||||
//扫描箱单内现品票即可
|
||||
String xpp=zzjlPick.getXpp();
|
||||
if(xpp==null){
|
||||
throw new BadRequestException( "请扫描现品票");
|
||||
}
|
||||
RRkXpp rRkXpp=xppRecordService.xppAnalysis(xpp,null);
|
||||
//查询是否能找到对应的库存
|
||||
List<Inventory> invs = inventoryRepository.queryInvStockItemCode(stock_code,rRkXpp.getItemCode());
|
||||
|
|
@ -418,7 +423,7 @@ public class PickDetailController {
|
|||
pickTicketService.pickForTask(task.getId(), task.getSrcStockCode(), task.getPlanQty()-task.getMoveQty(), null, SecurityUtils.getCurrentUsername());
|
||||
}
|
||||
|
||||
} else if (xppQRCode!=null) {//现品票拣货确认
|
||||
} else if (xppQRCode!=null&&zzjlPick.getView_type().equals("02")) {//现品票拣货确认
|
||||
XppRecord xpp = xppRecordRepository.findByEwmType(xppQRCode, BillParmType.XPP_1001);
|
||||
if (Objects.isNull(xpp)){
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "未找到对应的现品票二维码");
|
||||
|
|
|
|||
|
|
@ -220,6 +220,24 @@ public class PickTicketController {
|
|||
}
|
||||
return new ResponseEntity<>("操作成功",HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/qtckAllocate")
|
||||
@Log("其他出库分配")
|
||||
@ApiOperation("其他出库分配")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
public ResponseEntity<Object> qtckAllocate(@RequestBody Long[] ids){
|
||||
for (Long id :ids) {
|
||||
List<PickDetail> pickTickets =pickDetailRepository.queryByPickTicketId(id);
|
||||
for (PickDetail pickDetail : pickTickets) {
|
||||
double unQty=pickDetail.getOrderQty()-pickDetail.getAllocatedQty();
|
||||
if(unQty>0) {
|
||||
//分配
|
||||
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(), pickDetail.getPo(), BaseStatus.QTCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>("操作成功",HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/xdckCancelAllocate")
|
||||
@Log("箱单出库取消分配")
|
||||
@ApiOperation("箱单出库取消分配")
|
||||
|
|
@ -317,23 +335,35 @@ public class PickTicketController {
|
|||
}
|
||||
|
||||
@PostMapping("/xdckPickOut")
|
||||
@Log("箱单库存拣货确认")
|
||||
@ApiOperation("箱单库存拣货确认")
|
||||
@Log("箱单拣货确认")
|
||||
@ApiOperation("箱单拣货确认")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
public ResponseEntity<Object> xdckPickOut(@RequestBody HashMap map){
|
||||
Long invId=Long.parseLong(map.get("invId").toString());
|
||||
Long detailId=Long.parseLong(map.get("detailId").toString());
|
||||
Inventory xdinv =inventoryRepository.getById(invId);
|
||||
PickDetail pickDetail=pickDetailRepository.getById(detailId);
|
||||
//所有该箱单库存一次性拣货确认
|
||||
List<Inventory> invs = inventoryRepository.queryInvStockCode(xdinv.getStockCode());
|
||||
for (Inventory inv : invs) {
|
||||
//生成Task,生成出库扣减库存
|
||||
Task task = taskService.storeTask(null,pickDetail,inv.getArea(),inv.getItemKey(),inv.getPoint(),null,inv.getQuantity(),inv.getStockCode());
|
||||
task.setBillCode(pickDetail.getItem().getCode()+"关联箱单出库"+detailId);
|
||||
task.setTaskType(BizStatus.XD_PICK);
|
||||
if(pickDetail.getBeXdPf()){
|
||||
if(xdinv.getQuantity()<pickDetail.getOrderQty()){
|
||||
throw new BadRequestException( "库存数量不足纳入数");
|
||||
}
|
||||
Task task = taskService.storeTask(null,pickDetail,xdinv.getArea(),xdinv.getItemKey(),
|
||||
xdinv.getPoint(),null,pickDetail.getOrderQty(),xdinv.getStockCode());
|
||||
task.setTaskType(BizStatus.XD_PF_PICK);
|
||||
taskRepository.save(task);
|
||||
pickTicketService.pickForTask(task.getId(), task.getSrcStockCode(), task.getPlanQty()-task.getMoveQty(), null, SecurityUtils.getCurrentUsername());
|
||||
|
||||
}else {
|
||||
//所有该箱单库存一次性拣货确认
|
||||
List<Inventory> invs = inventoryRepository.queryInvStockCode(xdinv.getStockCode());
|
||||
for (Inventory inv : invs) {
|
||||
//生成Task,生成出库扣减库存
|
||||
Task task = taskService.storeTask(null, pickDetail, inv.getArea(), inv.getItemKey(), inv.getPoint(), null, inv.getQuantity(), inv.getStockCode());
|
||||
task.setBillCode(pickDetail.getItem().getCode() + "关联箱单出库" + detailId);
|
||||
task.setTaskType(BizStatus.XD_PICK);
|
||||
taskRepository.save(task);
|
||||
pickTicketService.pickForTask(task.getId(), task.getSrcStockCode(), task.getPlanQty() - task.getMoveQty(), null, SecurityUtils.getCurrentUsername());
|
||||
}
|
||||
}
|
||||
|
||||
return new ResponseEntity<>("操作成功",HttpStatus.OK);
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import com.youchain.modules.system.domain.Job;
|
|||
import com.youchain.modules.system.repository.JobRepository;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -832,6 +833,8 @@ public class XppRecordController {
|
|||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/xppBd")
|
||||
@Log("现品票补打")
|
||||
@ApiOperation("现品票补打")
|
||||
|
|
@ -849,16 +852,71 @@ public class XppRecordController {
|
|||
}
|
||||
String ewm=xpp.getEwm();
|
||||
//替换后三位
|
||||
ewm=ewm.substring(0,ewm.length()-3)+fzh;
|
||||
if(ewm.length()==85) {
|
||||
ewm = ewm.substring(0, ewm.length() - 3) + fzh;
|
||||
}else{
|
||||
ewm = ewm+ fzh;
|
||||
}
|
||||
//替换数量
|
||||
String formatted = String.format("%0" + 7 + "d", xpp.getBdNrs());
|
||||
String bd_ewm=ewm.substring(0,45)+formatted+ewm.substring(52,ewm.length());
|
||||
xpp.setBdEwm(bd_ewm);
|
||||
log.info(bd_ewm);
|
||||
xppRecordService.update(xpp);
|
||||
// inventoryLogService.storeInventoryLog(BizStatus.ADJUST, BizStatus.INVARIANT, "现品票拆分", xpp.getInvPoint().getArea(), xpp.getItemKey(), xpp.getInvPoint(), xpp.getInvPoint(), null, srcQty, xppRecord.getNrs()+0d,xppRecord.getEwm(),
|
||||
// BizStatus.MOVE, xppRecord.getId(), inventory.getId(), "现品票移位");
|
||||
return new ResponseEntity<>("操作成功", HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/xppSplit")
|
||||
@Log("现品票拆分")
|
||||
@ApiOperation("现品票拆分")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> xppSplit( @RequestBody HashMap map) {
|
||||
Long id=Long.parseLong(map.get("id").toString());
|
||||
Integer splitCount = Integer.valueOf(map.get("cfs").toString());
|
||||
String fzh=map.get("fzh").toString();
|
||||
if(fzh.length()!=3){
|
||||
throw new BadRequestException("分支号必须三位数");
|
||||
}
|
||||
XppRecord old_xpp=xppRecordRepository.getById(id);
|
||||
String ewm=old_xpp.getEwm();
|
||||
//替换后三位
|
||||
if(ewm.length()==85) {
|
||||
ewm = ewm.substring(0, ewm.length() - 3) + fzh;
|
||||
}else{
|
||||
ewm = ewm+ fzh;
|
||||
}
|
||||
//替换数量
|
||||
String formatted = String.format("%0" + 7 + "d", splitCount);
|
||||
String new_ewm=ewm.substring(0,45)+formatted+ewm.substring(52,ewm.length());
|
||||
//查询二维码是否重复,重复则换个分支号即可
|
||||
XppRecord be_cf=xppRecordRepository.findByEwmType(new_ewm, old_xpp.getType());
|
||||
if(be_cf!=null){
|
||||
throw new BadRequestException("现品票重复,更换分支号");
|
||||
}
|
||||
if(!old_xpp.getStatus().equals(BizStatus.PUTAWAY)){
|
||||
throw new BadRequestException("现品票状态不正确");
|
||||
}
|
||||
if (splitCount <= 0) {
|
||||
throw new BadRequestException("拆分数量必须大于0");
|
||||
}
|
||||
if (old_xpp.getNrs() < splitCount) {
|
||||
throw new BadRequestException("拆分数量不能大于原数量");
|
||||
}
|
||||
XppRecord new_xpp = new XppRecord();
|
||||
BeanUtils.copyProperties(old_xpp,new_xpp,"id","nrs");
|
||||
new_xpp.setNrs(splitCount);
|
||||
new_xpp.setFzh(fzh);
|
||||
new_xpp.setEwm(new_ewm);
|
||||
new_xpp.setDescription(old_xpp.getId()+"现品票拆分");
|
||||
//拆分来源数据
|
||||
xppRecordRepository.save(new_xpp);
|
||||
old_xpp.setNrs(old_xpp.getNrs()-splitCount);
|
||||
xppRecordRepository.save(old_xpp);
|
||||
return new ResponseEntity<>("操作成功", HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/createReceipt")
|
||||
@Log("现品票-生成收货清单")
|
||||
@ApiOperation("现品票-生成收货清单")
|
||||
|
|
|
|||
|
|
@ -16,5 +16,7 @@ public class RInvQuery {
|
|||
/**数量*/
|
||||
int qty;
|
||||
/**批次*/
|
||||
String propD1;
|
||||
String propC1;
|
||||
/**税别*/
|
||||
String propC2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,12 @@ public class ZzjlPickList {
|
|||
String item_name;
|
||||
/**制造库位*/
|
||||
String point_code;
|
||||
/**库位*/
|
||||
String ck_point_code;
|
||||
/**税别*/
|
||||
String bonded;
|
||||
/**箱单品番*/
|
||||
String be_xd_pf;
|
||||
/**数量*/
|
||||
int order_qty;
|
||||
/**分配数量*/
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public interface InventoryService {
|
|||
|
||||
void downloadZz(List<InventoryDto> all, HttpServletResponse response) throws Exception, Exception;
|
||||
|
||||
List<Inventory> queryInventoryAllocate(long itemId,long areaId,Long zzkwId,String stockCode,String propC2,String type);
|
||||
List<Inventory> queryInventoryAllocate(long itemId,long areaId,Long zzkwId,Long pointId,String stockCode,String propC2,String type);
|
||||
|
||||
/**
|
||||
* 得到线边库存数量
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ public class CountMoveDetailDto implements Serializable {
|
|||
/** 修改人 */
|
||||
private String updateBy;
|
||||
|
||||
private String src_stock_code;
|
||||
|
||||
/** 创建时间 */
|
||||
private Timestamp createTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ public class CountMoveDetailRecordDto implements Serializable {
|
|||
/** 目标库位 */
|
||||
private PointDto dstPoint;
|
||||
|
||||
private String srcStockCode;
|
||||
|
||||
/** 计划数量 */
|
||||
private Double planQty;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,9 +37,10 @@ public class PickDetailQueryCriteria{
|
|||
@Query(joinName = "item", propName="name",type = Query.Type.INNER_LIKE)
|
||||
private String itemName;
|
||||
|
||||
/** 入库库区 */
|
||||
/** 叫料库区 */
|
||||
@Query(joinName = "shArea", propName="code",type = Query.Type.INNER_LIKE)
|
||||
private String rkAreaCode;
|
||||
/** 拣货库区 */
|
||||
@Query(joinName = "area", propName="code",type = Query.Type.INNER_LIKE)
|
||||
private String ckAreaCode;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ public class SparepartsQueryCriteria {
|
|||
*/
|
||||
@Query(joinName = "bigItemId", propName = "code", type = Query.Type.INNER_LIKE)
|
||||
private String bigItemIdModes;
|
||||
@Query(propName = "code",joinName = "shArea",type = Query.Type.INNER_LIKE)
|
||||
private String shAreaCode;
|
||||
|
||||
/**
|
||||
* 工位
|
||||
|
|
|
|||
|
|
@ -262,21 +262,24 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
gdItemCode=point.getItemCode();
|
||||
}
|
||||
if(gdItemCode!=null&&!gdItemCode.equals("")&&!d.getItem().getCode().equals(gdItemCode)){
|
||||
throw new BadRequestException("和固定库位品番"+gdItemCode+"不匹配");
|
||||
throw new BadRequestException("品番"+d.getItem().getCode()+"和库位"+point.getCode()+"固定品番"+gdItemCode+"不匹配");
|
||||
}
|
||||
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(BaseStatus.ZZKW, null, null, null);
|
||||
}
|
||||
}else{
|
||||
// if(area.getBexb()){
|
||||
// point= pointService.getPoint(area.getPointCode(), null, BaseStatus.HCKW, null);//取默认线边库位
|
||||
// zzkw=d.getPoint();
|
||||
// if(zzkw==null){
|
||||
// //取默认制造库位
|
||||
// zzkw= pointService.getPoint(BaseStatus.ZZKW, null, null, null);
|
||||
// }
|
||||
// }else{
|
||||
// pc1=DateUtil.dateYmdz();
|
||||
// }
|
||||
if(!area.getBexb()){
|
||||
pc1=DateUtil.dateYmdz();
|
||||
}
|
||||
if(point==null){
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.youchain.businessdata.repository.CountMoveDetailRepository;
|
|||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.repository.XppRecordRepository;
|
||||
import com.youchain.businessdata.service.*;
|
||||
import com.youchain.businessdata.service.dto.CountMoveDetailRecordDto;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
|
|
@ -119,15 +120,17 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
List<Inventory> inventoryList=inventoryRepository.queryInventoryArea(countMove.getSrcArea().getId());
|
||||
for(Inventory inv:inventoryList) {
|
||||
ItemKey itemKey = inv.getItemKey();
|
||||
int nrs = xppRecordRepository.queryXppItemKeyPointNrs(itemKey.getId(), inv.getPoint().getId());
|
||||
if (inv.getQueuedQty() > 0) {
|
||||
throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数");
|
||||
}
|
||||
if(inv.getQuantity().intValue()!=nrs){
|
||||
inventoryLogService.storeInventoryLog(BizStatus.COUNT_MOVE, BizStatus.INVARIANT, countMove.getCode(), countMove.getDstArea(), itemKey, inv.getPoint(), inv.getPoint(), null, inv.getQuantity()+0d, nrs+0d, null,
|
||||
BizStatus.COUNT, null, inv.getId(), "调整库存数量,和现品票匹配");
|
||||
inv.setQuantity(nrs+0d);
|
||||
inventoryService.update(inv);
|
||||
if(inv.getStockCode()==null) {//非箱单库存根据纳入数调整库存数
|
||||
int nrs = xppRecordRepository.queryXppItemKeyPointNrs(itemKey.getId(), inv.getPoint().getId());
|
||||
if (inv.getQueuedQty() > 0) {
|
||||
throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数");
|
||||
}
|
||||
if (inv.getQuantity().intValue() != nrs) {
|
||||
inventoryLogService.storeInventoryLog(BizStatus.COUNT_MOVE, BizStatus.INVARIANT, countMove.getCode(), countMove.getDstArea(), itemKey, inv.getPoint(), inv.getPoint(), null, inv.getQuantity() + 0d, nrs + 0d, null,
|
||||
BizStatus.COUNT, null, inv.getId(), "调整库存数量,和现品票匹配");
|
||||
inv.setQuantity(nrs + 0d);
|
||||
inventoryService.update(inv);
|
||||
}
|
||||
}
|
||||
createCountDetail(countMove,inv,itemKey,countMove.getDstPoint());
|
||||
}
|
||||
|
|
@ -144,6 +147,7 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
countMoveDetail.setSrcPoint(inv.getPoint());
|
||||
countMoveDetail.setOrderQty(inv.getQuantity());
|
||||
countMoveDetail.setCountQty(0d);
|
||||
countMoveDetail.setSrcStockCode(inv.getStockCode());
|
||||
countMoveDetail.setDstPoint(dstPoint);
|
||||
countMoveDetailService.create(countMoveDetail);
|
||||
countMove.setOrderQty(countMove.getOrderQty()+inv.getQuantity());
|
||||
|
|
@ -212,38 +216,42 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
List<Object[]> countMoveDetailObjs=countMoveDetailRepository.queryIkPGroupDetails(countMove.getId());
|
||||
log.info("countMoveDetailList:"+countMoveDetailObjs.size());
|
||||
|
||||
|
||||
//得到盘点库区下所有库存
|
||||
List<Inventory> inventoryListAll=inventoryRepository.queryInventoryArea2(countMove.getSrcArea().getId());
|
||||
log.info("inventoryListAll:"+inventoryListAll.size());
|
||||
Map<Integer,List<Inventory>> map_inventory=new HashMap<>();
|
||||
Map<String,List<Inventory>> map_inventory=new HashMap<>();
|
||||
for (Inventory inv :inventoryListAll ) {
|
||||
//同一itemKey,库位,箱单号数据合并
|
||||
String key=inv.getItemKey().getId()+""+inv.getPoint().getId();
|
||||
List<Inventory> ll=map_inventory.get(Integer.parseInt(key));
|
||||
if(inv.getStockCode()!=null){
|
||||
key+=inv.getStockCode();
|
||||
}
|
||||
List<Inventory> ll=map_inventory.get(key);
|
||||
if(ll!=null && ll.size()>0){
|
||||
ll.add(inv);
|
||||
map_inventory.put(Integer.parseInt(key),ll);
|
||||
map_inventory.put(key,ll);
|
||||
}else{
|
||||
List<Inventory> list_aa=new ArrayList<>();
|
||||
list_aa.add(inv);
|
||||
map_inventory.put(Integer.parseInt(key),list_aa);
|
||||
map_inventory.put(key,list_aa);
|
||||
}
|
||||
}
|
||||
log.info("map_inventory:"+map_inventory.keySet().size());
|
||||
|
||||
log.info("xppRecordListAll:");
|
||||
List<XppRecord> xppRecordListAll = xppRecordRepository.queryXppItemKeyPoint2();
|
||||
Map<Integer,List<XppRecord>> map_xppRecord=new HashMap<>();
|
||||
Map<String,List<XppRecord>> map_xppRecord=new HashMap<>();
|
||||
log.info("xppRecordListAll:"+xppRecordListAll.size());
|
||||
for (XppRecord xpp :xppRecordListAll ) {
|
||||
String key=xpp.getItemKey().getId()+""+xpp.getInvPoint().getId();
|
||||
List<XppRecord> ll=map_xppRecord.get(Integer.parseInt(key));
|
||||
List<XppRecord> ll=map_xppRecord.get(key);
|
||||
if(ll!=null && ll.size()>0){
|
||||
ll.add(xpp);
|
||||
map_xppRecord.put(Integer.parseInt(key),ll);
|
||||
map_xppRecord.put(key,ll);
|
||||
}else{
|
||||
List<XppRecord> list_aa=new ArrayList<>();
|
||||
list_aa.add(xpp);
|
||||
map_xppRecord.put(Integer.parseInt(key),list_aa);
|
||||
map_xppRecord.put(key,list_aa);
|
||||
}
|
||||
}
|
||||
log.info("map_xppRecord:"+map_xppRecord.keySet().size());
|
||||
|
|
@ -255,49 +263,63 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
for(Object[] objs:countMoveDetailObjs){
|
||||
Long itemKeyId=Long.parseLong(objs[1].toString());
|
||||
Long dstPointId=Long.parseLong(objs[2].toString());
|
||||
String stock_code=objs[3]==null?null:objs[3].toString();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<CountMoveDetail> countMoveDetailList=countMoveDetailRepository.queryIkPDetails(countMove.getId(),itemKeyId,dstPointId);
|
||||
List<CountMoveDetail> countMoveDetailList=countMoveDetailRepository.queryIkPDetails(countMove.getId(),itemKeyId,dstPointId,stock_code);
|
||||
for (CountMoveDetail d:countMoveDetailList){
|
||||
//log.info(++iii +"");
|
||||
String key1=d.getItemKey().getId()+""+d.getSrcPoint().getId();
|
||||
List<Inventory> inventoryList=map_inventory.get(Integer.parseInt(key1));
|
||||
if(stock_code!=null){
|
||||
key1+=stock_code;
|
||||
}
|
||||
List<Inventory> inventoryList=new ArrayList<>();
|
||||
if(map_inventory!=null&&map_inventory.size()>0) {
|
||||
inventoryList=map_inventory.get(key1);
|
||||
}
|
||||
//log.info("Inventory======="+new Date()+"====");
|
||||
for(Inventory inv:inventoryList) {
|
||||
ItemKey itemKey = inv.getItemKey();
|
||||
String key2 = itemKey.getId() + "" + inv.getPoint().getId();
|
||||
List<XppRecord> xppRecordList = map_xppRecord.get(Integer.parseInt(key2));
|
||||
//log.info("XppRecord=======" + new Date() + "====");
|
||||
if(inv.getStockCode()!=null){
|
||||
key2+=inv.getStockCode();
|
||||
}
|
||||
if (inv.getQueuedQty() > 0) {
|
||||
throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数");
|
||||
}
|
||||
//log.info("现品票处理===" + iii + "====" + new Date() + "====" + xppRecordList.size());
|
||||
for (XppRecord xpp : xppRecordList) {
|
||||
xpp.setInvPoint(d.getDstPoint());
|
||||
xpp.setArea(d.getDstPoint().getArea());
|
||||
xpp.setCountCode(countMove.getCode());
|
||||
xppRecordService.update(xpp);
|
||||
inventoryLogService.storeInventoryLog(BizStatus.COUNT_MOVE, BizStatus.REDUCE, countMove.getCode(), inv.getArea(), itemKey, d.getSrcPoint(), d.getDstPoint(), inv.getZzkw(), xpp.getNrs() + 0d, xpp.getNrs() + 0d, xpp.getEwm(),
|
||||
BizStatus.COUNT, xpp.getId(), inv.getId(), "盘点移位" + d.getDstPoint().getArea().getCode());
|
||||
d.setCountQty(d.getCountQty() + xpp.getNrs());
|
||||
countMoveDetailService.update(d);
|
||||
CountMoveDetailRecord countMoveDetailRecord = new CountMoveDetailRecord();
|
||||
countMoveDetailRecord.setCountMove(countMove);
|
||||
countMoveDetailRecord.setCountMoveDetail(d);
|
||||
countMoveDetailRecord.setXppEwm(xpp.getEwm());
|
||||
countMoveDetailRecord.setCountQty(xpp.getNrs() + 0d);
|
||||
countMoveDetailRecord.setXpp(xpp);
|
||||
countMoveDetailRecord.setSrcPoint(d.getSrcPoint());
|
||||
countMoveDetailRecord.setCountPoint(d.getDstPoint());
|
||||
countMoveDetailRecord.setItemKey(d.getItemKey());
|
||||
countMoveDetailRecord.setStatus(BizStatus.OPEN);
|
||||
countMoveDetailRecordService.create(countMoveDetailRecord);
|
||||
List<XppRecord> xppRecordList =new ArrayList<>();
|
||||
if(map_xppRecord!=null&&map_xppRecord.size()>0) {
|
||||
xppRecordList=map_xppRecord.get(key2);
|
||||
}
|
||||
//log.info("XppRecord=======" + new Date() + "====");
|
||||
|
||||
//log.info("现品票处理===" + iii + "====" + new Date() + "====" + xppRecordList.size());
|
||||
if(xppRecordList!=null&&xppRecordList.size()>0) {
|
||||
for (XppRecord xpp : xppRecordList) {
|
||||
xpp.setInvPoint(d.getDstPoint());
|
||||
xpp.setArea(d.getDstPoint().getArea());
|
||||
xpp.setCountCode(countMove.getCode());
|
||||
xppRecordService.update(xpp);
|
||||
inventoryLogService.storeInventoryLog(BizStatus.COUNT_MOVE, BizStatus.REDUCE, countMove.getCode(), inv.getArea(), itemKey, d.getSrcPoint(), d.getDstPoint(), inv.getZzkw(), xpp.getNrs() + 0d, xpp.getNrs() + 0d, xpp.getEwm(),
|
||||
BizStatus.COUNT, xpp.getId(), inv.getId(), "盘点移位" + d.getDstPoint().getArea().getCode());
|
||||
d.setCountQty(d.getCountQty() + xpp.getNrs());
|
||||
countMoveDetailService.update(d);
|
||||
createCountMoveDetailRecord(countMove,d,xpp);
|
||||
//查找目标库位是否有库存,有则数量累加,没有新建
|
||||
Inventory newInv = inventoryService.getInventory(itemKey, d.getDstPoint().getArea(), d.getDstPoint(), inv.getZzkw(), dept, BizStatus.COUNT_MOVE, null);
|
||||
newInv.setQuantity(newInv.getQuantity() + xpp.getNrs());
|
||||
inventoryService.update(newInv);
|
||||
inv.setQuantity(inv.getQuantity() - xpp.getNrs());
|
||||
inventoryService.update(inv);
|
||||
}
|
||||
}else{
|
||||
createCountMoveDetailRecord(countMove,d,null);
|
||||
//查找目标库位是否有库存,有则数量累加,没有新建
|
||||
Inventory newInv = inventoryService.getInventory(itemKey, d.getDstPoint().getArea(), d.getDstPoint(), inv.getZzkw(), dept, BizStatus.COUNT_MOVE,null);
|
||||
newInv.setQuantity(newInv.getQuantity() + xpp.getNrs());
|
||||
Inventory newInv = inventoryService.getInventory(itemKey, d.getDstPoint().getArea(), d.getDstPoint(), inv.getZzkw(), dept, BizStatus.COUNT_MOVE, d.getSrcStockCode());
|
||||
newInv.setQuantity(newInv.getQuantity() + d.getOrderQty());
|
||||
inventoryService.update(newInv);
|
||||
inv.setQuantity(inv.getQuantity() - xpp.getNrs());
|
||||
inv.setQuantity(inv.getQuantity() - d.getOrderQty());
|
||||
inventoryService.update(inv);
|
||||
}
|
||||
}
|
||||
|
|
@ -326,4 +348,21 @@ public class CountMoveServiceImpl implements CountMoveService {
|
|||
countMove.setStatus(BizStatus.COUNT_ALL);
|
||||
this.update(countMove);
|
||||
}
|
||||
|
||||
CountMoveDetailRecordDto createCountMoveDetailRecord(CountMove countMove,CountMoveDetail d,XppRecord xpp){
|
||||
CountMoveDetailRecord countMoveDetailRecord = new CountMoveDetailRecord();
|
||||
countMoveDetailRecord.setCountMove(countMove);
|
||||
countMoveDetailRecord.setCountMoveDetail(d);
|
||||
if(xpp!=null) {
|
||||
countMoveDetailRecord.setXppEwm(xpp.getEwm());
|
||||
countMoveDetailRecord.setCountQty(xpp.getNrs() + 0d);
|
||||
countMoveDetailRecord.setXpp(xpp);
|
||||
}
|
||||
countMoveDetailRecord.setSrcPoint(d.getSrcPoint());
|
||||
countMoveDetailRecord.setCountPoint(d.getDstPoint());
|
||||
countMoveDetailRecord.setItemKey(d.getItemKey());
|
||||
countMoveDetailRecord.setStatus(BizStatus.OPEN);
|
||||
countMoveDetailRecord.setSrcStockCode(d.getSrcStockCode());
|
||||
return countMoveDetailRecordService.create(countMoveDetailRecord);
|
||||
}
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Inventory> queryInventoryAllocate(long itemId, long areaId,Long zzkwId,String stockCode,String propC2,String type) {
|
||||
public List<Inventory> queryInventoryAllocate(long itemId, long areaId,Long zzkwId,Long pointId,String stockCode,String propC2,String type) {
|
||||
String hql = " from Inventory inv where 1=1 " +
|
||||
" and inv.itemKey.item.id=" + itemId + " " +
|
||||
" and inv.quantity-inv.queuedQty>0 and inv.quantity>0 and inv.point.code !='BH_ZC'";
|
||||
|
|
@ -157,16 +157,23 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
hql+=" and inv.area.id=" + areaId + " ";
|
||||
hql+=" and inv.zzkw.id="+zzkwId;
|
||||
hql+="and inv.point.type in ('"+BaseStatus.HCKW+"','"+BaseStatus.ZZKW+"')";
|
||||
}
|
||||
if(pointId!=null){
|
||||
hql+=" and inv.point.id="+pointId;
|
||||
}else{
|
||||
hql+="and inv.point.type='"+BaseStatus.CH+"' ";
|
||||
}
|
||||
if(type.equals(BaseStatus.ZCCK)) {
|
||||
if (stockCode != null) {
|
||||
hql += " and inv.stockCode='" + stockCode + "'";
|
||||
} else {
|
||||
if(type.equals(BaseStatus.ZZJL)) {
|
||||
hql+="and inv.point.type='"+BaseStatus.CH+"'";
|
||||
}
|
||||
if(stockCode!=null){
|
||||
hql += " and inv.stockCode='" + stockCode + "'";
|
||||
}else{
|
||||
if(type.equals(BaseStatus.ZCCK)) {//非箱单出库需出无箱单品番,其他出库只需要满足库存即可出库
|
||||
hql += " and inv.stockCode is null";
|
||||
}
|
||||
}
|
||||
|
||||
if(propC2!=null){
|
||||
hql+=" and inv.itemKey.propC2='"+propC2+"'";
|
||||
}
|
||||
|
|
@ -234,13 +241,13 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
if (dept != null) {
|
||||
hql += " and inv.dept.id=" + dept.getId() + " ";
|
||||
}
|
||||
if(area.getBexb()) {
|
||||
if (zzkw != null) {
|
||||
hql += " and inv.zzkw.id=" + zzkw.getId() + " ";
|
||||
}else{
|
||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "线边仓制造库位必填");
|
||||
}
|
||||
}
|
||||
// if(area.getBexb()) {
|
||||
// if (zzkw != null) {
|
||||
// hql += " and inv.zzkw.id=" + zzkw.getId() + " ";
|
||||
// }else{
|
||||
// throw new BadRequestException(HttpStatus.NOT_FOUND, "线边仓制造库位必填");
|
||||
// }
|
||||
// }
|
||||
if(stockCode!=null){
|
||||
hql += " and inv.stockCode='" + stockCode + "' ";
|
||||
} else {
|
||||
|
|
@ -393,7 +400,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
}
|
||||
|
||||
public List<RInvQuery> queryInvApp(String code,String pointCode) {
|
||||
String sql = "SELECT inv.id invId,it.`code` itemCode,it.name itemName,inv.quantity qty,ik.prop_C1 propD1,p.code pointCode FROM `data_inventory` inv \n" +
|
||||
String sql = "SELECT inv.id invId,it.`code` itemCode,it.name itemName,inv.quantity qty,ik.prop_C1 propC1,ik.prop_C2 propC2,p.code pointCode FROM `data_inventory` inv \n" +
|
||||
"left join data_item_key ik on ik.id=inv.item_key_id\n" +
|
||||
"left join base_item it on it.id=ik.item_id\n" +
|
||||
"left join base_point p on p.id=inv.point_id \n" +
|
||||
|
|
@ -423,7 +430,8 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
if (pickDetail.getOrderQty() > pickDetail.getPickedQty()) {
|
||||
Long zzkwId = null;
|
||||
Long areaId = 0L;
|
||||
List<Inventory> invs = this.queryInventoryAllocate(item.getId(), areaId, zzkwId, null, pickDetail.getPropC2(), BaseStatus.ZZJL);
|
||||
this.queryInventoryAllocate(item.getId(), areaId,zzkwId,null,pickDetail.getPo(),pickDetail.getPropC2(), BaseStatus.ZZJL);
|
||||
List<Inventory> invs =this.queryInventoryAllocate(item.getId(), areaId,zzkwId,null,pickDetail.getPo(),pickDetail.getPropC2(), BaseStatus.ZZJL);
|
||||
for(Inventory inv:invs){
|
||||
XdInventory xd=new XdInventory();
|
||||
xd.setInvId(inv.getId());
|
||||
|
|
|
|||
|
|
@ -205,29 +205,35 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
Item item = pd.getItem();
|
||||
String billCode=null;
|
||||
Long areaId=0L;
|
||||
Long pointId=null;
|
||||
if(type.equals(BaseStatus.QTCK)
|
||||
&&pd.getPoint()!=null){
|
||||
pointId=pd.getPoint().getId();
|
||||
}
|
||||
if (pd.getOrderQty() > pd.getAllocatedQty()) {
|
||||
Long zzkwId=null;
|
||||
if(pickTicket!=null){
|
||||
if(pd.getPoint()!=null&&pickTicket.getArea().getBexb()){
|
||||
zzkwId=pd.getPoint().getId();
|
||||
if(pd.getPoint()!=null&&pickTicket.getArea()!=null){
|
||||
if(pickTicket.getArea().getBexb()) {
|
||||
zzkwId = pd.getPoint().getId();
|
||||
}
|
||||
areaId= pickTicket.getArea().getId();
|
||||
}
|
||||
areaId= pickTicket.getArea().getId();
|
||||
billCode=pickTicket.getCode();
|
||||
}
|
||||
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(),areaId,zzkwId,stockCode,pd.getPropC2(),type);
|
||||
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(),areaId,zzkwId,pointId,stockCode,pd.getPropC2(),type);
|
||||
if (invs.size() > 0) {
|
||||
double allocateQty = 0;
|
||||
double unQty = quantity;//未分配数量
|
||||
double srs=item.getExtendD3();
|
||||
Map<String,String> map=new HashMap<>();
|
||||
for (Inventory inv : invs) {
|
||||
if(inv.getStockCode()!=null&&pd.getPo()==null){
|
||||
if(inv.getStockCode()!=null&&pd.getPo()==null&&!type.equals(BaseStatus.QTCK)){
|
||||
//回写推荐托盘即可
|
||||
pd.setStatus(BizStatus.ALLOCATE);
|
||||
pd.setArea(inv.getArea());
|
||||
pd.setCkPoint(inv.getPoint());
|
||||
map.put(inv.getId()+"",inv.getStockCode()+"]"+inv.getItemKey().getPropC1()+"]"+inv.getPoint().getCode()+"]"+inv.getQuantity());
|
||||
|
||||
continue;
|
||||
}
|
||||
Point startPoint = inv.getPoint();//原库位
|
||||
|
|
@ -272,6 +278,9 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
}
|
||||
//备货表上出单日期(审核写)
|
||||
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
|
||||
if(pickTicket.getArea()==null){
|
||||
pickTicket.setArea(inv.getArea());
|
||||
}
|
||||
pickTicketRepository.save(pickTicket);
|
||||
}
|
||||
if(pd.getAllocatedQty()>0) {
|
||||
|
|
@ -409,12 +418,14 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
}
|
||||
|
||||
public List<ZzjlPickList> queryZzjlPickList(String itemCode,String areaName) {
|
||||
String sql="SELECT d.id detail_id,IFNULL(a.name,\"\") area_name,s.`name` s_area_name,it.code item_code,it.name item_name, p.code point_code,d.prop_c2 bonded,d.order_qty,d.allocated_qty,d.picked_qty,d.create_by,d.create_time\n" +
|
||||
String sql="SELECT d.id detail_id,IFNULL(a.name,\"\") area_name,IFNULL(ck_point.code,\"\") ck_point_code," +
|
||||
"d.be_xd_pf,s.`name` s_area_name,it.code item_code,it.name item_name, p.code point_code,d.prop_c2 bonded,d.order_qty,d.allocated_qty,d.picked_qty,d.create_by,d.create_time\n" +
|
||||
" from data_pick_detail d\n" +
|
||||
" LEFT JOIN base_item it on it.id=d.item_id\n" +
|
||||
" left JOIN base_point p on p.id=d.point_id\n" +
|
||||
" left join base_area a on a.id=d.area_id\n" +
|
||||
" left join base_area s on s.id=d.sh_area_id\n" +
|
||||
" left join base_point ck_point on ck_point.id=d.ck_point_id\n" +
|
||||
" where 1=1 and d.type='ZZJL' and d.picked_qty=0 ";
|
||||
|
||||
if(areaName!=null&&!areaName.equals("")){
|
||||
|
|
|
|||
|
|
@ -360,8 +360,12 @@ public class TaskServiceImpl implements TaskService {
|
|||
hql+=" and t.asnDetail.id="+asnDetailId+" and t.taskType='ASN'";
|
||||
}else if(pickDetailId!=null){
|
||||
hql+=" and t.taskType='PICK' and t.pickDetail.id="+pickDetailId;
|
||||
}else if(ikId!=null){
|
||||
hql+=" and t.pickDetail.pickTicket.id="+pickId+" and t.itemKey.id="+ikId;
|
||||
}
|
||||
if(ikId!=null){
|
||||
hql+=" and t.itemKey.id="+ikId;
|
||||
}
|
||||
if(pickId!=null){
|
||||
hql+=" and t.pickDetail.pickTicket.id="+pickId;
|
||||
}
|
||||
if(srcPointId!=null){
|
||||
hql+=" and t.srcPoint.id="+srcPointId;
|
||||
|
|
|
|||
|
|
@ -421,11 +421,11 @@ public class XppRecordServiceImpl implements XppRecordService {
|
|||
if (item==null){
|
||||
throw new BadRequestException("部品品番不存在");
|
||||
}
|
||||
// if(type!=null) {
|
||||
// XppRecord xppRecord = xppRecordRepository.findByEwmType(ewm, type);
|
||||
// if (xppRecord != null) {
|
||||
// throw new BadRequestException("二维码已采集");
|
||||
// }
|
||||
// if(type!=null&&type.equals(BillParmType.XPP_1001)) {
|
||||
XppRecord xppRecord = xppRecordRepository.findByEwmType(ewm, type);
|
||||
if (xppRecord != null) {
|
||||
throw new BadRequestException("二维码已采集");
|
||||
}
|
||||
// }
|
||||
RRkXpp xpp = new RRkXpp();
|
||||
xpp.setItemCode(item.getCode());
|
||||
|
|
|
|||
|
|
@ -116,6 +116,12 @@ public interface BaseStatus {
|
|||
*/
|
||||
public static String ZCCK = "ZCCK";
|
||||
|
||||
|
||||
/**
|
||||
* 出库指示-其他指示
|
||||
*/
|
||||
public static String QTCK = "QTCK";
|
||||
|
||||
/**
|
||||
* 出库指示-留样出库
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue