no message
parent
9b9453fe11
commit
bcef8c2859
|
|
@ -5,6 +5,8 @@ import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ItemDate {
|
public class ItemDate {
|
||||||
|
@ApiModelProperty(value ="行号",required = true,example = "行号")
|
||||||
|
int lineNo;
|
||||||
@ApiModelProperty(value ="物料代码",required = true,example = "物料代码")
|
@ApiModelProperty(value ="物料代码",required = true,example = "物料代码")
|
||||||
String itemCode;
|
String itemCode;
|
||||||
@ApiModelProperty(value ="物料名称",required = true,example = "物料名称")
|
@ApiModelProperty(value ="物料名称",required = true,example = "物料名称")
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,15 @@ import java.util.Set;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ZcData {
|
public class ZcData {
|
||||||
|
@ApiModelProperty(value ="行号",required = true,example = "行号")
|
||||||
|
int lineNo;
|
||||||
@ApiModelProperty(value ="总成代码",required = true,example = "总成代码")
|
@ApiModelProperty(value ="总成代码",required = true,example = "总成代码")
|
||||||
String completeCode;
|
String completeCode;
|
||||||
@ApiModelProperty(value ="总成名称",required = true,example = "总成名称")
|
@ApiModelProperty(value ="总成名称",required = true,example = "总成名称")
|
||||||
String completeName;
|
String completeName;
|
||||||
@ApiModelProperty(value ="总成套数",required = true,example = "总成套数")
|
@ApiModelProperty(value ="总成套数",required = true,example = "总成套数")
|
||||||
double completeQty=0d;
|
double completeQty=0d;
|
||||||
|
|
||||||
@ApiModelProperty(value ="总成明细",required = true)
|
@ApiModelProperty(value ="总成明细",required = true)
|
||||||
Set<ItemDate> blzcmx;
|
Set<ItemDate> blzcmx;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,15 +51,18 @@ public class GdDetail extends BaseEntity implements Serializable {
|
||||||
private Gd gd;
|
private Gd gd;
|
||||||
@Column(name = "`line_no`")
|
@Column(name = "`line_no`")
|
||||||
@ApiModelProperty(value = "行号")
|
@ApiModelProperty(value = "行号")
|
||||||
private Long lineNo;
|
private int lineNo;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`item_id`",nullable = false)
|
@JoinColumn(name = "`item_id`",nullable = false)
|
||||||
@ApiModelProperty(value = "单品物料")
|
@ApiModelProperty(value = "单品物料")
|
||||||
private Item item;
|
private Item item;
|
||||||
@Column(name = "`item_qty`")
|
@Column(name = "`item_qty`")
|
||||||
@ApiModelProperty(value = "订单数量")
|
@ApiModelProperty(value = "单品数量")
|
||||||
private Double itemQty=0d;
|
private Double itemQty=0d;
|
||||||
|
@Column(name = "`order_qty`")
|
||||||
|
@ApiModelProperty(value = "未拆分数量")
|
||||||
|
private Double orderQty=0d;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`big_item_id`",nullable = true)
|
@JoinColumn(name = "`big_item_id`",nullable = true)
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,11 @@ public class PickDetail extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "ID")
|
@ApiModelProperty(value = "ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(name = "`pick_id`")
|
@OneToOne
|
||||||
@ApiModelProperty(value = "订单序号")
|
@JoinColumn(name = "`pick_id`",nullable = false)
|
||||||
private Long pickId;
|
@NotNull
|
||||||
|
@ApiModelProperty(value = "出库单")
|
||||||
|
private Pick pick;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`item_id`",nullable = false)
|
@JoinColumn(name = "`item_id`",nullable = false)
|
||||||
|
|
@ -56,8 +58,8 @@ 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 Long lineNo;
|
private int lineNo;
|
||||||
|
|
||||||
@Column(name = "`po`")
|
@Column(name = "`po`")
|
||||||
@ApiModelProperty(value = "po订单号")
|
@ApiModelProperty(value = "po订单号")
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ public interface GdDetailRepository extends JpaRepository<GdDetail, Long>, JpaSp
|
||||||
@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", nativeQuery = false)
|
||||||
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 ", nativeQuery = false)
|
@Query(value = "SELECT g FROM GdDetail g WHERE g.gd.id=?1 and g.orderQty>0", nativeQuery = false)
|
||||||
List<GdDetail> findByGd(Long gdId);
|
List<GdDetail> findByGdAndQty(Long gdId);
|
||||||
|
@Query(value = "SELECT g FROM GdDetail g WHERE g.bigItem.id=?1 ", nativeQuery = false)
|
||||||
|
List<GdDetail> findByBigItem(Long bigItemId);
|
||||||
}
|
}
|
||||||
|
|
@ -52,4 +52,6 @@ public interface PickDetailRepository extends JpaRepository<PickDetail, Long>, J
|
||||||
" UNION select a.* from data_pick_detail a INNER JOIN base_item b on a.item_id = b.id " +
|
" UNION select a.* from data_pick_detail a INNER JOIN base_item b on a.item_id = b.id " +
|
||||||
"WHERE b.name = '前桶' and a.create_time > :time ", nativeQuery = true)
|
"WHERE b.name = '前桶' and a.create_time > :time ", nativeQuery = true)
|
||||||
List<PickDetail> queryOutQHAllData(String time);
|
List<PickDetail> queryOutQHAllData(String time);
|
||||||
|
@Query(value = "SELECT p FROM PickDetail p WHERE p.pick.id=?1 and p.item.id=?2", nativeQuery = false)
|
||||||
|
List<PickDetail> findRepeat(Long pickId, Long itemId);
|
||||||
}
|
}
|
||||||
|
|
@ -18,6 +18,9 @@ package com.youchain.businessdata.repository;
|
||||||
import com.youchain.businessdata.domain.Pick;
|
import com.youchain.businessdata.domain.Pick;
|
||||||
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 +28,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
* @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", nativeQuery = false)
|
||||||
|
List<Pick> findRepeat(long gdDetailId,int no);
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +66,7 @@ public class MesController {
|
||||||
/* 验证BOM*/
|
/* 验证BOM*/
|
||||||
BigBom bigBom=verifiedBigBom(bigItem,item,itemDate.getItemQty());
|
BigBom bigBom=verifiedBigBom(bigItem,item,itemDate.getItemQty());
|
||||||
/* 添加工单明细*/
|
/* 添加工单明细*/
|
||||||
GdDetail gdDetail = gdDetailService.save(gd,orderType,bigItem,zcData.getCompleteQty(),item,itemDate.getItemQty());
|
GdDetail gdDetail = gdDetailService.save(zcData.getLineNo(),gd,orderType,bigItem,zcData.getCompleteQty(),item,itemDate.getItemQty(),itemDate.getItemQty()*zcData.getCompleteQty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +77,7 @@ public class MesController {
|
||||||
/* 验证单品物料*/
|
/* 验证单品物料*/
|
||||||
Item item=verifiedItem(itemDate.getItemCode(),itemDate.getItemName());
|
Item item=verifiedItem(itemDate.getItemCode(),itemDate.getItemName());
|
||||||
/* 添加工单明细*/
|
/* 添加工单明细*/
|
||||||
GdDetail gdDetail = gdDetailService.save(gd,orderType,null,null,item,itemDate.getItemQty());
|
GdDetail gdDetail = gdDetailService.save(itemDate.getLineNo(),gd,orderType,null,null,item,itemDate.getItemQty(),itemDate.getItemQty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 生成 出库明细*/
|
/* 生成 出库明细*/
|
||||||
|
|
|
||||||
|
|
@ -86,13 +86,15 @@ public interface GdDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加工单明细
|
* 添加工单明细
|
||||||
|
* @param lineNo 行号
|
||||||
* @param gd 工单
|
* @param gd 工单
|
||||||
* @param orderType 分配类型 成套,单品
|
* @param orderType 分配类型 成套,单品
|
||||||
* @param bigItem 成套 物料
|
* @param bigItem 成套 物料
|
||||||
* @param completeQty 成套数
|
* @param completeQty 成套数
|
||||||
* @param item 单品物料
|
* @param item 单品物料
|
||||||
* @param itemQty 每套单品数
|
* @param itemQty 每套单品数
|
||||||
|
* @param orderQty 未拆分数量
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
GdDetail save(Gd gd, String orderType, BigItem bigItem, Double completeQty, Item item, Double itemQty);
|
GdDetail save(int lineNo,Gd gd, String orderType, BigItem bigItem, Double completeQty, Item item, Double itemQty,Double orderQty);
|
||||||
}
|
}
|
||||||
|
|
@ -17,6 +17,7 @@ package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
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.businessdata.domain.Gd;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -46,7 +47,7 @@ public class GdDetailDto implements Serializable {
|
||||||
private Timestamp updateTime;
|
private Timestamp updateTime;
|
||||||
|
|
||||||
/** 行号 */
|
/** 行号 */
|
||||||
private Long lineNo;
|
private int lineNo;
|
||||||
|
|
||||||
/** 关联物料 */
|
/** 关联物料 */
|
||||||
private Long itemId;
|
private Long itemId;
|
||||||
|
|
@ -61,6 +62,8 @@ public class GdDetailDto implements Serializable {
|
||||||
|
|
||||||
/** 总成套数 */
|
/** 总成套数 */
|
||||||
private Long bigItemQty;
|
private Long bigItemQty;
|
||||||
|
private Gd gd;
|
||||||
|
private Double orderQty;
|
||||||
|
|
||||||
/** 单据类型 */
|
/** 单据类型 */
|
||||||
private String orderType;
|
private String orderType;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
import com.youchain.basicdata.service.dto.ItemDto;
|
import com.youchain.basicdata.service.dto.ItemDto;
|
||||||
import com.youchain.basicdata.service.dto.ItemSmallDto;
|
import com.youchain.basicdata.service.dto.ItemSmallDto;
|
||||||
|
import com.youchain.businessdata.domain.Pick;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
|
@ -35,13 +36,13 @@ public class PickDetailDto implements Serializable {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 订单序号 */
|
/** 订单序号 */
|
||||||
private Long pickId;
|
private PickDto pick;
|
||||||
|
|
||||||
/** 物料序号 */
|
/** 物料序号 */
|
||||||
private ItemDto item;
|
private ItemDto item;
|
||||||
|
|
||||||
/** 行号 */
|
/** 封包系数 */
|
||||||
private Long lineNo;
|
private int lineNo;
|
||||||
|
|
||||||
/** po订单号 */
|
/** po订单号 */
|
||||||
private String po;
|
private String po;
|
||||||
|
|
@ -100,7 +101,7 @@ public class PickDetailDto implements Serializable {
|
||||||
/** 来源名称 */
|
/** 来源名称 */
|
||||||
private String sourceName;
|
private String sourceName;
|
||||||
|
|
||||||
/** 来源序号 */
|
/** 封包系数 */
|
||||||
private Long sourceId;
|
private Long sourceId;
|
||||||
|
|
||||||
/** 创建人 */
|
/** 创建人 */
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service.dto;
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
|
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;
|
||||||
|
|
@ -45,6 +47,7 @@ public class PickDto implements Serializable {
|
||||||
|
|
||||||
/** 仓库ID */
|
/** 仓库ID */
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
private DeptDto dept;
|
||||||
|
|
||||||
/** 出库单头 */
|
/** 出库单头 */
|
||||||
private String code;
|
private String code;
|
||||||
|
|
@ -56,5 +59,6 @@ public class PickDto implements Serializable {
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 关联工单明细 */
|
/** 关联工单明细 */
|
||||||
private String gdDetaiId;
|
private Long gdDetailId;
|
||||||
|
private GdDetail gdDetail;
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +114,7 @@ public class GdDetailServiceImpl implements GdDetailService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GdDetail save(Gd gd, String orderType, BigItem bigItem, Double completeQty, Item item, Double itemQty) {
|
public GdDetail save(int lineNo,Gd gd, String orderType, BigItem bigItem, Double completeQty, Item item, Double itemQty,Double orderQty) {
|
||||||
GdDetail gdDetail= new GdDetail();
|
GdDetail gdDetail= new GdDetail();
|
||||||
List<GdDetail> gdList;
|
List<GdDetail> gdList;
|
||||||
if (orderType.equals(BaseStatus.GD_TYPE_DP)){
|
if (orderType.equals(BaseStatus.GD_TYPE_DP)){
|
||||||
|
|
@ -126,8 +126,10 @@ public class GdDetailServiceImpl implements GdDetailService {
|
||||||
gdDetail=gdList.get(0);
|
gdDetail=gdList.get(0);
|
||||||
}
|
}
|
||||||
gdDetail.setGd(gd);
|
gdDetail.setGd(gd);
|
||||||
|
gdDetail.setLineNo(lineNo);
|
||||||
gdDetail.setItem(item);
|
gdDetail.setItem(item);
|
||||||
gdDetail.setItemQty(itemQty);
|
gdDetail.setItemQty(itemQty);
|
||||||
|
gdDetail.setOrderQty(orderQty);
|
||||||
gdDetail.setBigItem(bigItem);
|
gdDetail.setBigItem(bigItem);
|
||||||
gdDetail.setBigItemQty(completeQty);
|
gdDetail.setBigItemQty(completeQty);
|
||||||
gdDetail.setDept(deptService.isDept());
|
gdDetail.setDept(deptService.isDept());
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,10 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -137,13 +135,26 @@ public class GdServiceImpl implements GdService {
|
||||||
@Override
|
@Override
|
||||||
public void addPickDetail(Gd gd) {
|
public void addPickDetail(Gd gd) {
|
||||||
int no=1;// 序号
|
int no=1;// 序号
|
||||||
List<GdDetail> gdDetailList=gdDetailRepository.findByGd(gd.getId());
|
while (true){
|
||||||
for(GdDetail gdDetail : gdDetailList) {
|
List<GdDetail> gdDetailList=gdDetailRepository.findByGdAndQty(gd.getId());
|
||||||
|
if (gdDetailList.size()<1){
|
||||||
|
break;
|
||||||
|
}else {
|
||||||
|
List<Integer> arr=new ArrayList<Integer>();//已分配过的行号
|
||||||
|
for (GdDetail gdDetail : gdDetailList) {
|
||||||
|
/*本次循环已拆分过 工单明细行*/
|
||||||
|
if (arr.contains(gdDetail.getLineNo())){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/*生成出库单*/
|
/*生成出库单*/
|
||||||
Pick pick = pickService.save(gdDetail,no);
|
Pick pick = pickService.save(gdDetail, no);
|
||||||
|
/* 去重*/
|
||||||
|
arr.add(gdDetail.getLineNo());
|
||||||
no=no+1;
|
no=no+1;
|
||||||
/*生成出库明细*/
|
/*生成出库明细*/
|
||||||
pickDetailService.save(pick);
|
pickDetailService.save(pick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -25,9 +25,7 @@ import com.youchain.basicdata.service.ItemService;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.basicdata.service.dto.ItemDto;
|
import com.youchain.basicdata.service.dto.ItemDto;
|
||||||
import com.youchain.businessdata.domain.*;
|
import com.youchain.businessdata.domain.*;
|
||||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
import com.youchain.businessdata.repository.*;
|
||||||
import com.youchain.businessdata.repository.InventoryRepository;
|
|
||||||
import com.youchain.businessdata.repository.TaskRepository;
|
|
||||||
import com.youchain.businessdata.service.InventoryService;
|
import com.youchain.businessdata.service.InventoryService;
|
||||||
import com.youchain.businessdata.service.TaskService;
|
import com.youchain.businessdata.service.TaskService;
|
||||||
import com.youchain.businessdata.service.dto.InventoryDto;
|
import com.youchain.businessdata.service.dto.InventoryDto;
|
||||||
|
|
@ -36,7 +34,6 @@ import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
|
||||||
import com.youchain.businessdata.service.PickDetailService;
|
import com.youchain.businessdata.service.PickDetailService;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailDto;
|
import com.youchain.businessdata.service.dto.PickDetailDto;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
||||||
|
|
@ -67,6 +64,7 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PickDetailServiceImpl implements PickDetailService {
|
public class PickDetailServiceImpl implements PickDetailService {
|
||||||
private final PickDetailRepository pickDetailRepository;
|
private final PickDetailRepository pickDetailRepository;
|
||||||
|
private final GdDetailRepository gdDetailRepository;
|
||||||
private final PickDetailMapper pickDetailMapper;
|
private final PickDetailMapper pickDetailMapper;
|
||||||
private final InventoryService inventoryService;
|
private final InventoryService inventoryService;
|
||||||
private final BoxRepository boxRepository;
|
private final BoxRepository boxRepository;
|
||||||
|
|
@ -320,7 +318,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
public PickDetail createPickDetail(Item item,String po) {
|
public PickDetail createPickDetail(Item item,String po) {
|
||||||
PickDetail d= new PickDetail();
|
PickDetail d= new PickDetail();
|
||||||
d.setItem(item);
|
d.setItem(item);
|
||||||
d.setLineNo(1l);
|
d.setLineNo(1);
|
||||||
d.setStatus(BizStatus.OPEN);
|
d.setStatus(BizStatus.OPEN);
|
||||||
d.setOrderQty(item.getExtendD1());
|
d.setOrderQty(item.getExtendD1());
|
||||||
d.setDept(item.getDept());
|
d.setDept(item.getDept());
|
||||||
|
|
@ -334,7 +332,37 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(Pick pick) {
|
public void save(Pick pick) {
|
||||||
GdDetail gdDetail=pick.getGdDetail();
|
List<GdDetail> gdDetailList;
|
||||||
gdDetail.getItem();
|
if (pick.getGdDetail().getBigItem()!=null) {
|
||||||
|
/* 成套物料 */
|
||||||
|
gdDetailList = gdDetailRepository.findByBigItem(pick.getGdDetail().getBigItem().getId());
|
||||||
|
}else {
|
||||||
|
/* 单品物料*/
|
||||||
|
gdDetailList=new ArrayList<>();
|
||||||
|
gdDetailList.add(pick.getGdDetail());
|
||||||
|
}
|
||||||
|
for (GdDetail gdDetail:gdDetailList){
|
||||||
|
int fb=1;//封包系数
|
||||||
|
PickDetail pickDetail=new PickDetail();
|
||||||
|
List<PickDetail> pickDetailList = pickDetailRepository.findRepeat(pick.getId(),gdDetail.getItem().getId());
|
||||||
|
if (pickDetailList.size()>0){
|
||||||
|
pickDetail=pickDetailList.get(0);
|
||||||
|
}
|
||||||
|
pickDetail.setDept(UserUtils.isDept);
|
||||||
|
pickDetail.setPick(pick);
|
||||||
|
pickDetail.setItem(gdDetail.getItem());
|
||||||
|
if (gdDetail.getBigItem()==null){
|
||||||
|
/*如果为单品物料 默认封包系数10*/
|
||||||
|
fb=10;
|
||||||
|
pickDetail.setOrderQty(1d*fb);
|
||||||
|
}else {
|
||||||
|
pickDetail.setOrderQty(gdDetail.getItemQty()*fb);
|
||||||
|
}
|
||||||
|
pickDetail.setLineNo(fb);
|
||||||
|
pickDetailRepository.save(pickDetail);
|
||||||
|
/*更新待拆分数量*/
|
||||||
|
gdDetail.setOrderQty(gdDetail.getOrderQty()-pickDetail.getOrderQty());
|
||||||
|
gdDetailRepository.save(gdDetail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,11 +98,9 @@ public class PickServiceImpl implements PickService {
|
||||||
map.put("修改人", pick.getUpdateBy());
|
map.put("修改人", pick.getUpdateBy());
|
||||||
map.put("创建时间", pick.getCreateTime());
|
map.put("创建时间", pick.getCreateTime());
|
||||||
map.put("修改时间", pick.getUpdateTime());
|
map.put("修改时间", pick.getUpdateTime());
|
||||||
map.put("仓库ID", pick.getDeptId());
|
|
||||||
map.put("出库单头", pick.getCode());
|
map.put("出库单头", pick.getCode());
|
||||||
map.put("序号", pick.getLineNo());
|
map.put("序号", pick.getLineNo());
|
||||||
map.put("状态", pick.getStatus());
|
map.put("状态", pick.getStatus());
|
||||||
map.put("关联工单明细", pick.getGdDetaiId());
|
|
||||||
list.add(map);
|
list.add(map);
|
||||||
}
|
}
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
|
|
@ -111,11 +109,17 @@ public class PickServiceImpl implements PickService {
|
||||||
@Override
|
@Override
|
||||||
public Pick save(GdDetail gdDetail, int no) {
|
public Pick save(GdDetail gdDetail, int no) {
|
||||||
Pick pick=new Pick();
|
Pick pick=new Pick();
|
||||||
|
List<Pick> pickList = pickRepository.findRepeat(gdDetail.getId(),no);
|
||||||
|
if (pickList.size()>0){
|
||||||
|
pick=pickList.get(0);
|
||||||
|
}
|
||||||
pick.setGdDetail(gdDetail);
|
pick.setGdDetail(gdDetail);
|
||||||
pick.setLineNo(no);
|
pick.setLineNo(no);
|
||||||
|
pick.setStatus(BizStatus.OPEN);
|
||||||
pick.setCode(gdDetail.getGd().getName()+"_"+no);
|
pick.setCode(gdDetail.getGd().getName()+"_"+no);
|
||||||
pick.setDept(UserUtils.getDept());
|
pick.setDept(UserUtils.isDept);
|
||||||
pickRepository.save(pick);
|
pickRepository.save(pick);
|
||||||
|
|
||||||
return pick;
|
return pick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.youchain.config.thread;
|
||||||
|
|
||||||
|
import com.youchain.modules.system.domain.Dept;
|
||||||
|
import com.youchain.modules.system.repository.DeptRepository;
|
||||||
|
import com.youchain.utils.BaseStatus;
|
||||||
|
import com.youchain.utils.UserUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class BaseComponent {
|
||||||
|
@Autowired
|
||||||
|
private DeptRepository deptRepository;
|
||||||
|
public BaseComponent(){
|
||||||
|
|
||||||
|
}
|
||||||
|
@PostConstruct
|
||||||
|
public void configUrlApi(){
|
||||||
|
UserUtils.isDept=deptRepository.findById(7l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
package com.youchain.modules.system.repository;
|
package com.youchain.modules.system.repository;
|
||||||
|
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
|
import com.youchain.modules.system.domain.Dict;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
|
@ -28,7 +29,8 @@ import java.util.Set;
|
||||||
* @date 2019-03-25
|
* @date 2019-03-25
|
||||||
*/
|
*/
|
||||||
public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificationExecutor<Dept> {
|
public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificationExecutor<Dept> {
|
||||||
|
@Query(value = "SELECT d.* FROM sys_dept d WHERE d.dept_id = ?1 ", nativeQuery = true)
|
||||||
|
Dept findById(long id);
|
||||||
/**
|
/**
|
||||||
* 根据 PID 查询
|
* 根据 PID 查询
|
||||||
* @param id pid
|
* @param id pid
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
package com.youchain.utils;
|
package com.youchain.utils;
|
||||||
|
|
||||||
|
import com.youchain.modules.system.domain.Dept;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
* @author houjianlan
|
* @author houjianlan
|
||||||
* @date 2023-08-16
|
* @date 2023-08-16
|
||||||
**/
|
**/
|
||||||
public interface BaseStatus {
|
@Service
|
||||||
|
public class BaseStatus {
|
||||||
/**
|
/**
|
||||||
* 空闲
|
* 空闲
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class UserUtils {
|
public class UserUtils {
|
||||||
|
public static Dept isDept=null;
|
||||||
public static Dept getDept(){
|
public static Dept getDept(){
|
||||||
List<Long> dataScopes = SecurityUtils.getCurrentUserDataScope();
|
List<Long> dataScopes = SecurityUtils.getCurrentUserDataScope();
|
||||||
Dept dept=new Dept();
|
Dept dept=new Dept();
|
||||||
|
|
@ -20,5 +21,6 @@ public class UserUtils {
|
||||||
dept.setId(0L);
|
dept.setId(0L);
|
||||||
}
|
}
|
||||||
return dept;
|
return dept;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue