no message
parent
19f3630e90
commit
c3dcafc53f
|
|
@ -9,16 +9,22 @@ import lombok.Data;
|
||||||
public class ZpjlCt {
|
public class ZpjlCt {
|
||||||
@ApiModelProperty(value ="任务号",required = true,example = "任务号")
|
@ApiModelProperty(value ="任务号",required = true,example = "任务号")
|
||||||
String taskCode;
|
String taskCode;
|
||||||
|
|
||||||
@ApiModelProperty(value ="工单号",required = true,example = "工单号")
|
@ApiModelProperty(value ="工单号",required = true,example = "工单号")
|
||||||
String orderNo;
|
String orderNo;
|
||||||
|
|
||||||
@ApiModelProperty(value ="下发时间",required = true,example = "2023-07-03 00:00:00")
|
@ApiModelProperty(value ="下发时间",required = true,example = "2023-07-03 00:00:00")
|
||||||
String createTime;
|
String createTime;
|
||||||
|
|
||||||
@ApiModelProperty(value ="总成代码",required = true)
|
@ApiModelProperty(value ="总成代码",required = true)
|
||||||
String completeCode;
|
String completeCode;
|
||||||
|
|
||||||
@ApiModelProperty(value ="总成名称",required = true)
|
@ApiModelProperty(value ="总成名称",required = true)
|
||||||
String completeName;
|
String completeName;
|
||||||
|
|
||||||
@ApiModelProperty(value ="需求工位",required = true)
|
@ApiModelProperty(value ="需求工位",required = true)
|
||||||
String station;
|
String station;
|
||||||
|
|
||||||
@ApiModelProperty(value ="需求点位",required = true)
|
@ApiModelProperty(value ="需求点位",required = true)
|
||||||
String pointCode;
|
String pointCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,22 @@ import lombok.Data;
|
||||||
public class ZpjlZj {
|
public class ZpjlZj {
|
||||||
@ApiModelProperty(value ="任务号",required = true,example = "任务号")
|
@ApiModelProperty(value ="任务号",required = true,example = "任务号")
|
||||||
String taskCode;
|
String taskCode;
|
||||||
|
|
||||||
@ApiModelProperty(value ="工单号",required = true,example = "工单号")
|
@ApiModelProperty(value ="工单号",required = true,example = "工单号")
|
||||||
String orderNo;
|
String orderNo;
|
||||||
|
|
||||||
@ApiModelProperty(value ="下发时间",required = true,example = "2023-07-03 00:00:00")
|
@ApiModelProperty(value ="下发时间",required = true,example = "2023-07-03 00:00:00")
|
||||||
String createTime;
|
String createTime;
|
||||||
|
|
||||||
@ApiModelProperty(value ="物料代码",required = true,example = "物料代码")
|
@ApiModelProperty(value ="物料代码",required = true,example = "物料代码")
|
||||||
String itemCode;
|
String itemCode;
|
||||||
|
|
||||||
@ApiModelProperty(value ="物料名称",required = true,example = "物料名称")
|
@ApiModelProperty(value ="物料名称",required = true,example = "物料名称")
|
||||||
String itemName;
|
String itemName;
|
||||||
|
|
||||||
@ApiModelProperty(value ="需求工位",required = true)
|
@ApiModelProperty(value ="需求工位",required = true)
|
||||||
String station;
|
String station;
|
||||||
|
|
||||||
@ApiModelProperty(value ="需求点位",required = true)
|
@ApiModelProperty(value ="需求点位",required = true)
|
||||||
String pointCode;
|
String pointCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,11 @@ public class Gd extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "ID")
|
@ApiModelProperty(value = "ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(name = "`code`")
|
@Column(name = "`code`",nullable = false)
|
||||||
@ApiModelProperty(value = "工单编号")
|
@ApiModelProperty(value = "工单编号")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@Column(name = "`name`")
|
@Column(name = "`name`",nullable = false)
|
||||||
@ApiModelProperty(value = "任务编号")
|
@ApiModelProperty(value = "任务编号")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ public class Gd extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "工单状态")
|
@ApiModelProperty(value = "工单状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@Column(name = "`station`")
|
@Column(name = "`station`",nullable = false)
|
||||||
@ApiModelProperty(value = "需求工位")
|
@ApiModelProperty(value = "需求工位")
|
||||||
private String station;
|
private String station;
|
||||||
@OneToOne
|
@OneToOne
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,12 @@ 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
|
@OneToOne
|
||||||
@JoinColumn(name = "`gd_id`",nullable = false)
|
@JoinColumn(name = "`gd_id`",nullable = false)
|
||||||
@ApiModelProperty(value = "工单")
|
@ApiModelProperty(value = "工单")
|
||||||
private Gd gd;
|
private Gd gd;
|
||||||
|
|
||||||
@Column(name = "`line_no`")
|
@Column(name = "`line_no`")
|
||||||
@ApiModelProperty(value = "行号")
|
@ApiModelProperty(value = "行号")
|
||||||
private int lineNo;
|
private int lineNo;
|
||||||
|
|
@ -57,6 +59,7 @@ public class GdDetail extends BaseEntity implements Serializable {
|
||||||
@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;
|
||||||
|
|
@ -65,9 +68,10 @@ public class GdDetail extends BaseEntity implements Serializable {
|
||||||
private Double orderQty=0d;
|
private Double orderQty=0d;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`big_item_id`",nullable = true)
|
@JoinColumn(name = "`big_item_id`",nullable = false)
|
||||||
@ApiModelProperty(value = "成套物料")
|
@ApiModelProperty(value = "成套物料")
|
||||||
private BigItem bigItem;
|
private BigItem bigItem;
|
||||||
|
|
||||||
@Column(name = "`big_item_qty`")
|
@Column(name = "`big_item_qty`")
|
||||||
@ApiModelProperty(value = "总成套数")
|
@ApiModelProperty(value = "总成套数")
|
||||||
private Double bigItemQty=0d;
|
private Double bigItemQty=0d;
|
||||||
|
|
@ -75,6 +79,7 @@ public class GdDetail extends BaseEntity implements Serializable {
|
||||||
@Column(name = "`order_type`")
|
@Column(name = "`order_type`")
|
||||||
@ApiModelProperty(value = "单据类型")
|
@ApiModelProperty(value = "单据类型")
|
||||||
private String orderType;
|
private String orderType;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`dept_id`",nullable = false)
|
@JoinColumn(name = "`dept_id`",nullable = false)
|
||||||
@ApiModelProperty(value = "仓库")
|
@ApiModelProperty(value = "仓库")
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Zheng Jie
|
* Copyright 2019-2020 Zheng Jie
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.domain;
|
package com.youchain.businessdata.domain;
|
||||||
|
|
||||||
import com.youchain.base.BaseEntity;
|
import com.youchain.base.BaseEntity;
|
||||||
|
|
@ -22,20 +22,21 @@ 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 javax.validation.constraints.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @author huojin
|
||||||
* @description /
|
* @website https://eladmin.vip
|
||||||
* @author huojin
|
* @description /
|
||||||
* @date 2024-06-11
|
* @date 2024-06-11
|
||||||
**/
|
**/
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
@Table(name="data_pick")
|
@Table(name = "data_pick")
|
||||||
public class Pick extends BaseEntity implements Serializable {
|
public class Pick extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
|
@ -44,10 +45,11 @@ public class Pick extends BaseEntity implements Serializable {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@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`")
|
@Column(name = "`code`")
|
||||||
@ApiModelProperty(value = "出库单头")
|
@ApiModelProperty(value = "出库单头")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
@ -60,17 +62,21 @@ public class Pick extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "状态")
|
@ApiModelProperty(value = "状态")
|
||||||
private String status;
|
private String status;
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`point_id`",nullable = false)
|
@JoinColumn(name = "`point_id`", nullable = false)
|
||||||
@ApiModelProperty(value = "备料点位")
|
@ApiModelProperty(value = "备料点位")
|
||||||
@NotNull
|
@NotNull
|
||||||
private Point point;
|
private Point point;
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`gd_detail_id`",nullable = false)
|
@JoinColumn(name = "`gd_detail_id`", nullable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "关联工单明细")
|
@ApiModelProperty(value = "关联工单明细")
|
||||||
private GdDetail gdDetail;
|
private GdDetail gdDetail;
|
||||||
|
|
||||||
public void copy(Pick source){
|
@Column(name = "`be_call`")
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
@ApiModelProperty(value = "是否叫料")
|
||||||
|
private Boolean beCall;
|
||||||
|
|
||||||
|
public void copy(Pick source) {
|
||||||
|
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Zheng Jie
|
* Copyright 2019-2020 Zheng Jie
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.repository;
|
package com.youchain.businessdata.repository;
|
||||||
|
|
||||||
import com.youchain.businessdata.domain.Pick;
|
import com.youchain.businessdata.domain.Pick;
|
||||||
|
|
@ -23,13 +23,17 @@ import org.springframework.data.jpa.repository.Query;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @author huojin
|
||||||
* @author huojin
|
* @website https://eladmin.vip
|
||||||
* @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)
|
@Query(value = "SELECT p FROM Pick p WHERE p.gdDetail.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 ", nativeQuery = false)
|
|
||||||
|
@Query(value = "SELECT p FROM Pick p WHERE p.status=?1 ")
|
||||||
List<Pick> findByStatus(String status);
|
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.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.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;
|
||||||
|
|
@ -33,6 +34,9 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "mes接口管理")
|
@Api(tags = "mes接口管理")
|
||||||
|
|
@ -42,47 +46,48 @@ public class MesController {
|
||||||
private final GdService gdService;
|
private final GdService gdService;
|
||||||
private final GdDetailService gdDetailService;
|
private final GdDetailService gdDetailService;
|
||||||
private final DeptService deptService;
|
private final DeptService deptService;
|
||||||
private final BigBomService bigBomService;
|
|
||||||
private final ItemRepository itemRepository;
|
private final ItemRepository itemRepository;
|
||||||
private final BigBomRepository bigBomRepository;
|
private final BigBomRepository bigBomRepository;
|
||||||
private final BigItemRepository bigItemRepository;
|
private final BigItemRepository bigItemRepository;
|
||||||
|
private final PickService pickService;
|
||||||
|
|
||||||
@PostMapping("/yclbl")
|
@PostMapping("/yclbl")
|
||||||
@Log("mes-原材料备料")
|
@Log("mes-原材料备料")
|
||||||
@ApiOperation("mes-原材料备料")
|
@ApiOperation("mes-原材料备料")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> yclbl(@Validated @RequestBody Yclbl yclbl){
|
public ResponseEntity<Object> yclbl(@Validated @RequestBody Yclbl yclbl) {
|
||||||
/* 添加工单单头*/
|
/* 添加工单单头*/
|
||||||
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) {
|
||||||
/* 验证成套 物料*/
|
/* 验证成套 物料*/
|
||||||
BigItem 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*/
|
/* 验证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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (yclbl.getBlzcmx()!=null){
|
if (yclbl.getBlzcmx() != null) {
|
||||||
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(),itemDate.getItemName());
|
Item item = verifiedItem(itemDate.getItemCode(), itemDate.getItemName());
|
||||||
/* 添加工单明细*/
|
/* 添加工单明细*/
|
||||||
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,68 +96,91 @@ public class MesController {
|
||||||
@Log("mes-散件BOM同步")
|
@Log("mes-散件BOM同步")
|
||||||
@ApiOperation("mes-散件BOM同步")
|
@ApiOperation("mes-散件BOM同步")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> sjBom(@Validated @RequestBody SjBom sjBom){
|
public ResponseEntity<Object> sjBom(@Validated @RequestBody SjBom sjBom) {
|
||||||
|
|
||||||
return new ResponseEntity<>(ApiResult.result(200,"成功",null), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.result(200, "成功", null), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/zpjlZj")
|
@PostMapping("/zpjlZj")
|
||||||
@Log("mes-其他整件叫料")
|
@Log("mes-其他整件叫料")
|
||||||
@ApiOperation("mes-其他整件叫料")
|
@ApiOperation("mes-其他整件叫料")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> zpjlZj(@Validated @RequestBody ZpjlZj zpjlZj){
|
public ResponseEntity<Object> zpjlZj(@Validated @RequestBody ZpjlZj zpjlZj) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(ApiResult.result(200,"成功",null), HttpStatus.OK);
|
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")
|
@PostMapping("/zpjlCt")
|
||||||
@Log("mes-成套叫料")
|
@Log("mes-成套叫料")
|
||||||
@ApiOperation("mes-成套叫料")
|
@ApiOperation("mes-成套叫料")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> zpjlCt(@Validated @RequestBody ZpjlCt zpjlCt){
|
public ResponseEntity<Object> zpjlCt(@Validated @RequestBody ZpjlCt zpjlCt) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(ApiResult.result(200,"成功",null), HttpStatus.OK);
|
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")
|
@PostMapping("/zpjlJj")
|
||||||
@Log("mes-紧急叫料")
|
@Log("mes-紧急叫料")
|
||||||
@ApiOperation("mes-紧急叫料")
|
@ApiOperation("mes-紧急叫料")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> zpjlJj(@Validated @RequestBody ZpjlJj zpjlJj){
|
public ResponseEntity<Object> zpjlJj(@Validated @RequestBody ZpjlJj zpjlJj) {
|
||||||
|
|
||||||
return new ResponseEntity<>(ApiResult.result(200,"成功",null), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.result(200, "成功", null), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/transTask")
|
@PostMapping("/transTask")
|
||||||
@Log("mes-搬运任务")
|
@Log("mes-搬运任务")
|
||||||
@ApiOperation("mes-搬运任务")
|
@ApiOperation("mes-搬运任务")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> transTask(@Validated @RequestBody TransTask transTask){
|
public ResponseEntity<Object> transTask(@Validated @RequestBody TransTask transTask) {
|
||||||
|
|
||||||
return new ResponseEntity<>(ApiResult.result(200,"成功",null), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.result(200, "成功", null), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 验证成套物料*/
|
/**
|
||||||
|
* 验证成套物料
|
||||||
|
*/
|
||||||
private BigItem verifiedBigItem(String completeCode, String completeName) {
|
private BigItem verifiedBigItem(String completeCode, String completeName) {
|
||||||
List<BigItem> bigItemList = bigItemRepository.findRepeat(completeCode,completeName);
|
List<BigItem> bigItemList = bigItemRepository.findRepeat(completeCode, completeName);
|
||||||
if (bigItemList.size()>0){
|
if (bigItemList.size() > 0) {
|
||||||
return bigItemList.get(0);
|
return bigItemList.get(0);
|
||||||
}else {
|
} else {
|
||||||
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护成套物料"+completeCode);
|
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护成套物料" + completeCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Item verifiedItem(String itemCode, String itemName) {
|
private Item verifiedItem(String itemCode, String itemName) {
|
||||||
List<Item> itemList = itemRepository.findRepeat(itemCode,itemName);
|
List<Item> itemList = itemRepository.findRepeat(itemCode, itemName);
|
||||||
if (itemList.size()>0){
|
if (itemList.size() > 0) {
|
||||||
return itemList.get(0);
|
return itemList.get(0);
|
||||||
}else {
|
} else {
|
||||||
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) {
|
private BigBom verifiedBigBom(BigItem bigItem, Item item, Double itemQty) {
|
||||||
List<BigBom> bigBomList = bigBomRepository.findRepeat(bigItem.getId(),item.getId());
|
List<BigBom> bigBomList = bigBomRepository.findRepeat(bigItem.getId(), item.getId());
|
||||||
if (bigBomList.size()>0){
|
if (bigBomList.size() > 0) {
|
||||||
return bigBomList.get(0);
|
return bigBomList.get(0);
|
||||||
}else {
|
} else {
|
||||||
// 添加BOM
|
// 添加BOM
|
||||||
BigBom bigBom= new BigBom();
|
BigBom bigBom = new BigBom();
|
||||||
bigBom.setBigItem(bigItem);
|
bigBom.setBigItem(bigItem);
|
||||||
bigBom.setItem(item);
|
bigBom.setItem(item);
|
||||||
bigBom.setQuantity(itemQty);
|
bigBom.setQuantity(itemQty);
|
||||||
|
|
@ -161,4 +189,12 @@ public class MesController {
|
||||||
return bigBom;
|
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;
|
void download(List<PickDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
Pick save(GdDetail gdDetail, int no);
|
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 GdDetail gdDetail;
|
||||||
/** 关联备料点位 */
|
/** 关联备料点位 */
|
||||||
private Point point;
|
private Point point;
|
||||||
}
|
|
||||||
|
/** 是否叫料 */
|
||||||
|
private Boolean beCall;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Zheng Jie
|
* Copyright 2019-2020 Zheng Jie
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service.impl;
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
|
|
@ -28,6 +28,7 @@ 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.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -36,11 +37,11 @@ import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @author huojin
|
||||||
* @description 服务实现
|
* @website https://eladmin.vip
|
||||||
* @author huojin
|
* @description 服务实现
|
||||||
* @date 2024-06-11
|
* @date 2024-06-11
|
||||||
**/
|
**/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PickServiceImpl implements PickService {
|
public class PickServiceImpl implements PickService {
|
||||||
|
|
@ -49,21 +50,21 @@ public class PickServiceImpl implements PickService {
|
||||||
private final PickMapper pickMapper;
|
private final PickMapper pickMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> queryAll(PickQueryCriteria criteria, Pageable pageable){
|
public Map<String, Object> queryAll(PickQueryCriteria criteria, Pageable pageable) {
|
||||||
Page<Pick> page = pickRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
Page<Pick> page = pickRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||||
return PageUtil.toPage(page.map(pickMapper::toDto));
|
return PageUtil.toPage(page.map(pickMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PickDto> queryAll(PickQueryCriteria criteria){
|
public List<PickDto> queryAll(PickQueryCriteria criteria) {
|
||||||
return pickMapper.toDto(pickRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
return pickMapper.toDto(pickRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public PickDto findById(Long id) {
|
public PickDto findById(Long id) {
|
||||||
Pick pick = pickRepository.findById(id).orElseGet(Pick::new);
|
Pick pick = pickRepository.findById(id).orElseGet(Pick::new);
|
||||||
ValidationUtil.isNull(pick.getId(),"Pick","id",id);
|
ValidationUtil.isNull(pick.getId(), "Pick", "id", id);
|
||||||
return pickMapper.toDto(pick);
|
return pickMapper.toDto(pick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,7 +78,7 @@ public class PickServiceImpl implements PickService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(Pick resources) {
|
public void update(Pick resources) {
|
||||||
Pick pick = pickRepository.findById(resources.getId()).orElseGet(Pick::new);
|
Pick pick = pickRepository.findById(resources.getId()).orElseGet(Pick::new);
|
||||||
ValidationUtil.isNull( pick.getId(),"Pick","id",resources.getId());
|
ValidationUtil.isNull(pick.getId(), "Pick", "id", resources.getId());
|
||||||
pick.copy(resources);
|
pick.copy(resources);
|
||||||
pickRepository.save(pick);
|
pickRepository.save(pick);
|
||||||
}
|
}
|
||||||
|
|
@ -93,7 +94,7 @@ public class PickServiceImpl implements PickService {
|
||||||
public void download(List<PickDto> all, HttpServletResponse response) throws IOException {
|
public void download(List<PickDto> all, HttpServletResponse response) throws IOException {
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
for (PickDto pick : all) {
|
for (PickDto pick : all) {
|
||||||
Map<String,Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("创建人", pick.getCreateBy());
|
map.put("创建人", pick.getCreateBy());
|
||||||
map.put("修改人", pick.getUpdateBy());
|
map.put("修改人", pick.getUpdateBy());
|
||||||
map.put("创建时间", pick.getCreateTime());
|
map.put("创建时间", pick.getCreateTime());
|
||||||
|
|
@ -108,18 +109,46 @@ 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);
|
List<Pick> pickList = pickRepository.findRepeat(gdDetail.getId(), no);
|
||||||
if (pickList.size()>0){
|
if (pickList.size() > 0) {
|
||||||
pick=pickList.get(0);
|
pick = pickList.get(0);
|
||||||
}
|
}
|
||||||
pick.setGdDetail(gdDetail);
|
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);
|
||||||
pick.setDept(UserUtils.isDept);
|
pick.setDept(UserUtils.isDept);
|
||||||
pickRepository.save(pick);
|
pickRepository.save(pick);
|
||||||
|
|
||||||
return pick;
|
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