diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/Item.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/Item.java
index bda9951..9db387e 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/domain/Item.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/Item.java
@@ -217,6 +217,22 @@ public class Item extends BaseEntity implements Serializable {
@ApiModelProperty(value = "库位")
private Point point;
+ @Column(name = "`AC`")
+ @ApiModelProperty(value = "A/C")
+ private String ac;
+
+ @Column(name = "`contents`")
+ @ApiModelProperty(value = "加工内容")
+ private String contents;
+
+ @Column(name = "`xz`")
+ @ApiModelProperty(value = "箱种")
+ private String xz;
+
+ @Column(name = "`srs`")
+ @ApiModelProperty(value = "收容数")
+ private int srs=0;
+
public void copy(Item source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/Point.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/Point.java
index 96a40ff..5c07856 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/domain/Point.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/Point.java
@@ -118,6 +118,10 @@ public class Point extends BaseEntity implements Serializable {
@Column(name = "`sort_index`")
@ApiModelProperty(value = "排序")
private int sortIndex=0;
+
+ @Column(name = "`inv_min`")
+ @ApiModelProperty(value = "库存下限")
+ private int invMin=0;
public void copy(Point source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/AreaRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/AreaRepository.java
index 01c2839..1f8307d 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/repository/AreaRepository.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/AreaRepository.java
@@ -17,6 +17,7 @@ package com.youchain.basicdata.repository;
import com.youchain.basicdata.domain.Area;
import com.youchain.basicdata.domain.BigItem;
+import com.youchain.basicdata.domain.Point;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
@@ -57,4 +58,7 @@ public interface AreaRepository extends JpaRepository , JpaSpecificat
@Query(value = "SELECT * FROM base_area t where t.code in ('A仓','S仓')", nativeQuery = true)
List getBomOutAreas();
+
+ @Query("from Area i where i.name in (:codes) and i.enabled=true ")
+ List queryByAreaCodes(List codes);
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountRepository.java
index 7893c81..658125e 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountRepository.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountRepository.java
@@ -75,20 +75,34 @@ public interface BomAccountRepository extends JpaRepository, J
//获得所有BOM标签
//SUBSTRING(bi.master_name, 1, CEIL(CHAR_LENGTH(bi.master_name)/2))
@Query(value = "select max(ba.id) id ,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 " +
+ " GROUP_CONCAT(bi.master_name, ';') AS jxs ,GROUP_CONCAT(ba.singles, ';') AS tyls " +
"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" +
" left join base_area area on area.id=ba.r_area_id" +
- " where ba.bp_type=:dxw and (it.code=:itemCode or :itemCode is null) and (point.code=: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=:hw or :hw is null) " +
" 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 " +
+ " 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" +
+ " 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 queryPrintAll(String itemCode, String hw, String ns,String kq,String dxw);
+ List queryPrintAll_old(String bigItemCode,String itemCode, String hw, String ns,String kq,String bp_type,String tckw,String supplier,String dxw);
+ @Query(value = "select ba.id id ,it.code, ba.ns,it.name pm,point.code hw,ba.xz,ba.srs,ba.bonded," +
+ "ba.supplier,bi.master_name AS jxs ,ba.singles AS tyls " +
+ "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" +
+ " left join base_area area on area.id=ba.r_area_id" +
+ " where (ba.bp_type=:bp_type or :bp_type is null) and (it.code=:itemCode or :itemCode is null) and (point.code=:hw or :hw is null) " +
+ " and (area.code=:kq or :kq is null) and (ba.ns=:ns or :ns is null)" +
+ " 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 queryPrintAll(String bigItemCode,String itemCode, String hw, String ns,String kq,String bp_type,String tckw,String supplier,String dxw);
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/PointRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/PointRepository.java
index 83be4de..0870cee 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/repository/PointRepository.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/PointRepository.java
@@ -48,7 +48,7 @@ public interface PointRepository extends JpaRepository, JpaSpecific
@Query(value = "select p.code,area.`name` areaName from base_point p \n" +
"left join base_area area on area.id=p.area_id " +
- " where (area.name=:areaName or :areaName is null)", nativeQuery = true)
+ " where (area.name=:areaName or :areaName is null) and p.description='自由货位标签'", nativeQuery = true)
List queryPrintAll(String areaName);
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountController.java
index b64a69f..d5554cd 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountController.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountController.java
@@ -50,9 +50,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
import javax.servlet.http.HttpServletResponse;
/**
@@ -123,6 +121,42 @@ public class BomAccountController {
return new ResponseEntity<>(list,HttpStatus.OK);
}
+// @GetMapping("/bomPrintBiaoQianList/{dxw}")
+// @Log("获取Bom中库位标签")
+// @ApiOperation("获取Bom中库位标签")
+// @AnonymousAccess
+// public ResponseEntity bomPrintBiaoQianList(@PathVariable("dxw") String dxw){
+// RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
+// String json=(String)redisUtils.get(SecurityUtils.getCurrentUsername()+dxw);
+// //log.info(SecurityUtils.getCurrentUsername()+dxw+"-----"+json);
+// List list= JSONUtil.toList(json, BomPrint_BiaoQian2.class);
+// List list2=new ArrayList<>();
+// for(BomPrint_BiaoQian2 l:list){
+// BomPrint_BiaoQian bq=new BomPrint_BiaoQian();
+// String code=l.getCode().substring(0,5)+"-"+l.getCode().substring(5,l.getCode().length());
+// 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.setEwm(l.getId()+"]"+l.getCode()+"]"+l.getNs()+"]"+l.getBonded()+"]"+l.getHw());
+// bq.setBonded(l.getBonded());
+// bq.setSrs(l.getSrs());
+// bq.setXz(l.getXz());
+// bq.setSupplier(l.getSupplier());
+// bq.setId(l.getId());
+// bq.setJxs(l.getJxs() == null ? null :
+// Arrays.stream(l.getJxs().split(";"))
+// .map(s -> s.length() > 16 ? s.substring(0, 16) : s)
+// .toArray(String[]::new));
+// bq.setTyls(l.getTyls()==null?null:l.getTyls().split(";"));
+// list2.add(bq);
+// }
+// return new ResponseEntity<>( list2,HttpStatus.OK);
+// }
+
+
@GetMapping("/bomPrintBiaoQianList/{dxw}")
@Log("获取Bom中库位标签")
@ApiOperation("获取Bom中库位标签")
@@ -132,9 +166,29 @@ public class BomAccountController {
String json=(String)redisUtils.get(SecurityUtils.getCurrentUsername()+dxw);
//log.info(SecurityUtils.getCurrentUsername()+dxw+"-----"+json);
List list= JSONUtil.toList(json, BomPrint_BiaoQian2.class);
- List list2=new ArrayList<>();
+ HashMap> map=new HashMap<>();
+ List 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 list2=map.get(key);
+ list2.add(l);
+ map.put(key,list2);
+ }else{
+ List list2=new ArrayList<>();
+ list2.add(l);
+ map.put(key,list2);
+ sortList.add(key);
+ }
+ }
+ List list2=new ArrayList<>();
+// for (String key : map.keySet()) {
+ for(String key:sortList){
+ log.info(key);
+ List bqs=map.get(key);
BomPrint_BiaoQian bq=new BomPrint_BiaoQian();
+ BomPrint_BiaoQian2 l=bqs.get(0);
String code=l.getCode().substring(0,5)+"-"+l.getCode().substring(5,l.getCode().length());
bq.setNs(l.getNs()+"/"+code);
bq.setCode(code);
@@ -142,19 +196,31 @@ public class BomAccountController {
hw=hw.substring(0,3)+"-"+hw.substring(3,hw.length());
bq.setHw(hw);
bq.setPm(l.getPm());
- bq.setEwm(l.getId()+"]"+l.getCode()+"]"+l.getNs()+"]"+l.getBonded()+"]"+l.getHw());
+ bq.setEwm(key);
bq.setBonded(l.getBonded());
bq.setSrs(l.getSrs());
bq.setXz(l.getXz());
bq.setSupplier(l.getSupplier());
bq.setId(l.getId());
- bq.setJxs(l.getJxs() == null ? null :
- Arrays.stream(l.getJxs().split(","))
- .map(s -> s.length() > 10 ? s.substring(0, 10) : s)
- .toArray(String[]::new));
- bq.setTyls(l.getTyls()==null?null:l.getTyls().split(","));
+ String[] jxs=new String[bqs.size()];
+ String[] tyls=new String[bqs.size()];
+ for(int i=0;i {
+// String[] parts = item.getHw().split("-");
+// // 将前后部分都转换为整数进行比较
+// int firstPart = Integer.parseInt(parts[0]);
+// int secondPart = Integer.parseInt(parts[1]);
+// // 先比较前部分,再比较后部分
+// return firstPart * 1000 + secondPart;
+// }));
return new ResponseEntity<>( list2,HttpStatus.OK);
}
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/ImportDataController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/ImportDataController.java
index 996836a..2e5fc7a 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/rest/ImportDataController.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/ImportDataController.java
@@ -22,6 +22,7 @@ import com.youchain.annotation.Log;
import com.youchain.basicdata.service.ImportAsnService;
import com.youchain.basicdata.service.ImportBomAccountService;
import com.youchain.basicdata.service.ImportDataService;
+import com.youchain.basicdata.service.ImportPointService;
import com.youchain.businessdata.domain.Asn;
import com.youchain.businessdata.domain.PickDetail;
import com.youchain.businessdata.domain.PickTicket;
@@ -38,6 +39,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@@ -70,6 +72,7 @@ public class ImportDataController {
private final ImportDataService importDataService;
private final ImportAsnService importAsnService;
private final ImportBomAccountService importBomAccountService;
+ private final ImportPointService importPointService;
@Log("导入完成品品番")
@ApiOperation("导入完成品品番")
@@ -90,7 +93,7 @@ public class ImportDataController {
}
String re = importDataService.importBigItem(readAll.get(i));
}
- return new ResponseEntity("导入成功", HttpStatus.OK);
+ return new ResponseEntity("导入成功", OK);
}
@Log("导入部品品番")
@@ -115,7 +118,7 @@ public class ImportDataController {
b = b + 1;
}
}
- return new ResponseEntity("导入成功:执行" + (a + b) + "行 新增" + a + "行,修改" + b + "行", HttpStatus.OK);
+ return new ResponseEntity("导入成功:执行" + (a + b) + "行 新增" + a + "行,修改" + b + "行", OK);
}
@Log("导入其他入库")
@@ -139,7 +142,7 @@ public class ImportDataController {
throw new BadRequestException(HttpStatus.NOT_FOUND, (i + 1) + "行" + re);
}
}
- return new ResponseEntity("导入成功", HttpStatus.OK);
+ return new ResponseEntity("导入成功", OK);
}
@Log("导入其他出库")
@@ -167,7 +170,7 @@ public class ImportDataController {
// for(PickDetail d:ds) {
// pickDetailService.allocate(d.getId(),d.getOrderQty());
// }
- return new ResponseEntity("导入成功", HttpStatus.OK);
+ return new ResponseEntity("导入成功", OK);
}
@Log("导入手工指示")
@@ -178,7 +181,7 @@ public class ImportDataController {
public ResponseEntity importPickInstruction(@RequestParam("file") MultipartFile multipartFile) {
List> readAll = getMaps(multipartFile);
importDataService.importPickInstruction(readAll);
- return new ResponseEntity("导入成功", HttpStatus.OK);
+ return new ResponseEntity("导入成功", OK);
}
@Log("导入移位明细")
@@ -189,7 +192,7 @@ public class ImportDataController {
public ResponseEntity importCountMoveDetail(@RequestParam Long countId, @RequestParam("file") MultipartFile multipartFile) {
List> readAll = getMaps(multipartFile);
importDataService.importCountMoveDetail(countId, readAll);
- return new ResponseEntity("导入成功", HttpStatus.OK);
+ return new ResponseEntity("导入成功", OK);
}
@Log("导入BOM工位清单")
@@ -202,7 +205,7 @@ public class ImportDataController {
for (int i = 0; i < readAll.size(); i++) {
importDataService.importBomAccount(i, readAll.get(i));
}
- return new ResponseEntity("导入成功" + readAll.size() + "行", HttpStatus.OK);
+ return new ResponseEntity("导入成功" + readAll.size() + "行", OK);
}
@@ -234,7 +237,7 @@ public class ImportDataController {
long start = System.currentTimeMillis();
importAsnService.importAsn(file, templateType);
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
- return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), HttpStatus.OK);
+ return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), OK);
}
@Log("导入BOM多列")
@@ -247,6 +250,20 @@ public class ImportDataController {
long start = System.currentTimeMillis();
importBomAccountService.importBomAccount(multipartFile);
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
- return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), HttpStatus.OK);
+ return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), OK);
+ }
+
+
+ @Log("导入Point")
+ @ApiOperation("导入Point")
+ @PostMapping(value = "/importPoint")
+ @Transactional
+ @AnonymousAccess
+ public ResponseEntity importPoint(@RequestParam("file") MultipartFile multipartFile) {
+ log.info("开始导入");
+ long start = System.currentTimeMillis();
+ importPointService.importPoint(multipartFile);
+ log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
+ return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), OK);
}
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/PointController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/PointController.java
index 0046aef..bb99c81 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/rest/PointController.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/PointController.java
@@ -106,13 +106,13 @@ public class PointController {
ExcelReader reader = ExcelUtil.getReader(file);
int i = 0;
List> readAll = reader.readAll();
- for (i = 4000; i < readAll.size(); i++) {
+ for (i = 1; i < readAll.size(); i++) {
String code = readAll.get(i).get("编码").toString().trim();
String types = readAll.get(i).get("存储类型").toString().trim();
String areaCode = readAll.get(i).get("库区").toString().trim();
String itemCode = readAll.get(i).get("品番编码") == null ? "" : readAll.get(i).get("品番编码").toString().trim();
String beatCode = readAll.get(i).get("纳所") == null ? "" : readAll.get(i).get("纳所").toString().trim();
- String ccTYPE = readAll.get(i).get("描述") == null ? "" : readAll.get(i).get("描述").toString().trim();
+ String ccTYPE = readAll.get(i).get("标签类型") == null ? "" : readAll.get(i).get("标签类型").toString().trim();
Area area = areaService.findByCode(areaCode);
if (area == null) {
throw new BadRequestException(areaCode+"库区不存在");
@@ -159,6 +159,8 @@ public class PointController {
return new ResponseEntity<>(pointService.queryAll(criteria, pageable), HttpStatus.OK);
}
+
+
@PostMapping("/getPoints")
@Log("加载point下拉框")
@ApiOperation("加载point下拉框")
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/AreaService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/AreaService.java
index 14482ab..9dae12f 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/service/AreaService.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/AreaService.java
@@ -16,6 +16,7 @@
package com.youchain.basicdata.service;
import com.youchain.basicdata.domain.Area;
+import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.service.dto.AreaDto;
import com.youchain.basicdata.service.dto.AreaQueryCriteria;
import org.springframework.data.domain.Pageable;
@@ -91,4 +92,9 @@ public interface AreaService {
void download(List all, HttpServletResponse response) throws Exception, Exception;
List getAreas(String type);
+
+
+ List queryByAreaCodes(List codes);
+
+ Map queryByAreaCodesToMap(List codes);
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/ImportPointService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/ImportPointService.java
new file mode 100644
index 0000000..4d4792b
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/ImportPointService.java
@@ -0,0 +1,11 @@
+package com.youchain.basicdata.service;
+
+import org.springframework.web.multipart.MultipartFile;
+
+public interface ImportPointService {
+ /**
+ * 批量导入
+ * @param file 文件
+ */
+ void importPoint(MultipartFile file);
+}
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountDto.java
index 82873c2..1f14aae 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountDto.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountDto.java
@@ -45,7 +45,7 @@ public class BomAccountDto implements Serializable {
/** 机型名称 */
private String bigItemName;
/** 刻印前缀 */
- private String kyqz;
+ private String kyQz;
/** 加工内容 */
private String contents;
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountQueryCriteria.java
index b4669d5..84ce1e4 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountQueryCriteria.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountQueryCriteria.java
@@ -62,4 +62,8 @@ public class BomAccountQueryCriteria{
private String ns;
@Query
private String bp_type;
+ @Query
+ private String tckw;
+ @Query
+ private String supplier;
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemDto.java
index 073f6fc..098d494 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemDto.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemDto.java
@@ -156,4 +156,12 @@ public class ItemDto implements Serializable {
private PointDto point;
+ private String ac;
+
+ private String contents;
+
+ private String xz;
+
+ private int srs;
+
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointDto.java
index 76b6a8c..19e15bb 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointDto.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointDto.java
@@ -79,7 +79,8 @@ public class PointDto implements Serializable {
private int line;
/** 层 */
private int rows;
-
+ /**库存下限*/
+ private int invMin;
/** 排序 */
private int sortIndex;
// /** 排序 */
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AreaServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AreaServiceImpl.java
index 262e441..5f6ce8f 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AreaServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AreaServiceImpl.java
@@ -16,11 +16,9 @@
package com.youchain.basicdata.service.impl;
import cn.hutool.json.JSONUtil;
+import com.google.common.collect.Maps;
import com.youchain.basicdata.domain.Area;
-import com.youchain.basicdata.domain.Item;
-import com.youchain.basicdata.service.PointService;
-import com.youchain.basicdata.service.dto.PointDto;
-import com.youchain.basicdata.service.mapstruct.PointMapper;
+
import com.youchain.utils.*;
import lombok.RequiredArgsConstructor;
import com.youchain.basicdata.repository.AreaRepository;
@@ -29,19 +27,18 @@ import com.youchain.basicdata.service.dto.AreaDto;
import com.youchain.basicdata.service.dto.AreaQueryCriteria;
import com.youchain.basicdata.service.mapstruct.AreaMapper;
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.data.domain.Page;
import org.springframework.data.domain.Pageable;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.io.IOException;
+import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
/**
* @author HJL
@@ -57,7 +54,6 @@ public class AreaServiceImpl implements AreaService {
private final AreaRepository areaRepository;
private final AreaMapper areaMapper;
private final EntityManager entityMapper;
- private final PointService pointService;
@Override
public Map queryAll(AreaQueryCriteria criteria, Pageable pageable) {
@@ -130,4 +126,27 @@ public class AreaServiceImpl implements AreaService {
}
return null;
}
+
+
+ @Override
+ public List queryByAreaCodes(List codes) {
+ if (CollectionUtils.isEmpty(codes)) {
+ return Collections.emptyList();
+ }
+ //去重
+ codes = codes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
+ return areaRepository.queryByAreaCodes(codes);
+ }
+
+ @Override
+ public Map queryByAreaCodesToMap(List codes) {
+ List items = queryByAreaCodes(codes);
+ //封装成map
+ Map itemMap = Maps.newHashMap();
+ for (Area item : items) {
+ itemMap.put(item.getName(), item);
+ itemMap.put(item.getCode(), item);
+ }
+ return itemMap;
+ }
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountServiceImpl.java
index 0d7d1c6..ec47571 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountServiceImpl.java
@@ -89,7 +89,7 @@ public class BomAccountServiceImpl implements BomAccountService {
}
public List queryPrintAll(BomAccountQueryCriteria criteria,String dxw){
- List bomPrints=bomAccountRepository.queryPrintAll(criteria.getItemCode(),criteria.getZPointCode(),criteria.getNs(),criteria.getRAreaCode(),dxw);
+ List bomPrints=bomAccountRepository.queryPrintAll(criteria.getBigItemCode(),criteria.getItemCode(),criteria.getZPointCode(),criteria.getNs(),criteria.getRAreaCode(),criteria.getBp_type(),criteria.getTckw(),criteria.getSupplier(),dxw);
return bomPrints;
}
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportBomAccountServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportBomAccountServiceImpl.java
index 8300d0a..ce93b14 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportBomAccountServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportBomAccountServiceImpl.java
@@ -48,7 +48,7 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
//13个开始4个一循环
- List> list=FastExcelUtil.readExcelData2(file);
+ List> list=FastExcelUtil.readExcelData2(file,2);
log.info("开始导入list:"+list.size());
List dataList =new ArrayList<>();
@@ -71,27 +71,27 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
for (int ccc=0;ccc<50;ccc++){
BomEntity bomAccountImport_new=new BomEntity();
int index=ccc*4+12;
- bomAccountImport_new.setJx((map.get((index+1)) != null ? map.get((index+1)).toString() : ""));
- bomAccountImport_new.setJxdm((map.get((index+2)) != null ? map.get((index+2)).toString() : ""));
- bomAccountImport_new.setKyh((map.get((index+3)) != null ? map.get((index+3)).toString() : ""));
- bomAccountImport_new.setTyl((map.get((index+4)) != null ? map.get((index+4)).toString() : ""));
+ String tyl=(map.get((index+4)) != null ? map.get((index+4)).toString() : "");
+ if (tyl.length() > 0) {
+ bomAccountImport_new.setJxdm((map.get((index+1)) != null ? map.get((index+1)).toString() : ""));
+ bomAccountImport_new.setJx((map.get((index+2)) != null ? map.get((index+2)).toString() : ""));
+ bomAccountImport_new.setKyh((map.get((index+3)) != null ? map.get((index+3)).toString() : ""));
+ bomAccountImport_new.setTyl(tyl);
+ log.error(bomAccountImport_new.getJx()+"---"+bomAccountImport_new.getTyl()+"---"+bomAccountImport_new.getKyh());
- log.error(bomAccountImport_new.getJx()+"---"+bomAccountImport_new.getTyl());
-
- bomAccountImport_new.setPf(bomAccountImport.getPf());
- bomAccountImport_new.setNs(bomAccountImport.getNs());
- bomAccountImport_new.setPm(bomAccountImport.getPm());
- bomAccountImport_new.setGys(bomAccountImport.getGys());
- bomAccountImport_new.setAc(bomAccountImport.getAc());
- bomAccountImport_new.setJgnr(bomAccountImport.getJgnr());
- bomAccountImport_new.setZcfq(bomAccountImport.getZcfq());
- bomAccountImport_new.setHw(bomAccountImport.getHw());
- bomAccountImport_new.setXz(bomAccountImport.getXz());
- bomAccountImport_new.setSrs(bomAccountImport.getSrs());
- bomAccountImport_new.setTckw(bomAccountImport.getTckw());
- bomAccountImport_new.setDxw(bomAccountImport.getDxw());
- bomAccountImport_new.setSb(bomAccountImport.getSb());
- if (bomAccountImport_new.getTyl().length() > 0) {
+ bomAccountImport_new.setPf(bomAccountImport.getPf());
+ bomAccountImport_new.setNs(bomAccountImport.getNs());
+ bomAccountImport_new.setPm(bomAccountImport.getPm());
+ bomAccountImport_new.setGys(bomAccountImport.getGys());
+ bomAccountImport_new.setAc(bomAccountImport.getAc());
+ bomAccountImport_new.setJgnr(bomAccountImport.getJgnr());
+ bomAccountImport_new.setZcfq(bomAccountImport.getZcfq());
+ bomAccountImport_new.setHw(bomAccountImport.getHw());
+ bomAccountImport_new.setXz(bomAccountImport.getXz());
+ bomAccountImport_new.setSrs(bomAccountImport.getSrs());
+ bomAccountImport_new.setTckw(bomAccountImport.getTckw());
+ bomAccountImport_new.setDxw(bomAccountImport.getDxw());
+ bomAccountImport_new.setSb(bomAccountImport.getSb());
dataList.add(bomAccountImport_new);
}
}
@@ -107,9 +107,9 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
Map existBomAccountMap =new HashMap<>();
for(BomEntity ba:dataList){
String key=ba.pf+"]"+ba.jxdm+"]"+ba.ns+"]"+ ba.hw+"]"+ba.sb;
- if(existBomAccountMap.containsKey(key)){
- log.info(JSONUtil.toJsonStr(ba));
- }
+// if(existBomAccountMap.containsKey(key)){
+// log.info(JSONUtil.toJsonStr(ba));
+// }
existBomAccountMap.put(key,ba);
}
@@ -139,6 +139,7 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
it.setXz(data.getXz());
it.setPm(data.getPm());
it.setSrs(data.getSrs()+"");
+ it.setJgnr(data.getJgnr());
itemEntitys.put(data.getPf(),it);
BigItemEntity be=new BigItemEntity();
@@ -211,31 +212,50 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
.map(ItemEntity::getPf)
.collect(Collectors.toList());
Map existMap = itemService.queryByItemCodesToMap(allCodes);
- Map createMap = new HashMap<>();
- List existCodes = new ArrayList<>(existMap.keySet());
- // 获取两个集合的非交集说明品番不存在或失效,直接提示
- List difference = SmartStringUtil.getDifference(allCodes, existCodes);
- List- creteItems=new ArrayList<>();
- for(String pf:difference){
- ItemEntity it=entitys.get(pf);
- Item entity=new Item();
- entity.setCode(pf);
- entity.setName(it.pm);
- entity.setExtendD3(Double.parseDouble(it.srs));
- entity.setDept(UserUtils.getDept());
- creteItems.add(entity);
- }
- if(CollectionUtils.isNotEmpty(creteItems)){
- List
- createEntityList= itemRepository.saveAll(creteItems);
- for (Item it:createEntityList){
- createMap.put(it.getCode(),it);
- }
- }
Map
totalMap = new HashMap<>();
- if (existMap != null) {
- totalMap.putAll(existMap);
+ //已存在更新,不存在创建
+ for(String code:allCodes){
+ ItemEntity itemEntity=entitys.get(code);
+ Item it=existMap.get(code);
+ if(it==null){
+ it=new Item();
+ it.setDept(UserUtils.getDept());
+ it.setCode(code);
+ it.setEnabled(Boolean.TRUE);
+ }
+ it.setName(itemEntity.pm);
+ it.setXz(itemEntity.xz);
+ it.setSrs(Integer.parseInt(itemEntity.srs));
+ it.setExtendD3(Double.parseDouble(itemEntity.srs));
+ it.setAc(itemEntity.ac);
+ it.setContents(itemEntity.jgnr);
+ itemRepository.save(it);
+ totalMap.put(it.getCode(),it);
}
- totalMap.putAll(createMap);
+// Map createMap = new HashMap<>();
+// List existCodes = new ArrayList<>(existMap.keySet());
+// // 获取两个集合的非交集说明品番不存在或失效,直接提示
+// List difference = SmartStringUtil.getDifference(allCodes, existCodes);
+// List- creteItems=new ArrayList<>();
+// for(String pf:difference){
+// ItemEntity it=entitys.get(pf);
+// Item entity=new Item();
+// entity.setCode(pf);
+// entity.setName(it.pm);
+// entity.setExtendD3(Double.parseDouble(it.srs));
+// entity.setDept(UserUtils.getDept());
+// creteItems.add(entity);
+// }
+// if(CollectionUtils.isNotEmpty(creteItems)){
+// List
- createEntityList= itemRepository.saveAll(creteItems);
+// for (Item it:createEntityList){
+// createMap.put(it.getCode(),it);
+// }
+// }
+// if (existMap != null) {
+// totalMap.putAll(existMap);
+// }
+// totalMap.putAll(createMap);
return totalMap;
}
@@ -245,69 +265,22 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
.map(BigItemEntity::getCode)
.collect(Collectors.toList());
Map
existMap = bigItemService.queryByBigItemCodesToMap(allCodes);
- Map createMap = new HashMap<>();
- List existCodes = new ArrayList<>(existMap.keySet());
- // 获取两个集合的非交集说明品番不存在或失效,直接提示
- List difference = SmartStringUtil.getDifference(allCodes, existCodes);
- List createEntitys=new ArrayList<>();
- for(String code:difference){
- BigItemEntity bi=entitys.get(code);
- BigItem entity=new BigItem();
- entity.setCode(code);
- entity.setName(bi.getName());
- entity.setDeptId(UserUtils.getDept().getId());
- entity.setModels("无");
- entity.setMasterName(bi.getName());
- entity.setEnabled(true);
- entity.setDeptId(UserUtils.getDept().getId());
- createEntitys.add(entity);
- }
- if(CollectionUtils.isNotEmpty(createEntitys)){
- List createEntityList= bigItemRepository.saveAll(createEntitys);
- for (BigItem it:createEntityList){
- createMap.put(it.getCode(),it);
- }
- }
Map totalMap = new HashMap<>();
- if (existMap != null) {
- totalMap.putAll(existMap);
- }
- totalMap.putAll(createMap);
- return totalMap;
- }
-
- //验证完成品品番
- private Map validateBigItem(List allCodes) {
- log.info(allCodes.toString());
-// Map existMap = bigItemService.queryByBigItemCodesToMap(allCodes);
- Map existMap = bigItemService.queryByBigItemNamesToMap(allCodes);
- Map createMap = new HashMap<>();
- List existCodes = new ArrayList<>(existMap.keySet());
- // 获取两个集合的非交集说明品番不存在或失效,直接提示
- List difference = SmartStringUtil.getDifference(allCodes, existCodes);
- List createEntitys=new ArrayList<>();
- for(String code:difference){
- BigItem entity=new BigItem();
- entity.setCode(code);
- entity.setName(code);
- entity.setDeptId(UserUtils.getDept().getId());
- entity.setModels("无");
- entity.setMasterName(code);
- entity.setEnabled(true);
- entity.setDeptId(UserUtils.getDept().getId());
- createEntitys.add(entity);
- }
- if(CollectionUtils.isNotEmpty(createEntitys)){
- List createEntityList= bigItemRepository.saveAll(createEntitys);
- for (BigItem it:createEntityList){
- createMap.put(it.getCode(),it);
+ for(String code:allCodes){
+ BigItemEntity bigItemEntity=entitys.get(code);
+ BigItem bigItem=existMap.get(code);
+ if(bigItem==null){
+ bigItem=new BigItem();
+ bigItem.setCode(code);
+ bigItem.setDeptId(UserUtils.getDept().getId());
+ bigItem.setEnabled(true);
+ bigItem.setDeptId(UserUtils.getDept().getId());
}
+ bigItem.setName(bigItemEntity.getName());//更新名称
+ bigItem.setMasterName(bigItemEntity.getName());
+ bigItemRepository.save(bigItem);
+ totalMap.put(code,bigItem);
}
- Map totalMap = new HashMap<>();
- if (existMap != null) {
- totalMap.putAll(existMap);
- }
- totalMap.putAll(createMap);
return totalMap;
}
//验证库位
@@ -421,186 +394,4 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
ba.setKyQz(data.getKyh());
return ba;
}
-
- public BomEntity createBomEntity(BomAccountImport data,String jx,int tyl){
- BomEntity entity = new BomEntity();
- entity.setNs(data.getNs());
- entity.setPf(data.getPf());
- entity.setPm(data.getPm());
- entity.setGys(data.getGys());
- entity.setAc(data.getAc());
- entity.setJgnr(data.getJgnr());
- entity.setZcfq(data.getZcfq());
- entity.setHw(data.getHw());
- entity.setXz(data.getXz());
- entity.setSrs(Integer.parseInt(data.getSrs()));
- entity.setTckw(data.getTckw());
- entity.setDxw(data.getDxw());
- entity.setSb(data.getSb());
- entity.setJx(jx);
- //entity.setTyl(tyl);
- return entity;
- }
-
- /*public List batchBomEntitys(BomAccountImport data, List bomEntitys){
- if(data.getZcfq().equals("制造库位")) {
- if (StringUtils.isNotEmpty(data.getTyl1())) {
- BomEntity entity = createBomEntity(data, data.getJx1(), Integer.parseInt(data.getTyl1()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl2())) {
- BomEntity entity = createBomEntity(data, data.getJx2(), Integer.parseInt(data.getTyl2()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl3())) {
- BomEntity entity = createBomEntity(data, data.getJx3(), Integer.parseInt(data.getTyl3()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl4())) {
- BomEntity entity = createBomEntity(data, data.getJx4(), Integer.parseInt(data.getTyl4()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl5())) {
- BomEntity entity = createBomEntity(data, data.getJx5(), Integer.parseInt(data.getTyl5()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl6())) {
- BomEntity entity = createBomEntity(data, data.getJx6(), Integer.parseInt(data.getTyl6()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl7())) {
- BomEntity entity = createBomEntity(data, data.getJx7(), Integer.parseInt(data.getTyl7()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl8())) {
- BomEntity entity = createBomEntity(data, data.getJx8(), Integer.parseInt(data.getTyl8()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl9())) {
- BomEntity entity = createBomEntity(data, data.getJx9(), Integer.parseInt(data.getTyl9()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl10())) {
- BomEntity entity = createBomEntity(data, data.getJx10(), Integer.parseInt(data.getTyl10()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl11())) {
- BomEntity entity = createBomEntity(data, data.getJx11(), Integer.parseInt(data.getTyl11()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl12())) {
- BomEntity entity = createBomEntity(data, data.getJx12(), Integer.parseInt(data.getTyl12()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl13())) {
- BomEntity entity = createBomEntity(data, data.getJx13(), Integer.parseInt(data.getTyl13()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl14())) {
- BomEntity entity = createBomEntity(data, data.getJx14(), Integer.parseInt(data.getTyl14()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl15())) {
- BomEntity entity = createBomEntity(data, data.getJx15(), Integer.parseInt(data.getTyl15()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl16())) {
- BomEntity entity = createBomEntity(data, data.getJx16(), Integer.parseInt(data.getTyl16()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl17())) {
- BomEntity entity = createBomEntity(data, data.getJx17(), Integer.parseInt(data.getTyl17()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl18())) {
- BomEntity entity = createBomEntity(data, data.getJx18(), Integer.parseInt(data.getTyl18()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl19())) {
- BomEntity entity = createBomEntity(data, data.getJx19(), Integer.parseInt(data.getTyl19()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl20())) {
- BomEntity entity = createBomEntity(data, data.getJx20(), Integer.parseInt(data.getTyl20()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl21())) {
- BomEntity entity = createBomEntity(data, data.getJx21(), Integer.parseInt(data.getTyl21()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl22())) {
- BomEntity entity = createBomEntity(data, data.getJx22(), Integer.parseInt(data.getTyl22()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl23())) {
- BomEntity entity = createBomEntity(data, data.getJx23(), Integer.parseInt(data.getTyl23()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl24())) {
- BomEntity entity = createBomEntity(data, data.getJx24(), Integer.parseInt(data.getTyl24()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl25())) {
- BomEntity entity = createBomEntity(data, data.getJx25(), Integer.parseInt(data.getTyl25()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl26())) {
- BomEntity entity = createBomEntity(data, data.getJx26(), Integer.parseInt(data.getTyl26()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl27())) {
- BomEntity entity = createBomEntity(data, data.getJx27(), Integer.parseInt(data.getTyl27()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl28())) {
- BomEntity entity = createBomEntity(data, data.getJx28(), Integer.parseInt(data.getTyl28()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl29())) {
- BomEntity entity = createBomEntity(data, data.getJx29(), Integer.parseInt(data.getTyl29()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl30())) {
- BomEntity entity = createBomEntity(data, data.getJx30(), Integer.parseInt(data.getTyl30()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl31())) {
- BomEntity entity = createBomEntity(data, data.getJx21(), Integer.parseInt(data.getTyl31()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl32())) {
- BomEntity entity = createBomEntity(data, data.getJx22(), Integer.parseInt(data.getTyl32()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl33())) {
- BomEntity entity = createBomEntity(data, data.getJx23(), Integer.parseInt(data.getTyl33()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl34())) {
- BomEntity entity = createBomEntity(data, data.getJx24(), Integer.parseInt(data.getTyl34()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl35())) {
- BomEntity entity = createBomEntity(data, data.getJx25(), Integer.parseInt(data.getTyl35()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl36())) {
- BomEntity entity = createBomEntity(data, data.getJx26(), Integer.parseInt(data.getTyl36()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl37())) {
- BomEntity entity = createBomEntity(data, data.getJx27(), Integer.parseInt(data.getTyl37()));
- bomEntitys.add(entity);
- }
- if (StringUtils.isNotEmpty(data.getTyl38())) {
- BomEntity entity = createBomEntity(data, data.getJx28(), Integer.parseInt(data.getTyl38()));
- bomEntitys.add(entity);
- }
- }else{
- BomEntity entity = createBomEntity(data, BaseStatus.DEFAULT_CG_BIG, 0);
- bomEntitys.add(entity);
- }
- return bomEntitys;
- }*/
-
}
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportDataServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportDataServiceImpl.java
index 1baa931..6d452c6 100644
--- a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportDataServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportDataServiceImpl.java
@@ -93,7 +93,7 @@ public class ImportDataServiceImpl implements ImportDataService {
String bp_type = readAll.get("部品种类") == null ? null : readAll.get("部品种类").toString();
BigItem bigItem = null;
- if (bigItemCode.length() > 0) {
+ if (bigItemCode!=null&&!bigItemCode.equals("")) {
bigItem = bigItemRepository.findByCode(bigItemCode);
if (bigItem == null) {
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + bigItemCode + "完成品品番无效");
diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportPointServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportPointServiceImpl.java
new file mode 100644
index 0000000..d372b41
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportPointServiceImpl.java
@@ -0,0 +1,146 @@
+package com.youchain.basicdata.service.impl;
+
+import com.youchain.basicdata.domain.Area;
+import com.youchain.basicdata.domain.BillType;
+import com.youchain.basicdata.domain.Item;
+import com.youchain.basicdata.domain.Point;
+import com.youchain.basicdata.repository.BillTypeRepository;
+import com.youchain.basicdata.repository.PointRepository;
+import com.youchain.basicdata.service.*;
+import com.youchain.businessdata.domain.Asn;
+import com.youchain.businessdata.domain.AsnDetail;
+import com.youchain.businessdata.inputJson.imports.BaseImport;
+import com.youchain.businessdata.inputJson.imports.PointImport;
+import com.youchain.businessdata.inputJson.imports.invoicePackingImport;
+import com.youchain.businessdata.repository.AsnDetailRepository;
+import com.youchain.businessdata.repository.AsnRepository;
+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 ImportPointServiceImpl implements ImportPointService {
+
+ private final PointRepository pointRepository;
+
+ private final PointService pointService;
+
+ private final AreaService areaService;
+
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void importPoint(MultipartFile file) {
+
+ // 验证模板类型是否正确
+ isValidTemplateType(file);
+
+ // 根据模板类型进行不同的处理
+ baseImportTemplate(file);
+ }
+
+ // 处理标准模板
+ @Transactional
+ public void baseImportTemplate(MultipartFile file) {
+ // 读取sheet数据
+ List dataList = FastExcelUtil.readExcelData(file, PointImport.class, 0, 1);
+
+ //批量导入
+ importPointData(dataList);
+ }
+
+ /**
+ * 处理批量导入
+ */
+ private void importPointData(List dataList) {
+ // TODO: 实现批量导入逻辑
+ log.info("处理批量导入,数据条数: {}", dataList.size());
+
+ //获取文件中所有的库位编码
+ List pointcodes = dataList.stream().map(PointImport::getCode).collect(Collectors.toList());
+ pointcodes = pointcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
+ Map exitPointMap = validatePoint(pointcodes);
+
+ //获取文件中所有的库区名称
+ List areaNames = dataList.stream().map(PointImport::getAreaName).collect(Collectors.toList());
+ areaNames = areaNames.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
+ Map exitAreaMap = validateArea(areaNames);
+
+ for (PointImport data : dataList) {
+ Point point = exitPointMap.get(data.getCode());
+ if (point == null) {
+ point=new Point();
+ point.setCode(data.getCode());
+ point.setDept(UserUtils.getDept());
+ point.setCreateBy(SecurityUtils.getCurrentUsername());
+ point.setCreateTime(new Timestamp(new Date().getTime()));
+ point.setEnabled(Boolean.TRUE);
+ }
+ point.setArea(exitAreaMap.get(data.getAreaName()));
+ String lx = data.getType();
+ if (lx.equals("材管库位")) {
+ lx = BaseStatus.CH;
+ } else if (lx.equals("制造库位")) {
+ lx = BaseStatus.ZZKW;
+ }else if (lx.equals("缓存库位")) {
+ lx = BaseStatus.HCKW;
+ }
+ point.setType(data.getType());
+ point.setBeatCode(data.getNs());
+ point.setDescription(data.getBqlx());
+ point.setItemCode(data.getItemCode());
+ pointRepository.save(point);
+ }
+ }
+
+ //验证库位
+ private Map validatePoint(List codes) {
+ Map existMap = pointService.queryByPointCodesToMap(codes);
+ return existMap;
+ }
+
+ //验证库区
+ private Map validateArea(List names) {
+ Map existMap = areaService.queryByAreaCodesToMap(names);
+ if (existMap.isEmpty()) {
+ throw new BadRequestException("库区不存在或已失效");
+ }
+ List existCodes = new ArrayList(existMap.keySet());
+ // 获取两个集合的非交集说明品番不存在或失效,直接提示
+ List difference = SmartStringUtil.getDifference(names, existCodes);
+ if (CollectionUtils.isNotEmpty(difference)) {
+ throw new BadRequestException(difference + "库区不存在或已失效");
+ }
+ return existMap;
+ }
+
+ //验证模板是否使用正确
+ private void isValidTemplateType(MultipartFile file) {
+ // 根据模板类型进行不同的处理
+ List requiredColumns = Arrays.asList(
+ "编码",
+ "库区",
+ "存储类型",
+ "品番编码",
+ "纳所",
+ "标签类型"
+ );
+ List headers = FastExcelUtil.readHeadContent(file, requiredColumns, 0, 0);
+ if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {
+ throw new BadRequestException("标准导入模板不正确,请确认模板信息");
+ }
+ }
+}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/XdMoveReq.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/XdMoveReq.java
new file mode 100644
index 0000000..a9bc8aa
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/XdMoveReq.java
@@ -0,0 +1,13 @@
+package com.youchain.businessdata.inputJson;
+
+import lombok.Data;
+
+@Data
+public class XdMoveReq {//箱单移位入参
+ String ewm;
+ /**库位序号*/
+ Long pointId;
+ /**箱单号*/
+ String stockCode;
+ String type;
+}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/ZzjlPickConfirm.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/ZzjlPickConfirm.java
new file mode 100644
index 0000000..01e88a6
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/ZzjlPickConfirm.java
@@ -0,0 +1,14 @@
+package com.youchain.businessdata.inputJson;
+
+import lombok.Data;
+
+@Data
+public class ZzjlPickConfirm {
+ /**序号*/
+ Long detail_id;
+ String type;
+ String view_type;
+ String scan_code;
+ String xpp;
+ String stock_code;
+}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/imports/PointImport.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/imports/PointImport.java
new file mode 100644
index 0000000..0c92a3d
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/imports/PointImport.java
@@ -0,0 +1,37 @@
+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 PointImport {
+ @ExcelProperty("编码")
+ private String code;
+
+ @ExcelProperty("库区")
+ private String areaName;
+
+ @ExcelProperty("存储类型")
+ private String type;
+
+ @ExcelProperty("品番编码")
+ private String itemCode;
+
+ @ExcelProperty("纳所")
+ private String ns;
+
+ @ExcelProperty("标签类型")
+ private String bqlx;
+
+}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/XppRecordRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/XppRecordRepository.java
index c876b61..b9d7a9d 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/repository/XppRecordRepository.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/XppRecordRepository.java
@@ -36,6 +36,10 @@ public interface XppRecordRepository extends JpaRepository, Jpa
@Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.ewm=?1", nativeQuery = true)
XppRecord findByCode(String qr);
+ @QueryHints(@QueryHint(name = "org.hibernate.cacheMode", value = "REFRESH"))
+ @Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.ewm=:ewm and xr.type=:type", nativeQuery = true)
+ XppRecord findByEwmType(String ewm,String type);
+
@Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.item_Key_id=?1 and xr.inv_Point_id=?2 and xr.status='PUTAWAY'", nativeQuery = true)
List queryXppItemKeyPoint(Long itemKeyId, Long invPointId);
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnController.java
index 2946256..fda6aa4 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnController.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnController.java
@@ -138,13 +138,16 @@ public class AsnController {
}
@PostMapping("/checkPutawayApp")
- @Log("校验托盘号-APP")
- @ApiOperation("校验托盘号-APP")
+ @Log("箱单入库-APP")
+ @ApiOperation("箱单入库-APP")
@PreAuthorize("@el.check('super:man')")
@Transactional(rollbackFor = Exception.class)
@DuplicateSubmission
public ResponseEntity checkPutawayApp(@RequestBody PutawayRequest request) {
String stockCode = request.getStockCode();
+ if(stockCode.indexOf("84")==0){
+ stockCode=stockCode.substring(2);
+ }
int checkType=request.getCheckType();
String pointCode= request.getPointCode();
if(checkType==1) {
@@ -184,6 +187,9 @@ public class AsnController {
@DuplicateSubmission
public ResponseEntity putawayApp(@RequestBody PutawayRequest request) {
String stockCode = request.getStockCode();
+ if(stockCode.indexOf("84")==0){
+ stockCode=stockCode.substring(2);
+ }
int checkType=request.getCheckType();
String pointCode= request.getPointCode();
Point point=pointRepository.findByCodeType(pointCode, BaseStatus.CH);
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnDetailController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnDetailController.java
index 7e0291a..815fe55 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnDetailController.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnDetailController.java
@@ -260,18 +260,18 @@ public class AsnDetailController {
public ResponseEntity putawayXppApp(@RequestBody IRkPut s) {
int seq=s.getSeq();
if(seq==1){
- RRkXpp map = xppRecordService.xppAnalysis(s.getEwm());
+ RRkXpp map = xppRecordService.xppAnalysis(s.getEwm(),BillParmType.XPP_1001);
return new ResponseEntity<>(map, HttpStatus.OK);
}
if (seq==2||seq==3) {//库存上架
String pointCode = s.getPointCode();
+ String[] str=pointCode.split("]");
String bomItemCode=null;
String bonded=null;
- if(seq==3){
- String[] str=pointCode.split("]");
- pointCode=str[4];
- bomItemCode=str[1];
- bonded=str[3];
+ if(str.length>1){//固定库位标签
+ pointCode=str[3];
+ bomItemCode=str[0];
+ bonded=str[2];
}
if (pointCode == null||pointCode.equals("")) {
return new ResponseEntity<>( "库位不能为空", BAD_REQUEST);
@@ -283,8 +283,10 @@ public class AsnDetailController {
Area area=point.getArea();
for(String ewm:s.getEwms()){
if(seq==2) {//收货上架
- XppRecord xppRecord = xppRecordService.saveXppRecord(ewm, point.getArea(), "1001");
+ XppRecord xppRecord = xppRecordService.saveXppRecord(ewm, point.getArea(), BillParmType.XPP_1001);
AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord);
+ asnDetail.setPropC2("课税");
+ asnDetailRepository.save(asnDetail);
asnDetailService.putawayInv(asnDetail.getId(), area.getId(), point.getId(), xppRecord.getNrs(), xppRecord.getEwm());
}else if(seq==3){//制造投料
xppRecordService.xppPutaway(ewm,bonded,bomItemCode,point);
@@ -295,8 +297,8 @@ public class AsnDetailController {
}
@PostMapping("/collectPutAway")
- @Log("现品票采集上架")
- @ApiOperation("现品票采集表")
+ @Log("现品票上架")
+ @ApiOperation("现品票上架")
@AnonymousAccess
@Transactional(rollbackFor = Exception.class)
public ResponseEntity collectPutAway(@RequestBody HashMap rk) {
@@ -304,11 +306,11 @@ public class AsnDetailController {
String type=rk.get("type").toString();
Point point=pointService.findEntityById(pointId);
String ewm=rk.get("ewm").toString();
- if(type.equals("1001")){//收货上架
+ if(type.equals(BillParmType.XPP_1001)){//收货上架
XppRecord xppRecord = xppRecordService.saveXppRecord(rk.get("ewm").toString(),point.getArea(),type);
AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord);
asnDetailService.putawayInv(asnDetail.getId(),point.getArea().getId(),pointId,xppRecord.getNrs(),xppRecord.getEwm());
- }else if(type.equals("2001")){//制造上架
+ }else if(type.equals(BillParmType.XPP_2001)){//制造投料上架
//查找线边库存是否存在,插入
Long bomId=Long.parseLong(rk.get("bomId").toString());
BomAccount bom=bomAccountRepository.getById(bomId);
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryController.java
index 7fabe38..9e054fc 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryController.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryController.java
@@ -15,24 +15,29 @@
*/
package com.youchain.businessdata.rest;
+import com.youchain.DuplicateSubmission.DuplicateSubmission;
import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log;
import com.youchain.appupdate.inputJson.ScanItemCode;
-import com.youchain.businessdata.domain.Inventory;
-import com.youchain.businessdata.domain.Task;
+import com.youchain.basicdata.domain.BomAccount;
+import com.youchain.basicdata.domain.Point;
+import com.youchain.basicdata.repository.BomAccountRepository;
+import com.youchain.basicdata.repository.PointRepository;
+import com.youchain.businessdata.domain.*;
+import com.youchain.businessdata.inputJson.XdMoveReq;
import com.youchain.businessdata.inputJson.buttenJson.InventoryButton;
import com.youchain.businessdata.repository.InventoryRepository;
import com.youchain.businessdata.repository.TaskRepository;
import com.youchain.businessdata.returnJson.RInvQuery;
+import com.youchain.businessdata.returnJson.XdInventory;
import com.youchain.businessdata.service.InventoryLogService;
import com.youchain.businessdata.service.InventoryService;
import com.youchain.businessdata.service.ItemKeyService;
-import com.youchain.businessdata.service.dto.InvQueryCriteria;
-import com.youchain.businessdata.service.dto.InventoryDto;
-import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
-import com.youchain.businessdata.service.dto.ItemKeyDto;
+import com.youchain.businessdata.service.dto.*;
+import com.youchain.businessdata.service.dto.jsonDto.CxjlDto;
import com.youchain.exception.BadRequestException;
import com.youchain.exception.handler.ApiResult;
+import com.youchain.utils.BillParmType;
import com.youchain.utils.BizStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
@@ -48,6 +53,7 @@ import io.swagger.annotations.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.servlet.http.HttpServletResponse;
/**
@@ -64,8 +70,11 @@ public class InventoryController {
private final InventoryService inventoryService;
private final InventoryRepository inventoryRepository;
- private final InventoryLogService invLogService;
+ private final InventoryLogService inventoryLogService;
private final TaskRepository taskRepository;
+ private final PointRepository pointRepository;
+ private final BomAccountRepository bomAccountRepository;
+ private final ItemKeyService itemKeyService;
@Log("导出数据")
@ApiOperation("导出数据")
@@ -108,6 +117,14 @@ public class InventoryController {
return new ResponseEntity<>(inventoryService.queryAll(criteria, pageable), HttpStatus.OK);
}
+ @GetMapping(value = "/queryInventoryZz")
+ @Log("查询制造库存")
+ @ApiOperation("查询制造库存")
+ @AnonymousAccess
+ public ResponseEntity queryInventoryZz(InventoryQueryCriteria criteria, Pageable pageable) {
+ return new ResponseEntity<>(inventoryService.queryAll(criteria, pageable), HttpStatus.OK);
+ }
+
@PostMapping
@Log("新增inventory")
@ApiOperation("新增inventory")
@@ -124,10 +141,10 @@ public class InventoryController {
//库存修改
Inventory byId = inventoryRepository.getById(resources.getId());
if (byId.getQuantity()>resources.getQuantity()){//以前的大于现在的
- invLogService.storeInventoryLog(BizStatus.INVENTORY_ADJUST, BizStatus.REDUCE, null, byId.getArea(), byId.getItemKey(), byId.getPoint(), byId.getPoint(), byId.getStock(), byId.getStock(), byId.getQuantity(), (byId.getQuantity() - resources.getQuantity()),
+ inventoryLogService.storeInventoryLog(BizStatus.INVENTORY_ADJUST, BizStatus.REDUCE, null, byId.getArea(), byId.getItemKey(), byId.getPoint(), byId.getPoint(), byId.getStock(), byId.getStock(), byId.getQuantity(), (byId.getQuantity() - resources.getQuantity()),
null,null,BizStatus.INVENTORY_ADJUST, byId.getId(), byId.getId(), resources.getDescription());
}else {
- invLogService.storeInventoryLog(BizStatus.INVENTORY_ADJUST, BizStatus.ADD, null, byId.getArea(), byId.getItemKey(), byId.getPoint(), byId.getPoint(), byId.getStock(), byId.getStock(), byId.getQuantity(), (resources.getQuantity()-byId.getQuantity()),
+ inventoryLogService.storeInventoryLog(BizStatus.INVENTORY_ADJUST, BizStatus.ADD, null, byId.getArea(), byId.getItemKey(), byId.getPoint(), byId.getPoint(), byId.getStock(), byId.getStock(), byId.getQuantity(), (resources.getQuantity()-byId.getQuantity()),
null,null,BizStatus.INVENTORY_ADJUST, byId.getId(), byId.getId(), resources.getDescription());
}
inventoryService.update(resources);
@@ -150,7 +167,7 @@ public class InventoryController {
if(update_zys qs=inventoryService.queryInvApp(code,scan.getPointCode());
return ApiResult.result(200, "", qs);
}
+
+ @GetMapping("/queryPickDetailXd")
+ @Log("拣货确认-箱单库存记录")
+ @ApiOperation("拣货确认-箱单库存记录")
+ @AnonymousAccess
+ public ResponseEntity queryPickDetailXd(TaskQueryCriteria criteria){
+ List invs = inventoryService.queryInvForPickDetail(criteria.getPickDetailId());
+ return new ResponseEntity<>(invs,HttpStatus.OK);
+ }
+
+ @PostMapping("/zzrkInv")
+ @Log("制造入库")
+ @ApiOperation("制造入库")
+ @PreAuthorize("@el.check('super:man')")
+ @AnonymousAccess
+ @DuplicateSubmission(5)
+ public ResponseEntity zzrkInv(@RequestBody CxjlDto cxjldto) throws Exception {
+ BomAccount bomAccount=bomAccountRepository.getById(cxjldto.getBom_account_id());
+ Point point=bomAccount.getZPoint();
+ ItemKey itemKey = itemKeyService.getItemKey(bomAccount.getItem(), null,bomAccount.getBonded());
+ Inventory inventory = inventoryService.getInventory(itemKey, point.getArea(), point, point, point.getDept(), BizStatus.ZZKW_TL,null);
+ double srcQty = inventory.getQuantity();
+ inventory.setQuantity(inventory.getQuantity() + cxjldto.getOrder_qty());
+ inventoryService.update(inventory);
+ InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.ZZKW_RK, BizStatus.ADD, "制造入库", point.getArea(), itemKey, inventory.getPoint(), inventory.getPoint(), null, null, srcQty, cxjldto.getOrder_qty()+0d, null, null,
+ BizStatus.ZZKW_TL, bomAccount.getId(), inventory.getId(), "制造入库");
+ inventoryLog.setZzkw(point);
+ inventoryLogService.update(inventoryLog);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+
+ @PostMapping("/xdMoveInvApp")
+ @Log("箱单移位App")
+ @ApiOperation("箱单移位App")
+ @PreAuthorize("@el.check('super:man')")
+ @AnonymousAccess
+ @DuplicateSubmission(5)
+ public ResponseEntity xdMoveInvApp(@RequestBody XdMoveReq xdMoveReq) throws Exception {
+ String type=xdMoveReq.getType();
+ String stockCode=xdMoveReq.getStockCode();
+ if(stockCode.indexOf("84")==0){
+ stockCode=stockCode.substring(2);
+ }
+
+ List invs = inventoryRepository.queryInvStockCode(stockCode);
+ if (invs.size() <= 0) {
+ throw new BadRequestException("没有对应的库存");
+ }
+ if (type.equals("xd_move_002")) {
+ String ewm=xdMoveReq.getEwm();
+ String[] str=ewm.split("]");
+ String pointCode=null;
+ if(str.length>=3) {//固定库位标签
+ pointCode = str[3];
+ }else {
+ pointCode=ewm;
+ }
+ Point point = pointRepository.findByCode(pointCode);
+ xdMoveReq.setPointId(point.getId());
+ xdMoveReq.setStockCode(stockCode);
+ this.xdMoveInv(xdMoveReq);
+ }
+ return new ResponseEntity<>("操作成功",HttpStatus.OK);
+}
+
+ @PostMapping("/xdMoveInv")
+ @Log("箱单移位")
+ @ApiOperation("箱单移位")
+ @PreAuthorize("@el.check('super:man')")
+ @AnonymousAccess
+ @DuplicateSubmission(5)
+ public ResponseEntity xdMoveInv(@RequestBody XdMoveReq xdMoveReq) throws Exception {
+ Point point=pointRepository.getById(xdMoveReq.getPointId());
+ if(!point.getType().equals("CH")) {
+ throw new BadRequestException("库位类型需为材管库位");
+ }
+ List invs=inventoryRepository.queryInvStockCode(xdMoveReq.getStockCode());
+ if(invs.size()<=0){
+ throw new BadRequestException("没有对应的库存");
+ }
+ for(Inventory inventory:invs){
+ double srcQty=inventory.getQuantity();
+ Point srcPoint=inventory.getPoint();
+ if(inventory.getQueuedQty()>0){
+ throw new BadRequestException("已锁定,不能移位");
+ }
+ if(point.getId().equals(inventory.getPoint().getId())){
+ throw new BadRequestException("库位相同,不能移位");
+ }
+ if(point.getItemCode()!=null&&!point.getItemCode().equals("")){
+ if(!point.getItemCode().equals(inventory.getItemKey().getItem().getCode())){
+ throw new BadRequestException("库位品番"+point.getItemCode()+"不一致,不能移位");
+ }
+ }
+ inventory.setPoint(point);
+ inventoryRepository.save(inventory);
+ InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.XD_MOVE, BizStatus.REDUCE, "箱单移位", point.getArea(), inventory.getItemKey(), srcPoint, point, null, null, srcQty, inventory.getQuantity(), xdMoveReq.getStockCode(), null,
+ BizStatus.ZZKW_TL, null, inventory.getId(), "箱单移位");
+ }
+ return new ResponseEntity<>("操作成功",HttpStatus.OK);
+ }
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/PickDetailController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickDetailController.java
index 8e6e687..7abe969 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/rest/PickDetailController.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickDetailController.java
@@ -16,6 +16,8 @@
package com.youchain.businessdata.rest;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
import com.youchain.DuplicateSubmission.DuplicateSubmission;
import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log;
@@ -24,23 +26,18 @@ import com.youchain.basicdata.repository.*;
import com.youchain.basicdata.service.AreaService;
import com.youchain.basicdata.service.dto.AreaDto;
import com.youchain.basicdata.service.dto.BomAccountPointDto;
-import com.youchain.businessdata.domain.Inventory;
-import com.youchain.businessdata.repository.PickTicketRepository;
-import com.youchain.businessdata.returnJson.RPTaskList;
-import com.youchain.businessdata.domain.PickDetail;
-import com.youchain.businessdata.domain.PickTicket;
-import com.youchain.businessdata.domain.Task;
+import com.youchain.businessdata.domain.*;
+import com.youchain.businessdata.inputJson.ZzjlPickConfirm;
+import com.youchain.businessdata.repository.*;
+import com.youchain.businessdata.returnJson.*;
import com.youchain.businessdata.inputJson.IPPickDetail;
import com.youchain.businessdata.inputJson.IScanPut;
-import com.youchain.businessdata.repository.PickDetailRepository;
import com.youchain.businessdata.service.*;
import com.youchain.businessdata.service.dto.*;
import com.youchain.businessdata.service.dto.jsonDto.CxjlDto;
import com.youchain.exception.BadRequestException;
import com.youchain.exception.handler.ApiResult;
-import com.youchain.utils.BaseStatus;
-import com.youchain.utils.BizStatus;
-import com.youchain.utils.DateUtil;
+import com.youchain.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
@@ -77,10 +74,15 @@ public class PickDetailController {
private final PickDetailRepository pickDetailRepository;
private final PickTicketService pickTicketService;
private final InventoryService inventoryService;
+ private final InventoryLogService inventoryLogService;
private final BillTypeRepository billTypeRepository;
+ private final InventoryRepository inventoryRepository;
+ private final TaskRepository taskRepository;
private final AreaRepository areaRepository;
private final ItemRepository itemRepository;
+ private final ItemKeyService itemKeyService;
private final PointRepository pointRepository;
+ private final XppRecordRepository xppRecordRepository;
private final AutomaticPlanningRepository automaticPlanningRepository;
private final BomAccountRepository bomAccountRepository;
private final PickTicketRepository pickTicketRepository;
@@ -199,6 +201,74 @@ public class PickDetailController {
return new ResponseEntity<>(HttpStatus.OK);
}
+ @PostMapping("/zzjlApp")
+ @Log("制造叫料App")
+ @ApiOperation("制造叫料App")
+ @PreAuthorize("@el.check('super:man')")
+ @AnonymousAccess
+ @DuplicateSubmission(5)
+ public ResponseEntity zzjlApp(@RequestBody CxjlDto cxjldto) throws Exception {
+ String ewm=cxjldto.getEwm();
+ String type=cxjldto.getType();
+ if(type.equals("cxjl_001")){
+ //解析二维码内容
+ String[] str=ewm.split("]");
+ if(str.length>=3){//固定库位标签
+ String pointCode=str[3];
+ String bomItemCode=str[0];
+ String bonded=str[2];
+ Point point=pointRepository.findByCode(pointCode);
+ Item item=itemRepository.findByCode(bomItemCode);
+ if(point==null||!point.getType().equals("ZZKW")){
+ throw new BadRequestException("制造库位错误");
+ }
+ cxjldto.setRk_id(point.getArea().getId());
+ cxjldto.setItem_id(item.getId());
+ cxjldto.setZzkw_id(point.getId());
+ cxjldto.setBonded(bonded);
+ cxjldto.setArea_name(point.getArea().getName());
+ cxjldto.setPoint_code(point.getCode());
+ cxjldto.setItem_name(item.getName());
+ cxjldto.setItem_code(item.getCode());
+ cxjldto.setOrder_qty(item.getSrs());
+ return new ResponseEntity<>(cxjldto,HttpStatus.OK);
+ }else{
+ throw new BadRequestException("扫描错误");
+ }
+
+ }else if(type.equals("cxjl_002")){//制造叫料APP
+
+ PickDetail pickDetail = pickDetailService.cxjlCreate(cxjldto);
+ //自动分配
+ pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(), pickDetail.getPo(), BaseStatus.ZZJL);
+ }else if(type.equals("cxjl_003")){//制造入库APP
+ //解析二维码内容
+ String[] str=ewm.split("]");
+ if(str.length>=3) {
+ String pointCode = str[3];
+ String bomItemCode = str[0];
+ String bonded = str[2];
+ Point point = pointRepository.findByCode(pointCode);
+ if (point == null || !point.getType().equals("ZZKW")) {
+ throw new BadRequestException("制造库位错误");
+ }
+ Item item = itemRepository.findByCode(bomItemCode);
+ ItemKey itemKey = itemKeyService.getItemKey(item, null, bonded);
+ Inventory inventory = inventoryService.getInventory(itemKey, point.getArea(), point, point, point.getDept(), BizStatus.ZZKW_TL, null);
+ double srcQty = inventory.getQuantity();
+ inventory.setQuantity(inventory.getQuantity() + cxjldto.getOrder_qty());
+ inventoryService.update(inventory);
+ InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.ZZKW_RK, BizStatus.ADD, "制造入库APP", point.getArea(), itemKey, inventory.getPoint(), inventory.getPoint(), null, null, srcQty, cxjldto.getOrder_qty() + 0d, null, null,
+ BizStatus.ZZKW_TL, null, inventory.getId(), "制造入库APP");
+ inventoryLog.setZzkw(point);
+ inventoryLogService.update(inventoryLog);
+ }else {
+ throw new BadRequestException("扫描错误");
+ }
+ }
+ return new ResponseEntity<>("操作成功", HttpStatus.OK);
+ }
+
@PostMapping("/zzjl")
@Log("制造叫料")
@ApiOperation("制造叫料")
@@ -206,28 +276,177 @@ public class PickDetailController {
@AnonymousAccess
@DuplicateSubmission(5)
public ResponseEntity zzjl(@RequestBody CxjlDto cxjldto) throws Exception {
- pickDetailService.cxjlCreate(cxjldto);
+ PickDetail pickDetail=pickDetailService.cxjlCreate(cxjldto);
+ BomAccount bomAccount=bomAccountRepository.getById(cxjldto.getBom_account_id());
+ cxjldto.setBonded(bomAccount.getBonded());
+ //自动分配
+ pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(),pickDetail.getPo(),BaseStatus.ZZJL);
return new ResponseEntity<>(HttpStatus.OK);
}
+ @PostMapping("/zzjlList")
+ @Log("制造叫料拣货列表")
+ @ApiOperation("制造叫料拣货列表")
+ @AnonymousAccess
+ public ResponseEntity zzjlList(@RequestBody HashMap map) throws Exception {
+ String itemCode=map.get("itemCode")==null?null:map.get("itemCode").toString();
+ //查询叫料返回数据
+ List list=pickDetailService.queryZzjlPickList(itemCode);
+ return new ResponseEntity<>(list,HttpStatus.OK);
+ }
+
+ @PostMapping("/zzjlPickApp")
+ @Log("制造叫料拣货确认")
+ @ApiOperation("制造叫料拣货确认")
+ @AnonymousAccess
+ public ResponseEntity zzjlPickApp(@RequestBody ZzjlPickConfirm zzjlPick) throws Exception {
+ String type= zzjlPick.getType();
+ if(type.equals("zzjl_pick_001")){
+ PickDetail pickDetail=pickDetailRepository.getById(zzjlPick.getDetail_id());
+ if(pickDetail.getPickedQty()>=pickDetail.getOrderQty()){
+ return new ResponseEntity<>("拣货完成,返回列表",HttpStatus.OK);
+ }
+ if(pickDetail.getAllocatedQty() tasks=taskRepository.getPickDetailTasks(pickDetail.getId());
+ String view_type="01";
+ String view_des="无库存";
+ String view_name="箱单号";
+ ZzjlPickHead head=new ZzjlPickHead();
+ List detail_list=new ArrayList<>();
+ if(tasks.size()>=0){
+ for(Task t:tasks){
+ ZzjlPickDetail detail=new ZzjlPickDetail();
+ detail.setStock_code("");
+ detail.setPoint_code(t.getSrcPoint().getCode());
+ detail.setPch(t.getItemKey().getPropC1());
+ detail.setItem_code(t.getItemKey().getItem().getCode());
+ detail.setItem_name(t.getItemKey().getItem().getName());
+ detail.setBonded(pickDetail.getPropC2());
+ detail.setQty(t.getPlanQty()+"");
+ detail_list.add(detail);
+ view_type="02";
+ view_name="现品票";
+ }
+ }
+ if(tasks.size()==0){
+ List invs= inventoryService.queryInvForPickDetail(pickDetail.getId());
+ for(XdInventory inv:invs) {
+ ZzjlPickDetail detail=new ZzjlPickDetail();
+ detail.setStock_code(inv.getStockCode());
+ detail.setPoint_code(inv.getPointCode());
+ detail.setPch(inv.getPropC1());
+ detail.setItem_code(inv.getItemCode());
+ detail.setItem_name(inv.getItemName());
+ detail.setBonded(inv.getBonded());
+ detail.setQty(inv.getInvQty());
+ detail_list.add(detail);
+ view_type="03";
+ }
+ }
+ if(view_type.equals("01")){
+ throw new BadRequestException( "无库存");
+ }
+ head.setView_des(view_des);
+ head.setView_type(view_type);
+ head.setView_list(detail_list);
+ head.setView_name(view_name);
+ return new ResponseEntity<>(head,HttpStatus.OK);
+ }else if(type.equals("zzjl_pick_002")){//扫描现品票或者箱单号
+ String xppQRCode= null;
+ String stock_code=null;
+ if(zzjlPick.getView_type().equals("02")){
+ xppQRCode=zzjlPick.getScan_code();
+ }else if(zzjlPick.getView_type().equals("03")){
+ stock_code=zzjlPick.getScan_code();
+ if(stock_code.indexOf("84")==0){
+ stock_code=stock_code.substring(2);
+ }
+ }
+ PickDetail pickDetail=pickDetailRepository.getById(zzjlPick.getDetail_id());
+ if(stock_code!=null){
+ List invs = inventoryRepository.queryInvStockCode(stock_code);
+ 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()+"关联箱单出库"+pickDetail.getId());
+ task.setTaskType(BizStatus.XD_PICK);
+ taskRepository.save(task);
+ pickTicketService.pickForTask(task.getId(), task.getSrcStockCode(), task.getPlanQty()-task.getMoveQty(), null, SecurityUtils.getCurrentUsername());
+ }
+ } else if (xppQRCode!=null) {//现品票拣货确认
+ XppRecord xpp = xppRecordRepository.findByEwmType(xppQRCode, BillParmType.XPP_1001);
+ if (Objects.isNull(xpp)){
+ throw new BadRequestException(HttpStatus.NOT_FOUND, "未找到对应的现品票二维码");
+ }
+ if(xpp.getCkTaskLog()!=null){
+ throw new BadRequestException(HttpStatus.NOT_FOUND, "现品票已出库");
+ }
+ ItemKey ik=xpp.getItemKey();
+ //取现品票上的库位进行拣货
+ Long srcPointId=null;
+ if(xpp.getInvPoint()!=null){
+ srcPointId=xpp.getInvPoint().getId();
+ }
+ List ts=taskService.queryTask(null,pickDetail.getId(),ik.getId(),null,srcPointId);
+ Task t=null;
+ for(Task task:ts){
+ if(task.getMoveQty()("操作成功",HttpStatus.OK);
+ }else {
+ throw new BadRequestException("请选择记录");
+ }
+ }
+
@PostMapping("/allocatePickDetail")
- @Log("拣货分配审核")
- @ApiOperation("拣货分配审核")
+ @Log("制造叫料分配审核")
+ @ApiOperation("制造叫料分配审核")
@AnonymousAccess
public synchronized ResponseEntity allocatePickDetail(@RequestBody Long[] ids) throws Exception {
List pickDetailIds = Arrays.asList(ids);
Collections.sort(pickDetailIds);//升序排序
if (pickDetailIds.size() > 0) {
- try {
- for (Long pickDetailId : pickDetailIds) {
- PickDetail pickDetail=pickDetailRepository.getById(pickDetailId);
- pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(),pickDetail.getPo(),BaseStatus.ZZJL);
- }
- } catch (Exception e) {
- return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
+ for (Long pickDetailId : pickDetailIds) {
+ PickDetail pickDetail=pickDetailRepository.getById(pickDetailId);
+ pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(),pickDetail.getPo(),BaseStatus.ZZJL);
}
} else {
- return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "参数错误或者为null", ""), HttpStatus.BAD_REQUEST);
+ throw new BadRequestException("请选择记录");
+ }
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+
+ @PostMapping("/cancelAllocatePickDetail")
+ @Log("制造叫料取消分配")
+ @ApiOperation("制造叫料取消分配")
+ @AnonymousAccess
+ public synchronized ResponseEntity cancelAllocatePickDetail(@RequestBody Long[] ids) throws Exception {
+ List pickDetailIds = Arrays.asList(ids);
+ Collections.sort(pickDetailIds);//升序排序
+ if (pickDetailIds.size() > 0) {
+ for (Long pickDetailId : pickDetailIds) {
+ PickDetail pickDetail=pickDetailRepository.getById(pickDetailId);
+ if(pickDetail.getAllocatedQty()>0&&pickDetail.getPickedQty()<=0) {
+ //取消分配
+ pickDetailService.cancelAllocate(pickDetail.getId());
+ }
+ }
+ } else {
+ throw new BadRequestException("请选择记录");
}
return new ResponseEntity<>(HttpStatus.OK);
}
@@ -283,19 +502,6 @@ public class PickDetailController {
return new ResponseEntity<>(HttpStatus.OK);
}
- @PostMapping("/cancelAllocate")
- @Log("取消分配")
- @ApiOperation("取消分配")
- @AnonymousAccess
- public synchronized ResponseEntity cancelAllocate(@RequestBody Long[] ids) {
- List pickDetailIds = Arrays.asList(ids);
- if (pickDetailIds.size() > 0) {
- for (Long id : pickDetailIds) {
- pickDetailService.cancelAllocate(id);
- }
- }
- return new ResponseEntity<>(HttpStatus.OK);
- }
@PostMapping("/queryTaskApp")
@Log("查询拣货列表")
@@ -325,19 +531,27 @@ public class PickDetailController {
}
public ResponseEntity pick_in(Long pickDetailId) {
+// List ts=taskRepository.getNotPickTask(resources.getPickTicketId());
+// if(ts.size()<=0){
+// throw new BadRequestException("没有需要拣货的明细");
+// }
+// for(Task t:ts) {
+// pickTicketService.pickForTask(t.getId(), t.getSrcStockCode(), t.getPlanQty()-t.getMoveQty(), null, bhr);
+// }
//查询未完成的拣货任务
- List Tasks = taskService.getPickNotAllTask(pickDetailId);
- if (Tasks.size() > 0) {
- try {
- for (Task task : Tasks) {
- log.error("正在拣货-----");
- taskService.pickConfirm(task.getId(), task.getPlanQty());
- }
- } catch (Exception e) {
- return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
+ List ts = taskService.getPickNotAllTask(pickDetailId);
+ if (ts.size() > 0) {
+
+// for (Task task : ts) {
+// log.error("正在拣货-----");
+// taskService.pickConfirm(task.getId(), task.getPlanQty());
+// }
+ for(Task t:ts) {
+ pickTicketService.pickForTask(t.getId(), t.getSrcStockCode(), t.getPlanQty()-t.getMoveQty(), null, SecurityUtils.getCurrentUsername());
}
+
} else {
- return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "已拣货完成,请勿重复操作!", ""), HttpStatus.BAD_REQUEST);
+ throw new BadRequestException("没有需要拣货的明细");
}
log.error("完成拣货-----");
return new ResponseEntity(ApiResult.fail(HttpStatus.OK.value(), "已拣货完成,请勿重复操作!", ""), HttpStatus.OK);
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/PickTicketController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickTicketController.java
index 068ca8f..a4008f9 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/rest/PickTicketController.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickTicketController.java
@@ -33,6 +33,7 @@ import com.youchain.businessdata.repository.*;
import com.youchain.businessdata.returnJson.PutawayRet;
import com.youchain.businessdata.returnJson.RPPickList;
import com.youchain.businessdata.returnJson.RPTaskList;
+import com.youchain.businessdata.returnJson.XdInventory;
import com.youchain.businessdata.service.*;
import com.youchain.businessdata.service.dto.PickTicketDto;
import com.youchain.businessdata.service.dto.PickTicketQueryCriteria;
@@ -97,33 +98,6 @@ public class PickTicketController {
return new ResponseEntity<>(pickTicketRepository.findById(id), HttpStatus.OK);
}
- @GetMapping(value = "/createNo")
- @Log("出库管理生成单号")
- @ApiOperation("出库管理生成单号")
- @AnonymousAccess
- public ResponseEntity createNo(@RequestParam("code") String code) {
- //获取最大单号
- PickTicket pickTicket = pickTicketRepository.queryMaxCode();
- //生成日期 YYMMDD 格式的日期
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYMMDD");
- String formatDate = simpleDateFormat.format(new Date());
- //返回的单号
- String returnNo = null;
- //判断是否有数据
- if (Objects.isNull(pickTicket)){
- log.warn("表中还没有数据");
- return new ResponseEntity<>((code+formatDate+"001"), HttpStatus.OK);
- }
- //获取出库管理的code值
- String pTCode = pickTicket.getCode();
- int i = Integer.parseInt(pTCode.substring(pTCode.length() - 3))+1;
- if (i > 999) {
- i = 001;
- }
- returnNo = code + formatDate + String.format("%03d", i);
- return new ResponseEntity<>(returnNo, HttpStatus.OK);
- }
-
@Log("导出数据")
@ApiOperation("导出数据")
@@ -191,7 +165,7 @@ public class PickTicketController {
}
- @PostMapping("/pickingOperations")
+ @PostMapping("/pickingOperations-del")
@Log("拣货操作")
@ApiOperation("拣货操作")
@PreAuthorize("@el.check('super:man')")
@@ -208,7 +182,7 @@ public class PickTicketController {
//检查该托盘是否还有库存
List invs=inventoryRepository.queryInvStockCode(stockCode);
if(invs.size()<=0){
- return new ResponseEntity<>("没有对应的库存",HttpStatus.BAD_REQUEST);
+ throw new BadRequestException("没有对应的库存");
}
BillType bt=billTypeRepository.findByName(BaseStatus.XDBH);
if(bt==null){
@@ -229,6 +203,42 @@ public class PickTicketController {
return new ResponseEntity<>("操作成功",HttpStatus.OK);
}
+ @PostMapping("/xdckAllocate")
+ @Log("箱单出库分配")
+ @ApiOperation("箱单出库分配")
+ @PreAuthorize("@el.check('super:man')")
+ public ResponseEntity xdckAllocate(@RequestBody Long[] ids){
+ for (Long id :ids) {
+ List 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.ZCCK);
+ }
+ }
+ }
+ return new ResponseEntity<>("操作成功",HttpStatus.OK);
+ }
+ @PostMapping("/xdckCancelAllocate")
+ @Log("箱单出库取消分配")
+ @ApiOperation("箱单出库取消分配")
+ @PreAuthorize("@el.check('super:man')")
+ public ResponseEntity xdckCancelAllocate(@RequestBody Long[] ids){
+ for (Long id :ids) {
+ List pickTickets =pickDetailRepository.queryByPickTicketId(id);
+ for (PickDetail pickDetail : pickTickets) {
+ if(pickDetail.getAllocatedQty()>0&&pickDetail.getPickedQty()<=0) {
+ //分配
+ pickDetailService.cancelAllocate(pickDetail.getId());
+ }
+ }
+ }
+ return new ResponseEntity<>("操作成功",HttpStatus.OK);
+ }
+
+
+
@PostMapping("/pickWhole")
@Log("备货操作-整单拣货")
@ApiOperation("备货操作-整单拣货")
@@ -261,7 +271,10 @@ public class PickTicketController {
@Transactional
public ResponseEntity pickWholeApp(@RequestBody PutawayRequest request){
String bhr=SecurityUtils.getCurrentUsername();
- String stockCode=request.getStockCode();
+ String stockCode = request.getStockCode();
+ if(stockCode.indexOf("84")==0){
+ stockCode=stockCode.substring(2);
+ }
List rets=new ArrayList<>();
if(request.getCheckType()==4){
List pts=pickTicketRepository.queryByCusCode(stockCode);
@@ -303,6 +316,29 @@ public class PickTicketController {
return new ResponseEntity<>("操作成功",HttpStatus.OK);
}
+ @PostMapping("/xdckPickOut")
+ @Log("箱单库存拣货确认")
+ @ApiOperation("箱单库存拣货确认")
+ @PreAuthorize("@el.check('super:man')")
+ public ResponseEntity 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 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);
+ }
+
@PostMapping("/pickBatch")
@Log("备货操作-批量拣货")
@ApiOperation("备货操作-批量拣货")
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskController.java
index 1932a5c..2ce766b 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskController.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskController.java
@@ -19,6 +19,8 @@ import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log;
import com.youchain.basicdata.service.dto.PointDto;
import com.youchain.basicdata.service.dto.PointQueryCriteria;
+import com.youchain.businessdata.domain.Inventory;
+import com.youchain.businessdata.domain.PickDetail;
import com.youchain.businessdata.domain.Task;
import com.youchain.businessdata.service.TaskService;
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
@@ -87,6 +89,7 @@ public class TaskController {
return new ResponseEntity<>(taskService.queryAll(criteria),HttpStatus.OK);
}
+
@PostMapping
@Log("新增task")
@ApiOperation("新增task")
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/XppRecordController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/XppRecordController.java
index 204a548..e26a397 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/rest/XppRecordController.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/XppRecordController.java
@@ -501,7 +501,7 @@ public class XppRecordController {
String ewm=jsonObject.getString("ewm");
String type=jsonObject.getString("type");
if(type.equals("7")){//现品票二维码解析
- RRkXpp xpp = xppRecordService.xppAnalysis(ewm);
+ RRkXpp xpp = xppRecordService.xppAnalysis(ewm,null);
return new ResponseEntity<>(xpp, HttpStatus.OK);
}else{
String gw="";
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/returnJson/XdInventory.java b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/XdInventory.java
new file mode 100644
index 0000000..bbdfaca
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/XdInventory.java
@@ -0,0 +1,34 @@
+package com.youchain.businessdata.returnJson;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class XdInventory {
+ Long invId;
+ Long pickDetailId;
+ /**物料号*/
+ String itemCode;
+ /**物料名称*/
+ String itemName;
+ /**A/C*/
+ String ac;
+ /**箱单号*/
+ String stockCode;
+
+ /**批次号*/
+ String propC1;
+ /**点位*/
+ String pointCode;
+ /**订单数量*/
+ String planQty;
+ /**库存数量*/
+ String invQty;
+
+ /**出库数量*/
+ String pickQty;
+ /**税别*/
+ String bonded;
+
+}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/returnJson/ZzjlPickDetail.java b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/ZzjlPickDetail.java
new file mode 100644
index 0000000..985690b
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/ZzjlPickDetail.java
@@ -0,0 +1,17 @@
+package com.youchain.businessdata.returnJson;
+
+import lombok.Data;
+
+@Data
+public class ZzjlPickDetail {
+ public String id;
+ public String stock_code;
+ public String point_code;
+ public String item_code;
+ public String pch;
+ public String item_name;
+ public String bonded;
+ public String qty;
+
+
+}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/returnJson/ZzjlPickHead.java b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/ZzjlPickHead.java
new file mode 100644
index 0000000..646d663
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/ZzjlPickHead.java
@@ -0,0 +1,14 @@
+package com.youchain.businessdata.returnJson;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ZzjlPickHead {
+ public String view_name;
+ public String view_type;
+ public String view_des;
+ public List view_list ;
+
+}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/returnJson/ZzjlPickList.java b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/ZzjlPickList.java
new file mode 100644
index 0000000..cc67566
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/ZzjlPickList.java
@@ -0,0 +1,31 @@
+package com.youchain.businessdata.returnJson;
+
+import lombok.Data;
+
+@Data
+public class ZzjlPickList {
+ /**序号*/
+ Long detail_id;
+ /**库区*/
+ String area_name;
+ /**品番*/
+ String item_code;
+ /**品名*/
+ String item_name;
+ /**制造库位*/
+ String point_code;
+ /**税别*/
+ String bonded;
+ /**数量*/
+ String order_qty;
+ /**分配数量*/
+ String allocated_qty;
+ /**拣货数量*/
+ String picked_qty;
+ /**创建人*/
+ String create_by;
+ /**创建时间*/
+ String create_time;
+
+
+}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryLogService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryLogService.java
index 6a39670..59c41cf 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryLogService.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryLogService.java
@@ -87,10 +87,12 @@ public interface InventoryLogService {
* @throws Exception /
*/
void download(List all, HttpServletResponse response) throws Exception, Exception;
- InventoryLog storeInventoryLog(String logType, String incDec, String relatedBill, Area area,ItemKey itemKey, Point srcPoint, Point dstPoint, Stock srcStock, Stock dstStock,
- Double srcQty, Double occurQty, String stockCode,String xpp,String refObj, Long refObjId, Long invId, String description);
+ InventoryLog storeInventoryLog(String logType, String incDec, String relatedBill, Area area,ItemKey itemKey, Point srcPoint, Point dstPoint,
+ Stock srcStock, Stock dstStock, Double srcQty, Double occurQty, String stockCode,
+ String xpp,String refObj, Long refObjId, Long invId, String description);
InventoryLog storeInventoryLog(String logType, String incDec, String relatedBill, Area area, ItemKey itemKey, Point srcPoint, Point dstPoint,
- Point zzkw, Double srcQty, Double occurQty,String xpp, String refObj, Long refObjId, Long invId, String description);
+ Point zzkw, Double srcQty, Double occurQty,
+ String xpp, String refObj, Long refObjId, Long invId, String description);
/**
* 游标分页
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryService.java
index 6a39ec7..e97a922 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryService.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryService.java
@@ -23,6 +23,7 @@ import com.youchain.businessdata.domain.Inventory;
import com.youchain.businessdata.domain.ItemKey;
import com.youchain.businessdata.inputJson.buttenJson.InventoryButton;
import com.youchain.businessdata.returnJson.RInvQuery;
+import com.youchain.businessdata.returnJson.XdInventory;
import com.youchain.businessdata.service.dto.InvQueryCriteria;
import com.youchain.businessdata.service.dto.InventoryDto;
import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
@@ -142,4 +143,6 @@ public interface InventoryService {
* @return
*/
List queryInvApp(String code,String pointCode);
+
+ List queryInvForPickDetail(Long pickDetailId);
}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/PickDetailService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/PickDetailService.java
index ab61bce..90992e7 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/PickDetailService.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/PickDetailService.java
@@ -22,6 +22,7 @@ import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.service.dto.BoxDto;
import com.youchain.businessdata.domain.PickDetail;
import com.youchain.businessdata.domain.PickTicket;
+import com.youchain.businessdata.returnJson.ZzjlPickList;
import com.youchain.businessdata.service.dto.PickDetailDto;
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
import com.youchain.businessdata.service.dto.PickDetailZscDto;
@@ -168,4 +169,6 @@ public interface PickDetailService {
* @return
*/
List getBomList(long picktickId,String largeClass);
+ /**查询制造叫料列表*/
+ List queryZzjlPickList(String itemCode);
}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/XppRecordService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/XppRecordService.java
index 4d08066..d6e033f 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/XppRecordService.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/XppRecordService.java
@@ -115,7 +115,7 @@ public interface XppRecordService {
* @param ewm
* @return
*/
- RRkXpp xppAnalysis(String ewm);
+ RRkXpp xppAnalysis(String ewm,String type);
/***
* 新增现品票标签
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/jsonDto/CxjlDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/jsonDto/CxjlDto.java
index 1153f8c..264ed26 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/jsonDto/CxjlDto.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/jsonDto/CxjlDto.java
@@ -29,8 +29,15 @@ import java.io.Serializable;
public class CxjlDto implements Serializable {
private Long bom_account_id;
private Long item_id;
+ private String item_code;
+ private String item_name;
+ private String point_code;
+ private String area_name;
private Long zzkw_id;
private Long rk_id;
- private double order_qty;
+ private int order_qty;
private String remark;
+ private String ewm;
+ private String type;
+ private String bonded;
}
\ No newline at end of file
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnDetailServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnDetailServiceImpl.java
index a0e2900..b7ce580 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnDetailServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnDetailServiceImpl.java
@@ -150,7 +150,11 @@ public class AsnDetailServiceImpl implements AsnDetailService {
ewm=xppRecord.getEwm();
srcPoint=xppRecord.getInvPoint();
}
- Inventory inventory=inventoryService.getInventory(t.getItemKey(),xppRecord.getArea(),srcPoint,t.getAsnDetail().getPoint(),t.getArea().getDept(),BizStatus.RECEIVING_CANCEL,asn.getCusCode());
+ String xdh=null;
+ if(asn!=null){
+ xdh=asn.getCusCode();
+ }
+ Inventory inventory=inventoryService.getInventory(t.getItemKey(),xppRecord.getArea(),srcPoint,t.getAsnDetail().getPoint(),t.getArea().getDept(),BizStatus.RECEIVING_CANCEL,xdh);
if(inventory==null){
throw new BadRequestException("找不到对应库存");
}
@@ -236,23 +240,28 @@ public class AsnDetailServiceImpl implements AsnDetailService {
@Override
public void putawayInv(@RequestBody Long asnDetailId, Long areaId, Long pointId, double recQty, String ewm) {
AsnDetail d = asnDetailRepository.getById(asnDetailId);
- String propC2="课税";
+ String propC2=null;
if(d.getPropC2()!=null){
- if(d.getPropC2().equals("EXP -")||d.getPropC2().equals("课税")){
- propC2="课税";
- }else if(d.getPropC2().equals("保税")){
- propC2="保税";
- }else{
- propC2="保税";
+ if(d.getPropC2().indexOf("EXP")>=0){
+ propC2=BaseStatus.BS;
+ }else if(d.getPropC2().indexOf("DOM")>=0){
+ propC2=BaseStatus.KS;
}
+ }else{
+ propC2="课税";
}
Area area =null;
Point point = null;
+ String gdItemCode=null;
if(pointId!=null){
point = pointService.findEntityById(pointId);
if( point.getType().equals(BaseStatus.CH)){
area=point.getArea();
}
+ gdItemCode=point.getItemCode();
+ }
+ if(gdItemCode!=null&&!gdItemCode.equals("")&&!d.getItem().getCode().equals(gdItemCode)){
+ throw new BadRequestException("和固定库位品番"+gdItemCode+"不匹配");
}
if(areaId!=null){
area = areaService.findEntityById(areaId);
@@ -264,7 +273,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
zzkw=d.getPoint();
if(zzkw==null){
//取默认制造库位
- zzkw= pointService.getPoint("ZZKW", null, null, null);
+ zzkw= pointService.getPoint(BaseStatus.ZZKW, null, null, null);
}
}else{
pc1=DateUtil.dateYmdz();
@@ -275,7 +284,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
double unRecQty=d.getOrderQty() - d.getReceivedQty();
if ( recQty<=unRecQty) {
//现品票确认将任务id回写到现品票表中
- XppRecord xppRecord = xppRecordRepository.findByCode(ewm);
+ XppRecord xppRecord = xppRecordRepository.findByEwmType(ewm,BillParmType.XPP_1001);
ItemKey ik=null;
if(xppRecord!=null){
if(!xppRecord.getStatus().equals(BizStatus.RECEIVED)&&!xppRecord.getStatus().equals(BizStatus.RETENTION_IN)){
@@ -294,6 +303,9 @@ public class AsnDetailServiceImpl implements AsnDetailService {
asn.setReceivedQuantity(asn.getReceivedQuantity()+recQty);
if(asn.getReceivedQuantity().intValue()>=asn.getOrderQuantity().intValue()) {
asn.setStatus(BizStatus.PUTAWAY);
+ asn.setReceivedDate(new Timestamp(new Date().getTime()));
+ asn.setArea(point.getArea());
+ asn.setRelatedBill3(point.getCode());
}
asnService.update(asn);
stockCode=asn.getCusCode();
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryServiceImpl.java
index 1d8ef34..daffccf 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryServiceImpl.java
@@ -22,14 +22,13 @@ import com.youchain.basicdata.domain.Item;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.domain.Stock;
import com.youchain.basicdata.service.PointService;
-import com.youchain.businessdata.domain.CountDetail;
-import com.youchain.businessdata.domain.Inventory;
-import com.youchain.businessdata.domain.InventoryLog;
-import com.youchain.businessdata.domain.ItemKey;
+import com.youchain.businessdata.domain.*;
import com.youchain.businessdata.inputJson.buttenJson.InventoryButton;
import com.youchain.businessdata.inputJson.buttenJson.dataAll.InventoryYW;
+import com.youchain.businessdata.repository.PickDetailRepository;
import com.youchain.businessdata.returnJson.RInvQuery;
import com.youchain.businessdata.returnJson.RPTaskList;
+import com.youchain.businessdata.returnJson.XdInventory;
import com.youchain.businessdata.service.InventoryLogService;
import com.youchain.businessdata.service.dto.*;
import com.youchain.exception.BadRequestException;
@@ -77,6 +76,7 @@ public class InventoryServiceImpl implements InventoryService {
private final EntityManager entityManager;
private final InventoryLogService invLogService;
private final PointService pointService;
+ private final PickDetailRepository pickDetailRepository;
@Override
public Map queryAll(InventoryQueryCriteria criteria, Pageable pageable) {
@@ -416,4 +416,32 @@ public class InventoryServiceImpl implements InventoryService {
List list = JSON.parseArray(JSON.toJSONString(ts),RInvQuery.class);
return list;
}
+
+ public List queryInvForPickDetail(Long pickDetailId) {
+ PickDetail pickDetail = pickDetailRepository.getById(pickDetailId);
+ Item item = pickDetail.getItem();
+ List xds=new ArrayList<>();
+ if (pickDetail.getOrderQty() > pickDetail.getPickedQty()) {
+ Long zzkwId = null;
+ Long areaId = 0L;
+ List invs = this.queryInventoryAllocate(item.getId(), areaId, zzkwId, null, pickDetail.getPropC2(), BaseStatus.ZZJL);
+ for(Inventory inv:invs){
+ XdInventory xd=new XdInventory();
+ xd.setInvId(inv.getId());
+ xd.setPickDetailId(pickDetailId);
+ xd.setItemCode(item.getCode());
+ xd.setItemName(item.getName());
+ xd.setStockCode(inv.getStockCode());
+ xd.setPointCode(inv.getPointCode());
+ xd.setBonded(pickDetail.getPropC2());
+ xd.setPlanQty(pickDetail.getOrderQty().intValue()+"");
+ xd.setInvQty(inv.getQuantity().intValue()+"");
+ xd.setPickQty(pickDetail.getPickedQty().intValue()+"");
+ xd.setPropC1(inv.getItemKey().getPropC1());
+ xds.add(xd);
+ }
+ }
+ return xds;
+ }
+
}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickDetailServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickDetailServiceImpl.java
index 3f7c8f2..e0b366b 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickDetailServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickDetailServiceImpl.java
@@ -16,20 +16,19 @@
package com.youchain.businessdata.service.impl;
import com.alibaba.fastjson.JSON;
+import com.youchain.annotation.Log;
import com.youchain.basicdata.domain.*;
import com.youchain.basicdata.repository.*;
import com.youchain.basicdata.service.AreaService;
import com.youchain.basicdata.service.ItemService;
import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.dto.ItemDto;
-import com.youchain.businessdata.domain.Inventory;
-import com.youchain.businessdata.domain.PickDetail;
-import com.youchain.businessdata.domain.PickTicket;
-import com.youchain.businessdata.domain.Task;
+import com.youchain.businessdata.domain.*;
import com.youchain.businessdata.repository.InventoryRepository;
import com.youchain.businessdata.repository.PickTicketRepository;
import com.youchain.businessdata.repository.TaskRepository;
import com.youchain.businessdata.returnJson.RPTaskList;
+import com.youchain.businessdata.returnJson.ZzjlPickList;
import com.youchain.businessdata.service.*;
import com.youchain.businessdata.service.dto.PickDetailZscDto;
import com.youchain.businessdata.service.dto.PickTicketDto;
@@ -50,6 +49,7 @@ import net.dreamlu.mica.core.utils.JsonUtil;
import org.hibernate.SQLQuery;
import org.hibernate.transform.AliasToEntityMapResultTransformer;
import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
@@ -180,17 +180,17 @@ public class PickDetailServiceImpl implements PickDetailService {
Area sharea=areaRepository.getById(cxjldto.getRk_id());
Item it=itemRepository.getById(cxjldto.getItem_id());
Point zzkw= pointRepository.getById(cxjldto.getZzkw_id());
- BomAccount bomAccount=bomAccountRepository.getById(cxjldto.getBom_account_id());
+// BomAccount bomAccount=bomAccountRepository.getById(cxjldto.getBom_account_id());
pd.setArea(area);
pd.setShArea(sharea);
pd.setItem(it);
pd.setPoint(zzkw);
pd.setStatus(BizStatus.OPEN);
- pd.setOrderQty(cxjldto.getOrder_qty());
+ pd.setOrderQty(cxjldto.getOrder_qty()+0d);
pd.setRemark(cxjldto.getRemark());
pd.setType(BaseStatus.ZZJL);
- pd.setPropC2(bomAccount.getBonded());
- pd.setBomId(bomAccount.getId());
+ pd.setPropC2(cxjldto.getBonded());
+ pd.setBomId(cxjldto.getBom_account_id());
this.create(pd);
return pd;
}
@@ -198,11 +198,9 @@ public class PickDetailServiceImpl implements PickDetailService {
@Override
@Transactional(rollbackFor = Exception.class)
public synchronized void allocate(long id, double quantity,String stockCode,String type){
- PickDetailDto pickDetailDto = findById(id);
- PickDetail pd = toEntity(pickDetailDto);//Dto转实体
+ PickDetail pd = pickDetailRepository.getById(id);
PickTicket pickTicket = pd.getPickTicket();
- ItemDto itemDto = pickDetailDto.getItem();
- Item item = itemService.toEntity(itemDto);
+ Item item = pd.getItem();
String billCode=null;
Long areaId=0L;
if (pd.getOrderQty() > pd.getAllocatedQty()) {
@@ -221,17 +219,18 @@ public class PickDetailServiceImpl implements PickDetailService {
double srs=item.getExtendD3();
Map map=new HashMap<>();
for (Inventory inv : invs) {
- if(inv.getStockCode()!=null){
+ if(inv.getStockCode()!=null&&pd.getPo()==null){
//回写推荐托盘即可
map.put(inv.getId()+"",inv.getStockCode()+"]"+inv.getItemKey().getPropC1()+"]"+inv.getPoint().getCode()+"]"+inv.getQuantity());
continue;
}
Point startPoint = inv.getPoint();//原库位
- String areaCode=BaseStatus.DEFAULT_AREA;
- Point endPoint = pointService.getPoint(null, null, BaseStatus.BHZC, areaCode);//目标库位
- if(endPoint==null){
- throw new BadRequestException(HttpStatus.NOT_FOUND, "请维护备货暂存区");
- }
+// String areaCode=BaseStatus.DEFAULT_AREA;
+// Point endPoint = pointService.getPoint(null, null, BaseStatus.BHZC, areaCode);//目标库位
+// if(endPoint==null){
+// throw new BadRequestException(HttpStatus.NOT_FOUND, "请维护备货暂存区");
+// }
+ Point endPoint =null;
if (unQty <= 0) {
break;
}
@@ -260,34 +259,38 @@ public class PickDetailServiceImpl implements PickDetailService {
unQty -= allocateQty;
pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty);
- if(type.equals(BaseStatus.ZCCK)) {
+ if(pickTicket!=null) {
pickTicket.setAllocatedQuantity(pickTicket.getAllocatedQuantity() + allocateQty);
-
if (pickTicket.getAllocatedQuantity()>0) {
pickTicket.setStatus(BizStatus.ALLOCATE);
}
//备货表上出单日期(审核写)
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
pickTicketRepository.save(pickTicket);
- } else if (type.equals(BaseStatus.ZZJL)) {
+ }
+ if(pd.getAllocatedQty()>0) {
pd.setStatus(BizStatus.ALLOCATE);
}
- this.update(pd);
+ pickDetailRepository.save(pd);
Task task = taskService.storeTask(null,pd,inv.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty,inv.getStockCode());
//修改占用数,写入日志
- inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.ADD, billCode, inv.getArea(), inv.getItemKey(), inv.getPoint(),
+ InventoryLog inventoryLog=inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.ADD, billCode, inv.getArea(), inv.getItemKey(), inv.getPoint(),
inv.getPoint(), inv.getZzkw(), (inv.getQueuedQty()-allocateQty), allocateQty, null, BizStatus.PICK,
pd.getId(), inv.getId(), task.getId()+"备货占用");
+ inventoryLog.setDstStockCode(inv.getStockCode());
+ inventoryLogService.update(inventoryLog);
}
- if(map!=null){
+ if(map!=null&&pickTicket==null){
pd.setRemark(map.values().stream()
.collect(Collectors.joining("\n")));
log.info(pd.getRemark()+"===="+pd.getType());
- this.update(pd);
+ pickDetailRepository.save(pd);
}
+ }else{
+ log.info("无库存。。。。");
}
} else {
- throw new BadRequestException(HttpStatus.NOT_FOUND,"已分配,请勿重复操作!");
+ throw new BadRequestException("已分配,请勿重复操作!");
}
}
@@ -296,23 +299,24 @@ public class PickDetailServiceImpl implements PickDetailService {
@Override
@Transactional(rollbackFor = Exception.class)
public synchronized void cancelAllocate(long id){
- PickDetailDto pickDetailDto = findById(id);
- PickDetail pd = toEntity(pickDetailDto);
+ PickDetail pd = pickDetailRepository.getById(id);
List Tasks = taskRepository.getPickNotAllTask(id);
for (Task task : Tasks) {
if(task.getMoveQty()>0){
- //throw new BadRequestException(HttpStatus.NOT_FOUND,"已拣货,请勿重复操作!");
- continue;
+ throw new BadRequestException(HttpStatus.NOT_FOUND,"已拣货,不能取消!");
+ //continue;
}
log.info(task.getId()+"==="+task.getItemKey().getItem().getCode()+"==="+task.getPlanQty());
//根据Taskz找到对应的库存
double quantity=task.getPlanQty();
// 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,task.getDstStockCode());
+ Inventory inv=inventoryService.getInventory(task.getItemKey(),task.getArea(),task.getSrcPoint(),task.getZzkw(),task.getDept(),BizStatus.CANCEL,task.getDstStockCode());
//修改占用数,写入日志
- inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.REDUCE, task.getBillCode(), inv.getArea(), inv.getItemKey(), inv.getPoint(),
+ InventoryLog inventoryLog=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,
pd.getId(), inv.getId(), task.getId()+"取消占用");
+ inventoryLog.setDstStockCode(inv.getStockCode());
+ inventoryLogService.update(inventoryLog);
inv.setQueuedQty(inv.getQueuedQty() - quantity);
inventoryRepository.save(inv);
//删除Task
@@ -323,9 +327,13 @@ public class PickDetailServiceImpl implements PickDetailService {
pd.setAllocatedQty(0d);
pd.setStatus(BizStatus.OPEN);
}
- this.update(pd);
pickDetailRepository.save(pd);
-
+ PickTicket pt=pd.getPickTicket();
+ if(pt!=null) {
+ pt.setStatus(BizStatus.OPEN);
+ pt.setAllocatedQuantity(0d);
+ pickTicketRepository.save(pt);
+ }
}
}
@@ -393,6 +401,24 @@ public class PickDetailServiceImpl implements PickDetailService {
return list;
}
+ public List queryZzjlPickList(String itemCode) {
+ String sql="SELECT d.id detail_id,a.`name` 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=p.area_id\n" +
+ " where d.type='ZZJL' and d.picked_qty=0;\n";
+ Query query = entityManager.createNativeQuery(sql);
+ List ts= query
+ .unwrap(SQLQuery.class)
+ .setResultTransformer(
+ AliasToEntityMapResultTransformer.INSTANCE
+ )
+ .list();
+ List list = JSON.parseArray(JSON.toJSONString(ts),ZzjlPickList.class);
+ return list;
+ }
+
public Map queryPickDetailAll(PickDetailQueryCriteria criteria, Pageable pageable) {
int pageNum=pageable.getPageNumber();//当前页
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickTicketServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickTicketServiceImpl.java
index 466fe34..22ba5ef 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickTicketServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickTicketServiceImpl.java
@@ -490,8 +490,9 @@ public class PickTicketServiceImpl implements PickTicketService {
PickDetail pd = task.getPickDetail();
PickTicket pt = pd.getPickTicket();
Point zzkw=pd.getPoint();
+ Area area=task.getArea();
//大部品的库存不能进去
- Inventory srcInv = inventoryService.getInventory(task.getItemKey(),pt.getArea(),task.getSrcPoint(),zzkw,pt.getArea().getDept(),BizStatus.PICK_DOWN,task.getDstStockCode());
+ Inventory srcInv = inventoryService.getInventory(task.getItemKey(),area,task.getSrcPoint(),zzkw,task.getDept(),BizStatus.PICK_DOWN,task.getDstStockCode());
if (srcInv==null) {
throw new BadRequestException(HttpStatus.NOT_FOUND, task.getItem().getCode() + "未发现库存数据");
}
@@ -508,9 +509,11 @@ public class PickTicketServiceImpl implements PickTicketService {
}
}
//库存扣除后还要 inventoryLog
- invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.REDUCE, pt.getCode(), srcInv.getArea(), srcInv.getItemKey(), srcInv.getPoint(),
+ InventoryLog inventoryLog=invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.REDUCE, task.getBillCode(), srcInv.getArea(), srcInv.getItemKey(), srcInv.getPoint(),
srcInv.getPoint(), zzkw, srcQty, pickQty, barCode, BizStatus.PICK_DOWN,
task.getId(), srcInv.getId(), pd.getRemark());
+ inventoryLog.setDstStockCode(srcInv.getStockCode());
+ invLogService.update(inventoryLog);
//生成taskLog 日志
TaskLog taskLog = taskLogService.createTaskLog(task, pickQty, stockCode, barCode, bhr);
if (xpp != null) {
@@ -533,13 +536,16 @@ public class PickTicketServiceImpl implements PickTicketService {
srcInv.setQueuedQty(0d);
}
inventoryService.update(srcInv);
-
//修改占用数,写入日志
- InventoryLog invLog=invLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.REDUCE, pt.getCode(), srcInv.getArea(), srcInv.getItemKey(), srcInv.getPoint(),
- srcInv.getPoint(), srcInv.getZzkw(),srcQue, fpQty, null, BizStatus.PICK,
- pd.getId(), srcInv.getId(), taskLog.getId()+"拣货确认");
- invLog.setDstQty(srcInv.getQueuedQty());
- invLogService.update(invLog);
+ if(task.getTaskType()!=null&&!task.getTaskType().equals(BizStatus.XD_PICK)) {
+ InventoryLog invLog = invLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.REDUCE, task.getBillCode(), srcInv.getArea(), srcInv.getItemKey(), srcInv.getPoint(),
+ srcInv.getPoint(), srcInv.getZzkw(), srcQue, fpQty, null, BizStatus.PICK,
+ pd.getId(), srcInv.getId(), taskLog.getId() + "拣货确认");
+ invLog.setDstQty(srcInv.getQueuedQty());
+ invLog.setDstStockCode(srcInv.getStockCode());
+ invLogService.update(invLog);
+ }
+
//生成备货库存,备货库存也不需要线边
/** Inventory dstInv = inventoryService.getInventory(srcInv.getItemKey(), srcInv.getArea(), task.getDstPoint(), zzkw, srcInv.getDept(), BizStatus.PICK_DOWN,task.getDstStockCode());
@@ -549,21 +555,26 @@ public class PickTicketServiceImpl implements PickTicketService {
dstInv.setQuantity(dstInv.getQuantity() + kcNum);
inventoryService.update(dstInv); **/
pd.setPickedQty(pd.getPickedQty() + pickQty);
- pickDetailService.update(pd);
- //拣货数量
- pt.setPickedQuantity(pt.getPickedQuantity() + pickQty);
- pt.setBhQty(pt.getBhQty() + pickQty);
+ if(pd.getPickedQty()>0){
+ pd.setStatus(BizStatus.PICK_ALL);
+ }
+ pickDetailRepository.save(pd);
+ if(pt!=null) {
+ //拣货数量
+ pt.setPickedQuantity(pt.getPickedQuantity() + pickQty);
+ pt.setBhQty(pt.getBhQty() + pickQty);
// if ((pt.getOrderQuantity() - pt.getPickedQuantity()) <= 0) {
// pt.setStatus(BizStatus.PICK_ALL);
// } else {
// pt.setStatus(BizStatus.PICKUP);
// }
- if(pickDetailRepository.queryPickQty(pt.getId()).size()>0){
- pt.setStatus(BizStatus.PICKUP);
- }else{
- pt.setStatus(BizStatus.PICK_ALL);
+ if (pickDetailRepository.queryPickQty(pt.getId()).size() > 0) {
+ pt.setStatus(BizStatus.PICKUP);
+ } else {
+ pt.setStatus(BizStatus.PICK_ALL);
+ }
+ this.update(pt);
}
- this.update(pt);
if (xpp != null) {
xpp.setStatus(BizStatus.PICK_ALL);
xpp.setBhr(SecurityUtils.getCurrentUsername());
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java
index bec5dd5..70a8af4 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java
@@ -370,4 +370,5 @@ public class TaskServiceImpl implements TaskService {
List taskList=query.getResultList();
return taskList;
}
+
}
diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/XppRecordServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/XppRecordServiceImpl.java
index 1cee681..441a703 100644
--- a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/XppRecordServiceImpl.java
+++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/XppRecordServiceImpl.java
@@ -389,8 +389,8 @@ public class XppRecordServiceImpl implements XppRecordService {
return xpp;
}
- public RRkXpp xppAnalysis(String ewm) {
- if (ewm.length() < 82) {
+ public RRkXpp xppAnalysis(String ewm,String type) {
+ if (ewm.length() <82) {
throw new BadRequestException("二维码格式错误");
}
int i = 0;
@@ -419,16 +419,18 @@ public class XppRecordServiceImpl implements XppRecordService {
if (item==null){
throw new BadRequestException("部品品番不存在");
}
- XppRecord xppRecord = xppRecordRepository.findByCode(ewm);
- if (xppRecord!=null){
- throw new BadRequestException("二维码已采集");
+ if(type!=null) {
+ XppRecord xppRecord = xppRecordRepository.findByEwmType(ewm, type);
+ if (xppRecord != null) {
+ throw new BadRequestException("二维码已采集");
+ }
}
RRkXpp xpp = new RRkXpp();
xpp.setItemCode(item.getCode());
xpp.setItemName(item.getName());
xpp.setAc(ac);
xpp.setDdbh(ddbh);
- xpp.setNrs(Integer.valueOf(nrs));
+ xpp.setNrs(Integer.valueOf(nrs.trim()));
xpp.setNrzsr(nrzsr);
xpp.setFzh(fzh);
xpp.setGys(gys.trim());
@@ -443,11 +445,11 @@ public class XppRecordServiceImpl implements XppRecordService {
}
public XppRecord saveXppRecord(String ewm,Area area,String type){
- XppRecord xppRecord = xppRecordRepository.findByCode(ewm);
- if (xppRecord != null) {
+ XppRecord xppRecord = xppRecordRepository.findByEwmType(ewm,type);
+ if (xppRecord != null&&type.equals(BillParmType.XPP_1001)) {
throw new BadRequestException("二维码已采集");
}
- RRkXpp xpp=this.xppAnalysis(ewm);
+ RRkXpp xpp=this.xppAnalysis(ewm,type);
Item item = itemRepository.findByCode(xpp.getItemCode());
if (item == null) {
throw new BadRequestException("部品品番不存在");
@@ -537,7 +539,7 @@ public class XppRecordServiceImpl implements XppRecordService {
throw new BadRequestException("现品票品番"+xppItemCode+"和库位品番"+bomItemCode+"不一致");
//return new ResponseEntity<>( "现品票品番"+xppItemCode+"和库位品番"+bomItemCode+"不一致", BAD_REQUEST);
}
- XppRecord xppRecord = this.saveXppRecord(ewm,point.getArea(),"2001");
+ XppRecord xppRecord = this.saveXppRecord(ewm,point.getArea(),BillParmType.XPP_2001);
ItemKey itemKey = itemKeyService.getItemKey(xppRecord.getItem(), null,bonded);
Inventory inventory = inventoryService.getInventory(itemKey, point.getArea(), point, point, point.getDept(), BizStatus.ZZKW_TL,null);
double srcQty = inventory.getQuantity();
diff --git a/youchain-system/src/main/java/com/youchain/utils/BillParmType.java b/youchain-system/src/main/java/com/youchain/utils/BillParmType.java
new file mode 100644
index 0000000..ec1e9dc
--- /dev/null
+++ b/youchain-system/src/main/java/com/youchain/utils/BillParmType.java
@@ -0,0 +1,12 @@
+package com.youchain.utils;
+
+public class BillParmType{
+ /**
+ * 现品票类型入参-材管上架
+ */
+ public static String XPP_1001 = "1001";
+ /**
+ * 现品票类型入参-制造上架
+ */
+ public static String XPP_2001 = "2001";
+}
diff --git a/youchain-system/src/main/java/com/youchain/utils/BizStatus.java b/youchain-system/src/main/java/com/youchain/utils/BizStatus.java
index a028247..fac8ad9 100644
--- a/youchain-system/src/main/java/com/youchain/utils/BizStatus.java
+++ b/youchain-system/src/main/java/com/youchain/utils/BizStatus.java
@@ -110,6 +110,10 @@ public class BizStatus {
* 出库任务
*/
public static String PICK = "PICK";
+ /**
+ * 箱单关联出库任务
+ */
+ public static String XD_PICK = "XD_PICK";
/**
* 盘点任务
@@ -237,6 +241,16 @@ public class BizStatus {
* 制造库位投料
*/
public static String ZZKW_TL = "ZZKW_TL";
+
+ /**
+ * 制造库位入库
+ */
+ public static String ZZKW_RK = "ZZKW_RK";
+
+ /**
+ * 制造库位入库
+ */
+ public static String XD_MOVE = "XD_MOVE";
/**
* 移库出库
*/
diff --git a/youchain-system/src/main/java/com/youchain/utils/FastExcelUtil.java b/youchain-system/src/main/java/com/youchain/utils/FastExcelUtil.java
index 77ec868..8c26407 100644
--- a/youchain-system/src/main/java/com/youchain/utils/FastExcelUtil.java
+++ b/youchain-system/src/main/java/com/youchain/utils/FastExcelUtil.java
@@ -170,10 +170,11 @@ public class FastExcelUtil {
}
- public static List> readExcelData2(MultipartFile file) {
+ public static List> readExcelData2(MultipartFile file, int headRowNumber) {
try {
return FastExcel.read(file.getInputStream())
- .sheet() // 默认读取第一个Sheet
+ .sheet()
+ .headRowNumber(headRowNumber)
.doReadSync();
} catch (IOException e) {
throw new BadRequestException("数据格式存在问题,无法读取");