no message
parent
19f3630e90
commit
c3dcafc53f
|
|
@ -9,16 +9,22 @@ import lombok.Data;
|
|||
public class ZpjlCt {
|
||||
@ApiModelProperty(value ="任务号",required = true,example = "任务号")
|
||||
String taskCode;
|
||||
|
||||
@ApiModelProperty(value ="工单号",required = true,example = "工单号")
|
||||
String orderNo;
|
||||
|
||||
@ApiModelProperty(value ="下发时间",required = true,example = "2023-07-03 00:00:00")
|
||||
String createTime;
|
||||
|
||||
@ApiModelProperty(value ="总成代码",required = true)
|
||||
String completeCode;
|
||||
|
||||
@ApiModelProperty(value ="总成名称",required = true)
|
||||
String completeName;
|
||||
|
||||
@ApiModelProperty(value ="需求工位",required = true)
|
||||
String station;
|
||||
|
||||
@ApiModelProperty(value ="需求点位",required = true)
|
||||
String pointCode;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,16 +9,22 @@ import lombok.Data;
|
|||
public class ZpjlZj {
|
||||
@ApiModelProperty(value ="任务号",required = true,example = "任务号")
|
||||
String taskCode;
|
||||
|
||||
@ApiModelProperty(value ="工单号",required = true,example = "工单号")
|
||||
String orderNo;
|
||||
|
||||
@ApiModelProperty(value ="下发时间",required = true,example = "2023-07-03 00:00:00")
|
||||
String createTime;
|
||||
|
||||
@ApiModelProperty(value ="物料代码",required = true,example = "物料代码")
|
||||
String itemCode;
|
||||
|
||||
@ApiModelProperty(value ="物料名称",required = true,example = "物料名称")
|
||||
String itemName;
|
||||
|
||||
@ApiModelProperty(value ="需求工位",required = true)
|
||||
String station;
|
||||
|
||||
@ApiModelProperty(value ="需求点位",required = true)
|
||||
String pointCode;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ public class Gd extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "`code`")
|
||||
@Column(name = "`code`",nullable = false)
|
||||
@ApiModelProperty(value = "工单编号")
|
||||
private String code;
|
||||
|
||||
@Column(name = "`name`")
|
||||
@Column(name = "`name`",nullable = false)
|
||||
@ApiModelProperty(value = "任务编号")
|
||||
private String name;
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ public class Gd extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "工单状态")
|
||||
private String status;
|
||||
|
||||
@Column(name = "`station`")
|
||||
@Column(name = "`station`",nullable = false)
|
||||
@ApiModelProperty(value = "需求工位")
|
||||
private String station;
|
||||
@OneToOne
|
||||
|
|
|
|||
|
|
@ -45,10 +45,12 @@ public class GdDetail extends BaseEntity implements Serializable {
|
|||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "`gd_id`",nullable = false)
|
||||
@ApiModelProperty(value = "工单")
|
||||
private Gd gd;
|
||||
|
||||
@Column(name = "`line_no`")
|
||||
@ApiModelProperty(value = "行号")
|
||||
private int lineNo;
|
||||
|
|
@ -57,6 +59,7 @@ public class GdDetail extends BaseEntity implements Serializable {
|
|||
@JoinColumn(name = "`item_id`",nullable = false)
|
||||
@ApiModelProperty(value = "单品物料")
|
||||
private Item item;
|
||||
|
||||
@Column(name = "`item_qty`")
|
||||
@ApiModelProperty(value = "单品数量")
|
||||
private Double itemQty=0d;
|
||||
|
|
@ -65,9 +68,10 @@ public class GdDetail extends BaseEntity implements Serializable {
|
|||
private Double orderQty=0d;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "`big_item_id`",nullable = true)
|
||||
@JoinColumn(name = "`big_item_id`",nullable = false)
|
||||
@ApiModelProperty(value = "成套物料")
|
||||
private BigItem bigItem;
|
||||
|
||||
@Column(name = "`big_item_qty`")
|
||||
@ApiModelProperty(value = "总成套数")
|
||||
private Double bigItemQty=0d;
|
||||
|
|
@ -75,6 +79,7 @@ public class GdDetail extends BaseEntity implements Serializable {
|
|||
@Column(name = "`order_type`")
|
||||
@ApiModelProperty(value = "单据类型")
|
||||
private String orderType;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "`dept_id`",nullable = false)
|
||||
@ApiModelProperty(value = "仓库")
|
||||
|
|
|
|||
|
|
@ -22,14 +22,15 @@ import lombok.Data;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author huojin
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author huojin
|
||||
* @date 2024-06-11
|
||||
**/
|
||||
@Entity
|
||||
|
|
@ -48,6 +49,7 @@ public class Pick extends BaseEntity implements Serializable {
|
|||
@NotNull
|
||||
@ApiModelProperty(value = "仓库")
|
||||
private Dept dept;
|
||||
|
||||
@Column(name = "`code`")
|
||||
@ApiModelProperty(value = "出库单头")
|
||||
private String code;
|
||||
|
|
@ -70,6 +72,10 @@ public class Pick extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "关联工单明细")
|
||||
private GdDetail gdDetail;
|
||||
|
||||
@Column(name = "`be_call`")
|
||||
@ApiModelProperty(value = "是否叫料")
|
||||
private Boolean beCall;
|
||||
|
||||
public void copy(Pick source) {
|
||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,13 +23,17 @@ import org.springframework.data.jpa.repository.Query;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author huojin
|
||||
* @website https://eladmin.vip
|
||||
* @date 2024-06-11
|
||||
**/
|
||||
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)
|
||||
@Query(value = "SELECT p FROM Pick p WHERE p.gdDetail.id=?1 and p.lineNo=?2")
|
||||
List<Pick> findRepeat(long gdDetailId, int no);
|
||||
@Query(value = "SELECT p FROM Pick p WHERE p.status=?1 ", nativeQuery = false)
|
||||
|
||||
@Query(value = "SELECT p FROM Pick p WHERE p.status=?1 ")
|
||||
List<Pick> findByStatus(String status);
|
||||
|
||||
@Query(value = " FROM Pick p WHERE p.code=?1 and p.code=?2 and p.code=?3 ")
|
||||
Pick findByPick(String gdNo, String completeCode, String station);
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ import com.youchain.businessdata.domain.Gd;
|
|||
import com.youchain.businessdata.domain.GdDetail;
|
||||
import com.youchain.businessdata.service.GdDetailService;
|
||||
import com.youchain.businessdata.service.GdService;
|
||||
import com.youchain.businessdata.service.PickService;
|
||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
|
|
@ -33,6 +34,9 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "mes接口管理")
|
||||
|
|
@ -42,10 +46,11 @@ public class MesController {
|
|||
private final GdService gdService;
|
||||
private final GdDetailService gdDetailService;
|
||||
private final DeptService deptService;
|
||||
private final BigBomService bigBomService;
|
||||
private final ItemRepository itemRepository;
|
||||
private final BigBomRepository bigBomRepository;
|
||||
private final BigItemRepository bigItemRepository;
|
||||
private final PickService pickService;
|
||||
|
||||
@PostMapping("/yclbl")
|
||||
@Log("mes-原材料备料")
|
||||
@ApiOperation("mes-原材料备料")
|
||||
|
|
@ -95,22 +100,41 @@ public class MesController {
|
|||
|
||||
return new ResponseEntity<>(ApiResult.result(200, "成功", null), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/zpjlZj")
|
||||
@Log("mes-其他整件叫料")
|
||||
@ApiOperation("mes-其他整件叫料")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> zpjlZj(@Validated @RequestBody ZpjlZj zpjlZj) {
|
||||
|
||||
return new ResponseEntity<>(ApiResult.result(200,"成功",null), HttpStatus.OK);
|
||||
try {
|
||||
String orderNo = zpjlZj.getOrderNo();//工单号
|
||||
String itemCode = zpjlZj.getItemCode();//物料代码
|
||||
String station = zpjlZj.getStation();//需求工位
|
||||
String pointCode = zpjlZj.getPointCode();//需求点位
|
||||
pickService.itemCall(orderNo, itemCode, station, pointCode);
|
||||
return successResponse("叫料成功!");
|
||||
} catch (Exception e) {
|
||||
return badResponse("叫料失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/zpjlCt")
|
||||
@Log("mes-成套叫料")
|
||||
@ApiOperation("mes-成套叫料")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> zpjlCt(@Validated @RequestBody ZpjlCt zpjlCt) {
|
||||
|
||||
return new ResponseEntity<>(ApiResult.result(200,"成功",null), HttpStatus.OK);
|
||||
try {
|
||||
String orderNo = zpjlCt.getOrderNo();//工单号
|
||||
String completeCode = zpjlCt.getCompleteCode();//成套代码
|
||||
String station = zpjlCt.getStation();//需求工位
|
||||
String pointCode = zpjlCt.getPointCode();//需求点位
|
||||
pickService.bigItemCall(orderNo, completeCode, station, pointCode);
|
||||
return successResponse("叫料成功!");
|
||||
} catch (Exception e) {
|
||||
return badResponse("叫料失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/zpjlJj")
|
||||
@Log("mes-紧急叫料")
|
||||
@ApiOperation("mes-紧急叫料")
|
||||
|
|
@ -119,6 +143,7 @@ public class MesController {
|
|||
|
||||
return new ResponseEntity<>(ApiResult.result(200, "成功", null), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/transTask")
|
||||
@Log("mes-搬运任务")
|
||||
@ApiOperation("mes-搬运任务")
|
||||
|
|
@ -128,7 +153,9 @@ public class MesController {
|
|||
return new ResponseEntity<>(ApiResult.result(200, "成功", null), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/** 验证成套物料*/
|
||||
/**
|
||||
* 验证成套物料
|
||||
*/
|
||||
private BigItem verifiedBigItem(String completeCode, String completeName) {
|
||||
List<BigItem> bigItemList = bigItemRepository.findRepeat(completeCode, completeName);
|
||||
if (bigItemList.size() > 0) {
|
||||
|
|
@ -137,6 +164,7 @@ public class MesController {
|
|||
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护成套物料" + completeCode);
|
||||
}
|
||||
}
|
||||
|
||||
private Item verifiedItem(String itemCode, String itemName) {
|
||||
List<Item> itemList = itemRepository.findRepeat(itemCode, itemName);
|
||||
if (itemList.size() > 0) {
|
||||
|
|
@ -161,4 +189,12 @@ public class MesController {
|
|||
return bigBom;
|
||||
}
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> badResponse(String message) {
|
||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), message, ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> successResponse(String message) {
|
||||
return new ResponseEntity<>(ApiResult.fail(OK.value(), message, ""), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,4 +83,22 @@ public interface PickService {
|
|||
void download(List<PickDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
Pick save(GdDetail gdDetail, int no);
|
||||
|
||||
/**
|
||||
* 成品叫料
|
||||
* @param gdNo->订单号
|
||||
* @param completeCode->成套代码
|
||||
* @param station->需求工位
|
||||
* @param pointCode->需求点位
|
||||
*/
|
||||
void bigItemCall(String gdNo,String completeCode,String station,String pointCode);
|
||||
|
||||
/**
|
||||
* 单品叫料
|
||||
* @param gdNo->订单号
|
||||
* @param itemCode->物料代码
|
||||
* @param station->需求工位
|
||||
* @param pointCode->需求点位
|
||||
*/
|
||||
void itemCall(String gdNo,String itemCode,String station,String pointCode);
|
||||
}
|
||||
|
|
@ -64,4 +64,7 @@ public class PickDto implements Serializable {
|
|||
private GdDetail gdDetail;
|
||||
/** 关联备料点位 */
|
||||
private Point point;
|
||||
|
||||
/** 是否叫料 */
|
||||
private Boolean beCall;
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
|
|
@ -36,9 +37,9 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @author huojin
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author huojin
|
||||
* @date 2024-06-11
|
||||
**/
|
||||
@Service
|
||||
|
|
@ -122,4 +123,32 @@ public class PickServiceImpl implements PickService {
|
|||
|
||||
return pick;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void bigItemCall(String gdNo, String completeCode, String station, String pointCode) {
|
||||
Pick pick = pickRepository.findByPick(gdNo, completeCode, station);
|
||||
if (pick == null) {
|
||||
throw new IllegalArgumentException(gdNo + "工单未备料,叫料失败!");
|
||||
}
|
||||
if (pick.getBeCall()) {
|
||||
throw new IllegalArgumentException(gdNo + "工单已叫料,请勿重复叫料!");
|
||||
}
|
||||
pick.setBeCall(true);
|
||||
pickRepository.save(pick);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void itemCall(String gdNo, String itemCode, String station, String pointCode) {
|
||||
Pick pick = pickRepository.findByPick(gdNo, itemCode, station);
|
||||
if (pick == null) {
|
||||
throw new IllegalArgumentException(gdNo + "工单未备料,叫料失败!");
|
||||
}
|
||||
if (pick.getBeCall()) {
|
||||
throw new IllegalArgumentException(gdNo + "工单已叫料,请勿重复叫料!");
|
||||
}
|
||||
pick.setBeCall(true);
|
||||
pickRepository.save(pick);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue