no message
parent
7a418eda87
commit
0bc5829e0a
|
|
@ -60,9 +60,7 @@ public class AppRun {
|
||||||
springApplication.addListeners(new ApplicationPidFileWriter());
|
springApplication.addListeners(new ApplicationPidFileWriter());
|
||||||
springApplication.addListeners(new MyApiDictListener());
|
springApplication.addListeners(new MyApiDictListener());
|
||||||
springApplication.run(args);
|
springApplication.run(args);
|
||||||
|
log.info(JSONUtil.toJsonStr(LicenseValidate.getDeviceInfo()));
|
||||||
log.error(JSONUtil.toJsonStr(LicenseValidate.getDeviceInfo()));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import org.springframework.stereotype.Component;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @description: ApplicationListener
|
* @description: ApplicationListener
|
||||||
* @copyright: @Copyright (c) 2022
|
* @copyright: @Copyright (c) 2022
|
||||||
* @company: Aiocloud
|
* @company: Aiocloud
|
||||||
|
|
@ -28,21 +27,17 @@ import java.util.List;
|
||||||
public class MyApiDictListener implements ApplicationListener<ContextRefreshedEvent> {
|
public class MyApiDictListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||||
|
|
||||||
public static boolean isCanRun = true;
|
public static boolean isCanRun = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||||
// 在这里处理特定的事件逻辑
|
// 在这里处理特定的事件逻辑
|
||||||
if (event.getApplicationContext().getParent() == null) {
|
if (event.getApplicationContext().getParent() == null) {
|
||||||
if (isCanRun) {
|
if (isCanRun) {
|
||||||
isCanRun = false;
|
isCanRun = false;
|
||||||
System.out.println("收到应用程序事件:" + event.toString());
|
|
||||||
|
|
||||||
System.out.println("收到应用程序事件2:" + event.toString());
|
|
||||||
ApiDictQueryCriteria dict = new ApiDictQueryCriteria();
|
ApiDictQueryCriteria dict = new ApiDictQueryCriteria();
|
||||||
ApiDictServiceImpl apiDictServiceImpl = SpringContextHolder.getBean(ApiDictServiceImpl.class);
|
ApiDictServiceImpl apiDictServiceImpl = SpringContextHolder.getBean(ApiDictServiceImpl.class);
|
||||||
// 在这里写入加载数据的逻辑
|
// 在这里写入加载数据的逻辑
|
||||||
apiDictServiceImpl.queryAllToSave();
|
apiDictServiceImpl.queryAllToSave();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// 确保只启动一次
|
// 确保只启动一次
|
||||||
// 在这里编写你的逻辑代码
|
// 在这里编写你的逻辑代码
|
||||||
|
|
|
||||||
|
|
@ -46,15 +46,9 @@ public class PackageCheck extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
@Column(name = "`code`", unique = true, nullable = false)
|
@Column(name = "`code`", unique = true, nullable = false)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@ApiModelProperty(value = "成套代码")
|
@ApiModelProperty(value = "代码")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@OneToOne
|
|
||||||
@JoinColumn(name = "`item_id`", nullable = false)
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "物料")
|
|
||||||
private Item item;
|
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "dept_id")
|
@JoinColumn(name = "dept_id")
|
||||||
@ApiModelProperty(value = "仓库")
|
@ApiModelProperty(value = "仓库")
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,20 @@ package com.youchain.basicdata.repository;
|
||||||
import com.youchain.basicdata.domain.PackageCheck;
|
import com.youchain.basicdata.domain.PackageCheck;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @author huojin
|
* @author huojin
|
||||||
|
* @website https://eladmin.vip
|
||||||
* @date 2024-06-13
|
* @date 2024-06-13
|
||||||
**/
|
**/
|
||||||
public interface PackageCheckRepository extends JpaRepository<PackageCheck, Long>, JpaSpecificationExecutor<PackageCheck> {
|
public interface PackageCheckRepository extends JpaRepository<PackageCheck, Long>, JpaSpecificationExecutor<PackageCheck> {
|
||||||
/**
|
/**
|
||||||
* 根据 Code 查询
|
* 根据 Code 查询
|
||||||
|
*
|
||||||
* @param code /
|
* @param code /
|
||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
|
@Query(" from PackageCheck p where p.code = ?1")
|
||||||
PackageCheck findByCode(String code);
|
PackageCheck findByCode(String code);
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ public class BigItemController {
|
||||||
return new ResponseEntity<>(bigItemService.queryAll(criteria, pageable), HttpStatus.OK);
|
return new ResponseEntity<>(bigItemService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/All")
|
@GetMapping("/queryAllBigItem")
|
||||||
@ApiOperation("查询所有bigitem")
|
@ApiOperation("查询所有bigitem")
|
||||||
public ResponseEntity<Object> queryAllBigItem(BigItemQueryCriteria criteria) {
|
public ResponseEntity<Object> queryAllBigItem(BigItemQueryCriteria criteria) {
|
||||||
return new ResponseEntity<>(bigItemService.queryAll(criteria), HttpStatus.OK);
|
return new ResponseEntity<>(bigItemService.queryAll(criteria), HttpStatus.OK);
|
||||||
|
|
|
||||||
|
|
@ -41,15 +41,10 @@ public class PackageCheckDto implements Serializable {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成套代码
|
* 代码
|
||||||
*/
|
*/
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料
|
|
||||||
*/
|
|
||||||
private ItemDto item;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仓库
|
* 仓库
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,4 @@ public class PackageCheckQueryCriteria {
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料编号
|
|
||||||
*/
|
|
||||||
@Query(propName = "code", joinName = "item")
|
|
||||||
private String itemCode;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,7 @@ public class PackageCheckServiceImpl implements PackageCheckService {
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
for (PackageCheckDto packageCheck : all) {
|
for (PackageCheckDto packageCheck : all) {
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("成套代码", packageCheck.getCode());
|
map.put("代码", packageCheck.getCode());
|
||||||
map.put("物料", packageCheck.getItem().getCode());
|
|
||||||
map.put("套数", packageCheck.getQuantity());
|
map.put("套数", packageCheck.getQuantity());
|
||||||
map.put("创建人", packageCheck.getCreateBy());
|
map.put("创建人", packageCheck.getCreateBy());
|
||||||
map.put("修改人", packageCheck.getUpdateBy());
|
map.put("修改人", packageCheck.getUpdateBy());
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ public class Gd extends BaseEntity implements Serializable {
|
||||||
@Column(name = "`station`",nullable = false)
|
@Column(name = "`station`",nullable = false)
|
||||||
@ApiModelProperty(value = "需求工位")
|
@ApiModelProperty(value = "需求工位")
|
||||||
private String station;
|
private String station;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`dept_id`",nullable = false)
|
@JoinColumn(name = "`dept_id`",nullable = false)
|
||||||
@ApiModelProperty(value = "仓库")
|
@ApiModelProperty(value = "仓库")
|
||||||
|
|
|
||||||
|
|
@ -18,21 +18,19 @@ package com.youchain.businessdata.domain;
|
||||||
import com.youchain.base.BaseEntity;
|
import com.youchain.base.BaseEntity;
|
||||||
import com.youchain.basicdata.domain.BigItem;
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.basicdata.domain.Point;
|
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @author huojin
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
* @description /
|
* @description /
|
||||||
* @author huojin
|
|
||||||
* @date 2024-06-06
|
* @date 2024-06-06
|
||||||
**/
|
**/
|
||||||
@Entity
|
@Entity
|
||||||
|
|
@ -63,12 +61,13 @@ public class GdDetail extends BaseEntity implements Serializable {
|
||||||
@Column(name = "`item_qty`")
|
@Column(name = "`item_qty`")
|
||||||
@ApiModelProperty(value = "单品数量")
|
@ApiModelProperty(value = "单品数量")
|
||||||
private Double itemQty = 0d;
|
private Double itemQty = 0d;
|
||||||
|
|
||||||
@Column(name = "`order_qty`")
|
@Column(name = "`order_qty`")
|
||||||
@ApiModelProperty(value = "未拆分数量")
|
@ApiModelProperty(value = "未拆分数量")
|
||||||
private Double orderQty = 0d;
|
private Double orderQty = 0d;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`big_item_id`",nullable = false)
|
@JoinColumn(name = "`big_item_id`")
|
||||||
@ApiModelProperty(value = "成套物料")
|
@ApiModelProperty(value = "成套物料")
|
||||||
private BigItem bigItem;
|
private BigItem bigItem;
|
||||||
|
|
||||||
|
|
@ -84,6 +83,7 @@ public class GdDetail extends BaseEntity implements Serializable {
|
||||||
@JoinColumn(name = "`dept_id`", nullable = false)
|
@JoinColumn(name = "`dept_id`", nullable = false)
|
||||||
@ApiModelProperty(value = "仓库")
|
@ApiModelProperty(value = "仓库")
|
||||||
private Dept dept;
|
private Dept dept;
|
||||||
|
|
||||||
public void copy(GdDetail source) {
|
public void copy(GdDetail source) {
|
||||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,38 +44,51 @@ public class Pick extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "ID")
|
@ApiModelProperty(value = "ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "`line_no`")
|
||||||
|
@ApiModelProperty(value = "序号")
|
||||||
|
private int lineNo;
|
||||||
|
|
||||||
|
@Column(name = "`code`",nullable = false)
|
||||||
|
@ApiModelProperty(value = "出库单号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Column(name = "`gd_code`",nullable = false)
|
||||||
|
@ApiModelProperty(value = "工单号")
|
||||||
|
private String gdCode;
|
||||||
|
|
||||||
|
@Column(name = "`station`",nullable = false)
|
||||||
|
@ApiModelProperty(value = "需求工位")
|
||||||
|
private String station;
|
||||||
|
|
||||||
|
@Column(name = "`cp_code_or_dp_code`",nullable = false)
|
||||||
|
@ApiModelProperty(value = "成品代码或单品代码")
|
||||||
|
private String cpCodeOrDpCode;
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "`status`")
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "`point_id`")
|
||||||
|
@ApiModelProperty(value = "备料点位")
|
||||||
|
@NotNull
|
||||||
|
private Point point;
|
||||||
|
|
||||||
|
@Column(name = "`is_call`")
|
||||||
|
@ApiModelProperty(value = "是否叫料")
|
||||||
|
private Boolean isCall;
|
||||||
|
|
||||||
|
@Column(name = "`source_id`")
|
||||||
|
@ApiModelProperty(value = "来源ID")
|
||||||
|
private Long sourceId;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`dept_id`", nullable = false)
|
@JoinColumn(name = "`dept_id`", nullable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "仓库")
|
@ApiModelProperty(value = "仓库")
|
||||||
private Dept dept;
|
private Dept dept;
|
||||||
|
|
||||||
@Column(name = "`code`")
|
|
||||||
@ApiModelProperty(value = "出库单头")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
@Column(name = "`line_no`")
|
|
||||||
@ApiModelProperty(value = "序号")
|
|
||||||
private int lineNo;
|
|
||||||
|
|
||||||
@Column(name = "`status`")
|
|
||||||
@ApiModelProperty(value = "状态")
|
|
||||||
private String status;
|
|
||||||
@OneToOne
|
|
||||||
@JoinColumn(name = "`point_id`", nullable = false)
|
|
||||||
@ApiModelProperty(value = "备料点位")
|
|
||||||
@NotNull
|
|
||||||
private Point point;
|
|
||||||
@OneToOne
|
|
||||||
@JoinColumn(name = "`gd_detail_id`", nullable = false)
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "关联工单明细")
|
|
||||||
private GdDetail gdDetail;
|
|
||||||
|
|
||||||
@Column(name = "`be_call`")
|
|
||||||
@ApiModelProperty(value = "是否叫料")
|
|
||||||
private Boolean beCall;
|
|
||||||
|
|
||||||
public void copy(Pick source) {
|
public void copy(Pick source) {
|
||||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class PickDetail extends BaseEntity implements Serializable {
|
||||||
private Item item;
|
private Item item;
|
||||||
|
|
||||||
@Column(name = "`line_no`")
|
@Column(name = "`line_no`")
|
||||||
@ApiModelProperty(value = "封包系数")
|
@ApiModelProperty(value = "行号")
|
||||||
private int lineNo;
|
private int lineNo;
|
||||||
|
|
||||||
@Column(name = "`po`")
|
@Column(name = "`po`")
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ import java.util.List;
|
||||||
**/
|
**/
|
||||||
public interface GdDetailRepository extends JpaRepository<GdDetail, Long>, JpaSpecificationExecutor<GdDetail> {
|
public interface GdDetailRepository extends JpaRepository<GdDetail, Long>, JpaSpecificationExecutor<GdDetail> {
|
||||||
@Query(value = "SELECT g FROM GdDetail g WHERE g.gd.id=?1 " +
|
@Query(value = "SELECT g FROM GdDetail g WHERE g.gd.id=?1 " +
|
||||||
" and (?2=null or g.bigItem.id=?2) and g.item.id=?3 and g.orderType=?4", nativeQuery = false)
|
" and (?2=null or g.bigItem.id=?2) and g.item.id=?3 and g.orderType=?4")
|
||||||
List<GdDetail> findRepeat(Long gdId, Long bigItemId, Long itemId,String orderType);
|
List<GdDetail> findRepeat(Long gdId, Long bigItemId, Long itemId,String orderType);
|
||||||
@Query(value = "SELECT g FROM GdDetail g WHERE g.gd.id=?1 and g.orderQty>0", nativeQuery = false)
|
@Query(value = " FROM GdDetail g WHERE g.gd.id=?1 and g.orderQty>0")
|
||||||
List<GdDetail> findByGdAndQty(Long gdId);
|
List<GdDetail> findByGdAndQty(Long gdId);
|
||||||
@Query(value = "SELECT g FROM GdDetail g WHERE g.bigItem.id=?1 ", nativeQuery = false)
|
@Query(value = "SELECT g FROM GdDetail g WHERE g.bigItem.id=?1 ")
|
||||||
List<GdDetail> findByBigItem(Long bigItemId);
|
List<GdDetail> findByBigItem(Long bigItemId);
|
||||||
}
|
}
|
||||||
|
|
@ -28,7 +28,7 @@ import java.util.List;
|
||||||
* @date 2024-06-11
|
* @date 2024-06-11
|
||||||
**/
|
**/
|
||||||
public interface PickRepository extends JpaRepository<Pick, Long>, JpaSpecificationExecutor<Pick> {
|
public interface PickRepository extends JpaRepository<Pick, Long>, JpaSpecificationExecutor<Pick> {
|
||||||
@Query(value = "SELECT p FROM Pick p WHERE p.gdDetail.id=?1 and p.lineNo=?2")
|
@Query(value = "SELECT p FROM Pick p WHERE p.id=?1 and p.lineNo=?2")
|
||||||
List<Pick> findRepeat(long gdDetailId, int no);
|
List<Pick> findRepeat(long gdDetailId, int no);
|
||||||
|
|
||||||
@Query(value = "SELECT p FROM Pick p WHERE p.status=?1 ")
|
@Query(value = "SELECT p FROM Pick p WHERE p.status=?1 ")
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @author huojin
|
* @author huojin
|
||||||
|
* @website https://eladmin.vip
|
||||||
* @date 2024-06-06
|
* @date 2024-06-06
|
||||||
**/
|
**/
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -52,13 +53,19 @@ public class GdController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询gd")
|
@ApiOperation("查询工单")
|
||||||
@ApiOperation("查询gd")
|
|
||||||
@PreAuthorize("@el.check('gd:list')")
|
@PreAuthorize("@el.check('gd:list')")
|
||||||
public ResponseEntity<Object> queryGd(GdQueryCriteria criteria, Pageable pageable) {
|
public ResponseEntity<Object> queryGd(GdQueryCriteria criteria, Pageable pageable) {
|
||||||
return new ResponseEntity<>(gdService.queryAll(criteria, pageable), HttpStatus.OK);
|
return new ResponseEntity<>(gdService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/queryAllGd")
|
||||||
|
@ApiOperation("查询All工单")
|
||||||
|
@PreAuthorize("@el.check('gd:list')")
|
||||||
|
public ResponseEntity<Object> queryAllGd(GdQueryCriteria criteria) {
|
||||||
|
return new ResponseEntity<>(gdService.queryAll(criteria), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增gd")
|
@Log("新增gd")
|
||||||
@ApiOperation("新增gd")
|
@ApiOperation("新增gd")
|
||||||
|
|
|
||||||
|
|
@ -9,31 +9,21 @@ import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.basicdata.repository.BigBomRepository;
|
import com.youchain.basicdata.repository.BigBomRepository;
|
||||||
import com.youchain.basicdata.repository.BigItemRepository;
|
import com.youchain.basicdata.repository.BigItemRepository;
|
||||||
import com.youchain.basicdata.repository.ItemRepository;
|
import com.youchain.basicdata.repository.ItemRepository;
|
||||||
import com.youchain.basicdata.service.BigBomService;
|
|
||||||
import com.youchain.businessdata.domain.Gd;
|
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
|
||||||
import com.youchain.businessdata.service.GdDetailService;
|
import com.youchain.businessdata.service.GdDetailService;
|
||||||
import com.youchain.businessdata.service.GdService;
|
import com.youchain.businessdata.service.GdService;
|
||||||
import com.youchain.businessdata.service.PickService;
|
import com.youchain.businessdata.service.PickService;
|
||||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
|
||||||
import com.youchain.exception.BadRequestException;
|
import com.youchain.exception.BadRequestException;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
import com.youchain.modules.system.service.DeptService;
|
import com.youchain.modules.system.service.DeptService;
|
||||||
import com.youchain.utils.BaseStatus;
|
|
||||||
import com.youchain.utils.BizStatus;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiResponse;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
|
|
@ -44,7 +34,6 @@ import static org.springframework.http.HttpStatus.OK;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MesController {
|
public class MesController {
|
||||||
private final GdService gdService;
|
private final GdService gdService;
|
||||||
private final GdDetailService gdDetailService;
|
|
||||||
private final DeptService deptService;
|
private final DeptService deptService;
|
||||||
private final ItemRepository itemRepository;
|
private final ItemRepository itemRepository;
|
||||||
private final BigBomRepository bigBomRepository;
|
private final BigBomRepository bigBomRepository;
|
||||||
|
|
@ -56,21 +45,29 @@ public class MesController {
|
||||||
@ApiOperation("mes-原材料备料")
|
@ApiOperation("mes-原材料备料")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> yclbl(@Validated @RequestBody Yclbl yclbl) {
|
public ResponseEntity<Object> yclbl(@Validated @RequestBody Yclbl yclbl) {
|
||||||
/* 添加工单单头*/
|
|
||||||
|
try {
|
||||||
|
gdService.materialBL(yclbl);
|
||||||
|
return successResponse("备料成功!");
|
||||||
|
}catch (Exception e){
|
||||||
|
return badResponse("备料失败:"+e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* *//* 添加工单单头*//*
|
||||||
Gd gd = gdService.createGd(yclbl.getOrderNo(), yclbl.getTaskCode(), yclbl.getStation());
|
Gd gd = gdService.createGd(yclbl.getOrderNo(), yclbl.getTaskCode(), yclbl.getStation());
|
||||||
if (yclbl.getBlzc() != null) {
|
if (yclbl.getBlzc() != null) {
|
||||||
String orderType = BaseStatus.GD_TYPE_CT;
|
String orderType = BaseStatus.GD_TYPE_CT;
|
||||||
Set<ZcData> blzc = yclbl.getBlzc();
|
Set<ZcData> blzc = yclbl.getBlzc();
|
||||||
for (ZcData zcData : blzc) {
|
for (ZcData zcData : blzc) {
|
||||||
/* 验证成套 物料*/
|
*//* 验证成套 物料*//*
|
||||||
BigItem bigItem = verifiedBigItem(zcData.getCompleteCode());
|
BigItem bigItem = verifiedBigItem(zcData.getCompleteCode());
|
||||||
Set<ItemDate> itemDates = zcData.getBlzcmx();
|
Set<ItemDate> itemDates = zcData.getBlzcmx();
|
||||||
for (ItemDate itemDate : itemDates) {
|
for (ItemDate itemDate : itemDates) {
|
||||||
/* 验证单品 物料*/
|
*//* 验证单品 物料*//*
|
||||||
Item item = verifiedItem(itemDate.getItemCode());
|
Item item = verifiedItem(itemDate.getItemCode());
|
||||||
/* 验证BOM*/
|
*//* 验证BOM*//*
|
||||||
BigBom bigBom = verifiedBigBom(bigItem, item, itemDate.getItemQty());
|
BigBom bigBom = verifiedBigBom(bigItem, item, itemDate.getItemQty());
|
||||||
/* 添加工单明细*/
|
*//* 添加工单明细*//*
|
||||||
GdDetail gdDetail = gdDetailService.save(zcData.getLineNo(), gd, orderType, bigItem, zcData.getCompleteQty(), item, itemDate.getItemQty(), itemDate.getItemQty() * zcData.getCompleteQty());
|
GdDetail gdDetail = gdDetailService.save(zcData.getLineNo(), gd, orderType, bigItem, zcData.getCompleteQty(), item, itemDate.getItemQty(), itemDate.getItemQty() * zcData.getCompleteQty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -79,16 +76,16 @@ public class MesController {
|
||||||
String orderType = BaseStatus.GD_TYPE_DP;
|
String orderType = BaseStatus.GD_TYPE_DP;
|
||||||
Set<ItemDate> itemDateList = yclbl.getBlzcmx();
|
Set<ItemDate> itemDateList = yclbl.getBlzcmx();
|
||||||
for (ItemDate itemDate : itemDateList) {
|
for (ItemDate itemDate : itemDateList) {
|
||||||
/* 验证单品物料*/
|
*//* 验证单品物料*//*
|
||||||
Item item = verifiedItem(itemDate.getItemCode());
|
Item item = verifiedItem(itemDate.getItemCode());
|
||||||
/* 添加工单明细*/
|
*//* 添加工单明细*//*
|
||||||
GdDetail gdDetail = gdDetailService.save(itemDate.getLineNo(), gd, orderType, null, null, item, itemDate.getItemQty(), itemDate.getItemQty());
|
GdDetail gdDetail = gdDetailService.save(itemDate.getLineNo(), gd, orderType, null, null, item, itemDate.getItemQty(), itemDate.getItemQty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 生成 出库明细*/
|
*//* 生成 出库明细*//*
|
||||||
gdService.addPickDetail(gd);
|
gdService.addPickDetail(gd);
|
||||||
ApiResult apiResult = ApiResult.result(200, "成功", null);
|
ApiResult apiResult = ApiResult.result(200, "成功", null);
|
||||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -114,7 +111,7 @@ public class MesController {
|
||||||
pickService.itemCall(orderNo, itemCode, station, pointCode);
|
pickService.itemCall(orderNo, itemCode, station, pointCode);
|
||||||
return successResponse("叫料成功!");
|
return successResponse("叫料成功!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badResponse("叫料失败!");
|
return badResponse("叫料失败!"+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -184,7 +181,7 @@ public class MesController {
|
||||||
bigBom.setBigItem(bigItem);
|
bigBom.setBigItem(bigItem);
|
||||||
bigBom.setItem(item);
|
bigBom.setItem(item);
|
||||||
bigBom.setQuantity(itemQty);
|
bigBom.setQuantity(itemQty);
|
||||||
bigBom.setDept(deptService.isDept());
|
bigBom.setDept(deptService.getDefaultDept());
|
||||||
bigBomRepository.save(bigBom);
|
bigBomRepository.save(bigBom);
|
||||||
return bigBom;
|
return bigBom;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.youchain.basicdata.domain.Box;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.basicdata.service.dto.BoxDto;
|
import com.youchain.basicdata.service.dto.BoxDto;
|
||||||
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
import com.youchain.businessdata.domain.Pick;
|
import com.youchain.businessdata.domain.Pick;
|
||||||
import com.youchain.businessdata.domain.PickDetail;
|
import com.youchain.businessdata.domain.PickDetail;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailDto;
|
import com.youchain.businessdata.service.dto.PickDetailDto;
|
||||||
|
|
@ -117,4 +118,11 @@ public interface PickDetailService {
|
||||||
PickDetail createPickDetail(Item item,String po);
|
PickDetail createPickDetail(Item item,String po);
|
||||||
|
|
||||||
void save(Pick pick);
|
void save(Pick pick);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建出库单明细
|
||||||
|
* @param pick->出库单
|
||||||
|
* @param gdDetails->工单明细
|
||||||
|
*/
|
||||||
|
void createPickDetail(Pick pick, List<GdDetail> gdDetails);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service;
|
package com.youchain.businessdata.service;
|
||||||
|
|
||||||
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
import com.youchain.businessdata.domain.Gd;
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
import com.youchain.businessdata.domain.Pick;
|
import com.youchain.businessdata.domain.Pick;
|
||||||
import com.youchain.businessdata.service.dto.PickDto;
|
import com.youchain.businessdata.service.dto.PickDto;
|
||||||
|
|
@ -101,4 +103,12 @@ public interface PickService {
|
||||||
* @param pointCode->需求点位
|
* @param pointCode->需求点位
|
||||||
*/
|
*/
|
||||||
void itemCall(String gdNo,String itemCode,String station,String pointCode);
|
void itemCall(String gdNo,String itemCode,String station,String pointCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建出库单
|
||||||
|
* @param gd->订单
|
||||||
|
* @param lineNo->行号
|
||||||
|
* @param cpCodeOrpCode->成品代码或原料代码
|
||||||
|
*/
|
||||||
|
Pick createPick(Gd gd, int lineNo, String cpCodeOrpCode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,40 @@
|
||||||
package com.youchain.businessdata.service.dto;
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.youchain.annotation.Query;
|
import com.youchain.annotation.Query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @author huojin
|
* @author huojin
|
||||||
|
* @website https://eladmin.vip
|
||||||
* @date 2024-06-06
|
* @date 2024-06-06
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class GdDetailQueryCriteria {
|
public class GdDetailQueryCriteria {
|
||||||
|
|
||||||
/** 模糊 */
|
/**
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
* 工单编码
|
||||||
private Long itemId;
|
*/
|
||||||
|
@Query(joinName = "gd>", propName = "code", type = Query.Type.INNER_LIKE)
|
||||||
|
private String gdCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单品编码
|
||||||
|
*/
|
||||||
|
@Query(joinName = "item>", propName = "code", type = Query.Type.INNER_LIKE)
|
||||||
|
private String itemCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成品编码
|
||||||
|
*/
|
||||||
|
@Query(joinName = "bigItem>", propName = "code", type = Query.Type.INNER_LIKE)
|
||||||
|
private String bigItemCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单据类型
|
||||||
|
*/
|
||||||
|
@Query
|
||||||
|
private String orderType;
|
||||||
}
|
}
|
||||||
|
|
@ -16,55 +16,94 @@
|
||||||
package com.youchain.businessdata.service.dto;
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import com.youchain.modules.system.service.dto.DeptDto;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @author huojin
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
* @description /
|
* @description /
|
||||||
* @author huojin
|
|
||||||
* @date 2024-06-11
|
* @date 2024-06-11
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class PickDto implements Serializable {
|
public class PickDto implements Serializable {
|
||||||
|
|
||||||
/** ID */
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 创建人 */
|
/**
|
||||||
private String createBy;
|
* 序号
|
||||||
|
*/
|
||||||
|
private int lineNo;
|
||||||
|
|
||||||
/** 修改人 */
|
/**
|
||||||
private String updateBy;
|
* 出库单号
|
||||||
|
*/
|
||||||
/** 创建时间 */
|
|
||||||
private Timestamp createTime;
|
|
||||||
|
|
||||||
/** 修改时间 */
|
|
||||||
private Timestamp updateTime;
|
|
||||||
|
|
||||||
/** 仓库ID */
|
|
||||||
private Long deptId;
|
|
||||||
private DeptDto dept;
|
|
||||||
|
|
||||||
/** 出库单头 */
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
/** 序号 */
|
/**
|
||||||
private String lineNo;
|
* 工单号
|
||||||
|
*/
|
||||||
|
private String gdCode;
|
||||||
|
|
||||||
/** 状态 */
|
/**
|
||||||
|
* 需求工位
|
||||||
|
*/
|
||||||
|
private String station;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成品代码或单品代码
|
||||||
|
*/
|
||||||
|
private String cpCodeOrDpCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 关联工单明细 */
|
/**
|
||||||
private Long gdDetailId;
|
* 备料点位
|
||||||
private GdDetail gdDetail;
|
*/
|
||||||
/** 关联备料点位 */
|
|
||||||
private Point point;
|
private Point point;
|
||||||
|
|
||||||
/** 是否叫料 */
|
/**
|
||||||
private Boolean beCall;
|
* 是否叫料
|
||||||
|
*/
|
||||||
|
private Boolean isCall;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源ID
|
||||||
|
*/
|
||||||
|
private Long sourceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库
|
||||||
|
*/
|
||||||
|
private Dept dept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,4 @@ public class PickQueryCriteria{
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
/** 模糊 */
|
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
|
||||||
private String gdDetaiId;
|
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +132,7 @@ public class GdDetailServiceImpl implements GdDetailService {
|
||||||
gdDetail.setOrderQty(orderQty);
|
gdDetail.setOrderQty(orderQty);
|
||||||
gdDetail.setBigItem(bigItem);
|
gdDetail.setBigItem(bigItem);
|
||||||
gdDetail.setBigItemQty(completeQty);
|
gdDetail.setBigItemQty(completeQty);
|
||||||
gdDetail.setDept(deptService.isDept());
|
gdDetail.setDept(deptService.getDefaultDept());
|
||||||
gdDetail.setOrderType(orderType);
|
gdDetail.setOrderType(orderType);
|
||||||
gdDetailRepository.save(gdDetail);
|
gdDetailRepository.save(gdDetail);
|
||||||
return gdDetail;
|
return gdDetail;
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,11 @@ import com.youchain.RequestData.Yclbl;
|
||||||
import com.youchain.RequestData.ZcData;
|
import com.youchain.RequestData.ZcData;
|
||||||
import com.youchain.basicdata.domain.BigItem;
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
|
import com.youchain.basicdata.domain.PackageCheck;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.basicdata.repository.BigItemRepository;
|
import com.youchain.basicdata.repository.BigItemRepository;
|
||||||
import com.youchain.basicdata.repository.ItemRepository;
|
import com.youchain.basicdata.repository.ItemRepository;
|
||||||
|
import com.youchain.basicdata.repository.PackageCheckRepository;
|
||||||
import com.youchain.basicdata.repository.PointRepository;
|
import com.youchain.basicdata.repository.PointRepository;
|
||||||
import com.youchain.businessdata.domain.Gd;
|
import com.youchain.businessdata.domain.Gd;
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
|
|
@ -31,7 +33,7 @@ import com.youchain.businessdata.repository.GdDetailRepository;
|
||||||
import com.youchain.businessdata.repository.PickRepository;
|
import com.youchain.businessdata.repository.PickRepository;
|
||||||
import com.youchain.businessdata.service.PickDetailService;
|
import com.youchain.businessdata.service.PickDetailService;
|
||||||
import com.youchain.businessdata.service.PickService;
|
import com.youchain.businessdata.service.PickService;
|
||||||
import com.youchain.exception.BadRequestException;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import com.youchain.modules.system.service.DeptService;
|
import com.youchain.modules.system.service.DeptService;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -40,7 +42,6 @@ import com.youchain.businessdata.service.GdService;
|
||||||
import com.youchain.businessdata.service.dto.GdDto;
|
import com.youchain.businessdata.service.dto.GdDto;
|
||||||
import com.youchain.businessdata.service.dto.GdQueryCriteria;
|
import com.youchain.businessdata.service.dto.GdQueryCriteria;
|
||||||
import com.youchain.businessdata.service.mapstruct.GdMapper;
|
import com.youchain.businessdata.service.mapstruct.GdMapper;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
@ -48,6 +49,9 @@ import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,6 +75,8 @@ public class GdServiceImpl implements GdService {
|
||||||
private final DeptService deptService;
|
private final DeptService deptService;
|
||||||
private final GdMapper gdMapper;
|
private final GdMapper gdMapper;
|
||||||
private final RedisObjectUtils redisObjectUtils;
|
private final RedisObjectUtils redisObjectUtils;
|
||||||
|
private final PackageCheckRepository packageCheckRepository;
|
||||||
|
private final BatchCreateOrUpdate batchCreateOrUpdate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(GdQueryCriteria criteria, Pageable pageable) {
|
public Map<String, Object> queryAll(GdQueryCriteria criteria, Pageable pageable) {
|
||||||
|
|
@ -139,7 +145,7 @@ public class GdServiceImpl implements GdService {
|
||||||
gd.setName(taskCode);
|
gd.setName(taskCode);
|
||||||
gd.setStation(station);
|
gd.setStation(station);
|
||||||
gd.setStatus(BizStatus.OPEN);
|
gd.setStatus(BizStatus.OPEN);
|
||||||
gd.setDept(deptService.isDept());
|
gd.setDept(deptService.getDefaultDept());
|
||||||
gdRepository.save(gd);
|
gdRepository.save(gd);
|
||||||
return gd;
|
return gd;
|
||||||
}
|
}
|
||||||
|
|
@ -174,33 +180,168 @@ public class GdServiceImpl implements GdService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原材料备料
|
||||||
|
*
|
||||||
|
* @param yclbl -> 备料参数
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void materialBL(Yclbl yclbl) {
|
public void materialBL(Yclbl yclbl) {
|
||||||
|
/** 验证参数有效性 */
|
||||||
|
validateGd(yclbl);
|
||||||
|
|
||||||
validateGd(yclbl);//验证参数有效性
|
/** 验证工单是否存在 */
|
||||||
Gd gd = gdRepository.findByGdList(yclbl.getOrderNo(), yclbl.getTaskCode(), yclbl.getStation());//查询备料工单是否存在
|
checkIfGdExists(yclbl);
|
||||||
|
|
||||||
|
/** 创建工单 */
|
||||||
|
Gd gd = createGd(yclbl.getOrderNo(), yclbl.getTaskCode(), yclbl.getStation());
|
||||||
|
|
||||||
|
/** 创建工单明细 */
|
||||||
|
List<GdDetail> gdDetailList = createGdDetailsCPAndDP(gd, yclbl);
|
||||||
|
|
||||||
|
/** 创建出库单和出库明细 */
|
||||||
|
createPickAndPickDetail(gd, gdDetailList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证工单是否存在
|
||||||
|
*
|
||||||
|
* @param yclbl -> 备料参数
|
||||||
|
*/
|
||||||
|
private void checkIfGdExists(Yclbl yclbl) {
|
||||||
|
Gd gd = gdRepository.findByGdList(yclbl.getOrderNo(), yclbl.getTaskCode(), yclbl.getStation());
|
||||||
if (gd != null) {
|
if (gd != null) {
|
||||||
throw new IllegalArgumentException(yclbl.getOrderNo() + "备料工单已存在!");
|
throw new IllegalArgumentException(yclbl.getOrderNo() + "备料工单已存在!");
|
||||||
}
|
}
|
||||||
this.createGd(yclbl.getOrderNo(), yclbl.getTaskCode(), yclbl.getStation());//创建备料工单
|
}
|
||||||
|
|
||||||
//添加备料明细
|
/**
|
||||||
if (!yclbl.getBlzc().isEmpty()) {
|
* 创建成品工单明细
|
||||||
|
*
|
||||||
|
* @param yclbl -> 备料参数
|
||||||
|
* @param gd -> 工单
|
||||||
|
*/
|
||||||
|
private List<GdDetail> createGdDetailsCP(Yclbl yclbl, Gd gd) {
|
||||||
|
if (yclbl.getBlzc().isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
String orderType = BaseStatus.GD_TYPE_CT;
|
String orderType = BaseStatus.GD_TYPE_CT;
|
||||||
Set<ZcData> blzc = yclbl.getBlzc();
|
Dept dept = deptService.getDefaultDept();
|
||||||
for (ZcData zcData : blzc) {
|
|
||||||
|
List<GdDetail> gdDetailsCreate = yclbl.getBlzc().parallelStream()
|
||||||
|
.flatMap(zcData -> {
|
||||||
BigItem bigItem = validateBigItem(zcData.getCompleteCode()); // 验证成品是否存在
|
BigItem bigItem = validateBigItem(zcData.getCompleteCode()); // 验证成品是否存在
|
||||||
Set<ItemDate> itemDates = zcData.getBlzcmx();
|
double completeQty = zcData.getCompleteQty();
|
||||||
for (ItemDate itemDate : itemDates) {
|
AtomicInteger index = new AtomicInteger(1);
|
||||||
|
return zcData.getBlzcmx().stream()
|
||||||
|
.map(itemDate -> {
|
||||||
Item item = validateItem(itemDate.getItemCode()); // 验证单品是否存在
|
Item item = validateItem(itemDate.getItemCode()); // 验证单品是否存在
|
||||||
|
return createGdDetail(
|
||||||
|
gd,
|
||||||
|
index.getAndIncrement(),
|
||||||
|
item,
|
||||||
|
itemDate.getItemQty(),
|
||||||
|
bigItem,
|
||||||
|
completeQty,
|
||||||
|
orderType,
|
||||||
|
dept
|
||||||
|
);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return gdDetailsCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建单品工单明细
|
||||||
|
*
|
||||||
|
* @param yclbl -> 备料参数
|
||||||
|
* @param gd -> 工单
|
||||||
|
*/
|
||||||
|
private List<GdDetail> createGdDetailsDP(Yclbl yclbl, Gd gd) {
|
||||||
|
if (yclbl.getBlzcmx().isEmpty()) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
String orderType = BaseStatus.GD_TYPE_DP;
|
||||||
|
Dept dept = deptService.getDefaultDept();
|
||||||
|
AtomicInteger index = new AtomicInteger(1);
|
||||||
|
List<GdDetail> gdDetailsCreate = yclbl.getBlzcmx().parallelStream()
|
||||||
|
.map(itemDate -> {
|
||||||
|
Item item = validateItem(itemDate.getItemCode()); // 验证单品是否存在
|
||||||
|
return createGdDetail(
|
||||||
|
gd,
|
||||||
|
index.getAndIncrement(),
|
||||||
|
item,
|
||||||
|
itemDate.getItemQty(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
orderType,
|
||||||
|
dept
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return gdDetailsCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建工单明细
|
||||||
|
*
|
||||||
|
* @param gd -> 工单
|
||||||
|
* @param yclbl -> 备料参数
|
||||||
|
*/
|
||||||
|
private List<GdDetail> createGdDetailsCPAndDP(Gd gd, Yclbl yclbl) {
|
||||||
|
|
||||||
|
/** 添加成品工单明细集合 */
|
||||||
|
List<GdDetail> gdDetailsCreateCP = createGdDetailsCP(yclbl, gd);
|
||||||
|
|
||||||
|
/** 添加单品工单明细集合 */
|
||||||
|
List<GdDetail> gdDetailsCreateDP = createGdDetailsDP(yclbl, gd);
|
||||||
|
|
||||||
|
/** 把两个集合合并 */
|
||||||
|
List<GdDetail> gdDetailsCreate = new ArrayList<>(gdDetailsCreateCP);
|
||||||
|
gdDetailsCreate.addAll(gdDetailsCreateDP);
|
||||||
|
|
||||||
|
/** 批量保存工单明细 */
|
||||||
|
CompletableFuture<List<GdDetail>> future = CompletableFuture.supplyAsync(() -> {
|
||||||
|
batchCreateOrUpdate.batchCreate(gdDetailsCreate);
|
||||||
|
return gdDetailsCreate;
|
||||||
|
});
|
||||||
|
return future.join();// 返回结果
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建工单明细
|
||||||
|
*
|
||||||
|
* @param gd-> 工单
|
||||||
|
* @param lineNo -> 行号
|
||||||
|
* @param item -> 单品
|
||||||
|
* @param itemQty -> 单品数量
|
||||||
|
* @param bigItem -> 成品
|
||||||
|
* @param bigItemQty -> 成品数量
|
||||||
|
* @param orderType -> 订单类型
|
||||||
|
* @param dept -> 仓库
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private GdDetail createGdDetail(Gd gd, int lineNo, Item item, Double itemQty, BigItem bigItem, Double bigItemQty, String orderType, Dept dept) {
|
||||||
|
GdDetail gdDetail = new GdDetail();
|
||||||
|
gdDetail.setGd(gd);
|
||||||
|
gdDetail.setLineNo(lineNo);
|
||||||
|
gdDetail.setItem(item);
|
||||||
|
gdDetail.setItemQty(itemQty);
|
||||||
|
gdDetail.setBigItem(bigItem);
|
||||||
|
gdDetail.setBigItemQty(bigItemQty);
|
||||||
|
gdDetail.setOrderType(orderType);
|
||||||
|
gdDetail.setDept(dept);
|
||||||
|
return gdDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证参数有效性
|
||||||
|
*
|
||||||
|
* @param yclbl -> 备料参数
|
||||||
|
*/
|
||||||
private void validateGd(Yclbl yclbl) {
|
private void validateGd(Yclbl yclbl) {
|
||||||
if (StringUtils.isEmpty(yclbl.getOrderNo())) {
|
if (StringUtils.isEmpty(yclbl.getOrderNo())) {
|
||||||
throw new IllegalArgumentException("工单号不能为空!");
|
throw new IllegalArgumentException("工单号不能为空!");
|
||||||
|
|
@ -217,21 +358,101 @@ public class GdServiceImpl implements GdService {
|
||||||
|
|
||||||
if (!yclbl.getBlzc().isEmpty()) {
|
if (!yclbl.getBlzc().isEmpty()) {
|
||||||
for (ZcData zcData : yclbl.getBlzc()) {
|
for (ZcData zcData : yclbl.getBlzc()) {
|
||||||
if (zcData.getBlzcmx().isEmpty()) {
|
if (!StringUtils.isEmpty(zcData.getCompleteCode())) {
|
||||||
throw new IllegalArgumentException("成品明细里面的单品明细不能为空!");
|
if (zcData.getCompleteQty() <= 0) {
|
||||||
|
throw new IllegalArgumentException("成品套数不能小于等于0!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ItemDate itemDate : zcData.getBlzcmx()) {
|
||||||
|
if (itemDate.getItemQty() == null || itemDate.getItemQty() <= 0) {
|
||||||
|
throw new IllegalArgumentException("单品套数不能小于等于0!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!yclbl.getBlzcmx().isEmpty()) {
|
||||||
|
for (ItemDate itemDate : yclbl.getBlzcmx()) {
|
||||||
|
if (itemDate.getItemQty() == null || itemDate.getItemQty() <= 0) {
|
||||||
|
throw new IllegalArgumentException("单品套数不能小于等于0!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证成品是否存在
|
||||||
|
*
|
||||||
|
* @param completeCode -> 成品编码
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private BigItem validateBigItem(String completeCode) {
|
private BigItem validateBigItem(String completeCode) {
|
||||||
BigItem bigItem = redisObjectUtils.getObjectFromCache(completeCode, () -> bigItemRepository.findByBigItemCode(completeCode), completeCode + "成品物料不存在,请维护!");
|
BigItem bigItem = redisObjectUtils.getObjectFromCache(completeCode, () -> bigItemRepository.findByBigItemCode(completeCode), completeCode + "成品物料不存在,请维护!");
|
||||||
return bigItem;
|
return bigItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证单品是否存在
|
||||||
|
*
|
||||||
|
* @param itemCode -> 单品编码
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private Item validateItem(String itemCode) {
|
private Item validateItem(String itemCode) {
|
||||||
Item item = redisObjectUtils.getObjectFromCache(itemCode, () -> itemRepository.findByItemCode(itemCode), itemCode + "单品物料不存在,请维护!");
|
Item item = redisObjectUtils.getObjectFromCache(itemCode, () -> itemRepository.findByItemCode(itemCode), itemCode + "单品物料不存在,请维护!");
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证翻包套数是否存在
|
||||||
|
*
|
||||||
|
* @param code -> 翻包编码
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private PackageCheck validatePackageCheck(String code) {
|
||||||
|
PackageCheck packageCheck = redisObjectUtils.getObjectFromCache(code, () -> packageCheckRepository.findByCode(code), code + "翻包套数不存在,请维护!");
|
||||||
|
return packageCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createPickAndPickDetail(Gd gd, List<GdDetail> gdDetailList) {
|
||||||
|
AtomicInteger lineNo = new AtomicInteger(1);
|
||||||
|
/** 成品工单明细集合 */
|
||||||
|
List<GdDetail> cpGdDetailList = gdDetailList.stream()
|
||||||
|
.filter(gdDetail -> BaseStatus.GD_TYPE_CT.equals(gdDetail.getOrderType()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
/** 根据成品编码查出对应的工单明细集合 */
|
||||||
|
Map<String, List<GdDetail>> groupedByCpCodeMap = cpGdDetailList.stream()
|
||||||
|
.collect(Collectors.groupingBy(gdDetail -> gdDetail.getBigItem().getCode()));
|
||||||
|
|
||||||
|
/** 根据工单明细生成出库单和出库单明细 */
|
||||||
|
groupedByCpCodeMap.forEach((code, gdDetails) -> {
|
||||||
|
PackageCheck packageCheck = validatePackageCheck(code);// 验证翻包套数是否存在
|
||||||
|
double xqTaoQty = gdDetails.get(0).getBigItemQty();//需求套数
|
||||||
|
double fbTaoQty = packageCheck.getQuantity();//翻包套数
|
||||||
|
double chkQty = Math.ceil(xqTaoQty / fbTaoQty);//生成出库单数量
|
||||||
|
|
||||||
|
for (int i = 0; i < chkQty; i++) {
|
||||||
|
Pick pick = pickService.createPick(gd, lineNo.getAndIncrement(), code);
|
||||||
|
pickDetailService.createPickDetail(pick, gdDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 单品工单明细集合 */
|
||||||
|
List<GdDetail> dpGdDetailList = gdDetailList.stream()
|
||||||
|
.filter(gdDetail -> BaseStatus.GD_TYPE_DP.equals(gdDetail.getOrderType()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
/** 根据单品编码查出对应的工单明细集合 */
|
||||||
|
Map<String, List<GdDetail>> groupedByDpCodeMap = dpGdDetailList.stream()
|
||||||
|
.collect(Collectors.groupingBy(gdDetail -> gdDetail.getItem().getCode()));
|
||||||
|
|
||||||
|
/** 根据工单明细生成出库单和出库单明细 */
|
||||||
|
groupedByDpCodeMap.forEach((code, gdDetails) -> {
|
||||||
|
Pick pick = pickService.createPick(gd, lineNo.getAndIncrement(), code);
|
||||||
|
pickDetailService.createPickDetail(pick, gdDetails);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ import org.springframework.data.domain.Pageable;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
@ -352,13 +353,12 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
@Override
|
@Override
|
||||||
public void save(Pick pick) {
|
public void save(Pick pick) {
|
||||||
List<GdDetail> gdDetailList;
|
List<GdDetail> gdDetailList;
|
||||||
if (pick.getGdDetail().getBigItem()!=null) {
|
if (pick != null) {
|
||||||
/* 成套物料 */
|
/* 成套物料 */
|
||||||
gdDetailList = gdDetailRepository.findByBigItem(pick.getGdDetail().getBigItem().getId());
|
gdDetailList = gdDetailRepository.findByBigItem(pick.getId());
|
||||||
} else {
|
} else {
|
||||||
/* 单品物料*/
|
/* 单品物料*/
|
||||||
gdDetailList = new ArrayList<>();
|
gdDetailList = new ArrayList<>();
|
||||||
gdDetailList.add(pick.getGdDetail());
|
|
||||||
}
|
}
|
||||||
for (GdDetail gdDetail : gdDetailList) {
|
for (GdDetail gdDetail : gdDetailList) {
|
||||||
int fb = 1;//封包系数
|
int fb = 1;//封包系数
|
||||||
|
|
@ -385,4 +385,21 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
gdDetailRepository.save(gdDetail);
|
gdDetailRepository.save(gdDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void createPickDetail(Pick pick, List<GdDetail> gdDetails) {
|
||||||
|
AtomicInteger lineNo = new AtomicInteger(1);
|
||||||
|
for (GdDetail gdDetail : gdDetails) {
|
||||||
|
PickDetail pickDetail = new PickDetail();
|
||||||
|
pickDetail.setPick(pick);
|
||||||
|
pickDetail.setItem(gdDetail.getItem());
|
||||||
|
pickDetail.setLineNo(lineNo.getAndIncrement());
|
||||||
|
pickDetail.setStatus(BizStatus.OPEN);
|
||||||
|
pickDetail.setOrderQty(gdDetail.getItemQty());
|
||||||
|
pickDetail.setSourceId(gdDetail.getId());
|
||||||
|
pickDetail.setDept(gdDetail.getDept());
|
||||||
|
pickDetailRepository.save(pickDetail);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,11 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service.impl;
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
import com.youchain.businessdata.domain.Gd;
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
import com.youchain.businessdata.domain.Pick;
|
import com.youchain.businessdata.domain.Pick;
|
||||||
|
import com.youchain.businessdata.domain.PickDetail;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import com.youchain.businessdata.repository.PickRepository;
|
import com.youchain.businessdata.repository.PickRepository;
|
||||||
|
|
@ -35,6 +38,7 @@ import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author huojin
|
* @author huojin
|
||||||
|
|
@ -114,7 +118,6 @@ public class PickServiceImpl implements PickService {
|
||||||
if (pickList.size() > 0) {
|
if (pickList.size() > 0) {
|
||||||
pick = pickList.get(0);
|
pick = pickList.get(0);
|
||||||
}
|
}
|
||||||
pick.setGdDetail(gdDetail);
|
|
||||||
pick.setLineNo(no);
|
pick.setLineNo(no);
|
||||||
pick.setStatus(BizStatus.OPEN);
|
pick.setStatus(BizStatus.OPEN);
|
||||||
pick.setCode(gdDetail.getGd().getName() + "_" + no);
|
pick.setCode(gdDetail.getGd().getName() + "_" + no);
|
||||||
|
|
@ -131,10 +134,10 @@ public class PickServiceImpl implements PickService {
|
||||||
if (pick == null) {
|
if (pick == null) {
|
||||||
throw new IllegalArgumentException(gdNo + "工单未备料,叫料失败!");
|
throw new IllegalArgumentException(gdNo + "工单未备料,叫料失败!");
|
||||||
}
|
}
|
||||||
if (pick.getBeCall()) {
|
if (pick.getIsCall()) {
|
||||||
throw new IllegalArgumentException(gdNo + "工单已叫料,请勿重复叫料!");
|
throw new IllegalArgumentException(gdNo + "工单已叫料,请勿重复叫料!");
|
||||||
}
|
}
|
||||||
pick.setBeCall(true);
|
pick.setIsCall(true);
|
||||||
pickRepository.save(pick);
|
pickRepository.save(pick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,10 +148,27 @@ public class PickServiceImpl implements PickService {
|
||||||
if (pick == null) {
|
if (pick == null) {
|
||||||
throw new IllegalArgumentException(gdNo + "工单未备料,叫料失败!");
|
throw new IllegalArgumentException(gdNo + "工单未备料,叫料失败!");
|
||||||
}
|
}
|
||||||
if (pick.getBeCall()) {
|
if (pick.getIsCall()) {
|
||||||
throw new IllegalArgumentException(gdNo + "工单已叫料,请勿重复叫料!");
|
throw new IllegalArgumentException(gdNo + "工单已叫料,请勿重复叫料!");
|
||||||
}
|
}
|
||||||
pick.setBeCall(true);
|
pick.setIsCall(true);
|
||||||
pickRepository.save(pick);
|
pickRepository.save(pick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Pick createPick(Gd gd, int lineNo, String cpCodeOrpCode) {
|
||||||
|
Pick pick = new Pick();
|
||||||
|
pick.setLineNo(lineNo);
|
||||||
|
pick.setCode(gd.getCode() + "_" + lineNo);
|
||||||
|
pick.setGdCode(gd.getCode());
|
||||||
|
pick.setStation(gd.getStation());
|
||||||
|
pick.setCpCodeOrDpCode(cpCodeOrpCode);
|
||||||
|
pick.setStatus(BizStatus.OPEN);
|
||||||
|
pick.setIsCall(false);
|
||||||
|
pick.setSourceId(gd.getId());
|
||||||
|
pick.setDept(gd.getDept());
|
||||||
|
pickRepository.save(pick);
|
||||||
|
return pick;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,5 +122,5 @@ public interface DeptService {
|
||||||
*/
|
*/
|
||||||
void verification(Set<DeptDto> deptDtos);
|
void verification(Set<DeptDto> deptDtos);
|
||||||
/** 获取默认仓库*/
|
/** 获取默认仓库*/
|
||||||
Dept isDept();
|
Dept getDefaultDept();
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +247,7 @@ public class DeptServiceImpl implements DeptService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dept isDept() {
|
public Dept getDefaultDept() {
|
||||||
Dept dept = redisObjectUtils.getObjectFromCache("dept", () -> deptMapper.toEntity(findById(7L)), "系统无此仓库!");
|
Dept dept = redisObjectUtils.getObjectFromCache("dept", () -> deptMapper.toEntity(findById(7L)), "系统无此仓库!");
|
||||||
return dept;
|
return dept;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ public class BaseStatus {
|
||||||
*/
|
*/
|
||||||
public static String EMPTY = "EMPTY";
|
public static String EMPTY = "EMPTY";
|
||||||
|
|
||||||
/** 工单类型 成套*/
|
/** 工单类型 成品*/
|
||||||
public static String GD_TYPE_CT = "成套";
|
public static String GD_TYPE_CT = "成品";
|
||||||
/** 工单类型 单品*/
|
/** 工单类型 单品*/
|
||||||
public static String GD_TYPE_DP = "单品";
|
public static String GD_TYPE_DP = "单品";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@ public class RedisObjectUtils {
|
||||||
object = getOrThrow(Optional.ofNullable(serviceSupplier.get()), errorMessage);
|
object = getOrThrow(Optional.ofNullable(serviceSupplier.get()), errorMessage);
|
||||||
redisUtils.set(cacheKey, object);
|
redisUtils.set(cacheKey, object);
|
||||||
}
|
}
|
||||||
|
if (object == null) {
|
||||||
|
object = getOrThrow(Optional.ofNullable(serviceSupplier.get()), errorMessage);
|
||||||
|
redisUtils.set(cacheKey, object);
|
||||||
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,18 @@
|
||||||
package com.youchain;
|
package com.youchain;
|
||||||
|
|
||||||
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
public class EladminSystemApplicationTests {
|
public class EladminSystemApplicationTests {
|
||||||
|
|
@ -16,6 +22,13 @@ public class EladminSystemApplicationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
List<Integer> list1 = Arrays.asList();
|
||||||
|
List<Integer> list2 = Arrays.asList();
|
||||||
|
|
||||||
|
List<Integer> list3 = new ArrayList<>(list1);
|
||||||
|
list3.addAll(list2);
|
||||||
|
|
||||||
|
System.out.println(list3); // 输出: [1, 2, 3, 4, 5]
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int MAX_TASK_COUNT = 4;
|
private static final int MAX_TASK_COUNT = 4;
|
||||||
|
|
@ -23,6 +36,77 @@ public class EladminSystemApplicationTests {
|
||||||
private long lastTaskTime = System.currentTimeMillis();
|
private long lastTaskTime = System.currentTimeMillis();
|
||||||
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
||||||
|
|
||||||
|
void aa(){
|
||||||
|
/*double taoQty=2;//基础套数
|
||||||
|
double xTaoQty=3;//需求套数
|
||||||
|
double ckdQty=Math.ceil(xTaoQty/taoQty);//生成出库单数量
|
||||||
|
System.out.println(ckdQty);*/
|
||||||
|
|
||||||
|
GdDetail gdDetail=new GdDetail();
|
||||||
|
gdDetail.setBigItem(null);
|
||||||
|
gdDetail.setOrderType("DP");
|
||||||
|
|
||||||
|
GdDetail gdDetail2=new GdDetail();
|
||||||
|
BigItem bigItem2=new BigItem();
|
||||||
|
bigItem2.setCode("CT_001");
|
||||||
|
gdDetail2.setBigItem(bigItem2);
|
||||||
|
gdDetail2.setOrderType("CP");
|
||||||
|
gdDetail2.setBigItemQty(1d);
|
||||||
|
|
||||||
|
GdDetail gdDetail3=new GdDetail();
|
||||||
|
BigItem bigItem3=new BigItem();
|
||||||
|
bigItem3.setCode("CT_001");
|
||||||
|
gdDetail3.setBigItem(bigItem3);
|
||||||
|
gdDetail3.setOrderType("CP");
|
||||||
|
gdDetail3.setBigItemQty(2d);
|
||||||
|
|
||||||
|
GdDetail gdDetail4=new GdDetail();
|
||||||
|
BigItem bigItem4=new BigItem();
|
||||||
|
bigItem4.setCode("CT_002");
|
||||||
|
gdDetail4.setBigItem(bigItem4);
|
||||||
|
gdDetail4.setOrderType("CP");
|
||||||
|
gdDetail4.setBigItemQty(3d);
|
||||||
|
|
||||||
|
GdDetail gdDetail5=new GdDetail();
|
||||||
|
BigItem bigItem5=new BigItem();
|
||||||
|
bigItem5.setCode("CT_002");
|
||||||
|
gdDetail5.setBigItem(bigItem5);
|
||||||
|
gdDetail5.setOrderType("CP");
|
||||||
|
gdDetail5.setBigItemQty(4d);
|
||||||
|
|
||||||
|
List<GdDetail> list=new ArrayList<>();
|
||||||
|
list.add(gdDetail);
|
||||||
|
list.add(gdDetail2);
|
||||||
|
list.add(gdDetail3);
|
||||||
|
list.add(gdDetail4);
|
||||||
|
list.add(gdDetail5);
|
||||||
|
|
||||||
|
for(GdDetail gd:list){
|
||||||
|
System.out.println("总集合:"+gd);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<GdDetail> cpList = list.stream()
|
||||||
|
.filter(gd -> "CP".equals(gd.getOrderType()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<GdDetail> dpList = list.stream()
|
||||||
|
.filter(gd -> "DP".equals(gd.getOrderType()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
for(GdDetail gd:cpList){
|
||||||
|
System.out.println("成品集合:"+gd);
|
||||||
|
}
|
||||||
|
for(GdDetail gd:dpList){
|
||||||
|
System.out.println("单品集合:"+gd);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, List<GdDetail>> groupedByCode = cpList.stream()
|
||||||
|
.collect(Collectors.groupingBy(gd -> gd.getBigItem().getCode()));
|
||||||
|
groupedByCode.forEach((code, details) -> {
|
||||||
|
System.out.println("Code: " + code);
|
||||||
|
details.forEach(System.out::println);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test(){
|
public void test(){
|
||||||
List<Integer> taskLists=new ArrayList<>();
|
List<Integer> taskLists=new ArrayList<>();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue