no message
parent
6884b7b96a
commit
a10f08b432
|
|
@ -5,9 +5,9 @@ import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ItemDate {
|
public class ItemDate {
|
||||||
@ApiModelProperty(value ="物料代码",required = true,example = "xxx")
|
@ApiModelProperty(value ="物料代码",required = true,example = "物料代码")
|
||||||
String itemCode;
|
String itemCode;
|
||||||
@ApiModelProperty(value ="物料名称",required = true,example = "xxx")
|
@ApiModelProperty(value ="物料名称",required = true,example = "物料名称")
|
||||||
String itemName;
|
String itemName;
|
||||||
@ApiModelProperty(value ="物料数量",required = true,example = "1")
|
@ApiModelProperty(value ="物料数量",required = true,example = "1")
|
||||||
Double itemQty=0d;
|
Double itemQty=0d;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
package com.youchain.basicdata.domain;
|
package com.youchain.basicdata.domain;
|
||||||
|
|
||||||
import com.youchain.base.BaseEntity;
|
import com.youchain.base.BaseEntity;
|
||||||
|
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;
|
||||||
|
|
@ -54,11 +55,12 @@ public class BigBom extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
@Column(name = "`quantity`")
|
@Column(name = "`quantity`")
|
||||||
@ApiModelProperty(value = "数量")
|
@ApiModelProperty(value = "数量")
|
||||||
private Float quantity;
|
private Double quantity;
|
||||||
|
|
||||||
@Column(name = "`dept_id`")
|
@OneToOne
|
||||||
@ApiModelProperty(value = "仓库ID")
|
@JoinColumn(name = "dept_id")
|
||||||
private Long deptId;
|
@ApiModelProperty(value = "仓库")
|
||||||
|
private Dept dept;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,12 @@
|
||||||
package com.youchain.basicdata.repository;
|
package com.youchain.basicdata.repository;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.BigBom;
|
import com.youchain.basicdata.domain.BigBom;
|
||||||
|
import com.youchain.basicdata.domain.Item;
|
||||||
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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -25,4 +29,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
* @date 2024-02-21
|
* @date 2024-02-21
|
||||||
**/
|
**/
|
||||||
public interface BigBomRepository extends JpaRepository<BigBom, Long>, JpaSpecificationExecutor<BigBom> {
|
public interface BigBomRepository extends JpaRepository<BigBom, Long>, JpaSpecificationExecutor<BigBom> {
|
||||||
|
@Query(value = "SELECT b FROM BigBom b WHERE b.bigItem.id = ?1 and b.item.id=?2", nativeQuery = false)
|
||||||
|
List<BigBom> findRepeat(Long bigItemId, Long itemId);
|
||||||
}
|
}
|
||||||
|
|
@ -16,8 +16,12 @@
|
||||||
package com.youchain.basicdata.repository;
|
package com.youchain.basicdata.repository;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.BigItem;
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
|
import com.youchain.basicdata.domain.Item;
|
||||||
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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -25,4 +29,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
* @date 2024-02-21
|
* @date 2024-02-21
|
||||||
**/
|
**/
|
||||||
public interface BigItemRepository extends JpaRepository<BigItem, Long>, JpaSpecificationExecutor<BigItem> {
|
public interface BigItemRepository extends JpaRepository<BigItem, Long>, JpaSpecificationExecutor<BigItem> {
|
||||||
|
@Query(value = "SELECT i FROM BigItem i WHERE i.code = ?1 and i.name=?2", nativeQuery = false)
|
||||||
|
List<BigItem> findRepeat(String completeCode, String completeName);
|
||||||
}
|
}
|
||||||
|
|
@ -44,22 +44,6 @@ public class Gd extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "ID")
|
@ApiModelProperty(value = "ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(name = "`create_by`")
|
|
||||||
@ApiModelProperty(value = "创建人")
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
@Column(name = "`update_by`")
|
|
||||||
@ApiModelProperty(value = "修改人")
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
@Column(name = "`create_time`")
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
private Timestamp createTime;
|
|
||||||
|
|
||||||
@Column(name = "`update_time`")
|
|
||||||
@ApiModelProperty(value = "修改时间")
|
|
||||||
private Timestamp updateTime;
|
|
||||||
|
|
||||||
@Column(name = "`code`")
|
@Column(name = "`code`")
|
||||||
@ApiModelProperty(value = "工单编号")
|
@ApiModelProperty(value = "工单编号")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
package com.youchain.businessdata.domain;
|
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.Item;
|
||||||
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
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;
|
||||||
|
|
@ -41,47 +45,37 @@ public class GdDetail extends BaseEntity implements Serializable {
|
||||||
@Column(name = "`id`")
|
@Column(name = "`id`")
|
||||||
@ApiModelProperty(value = "ID")
|
@ApiModelProperty(value = "ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
@OneToOne
|
||||||
@Column(name = "`create_by`")
|
@JoinColumn(name = "`gd_id`",nullable = false)
|
||||||
@ApiModelProperty(value = "创建人")
|
@ApiModelProperty(value = "工单")
|
||||||
private String createBy;
|
private Gd gd;
|
||||||
|
|
||||||
@Column(name = "`update_by`")
|
|
||||||
@ApiModelProperty(value = "修改人")
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
@Column(name = "`create_time`")
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
private Timestamp createTime;
|
|
||||||
|
|
||||||
@Column(name = "`update_time`")
|
|
||||||
@ApiModelProperty(value = "修改时间")
|
|
||||||
private Timestamp updateTime;
|
|
||||||
|
|
||||||
@Column(name = "`line_no`")
|
@Column(name = "`line_no`")
|
||||||
@ApiModelProperty(value = "行号")
|
@ApiModelProperty(value = "行号")
|
||||||
private Long lineNo;
|
private Long lineNo;
|
||||||
|
|
||||||
@Column(name = "`item_id`")
|
@OneToOne
|
||||||
@ApiModelProperty(value = "关联物料")
|
@JoinColumn(name = "`item_id`",nullable = false)
|
||||||
private Long itemId;
|
@ApiModelProperty(value = "单品物料")
|
||||||
|
private Item item;
|
||||||
@Column(name = "`item_qty`")
|
@Column(name = "`item_qty`")
|
||||||
@ApiModelProperty(value = "订单数量")
|
@ApiModelProperty(value = "订单数量")
|
||||||
private Long itemQty;
|
private Double itemQty=0d;
|
||||||
|
|
||||||
@Column(name = "`big_item_id`")
|
|
||||||
@ApiModelProperty(value = "总成代码")
|
|
||||||
private Long bigItemId;
|
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "`big_item_id`",nullable = true)
|
||||||
|
@ApiModelProperty(value = "成套物料")
|
||||||
|
private BigItem bigItem;
|
||||||
@Column(name = "`big_item_qty`")
|
@Column(name = "`big_item_qty`")
|
||||||
@ApiModelProperty(value = "总成套数")
|
@ApiModelProperty(value = "总成套数")
|
||||||
private Long bigItemQty;
|
private Double bigItemQty=0d;
|
||||||
|
|
||||||
@Column(name = "`order_type`")
|
@Column(name = "`order_type`")
|
||||||
@ApiModelProperty(value = "单据类型")
|
@ApiModelProperty(value = "单据类型")
|
||||||
private Long orderType;
|
private String orderType;
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "`dept_id`",nullable = false)
|
||||||
|
@ApiModelProperty(value = "仓库")
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,13 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.repository;
|
package com.youchain.businessdata.repository;
|
||||||
|
|
||||||
|
import com.youchain.businessdata.domain.Gd;
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -25,4 +29,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
* @date 2024-06-06
|
* @date 2024-06-06
|
||||||
**/
|
**/
|
||||||
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 " +
|
||||||
|
" and (?2=null or g.bigItem.id=?2) and g.item.id=?3 and g.orderType=?4", nativeQuery = false)
|
||||||
|
List<GdDetail> findRepeat(Long gdId, Long bigItemId, Long itemId,String orderType);
|
||||||
}
|
}
|
||||||
|
|
@ -3,8 +3,13 @@ package com.youchain.businessdata.rest;
|
||||||
import com.youchain.RequestData.*;
|
import com.youchain.RequestData.*;
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
|
import com.youchain.basicdata.domain.BigBom;
|
||||||
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
|
import com.youchain.basicdata.repository.BigBomRepository;
|
||||||
|
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.Gd;
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
import com.youchain.businessdata.service.GdDetailService;
|
import com.youchain.businessdata.service.GdDetailService;
|
||||||
|
|
@ -12,6 +17,7 @@ import com.youchain.businessdata.service.GdService;
|
||||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
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.utils.BaseStatus;
|
import com.youchain.utils.BaseStatus;
|
||||||
import com.youchain.utils.BizStatus;
|
import com.youchain.utils.BizStatus;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -34,7 +40,12 @@ import java.util.Set;
|
||||||
@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 BigBomService bigBomService;
|
||||||
private final ItemRepository itemRepository;
|
private final ItemRepository itemRepository;
|
||||||
|
private final BigBomRepository bigBomRepository;
|
||||||
|
private final BigItemRepository bigItemRepository;
|
||||||
@PostMapping("/yclbl")
|
@PostMapping("/yclbl")
|
||||||
@Log("mes-原材料备料")
|
@Log("mes-原材料备料")
|
||||||
@ApiOperation("mes-原材料备料")
|
@ApiOperation("mes-原材料备料")
|
||||||
|
|
@ -43,22 +54,34 @@ public class MesController {
|
||||||
/* 添加工单单头*/
|
/* 添加工单单头*/
|
||||||
Gd gd = gdService.save(yclbl.getOrderNo(),yclbl.getTaskCode(),yclbl.getStation());
|
Gd gd = gdService.save(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) {
|
||||||
*//* 验证成套 物料*//*
|
/* 验证成套 物料*/
|
||||||
Item bigItem=verifiedBigItem(zcData.getCompleteCode(),zcData.getCompleteName());
|
BigItem bigItem=verifiedBigItem(zcData.getCompleteCode(),zcData.getCompleteName());
|
||||||
Set<ItemDate> itemDates=zcData.getBlzcmx();
|
Set<ItemDate> itemDates=zcData.getBlzcmx();
|
||||||
for (ItemDate itemDate : itemDates) {
|
for (ItemDate itemDate : itemDates) {
|
||||||
*//* 验证单品 物料*//*
|
/* 验证单品 物料*/
|
||||||
Item item=verifiedItem(itemDate.getItemCode(),itemDate.getItemName());
|
Item item=verifiedItem(itemDate.getItemCode(),itemDate.getItemName());
|
||||||
*//* 添加工单明细*//*
|
/* 验证BOM*/
|
||||||
// GdDetail gdDetail = gdDetailService.save(gd.getId(),yc(),yclbl.getStation());
|
BigBom bigBom=verifiedBigBom(bigItem,item,itemDate.getItemQty());
|
||||||
|
/* 添加工单明细*/
|
||||||
|
GdDetail gdDetail = gdDetailService.save(gd,orderType,bigItem,zcData.getCompleteQty(),item,itemDate.getItemQty());
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}else if (yclbl.getBlzcmx()!=null){
|
|
||||||
String orderType = BaseStatus.GD_TYPE_DP;
|
|
||||||
}
|
}
|
||||||
|
if (yclbl.getBlzcmx()!=null){
|
||||||
|
String orderType = BaseStatus.GD_TYPE_DP;
|
||||||
|
Set<ItemDate> itemDateList=yclbl.getBlzcmx();
|
||||||
|
for (ItemDate itemDate:itemDateList){
|
||||||
|
/* 验证单品物料*/
|
||||||
|
Item item=verifiedItem(itemDate.getItemCode(),itemDate.getItemName());
|
||||||
|
/* 添加工单明细*/
|
||||||
|
GdDetail gdDetail = gdDetailService.save(gd,orderType,null,null,item,itemDate.getItemQty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 生成 出库明细*/
|
||||||
|
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()));
|
||||||
}
|
}
|
||||||
|
|
@ -106,10 +129,10 @@ public class MesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 验证成套物料*/
|
/** 验证成套物料*/
|
||||||
private Item verifiedBigItem(String completeCode, String completeName) {
|
private BigItem verifiedBigItem(String completeCode, String completeName) {
|
||||||
List<Item> itemList = itemRepository.findRepeat(completeCode,completeName);
|
List<BigItem> bigItemList = bigItemRepository.findRepeat(completeCode,completeName);
|
||||||
if (itemList.size()>0){
|
if (bigItemList.size()>0){
|
||||||
return itemList.get(0);
|
return bigItemList.get(0);
|
||||||
}else {
|
}else {
|
||||||
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护成套物料"+completeCode);
|
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护成套物料"+completeCode);
|
||||||
}
|
}
|
||||||
|
|
@ -122,4 +145,24 @@ public class MesController {
|
||||||
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护单品物料"+itemCode);
|
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护单品物料"+itemCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BigBom verifiedBigBom(BigItem bigItem, Item item, Double itemQty) {
|
||||||
|
List<BigBom> bigBomList = bigBomRepository.findRepeat(bigItem.getId(),item.getId());
|
||||||
|
if (bigBomList.size()>0){
|
||||||
|
return bigBomList.get(0);
|
||||||
|
}else {
|
||||||
|
// 添加BOM
|
||||||
|
BigBom bigBom= new BigBom();
|
||||||
|
bigBom.setBigItem(bigItem);
|
||||||
|
bigBom.setItem(item);
|
||||||
|
bigBom.setQuantity(itemQty);
|
||||||
|
bigBom.setDept(deptService.isDept());
|
||||||
|
bigBomRepository.save(bigBom);
|
||||||
|
return bigBom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** 拆分工单*/
|
||||||
|
private void splitGd(Gd gd) {
|
||||||
|
List<GdDetail> gdDetailList=gdDetailService.fingByDg(gd.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service;
|
package com.youchain.businessdata.service;
|
||||||
|
|
||||||
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
|
import com.youchain.basicdata.domain.Item;
|
||||||
|
import com.youchain.businessdata.domain.Gd;
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
import com.youchain.businessdata.service.dto.GdDetailDto;
|
import com.youchain.businessdata.service.dto.GdDetailDto;
|
||||||
import com.youchain.businessdata.service.dto.GdDetailQueryCriteria;
|
import com.youchain.businessdata.service.dto.GdDetailQueryCriteria;
|
||||||
|
|
@ -80,4 +83,16 @@ public interface GdDetailService {
|
||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
*/
|
*/
|
||||||
void download(List<GdDetailDto> all, HttpServletResponse response) throws IOException;
|
void download(List<GdDetailDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加工单明细
|
||||||
|
* @param gd 工单
|
||||||
|
* @param orderType 分配类型 成套,单品
|
||||||
|
* @param bigItem 成套 物料
|
||||||
|
* @param completeQty 成套数
|
||||||
|
* @param item 单品物料
|
||||||
|
* @param itemQty 每套单品数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
GdDetail save(Gd gd, String orderType, BigItem bigItem, Double completeQty, Item item, Double itemQty);
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service.dto;
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
|
import com.youchain.basicdata.domain.Item;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -48,16 +50,18 @@ public class GdDetailDto implements Serializable {
|
||||||
|
|
||||||
/** 关联物料 */
|
/** 关联物料 */
|
||||||
private Long itemId;
|
private Long itemId;
|
||||||
|
private Item item;
|
||||||
|
|
||||||
/** 订单数量 */
|
/** 订单数量 */
|
||||||
private Long itemQty;
|
private Long itemQty;
|
||||||
|
|
||||||
/** 总成代码 */
|
/** 总成代码 */
|
||||||
private Long bigItemId;
|
private Long bigItemId;
|
||||||
|
private BigItem bigItem;
|
||||||
|
|
||||||
/** 总成套数 */
|
/** 总成套数 */
|
||||||
private Long bigItemQty;
|
private Long bigItemQty;
|
||||||
|
|
||||||
/** 单据类型 */
|
/** 单据类型 */
|
||||||
private Long orderType;
|
private String orderType;
|
||||||
}
|
}
|
||||||
|
|
@ -15,11 +15,12 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service.impl;
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
|
import com.youchain.basicdata.domain.Item;
|
||||||
|
import com.youchain.businessdata.domain.Gd;
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
import com.youchain.utils.FileUtil;
|
import com.youchain.modules.system.service.DeptService;
|
||||||
import com.youchain.utils.PageUtil;
|
import com.youchain.utils.*;
|
||||||
import com.youchain.utils.QueryHelp;
|
|
||||||
import com.youchain.utils.ValidationUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import com.youchain.businessdata.repository.GdDetailRepository;
|
import com.youchain.businessdata.repository.GdDetailRepository;
|
||||||
import com.youchain.businessdata.service.GdDetailService;
|
import com.youchain.businessdata.service.GdDetailService;
|
||||||
|
|
@ -49,6 +50,7 @@ public class GdDetailServiceImpl implements GdDetailService {
|
||||||
|
|
||||||
private final GdDetailRepository gdDetailRepository;
|
private final GdDetailRepository gdDetailRepository;
|
||||||
private final GdDetailMapper gdDetailMapper;
|
private final GdDetailMapper gdDetailMapper;
|
||||||
|
private final DeptService deptService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> queryAll(GdDetailQueryCriteria criteria, Pageable pageable){
|
public Map<String,Object> queryAll(GdDetailQueryCriteria criteria, Pageable pageable){
|
||||||
|
|
@ -110,4 +112,27 @@ public class GdDetailServiceImpl implements GdDetailService {
|
||||||
}
|
}
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GdDetail save(Gd gd, String orderType, BigItem bigItem, Double completeQty, Item item, Double itemQty) {
|
||||||
|
GdDetail gdDetail= new GdDetail();
|
||||||
|
List<GdDetail> gdList;
|
||||||
|
if (orderType.equals(BaseStatus.GD_TYPE_DP)){
|
||||||
|
gdList=gdDetailRepository.findRepeat(gd.getId(),null,item.getId(),BaseStatus.GD_TYPE_DP);
|
||||||
|
}else {
|
||||||
|
gdList=gdDetailRepository.findRepeat(gd.getId(),bigItem.getId(),item.getId(),BaseStatus.GD_TYPE_CT);
|
||||||
|
}
|
||||||
|
if (gdList.size()>0){
|
||||||
|
gdDetail=gdList.get(0);
|
||||||
|
}
|
||||||
|
gdDetail.setGd(gd);
|
||||||
|
gdDetail.setItem(item);
|
||||||
|
gdDetail.setItemQty(itemQty);
|
||||||
|
gdDetail.setBigItem(bigItem);
|
||||||
|
gdDetail.setBigItemQty(completeQty);
|
||||||
|
gdDetail.setDept(deptService.isDept());
|
||||||
|
gdDetail.setOrderType(orderType);
|
||||||
|
gdDetailRepository.save(gdDetail);
|
||||||
|
return gdDetail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue