no message
parent
5626570327
commit
ccb171e86c
2
pom.xml
2
pom.xml
|
|
@ -146,7 +146,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ public class ApiResult {
|
|||
private String message;//内容
|
||||
private int status;//编码
|
||||
|
||||
public static ApiResult fail() {
|
||||
public ApiResult fail() {
|
||||
|
||||
return result(400, "操作失败!", null);
|
||||
return result(status, "message!", data);
|
||||
}
|
||||
|
||||
public static ApiResult fail(int code, String msg, Object data) {
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||
* </pre>
|
||||
*/
|
||||
public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator;
|
||||
|
||||
/**
|
||||
* 定义GB的计算常量
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.youchain.appupdate.rest;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
|
|
@ -167,7 +168,7 @@ public class SceneAppController {
|
|||
message = resulObject.getString("message") == null ? "" : resulObject.getString("message");
|
||||
}
|
||||
if (code.equals("0")) {
|
||||
//终点占用
|
||||
/* //终点占用
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(endPoint);
|
||||
//生成入库任务
|
||||
|
|
@ -178,7 +179,7 @@ public class SceneAppController {
|
|||
ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1(), asnDetail.getOrderNumber());
|
||||
//生成入库记录
|
||||
Task task = new Task(item, itemKey, asnDetail.getOrderNumber(), BizStatus.ASN, asnDetail, null, null, null, stock, stock, srcPoint, endPoint, stock.getCode(), stock.getCode(), srcPoint.getCode(), endPoint.getCode(), null, BizStatus.OPEN, asnDetail.getOrderQty(), null, null, item.getDept(), agvTask);
|
||||
taskService.create(task);
|
||||
taskService.create(task);*/
|
||||
} else {
|
||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), message, ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
|
@ -255,11 +256,18 @@ public class SceneAppController {
|
|||
|
||||
|
||||
@PostMapping("/pointCallStock")
|
||||
@Log("空车出库")
|
||||
@ApiOperation("空车出库")
|
||||
@Log("容器搬运")
|
||||
@ApiOperation("容器搬运")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> pointCallStock(@RequestBody PointCallStock pointCallStock) {
|
||||
String pointCode = pointCallStock.getPointCode();
|
||||
public ResponseEntity<Object> pointCallStock(@RequestBody JSONObject jsonObject) {
|
||||
System.out.println("容器搬运"+jsonObject);
|
||||
String pointEndCode = jsonObject.getString("pointCode");
|
||||
JSONArray ids=jsonObject.getJSONArray("ids");
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
Long id=ids.getLong(i);
|
||||
agvTaskService.addAgvTask(id,pointEndCode);
|
||||
}
|
||||
/*String pointCode = pointCallStock.getPointCode();
|
||||
String agvScene = pointCallStock.getAgvScene();
|
||||
String code = "0";
|
||||
String message = null;
|
||||
|
|
@ -310,16 +318,24 @@ public class SceneAppController {
|
|||
pointService.update(srcPoint);
|
||||
} else {
|
||||
throw new RuntimeException(message);
|
||||
}
|
||||
}*/
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/pointStockBack")
|
||||
@Log("空车入库")
|
||||
@ApiOperation("空车入库")
|
||||
@Log("容器入场")
|
||||
@ApiOperation("容器入场")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> pointStockBack(@RequestBody PointCallStock pointCallStock) {
|
||||
String pointCode = pointCallStock.getPointCode();
|
||||
public ResponseEntity<Object> pointStockBack(@RequestBody JSONObject jsonObject) {
|
||||
System.out.println("容器入场:"+jsonObject);
|
||||
String storageType = jsonObject.getString("storageType");
|
||||
JSONArray ids=jsonObject.getJSONArray("ids");
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
Long id = ids.getLong(i);
|
||||
agvTaskService.pointStockRk(storageType,id);
|
||||
|
||||
}
|
||||
/*String pointCode = pointCallStock.getPointCode();
|
||||
String agvScene = pointCallStock.getAgvScene();
|
||||
String srcAreaName = null;
|
||||
String endAreaName = null;
|
||||
|
|
@ -364,7 +380,7 @@ public class SceneAppController {
|
|||
pointService.update(endPoint);
|
||||
} else {
|
||||
throw new RuntimeException(message);
|
||||
}
|
||||
}*/
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class SmallAppController {
|
|||
@ApiOperation("满料入库-小件")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> bindStock(@RequestBody Mo mo) {
|
||||
String Mo = mo.getMo();//MO票
|
||||
/*String Mo = mo.getMo();//MO票
|
||||
String stockCode = mo.getStockCode();//料箱号
|
||||
//MO票解析规则 LB]A0008157]231129]2238100000506]20]230729283171]]
|
||||
String[] str = Mo.split("]");
|
||||
|
|
@ -128,7 +128,7 @@ public class SmallAppController {
|
|||
stockService.update(stock);
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "绑定成功!", ""), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ public class Item extends BaseEntity implements Serializable {
|
|||
private StockType stockType;
|
||||
|
||||
@Column(name = "`extend_d1`")
|
||||
@ApiModelProperty(value = "默认容器装载数")
|
||||
@ApiModelProperty(value = "装载数")
|
||||
private Double extendD1=1d;
|
||||
|
||||
@Column(name = "`extend_d2`")
|
||||
|
|
|
|||
|
|
@ -55,9 +55,11 @@ public class Point extends BaseEntity implements Serializable {
|
|||
private String status;
|
||||
|
||||
@Column(name = "`description`")
|
||||
@ApiModelProperty(value = "存储类型")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String description;
|
||||
|
||||
@Column(name = "`storage_type`")
|
||||
@ApiModelProperty(value = "存储类型")
|
||||
private String storageType;
|
||||
@Column(name = "`beat_code`")
|
||||
@ApiModelProperty(value = "冷却区区域编码")
|
||||
private String beatCode;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ package com.youchain.basicdata.repository;
|
|||
import com.youchain.basicdata.domain.BillType;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -25,4 +28,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||
* @date 2023-08-07
|
||||
**/
|
||||
public interface BillTypeRepository extends JpaRepository<BillType, Long>, JpaSpecificationExecutor<BillType> {
|
||||
@Query(value = "SELECT b FROM BillType b WHERE b.sourceName = ?1 ")
|
||||
List<BillType> findBySourceName(String sourceName);
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@ package com.youchain.basicdata.repository;
|
|||
import com.youchain.basicdata.domain.Item;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -25,4 +26,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||
* @date 2023-08-16
|
||||
**/
|
||||
public interface ItemRepository extends JpaRepository<Item, Long>, JpaSpecificationExecutor<Item> {
|
||||
@Query(value = "SELECT i FROM Item i WHERE i.code=?1")
|
||||
Item findByCode(String itemCode);
|
||||
}
|
||||
|
|
@ -31,6 +31,10 @@ import java.util.Map;
|
|||
public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecificationExecutor<Point> {
|
||||
@Query(value = "SELECT u.id,u.code FROM base_point p WHERE p.enabled=1 and p.status='FREE'", nativeQuery = true)
|
||||
public List<Map<String, String>> getKyPointList();
|
||||
|
||||
|
||||
@Query(value = "SELECT p FROM Point p WHERE p.area.code=?1 and p.enabled=true and p.storageType is not null")
|
||||
List<Point> findByAreaCode(String areaCode);
|
||||
@Query(value = "SELECT p FROM Point p WHERE p.code=?1 and p.enabled=true")
|
||||
Point findByCode(String code);
|
||||
@Query(value = "SELECT p FROM Point p WHERE p.type=?1 and p.area.code=?2 and p.enabled=true")
|
||||
Point findByTypeAndArea(String type,String areaCode);
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package com.youchain.basicdata.rest;
|
||||
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.domain.BillType;
|
||||
import com.youchain.basicdata.service.BillTypeService;
|
||||
|
|
@ -84,4 +85,11 @@ public class BillTypeController {
|
|||
billTypeService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getBillType")
|
||||
@Log("加载单据类型下拉框")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> getBillType(){
|
||||
return new ResponseEntity<>(billTypeService.getBillType(),HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
|
|
@ -80,4 +80,6 @@ public interface BillTypeService {
|
|||
* @throws IOException /
|
||||
*/
|
||||
void download(List<BillTypeDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
List<BillType> getBillType();
|
||||
}
|
||||
|
|
@ -69,6 +69,8 @@ public class PointDto implements Serializable {
|
|||
|
||||
/** 类型 */
|
||||
private String type;
|
||||
/** 存储类型 */
|
||||
private String storageType;
|
||||
|
||||
/** 热度 */
|
||||
private Double heat;
|
||||
|
|
|
|||
|
|
@ -110,4 +110,9 @@ public class BillTypeServiceImpl implements BillTypeService {
|
|||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BillType> getBillType() {
|
||||
return billTypeRepository.findAll();
|
||||
}
|
||||
}
|
||||
|
|
@ -338,7 +338,7 @@ public class BoxServiceImpl implements BoxService {
|
|||
message = resulObject.getString("message") == null ? "" : resulObject.getString("message");
|
||||
}
|
||||
if (code.equals("0")) {
|
||||
//按钮盒点位占用,空车缓存点位占用
|
||||
/*//按钮盒点位占用,空车缓存点位占用
|
||||
stratPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(stratPoint);
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
|
|
@ -352,7 +352,7 @@ public class BoxServiceImpl implements BoxService {
|
|||
ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1(), asnDetail.getOrderNumber());
|
||||
//生成入库记录
|
||||
Task task = new Task(item, itemKey, asnDetail.getOrderNumber(), BizStatus.ASN, asnDetail, null, null, null, null, null, stratPoint, endPoint, null, null, stratPoint.getCode(), endPoint.getCode(), null, BizStatus.ATCALL, asnDetail.getOrderQty(), null, null, item.getDept(), agvTask);
|
||||
taskService.create(task);
|
||||
taskService.create(task);*/
|
||||
} else {
|
||||
throw new RuntimeException(message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.youchain.basicdata.domain.Point;
|
|||
import com.youchain.basicdata.service.dto.StockSmallDto;
|
||||
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
||||
import com.youchain.businessdata.inputJson.IPTask;
|
||||
import com.youchain.modules.system.domain.DictDetail;
|
||||
import com.youchain.utils.*;
|
||||
import jdk.internal.dynalink.beans.StaticClass;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -142,27 +143,13 @@ public class PointServiceImpl implements PointService {
|
|||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (PointDto point : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("RCS代码", point.getCode());
|
||||
map.put("名称", point.getName());
|
||||
map.put("代码", point.getCode());
|
||||
/*map.put("名称", point.getName());
|
||||
map.put("状态", point.getStatus());
|
||||
map.put("描述", point.getDescription());
|
||||
map.put("区域编码", point.getBeatCode());
|
||||
map.put("物料编码", point.getItemCode());
|
||||
map.put("库区名称", point.getArea().getName());
|
||||
map.put("库区", point.getArea().getName());
|
||||
map.put("是否启用", point.getEnabled());
|
||||
map.put("仓库名称", point.getDept().getName());
|
||||
map.put("坐标X", point.getPosX());
|
||||
map.put("坐标Y", point.getPosY());
|
||||
map.put("坐标Z", point.getPosZ());
|
||||
map.put("层", point.getRows());
|
||||
map.put("列", point.getCol());
|
||||
map.put("排", point.getLine());
|
||||
map.put("类型", point.getType());
|
||||
map.put("热度", point.getHeat());
|
||||
map.put("创建人", point.getCreateBy());
|
||||
map.put("修改人", point.getUpdateBy());
|
||||
map.put("创建时间", point.getCreateTime());
|
||||
map.put("修改时间", point.getUpdateTime());
|
||||
map.put("类型", point.getType());*/
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class AgvTask extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "容器号")
|
||||
private String stockCode;
|
||||
|
||||
@Column(name = "`stock_type_code`",nullable = true)
|
||||
@Column(name = "`stock_type_code`",nullable = false)
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "")
|
||||
private String stockTypeCode;
|
||||
|
|
@ -123,11 +123,11 @@ public class AgvTask extends BaseEntity implements Serializable {
|
|||
private Timestamp jobMessageTime;
|
||||
|
||||
@Column(name = "`start_time`")
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
@ApiModelProperty(value = "取料时间")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Column(name = "`end_time`")
|
||||
@ApiModelProperty(value = "完成时间")
|
||||
@ApiModelProperty(value = "放料时间")
|
||||
private Timestamp endTime;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.youchain.businessdata.domain;
|
||||
|
||||
import com.youchain.base.BaseEntity;
|
||||
import com.youchain.basicdata.domain.BillType;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
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.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author hjl
|
||||
* @date 2024-02-29
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="data_asn")
|
||||
public class Asn extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "dept_id")
|
||||
@ApiModelProperty(value = "仓库ID")
|
||||
private Dept dept;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "bill_type_id")
|
||||
@ApiModelProperty(value = "单据类型ID")
|
||||
private BillType billType;
|
||||
|
||||
@Column(name = "`order_origin`")
|
||||
@ApiModelProperty(value = "订单来源")
|
||||
private String orderOrigin;
|
||||
|
||||
@Column(name = "`structure`")
|
||||
@ApiModelProperty(value = "货主")
|
||||
private String structure;
|
||||
|
||||
@Column(name = "`er_time`")
|
||||
@ApiModelProperty(value = "操作时间")
|
||||
private Timestamp erTime;
|
||||
|
||||
@Column(name = "`related_bill1`")
|
||||
@ApiModelProperty(value = "系统单号")
|
||||
private String relatedBill1;
|
||||
|
||||
@Column(name = "`related_bill2`")
|
||||
@ApiModelProperty(value = "客户订单号")
|
||||
private String relatedBill2;
|
||||
|
||||
@Column(name = "`source_name`")
|
||||
@ApiModelProperty(value = "来源名称")
|
||||
private String sourceName;
|
||||
|
||||
@Column(name = "`status`")
|
||||
@ApiModelProperty(value = "订单状态")
|
||||
private String status;
|
||||
|
||||
@Column(name = "`address`")
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
public void copy(Asn source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
|
|
@ -47,9 +47,10 @@ public class AsnDetail extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "`asn_id`")
|
||||
@OneToOne
|
||||
@JoinColumn(name = "`asn_id`")
|
||||
@ApiModelProperty(value = "订单序号")
|
||||
private Long asnId;
|
||||
private Asn asn;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "`item_id`",nullable = false)
|
||||
|
|
@ -108,15 +109,15 @@ public class AsnDetail extends BaseEntity implements Serializable {
|
|||
private String remark;
|
||||
|
||||
@Column(name = "`prop_c1`")
|
||||
@ApiModelProperty(value = "批次号")
|
||||
@ApiModelProperty(value = "中标批次名称")
|
||||
private String propC1;
|
||||
|
||||
@Column(name = "`prop_c2`")
|
||||
@ApiModelProperty(value = "序列号")
|
||||
@ApiModelProperty(value = "成品物料编码")
|
||||
private String propC2;
|
||||
|
||||
@Column(name = "`prop_c3`")
|
||||
@ApiModelProperty(value = "厂家编号")
|
||||
@ApiModelProperty(value = "序列号")
|
||||
private String propC3;
|
||||
|
||||
@Column(name = "`prop_c4`")
|
||||
|
|
|
|||
|
|
@ -54,23 +54,23 @@ public class ItemKey extends BaseEntity implements Serializable {
|
|||
private String propC1;
|
||||
|
||||
@Column(name = "`prop_c2`")
|
||||
@ApiModelProperty(value = "序列号")
|
||||
@ApiModelProperty(value = "字符")
|
||||
private String propC2;
|
||||
|
||||
@Column(name = "`prop_c3`")
|
||||
@ApiModelProperty(value = "属性4")
|
||||
@ApiModelProperty(value = "计划单号")
|
||||
private String propC3;
|
||||
|
||||
@Column(name = "`prop_c4`")
|
||||
@ApiModelProperty(value = "属性4")
|
||||
@ApiModelProperty(value = "厂家供货码")
|
||||
private String propC4;
|
||||
|
||||
@Column(name = "`prop_c5`")
|
||||
@ApiModelProperty(value = "属性5")
|
||||
@ApiModelProperty(value = "供货数量")
|
||||
private String propC5;
|
||||
|
||||
@Column(name = "`prop_c6`")
|
||||
@ApiModelProperty(value = "属性6")
|
||||
@ApiModelProperty(value = "流水号")
|
||||
private String propC6;
|
||||
|
||||
@Column(name = "`prop_d1`")
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public class Task extends BaseEntity implements Serializable {
|
|||
private String taskStatus;
|
||||
|
||||
@Column(name = "`be_skip`")
|
||||
@ApiModelProperty(value = "跳过")
|
||||
@ApiModelProperty(value = "是否AGV任务")
|
||||
private Integer beSkip=0;
|
||||
|
||||
@Column(name = "`be_back`")
|
||||
|
|
@ -144,7 +144,7 @@ public class Task extends BaseEntity implements Serializable {
|
|||
private Double moveQty=0d;
|
||||
|
||||
@Column(name = "`put_code`")
|
||||
@ApiModelProperty(value = "上架号")
|
||||
@ApiModelProperty(value = "流水号")
|
||||
private String putCode;
|
||||
|
||||
@Column(name = "`inv_id`")
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ package com.youchain.businessdata.repository;
|
|||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -25,4 +29,17 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||
* @date 2023-08-14
|
||||
**/
|
||||
public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, JpaSpecificationExecutor<AsnDetail> {
|
||||
@Query("select d from AsnDetail d where d.asn.id=?1 and d.lineNo=?2")
|
||||
List<AsnDetail> findByLineNo(Long id, Long lineNo);
|
||||
@Query(value = " select i.id,sum(ad.order_qty) from data_asn_detail ad "
|
||||
+" left join data_asn a on ad.asn_id=a.id "
|
||||
+" left join base_bill_type bt on bt.id=a.bill_type_id "
|
||||
+" left join base_item i on ad.item_id=i.id "
|
||||
+" where a.`status`=?1 and bt.`code`=?2 "
|
||||
+" group by i.id ",nativeQuery = true)
|
||||
List<Map<String,Object>> findByAsn(String asnStatus, String billTypeCode);
|
||||
@Query("select d from AsnDetail d where d.asn.relatedBill1=?1 and d.item.code=?2 and d.orderQty>d.receivedQty")
|
||||
List<AsnDetail> findByAsnAndItem(String taskBillCode, String itemCode);
|
||||
@Query("select d from AsnDetail d where d.asn.id=?1 and d.asn.status=?2")
|
||||
List<AsnDetail> findByAsnId(Long asnId,String asnStatus);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.youchain.businessdata.repository;
|
||||
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author hjl
|
||||
* @date 2024-02-29
|
||||
**/
|
||||
public interface AsnRepository extends JpaRepository<Asn, Long>, JpaSpecificationExecutor<Asn> {
|
||||
@Query(value = "select a from Asn a where a.relatedBill1=?1")
|
||||
Asn findByRelatedBill1(String relatedBill1);
|
||||
}
|
||||
|
|
@ -29,4 +29,6 @@ import java.util.List;
|
|||
* @date 2023-08-21
|
||||
**/
|
||||
public interface ItemKeyRepository extends JpaRepository<ItemKey, Long>, JpaSpecificationExecutor<ItemKey> {
|
||||
@Query(value = "SELECT ik FROM ItemKey ik WHERE ik.item.id=?1 and ik.propC1=?2 and ik.propC2=?3 and ik.propC3=?4 and ik.propC4=?5 and ik.propC5=?6 and ik.propC6=?7")
|
||||
ItemKey getByItemKey(Long id, String propC1, String propC2, String propC3, String propC4, String propC5, String propC6);
|
||||
}
|
||||
|
|
@ -80,4 +80,16 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
|||
*/
|
||||
@Query(value = "select * from data_task a where a.dst_point_code like 'MA1151-QHL%' and a.create_time > :time", nativeQuery = true)
|
||||
List<Task> queryInQHALLData(String time);
|
||||
@Query(value = "select t from Task t where t.itemKey.id =?1 and t.taskStatus=?2")
|
||||
List<Task> findByItemKey(Long id,String taskStatus);
|
||||
|
||||
@Query(value = " select i.id 'itemId',SUM(t.plan_qty) 'taskQty' from data_task t "
|
||||
+" left join data_item_key ik on t.item_key_id=ik.id "
|
||||
+" left join base_item i on i.id=ik.item_id "
|
||||
+" where t.task_status=?1 and t.be_skip=?2 "
|
||||
+" and i.good_type=?3 "
|
||||
+" group by i.id ",nativeQuery = true)
|
||||
List<Map<String,Object>> findBySumPlanQty(String taskStatus,int beSkip,String goodType);
|
||||
@Query(value = "select t from Task t where t.taskStatus =?1 and t.beSkip=?2 and t.itemKey.item.goodType=?3")
|
||||
List<Task> findByItemType(String taskStatus, int beSkip, String goodType);
|
||||
}
|
||||
|
|
@ -97,8 +97,8 @@ public class AgvTaskController {
|
|||
* @param json
|
||||
*/
|
||||
@PostMapping("/agvTaskCallback")
|
||||
@Log("料箱任务接口回调")
|
||||
@ApiOperation("料箱任务接口回调")
|
||||
@Log("AGV搬运任务回调接口")
|
||||
@ApiOperation("AGV搬运任务回调接口")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> agvTaskCallback(@RequestBody String json){
|
||||
JSONObject jsonObject = JSON.parseObject(json);
|
||||
|
|
@ -108,9 +108,10 @@ public class AgvTaskController {
|
|||
String missionStatus = jsonObject.getString("missionStatus")==null?"":jsonObject.getString("missionStatus");//作业当前状态
|
||||
//查询对应BOX
|
||||
try {
|
||||
AgvTaskDto dto= agvTaskService.findById(Integer.parseInt(taskCode));
|
||||
/*AgvTaskDto dto= agvTaskService.findById(Integer.parseInt(taskCode));
|
||||
AgvTask agvTask=agvTaskService.toEntity(dto);
|
||||
agvTaskService.agvTaskCallback(agvTask,missionStatus,"");
|
||||
agvTaskService.agvTaskCallback(agvTask,missionStatus,"");*/
|
||||
agvTaskService.agvTaskCallback(taskCode,missionStatus);
|
||||
return new ResponseEntity<>(ApiResult.success("",""),HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.fail(400,e.getMessage(),""),HttpStatus.OK);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.youchain.businessdata.rest;
|
||||
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.businessdata.service.dto.AsnQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author hjl
|
||||
* @date 2024-02-29
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "asn管理")
|
||||
@RequestMapping("/api/asn")
|
||||
public class AsnController {
|
||||
|
||||
private final AsnService asnService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('asn:list')")
|
||||
public void exportAsn(HttpServletResponse response, AsnQueryCriteria criteria) throws IOException {
|
||||
asnService.download(asnService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询asn")
|
||||
@ApiOperation("查询asn")
|
||||
@PreAuthorize("@el.check('asn:list')")
|
||||
public ResponseEntity<Object> queryAsn(AsnQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(asnService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增asn")
|
||||
@ApiOperation("新增asn")
|
||||
@PreAuthorize("@el.check('asn:add')")
|
||||
public ResponseEntity<Object> createAsn(@Validated @RequestBody Asn resources){
|
||||
return new ResponseEntity<>(asnService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改asn")
|
||||
@ApiOperation("修改asn")
|
||||
@PreAuthorize("@el.check('asn:edit')")
|
||||
public ResponseEntity<Object> updateAsn(@Validated @RequestBody Asn resources){
|
||||
asnService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除asn")
|
||||
@ApiOperation("删除asn")
|
||||
@PreAuthorize("@el.check('asn:del')")
|
||||
public ResponseEntity<Object> deleteAsn(@RequestBody Long[] ids) {
|
||||
asnService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/getAsnList")
|
||||
@Log("加载出库单下拉框")
|
||||
@ApiOperation("加载出库单下拉框")
|
||||
@PreAuthorize("@el.check('asn:del')")
|
||||
public ResponseEntity<Object> getAsnList() {
|
||||
return new ResponseEntity<>(asnService.getAsnList(),HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/startAsn")
|
||||
@Log("开始收货")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> startAsn(@RequestBody String id) {
|
||||
ApiResult apiResult = asnService.startAsn(id);
|
||||
return new ResponseEntity<>(ApiResult.success(apiResult.getMessage(),apiResult.getData()), HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
}
|
||||
|
|
@ -122,12 +122,7 @@ public class AsnDetailController {
|
|||
@PreAuthorize("@el.check('asnDetail:add')")
|
||||
@Transient
|
||||
public ResponseEntity<Object> createAsnDetail(@Validated @RequestBody AsnDetail asnDetail){
|
||||
asnDetail.setStatus(BizStatus.OPEN);
|
||||
asnDetail.setDept(UserUtils.getDept());
|
||||
asnDetailService.create(asnDetail);
|
||||
Stock stock=asnDetail.getStock();
|
||||
stock.setStatus(BaseStatus.USED);
|
||||
stockService.update(stock);
|
||||
asnDetailService.createAsnDetail(asnDetail);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@Log("采集MO票")
|
||||
|
|
@ -532,12 +527,18 @@ public class AsnDetailController {
|
|||
String returnDate = jsonObject.getString("returnDate");
|
||||
|
||||
//调用收货方法
|
||||
|
||||
JSONObject obj=new JSONObject();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("taskCode",taskCode);
|
||||
obj.putAll(map);
|
||||
return new ResponseEntity<>(ApiResult.success("",obj), HttpStatus.OK);
|
||||
|
||||
}
|
||||
@PostMapping("/importAsnApi")
|
||||
@Log("接收SAP入库单")
|
||||
@ApiOperation("接收SAP入库单")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importAsnApi(@RequestBody JSONObject jsonObject) {
|
||||
asnDetailService.importAsnApi(jsonObject);
|
||||
return new ResponseEntity<>(ApiResult.success("",""), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package com.youchain.businessdata.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.service.dto.PointDto;
|
||||
|
|
@ -22,6 +23,7 @@ import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
|||
import com.youchain.businessdata.domain.Task;
|
||||
import com.youchain.businessdata.service.TaskService;
|
||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.util.StandardSessionIdGenerator;
|
||||
|
|
@ -111,4 +113,12 @@ public class TaskController {
|
|||
taskService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/readRfid")
|
||||
@Log("读取RFID代码")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> readRfid(@RequestBody JSONObject body) {
|
||||
String rfid=body.getString("rfid");
|
||||
ApiResult apiResult = taskService.readRfid(rfid);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.youchain.annotation.Log;
|
|||
import com.youchain.businessdata.domain.AgvTask;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
|
|
@ -154,6 +155,7 @@ public interface AgvTaskService {
|
|||
* @param containerCode
|
||||
*/
|
||||
void agvTaskCallback(AgvTask agvTask,String status,String containerCode);
|
||||
void agvTaskCallback(String taskCode,String status);
|
||||
|
||||
/**
|
||||
* 根据容器编号 查询AgvTasK
|
||||
|
|
@ -205,4 +207,25 @@ public interface AgvTaskService {
|
|||
List<AgvTask> findByAgvList(String type,String jobType);
|
||||
|
||||
List<AgvTask> findById(List<Integer> ids);
|
||||
|
||||
/**
|
||||
* 容器入场
|
||||
* @param storageType 容器类型
|
||||
* @param id 入场库位
|
||||
*/
|
||||
void pointStockRk(String storageType, Long id);
|
||||
|
||||
AgvTask addAgvTask(String type,String stockTypeCode,String startSlotCode,String endSlotCode,String status,String jobType);
|
||||
|
||||
/**
|
||||
* 生成 AGV搬运任务
|
||||
* @param id
|
||||
* @param pointEndCode
|
||||
*/
|
||||
String addAgvTask(Long id, String pointEndCode);
|
||||
|
||||
/**
|
||||
* 生成入库AGV搬运任务
|
||||
*/
|
||||
ApiResult addAgvAsn();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package com.youchain.businessdata.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
|
|
@ -102,11 +103,19 @@ public interface AsnDetailService {
|
|||
AsnDetail findByStock(String code);
|
||||
|
||||
/**
|
||||
* 自动生成AsnDetail
|
||||
* @param item
|
||||
* 生成AsnDetail
|
||||
* @return
|
||||
*/
|
||||
AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint,String propC1,String gdh);
|
||||
AsnDetail createAsnDetail(AsnDetail asnDetail);
|
||||
|
||||
boolean findByMo(String Mo);
|
||||
|
||||
String importAsnApi(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 入库任务,更新入库单明细,入库单
|
||||
* @param asnDetail 入库单明细
|
||||
* @param qty 收货数量
|
||||
*/
|
||||
void receivingAsnDetail(AsnDetail asnDetail, Double qty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.youchain.businessdata.service;
|
||||
|
||||
import com.youchain.basicdata.domain.BillType;
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import com.youchain.businessdata.service.dto.AsnDto;
|
||||
import com.youchain.businessdata.service.dto.AsnQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务接口
|
||||
* @author hjl
|
||||
* @date 2024-02-29
|
||||
**/
|
||||
public interface AsnService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(AsnQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<AsnDto>
|
||||
*/
|
||||
List<AsnDto> queryAll(AsnQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return AsnDto
|
||||
*/
|
||||
AsnDto findById(Long id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return AsnDto
|
||||
*/
|
||||
AsnDto create(Asn resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(Asn resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<AsnDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 添加收货单
|
||||
* @param billType 单据类型
|
||||
* @param relatedBill1 系统单头
|
||||
* @param structure 货主
|
||||
* @param orderOrigin 来源
|
||||
* @param erTime 操作时间
|
||||
* @return
|
||||
*/
|
||||
Asn addAsn(BillType billType, String relatedBill1, String structure,String orderOrigin, Timestamp erTime);
|
||||
|
||||
List<Asn> getAsnList();
|
||||
|
||||
//开始收货
|
||||
ApiResult startAsn(String id);
|
||||
}
|
||||
|
|
@ -84,4 +84,6 @@ public interface ItemKeyService {
|
|||
void download(List<ItemKeyDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
ItemKey getItemKey(Item item, String propC1,String orderNumber);
|
||||
|
||||
ItemKey getItemKey(Item item, String propC1,String propC2,String propC3,String propC4,String propC5,String propC6);
|
||||
}
|
||||
|
|
@ -21,6 +21,7 @@ import com.youchain.businessdata.domain.Task;
|
|||
import com.youchain.businessdata.inputJson.IPTask;
|
||||
import com.youchain.businessdata.service.dto.TaskDto;
|
||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
|
@ -128,6 +129,7 @@ public interface TaskService {
|
|||
|
||||
List<Task> getAgvTaskList(Integer id);
|
||||
|
||||
List<Task> findbyPointCode(Long boxId);
|
||||
List<Task> findByPointCode(Long boxId);
|
||||
|
||||
ApiResult readRfid(String rfid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.youchain.basicdata.domain.Stock;
|
|||
import com.youchain.basicdata.service.dto.ItemSmallDto;
|
||||
import com.youchain.basicdata.service.dto.PointDto;
|
||||
import com.youchain.basicdata.service.dto.StockDto;
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.modules.system.service.dto.DeptSmallDto;
|
||||
import lombok.Data;
|
||||
|
|
@ -39,7 +40,7 @@ public class AsnDetailDto implements Serializable {
|
|||
private Long id;
|
||||
|
||||
/** 订单序号 */
|
||||
private Long asnId;
|
||||
private Asn asn;
|
||||
|
||||
/** 物料 */
|
||||
private ItemSmallDto item;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ public class AsnDetailQueryCriteria{
|
|||
// 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段
|
||||
@Query(joinName = "item", propName="code",type = Query.Type.EQUAL)
|
||||
private String itemCode;
|
||||
@Query(joinName = "asn", propName="relatedBill1",type = Query.Type.EQUAL)
|
||||
private String relatedBill1;
|
||||
|
||||
/** 模糊 */
|
||||
@Query(joinName = "item", propName="name",type = Query.Type.INNER_LIKE)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.youchain.businessdata.service.dto;
|
||||
|
||||
import com.youchain.basicdata.domain.BillType;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author hjl
|
||||
* @date 2024-02-29
|
||||
**/
|
||||
@Data
|
||||
public class AsnDto implements Serializable {
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 仓库ID */
|
||||
private Dept dept;
|
||||
|
||||
/** 单据类型ID */
|
||||
private BillType billType;
|
||||
|
||||
/** 订单来源 */
|
||||
private String orderOrigin;
|
||||
|
||||
/** 货主 */
|
||||
private String structure;
|
||||
|
||||
/** 操作时间 */
|
||||
private Timestamp erTime;
|
||||
|
||||
/** 系统单号 */
|
||||
private String relatedBill1;
|
||||
|
||||
/** 客户订单号 */
|
||||
private String relatedBill2;
|
||||
|
||||
/** 来源名称 */
|
||||
private String sourceName;
|
||||
|
||||
/** 订单状态 */
|
||||
private String status;
|
||||
|
||||
/** 地址 */
|
||||
private String address;
|
||||
|
||||
/** 创建人 */
|
||||
private String createBy;
|
||||
|
||||
/** 修改人 */
|
||||
private String updateBy;
|
||||
|
||||
/** 创建时间 */
|
||||
private Timestamp createTime;
|
||||
|
||||
/** 修改时间 */
|
||||
private Timestamp updateTime;
|
||||
|
||||
/** 订单时间 */
|
||||
private Timestamp orderDate;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.youchain.businessdata.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import com.youchain.annotation.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author hjl
|
||||
* @date 2024-02-29
|
||||
**/
|
||||
@Data
|
||||
public class AsnQueryCriteria{
|
||||
}
|
||||
|
|
@ -20,19 +20,21 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.Netty.NettyUtils;
|
||||
import com.youchain.basicdata.domain.Box;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.BoxRepository;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.basicdata.service.BoxService;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.basicdata.service.impl.BoxServiceImpl;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.service.InventoryLogService;
|
||||
import com.youchain.businessdata.service.InventoryService;
|
||||
import com.youchain.businessdata.service.TaskService;
|
||||
import com.youchain.businessdata.service.*;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
||||
import com.youchain.modules.system.service.DictService;
|
||||
import com.youchain.modules.system.service.dto.DictDto;
|
||||
|
|
@ -40,7 +42,6 @@ import com.youchain.modules.system.service.dto.DictQueryCriteria;
|
|||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
||||
import com.youchain.businessdata.service.mapstruct.AgvTaskMapper;
|
||||
|
|
@ -72,10 +73,14 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
private final AgvTaskRepository agvTaskRepository;
|
||||
private final AgvTaskMapper agvTaskMapper;
|
||||
private final TaskRepository taskRepository;
|
||||
private final AsnDetailService asnDetailService;
|
||||
private final InventoryService inventoryService;
|
||||
private final AsnService asnService;
|
||||
private final ItemService itemService;
|
||||
private final InventoryLogService inventoryLogService;
|
||||
private final TaskService taskService;
|
||||
private final PointService pointService;
|
||||
private final PointRepository pointRepository;
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
private final StockRepository stockRepository;
|
||||
private final DictService dictService;
|
||||
|
|
@ -493,7 +498,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void agvTaskCallback(AgvTask agvTask, String status, String containerCode) {
|
||||
public void agvTaskCallback(AgvTask agvTask, String status, String containerCode) {
|
||||
String agv_on_off = "OFF";
|
||||
agv_on_off = dictService.getDictDescription("agv_on_off") == null ? "OFF" : dictService.getDictDescription("agv_on_off").getDescription();
|
||||
String code = "0";
|
||||
|
|
@ -999,6 +1004,37 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void agvTaskCallback(String taskCode, String status) {
|
||||
// agvTask搬运任务
|
||||
AgvTask agvTask=agvTaskRepository.getById(Integer.valueOf(taskCode));
|
||||
// task库存任务
|
||||
List<Task> tasks=taskRepository.getAgvTaskList(agvTask.getId());
|
||||
Point startPoint=null;
|
||||
Point endPoint=null;
|
||||
if (status.equals("1")){
|
||||
// 开始执行
|
||||
agvTask.setStatus(BizStatus.ATWORK);
|
||||
}else if (status.equals("2")){
|
||||
// 取料完成
|
||||
startPoint=pointRepository.findByCode(agvTask.getStartSlotCode());
|
||||
startPoint.setStatus(BaseStatus.FREE);
|
||||
startPoint.setStorageType(null);
|
||||
pointRepository.save(startPoint);
|
||||
agvTask.setStartTime(new Timestamp((new Date()).getTime()));
|
||||
} else if (status.equals("3")) {
|
||||
// 放料完成
|
||||
endPoint=pointRepository.findByCode(agvTask.getEndSlotCode());
|
||||
endPoint.setStatus(BaseStatus.FREE);
|
||||
pointRepository.save(endPoint);
|
||||
agvTask.setStatus(BizStatus.FINISH);
|
||||
agvTask.setEndTime(new Timestamp((new Date()).getTime()));
|
||||
} else if (status.equals("4")) {
|
||||
// 取消任务
|
||||
}
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvTask findBycontainerCode(String containerCode) {
|
||||
return agvTaskRepository.findBycontainerCode(containerCode);
|
||||
|
|
@ -1088,4 +1124,120 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
return agvTaskList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pointStockRk(String storageType, Long id) {
|
||||
Point point=pointRepository.getById(id);
|
||||
System.out.println("调用容器入场接口");
|
||||
point.setStorageType(storageType);
|
||||
pointRepository.save(point);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvTask addAgvTask(String type, String stockTypeCode, String startSlotCode, String endSlotCode, String status, String jobType) {
|
||||
AgvTask agvTask= new AgvTask();
|
||||
agvTask.setType(type);
|
||||
agvTask.setStockTypeCode(stockTypeCode);
|
||||
agvTask.setStartSlotCode(startSlotCode);
|
||||
agvTask.setEndSlotCode(endSlotCode);
|
||||
agvTask.setStatus(status);
|
||||
agvTask.setJobType(jobType);
|
||||
return agvTaskRepository.save(agvTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addAgvTask(Long id, String pointEndCode) {
|
||||
Point startPoint=pointRepository.getById(id);
|
||||
Point endPoint=pointRepository.findByCode(pointEndCode);
|
||||
if (endPoint!=null){
|
||||
if (!startPoint.getStatus().equals(BaseStatus.FREE)){
|
||||
return startPoint.getCode()+":被任务占用";
|
||||
}
|
||||
if (!endPoint.getStatus().equals(BaseStatus.FREE)){
|
||||
return endPoint.getCode()+":被任务占用";
|
||||
}
|
||||
AgvTask agvTask = addAgvTask(BizStatus.AGV_F, startPoint.getStorageType(), startPoint.getCode(),endPoint.getCode() , BizStatus.OPEN, BizStatus.ASN);
|
||||
startPoint.setStatus(BaseStatus.USED);
|
||||
pointRepository.save(startPoint);
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
endPoint.setStorageType(startPoint.getStorageType());
|
||||
pointRepository.save(endPoint);
|
||||
}else {
|
||||
return pointEndCode+":目标点错误";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ApiResult addAgvAsn() {
|
||||
//半成品入库
|
||||
List<Map<String,Object>> asnDetailSumQty=asnDetailRepository.findByAsn(BizStatus.RECEIVING,"SM_RK");
|
||||
List<Map<String,Object>> taskSumQty=taskRepository.findBySumPlanQty(BizStatus.RECEIVING,1,"SMGS");
|
||||
if (taskSumQty.size()>1){
|
||||
//异常
|
||||
List<Task> taskList=taskRepository.findByItemType(BizStatus.RECEIVING,1,"SMGS");
|
||||
for (int i = 0; i < taskList.size(); i++) {
|
||||
Task task=taskList.get(i);
|
||||
task.setTaskStatus(BizStatus.UNUSUAL);
|
||||
taskRepository.save(task);
|
||||
}
|
||||
return ApiResult.success(500, "任务异常:单次任务中有多个物料", "");
|
||||
} else if (taskSumQty.size()==1) {
|
||||
//半成品入库
|
||||
Map<String,Object> objectMap=taskSumQty.get(0);
|
||||
Long itemId=Long.valueOf(objectMap.get("itemId")+"");
|
||||
Double taskQty=Double.valueOf(objectMap.get("taskQty")+"");
|
||||
Item item=itemService.findByItemId(itemId);
|
||||
if (taskQty>=item.getExtendD1()){
|
||||
//入库
|
||||
//查询入库库位
|
||||
List<Point> pointList = pointRepository.findByAreaCode("SMGS");
|
||||
if (pointList.size()>0){
|
||||
Point point=pointList.get(0);
|
||||
List<Task> taskList=taskRepository.findByItemType(BizStatus.RECEIVING,1,"SMGS");
|
||||
for (int i = 0; i < taskList.size(); i++) {
|
||||
Task task=taskList.get(i);
|
||||
task.setDstPoint(point);
|
||||
task.setMoveQty(task.getPlanQty());
|
||||
List<AsnDetail> asnDetailList=asnDetailRepository.findByAsnAndItem(task.getBillCode(),task.getItemKey().getItem().getCode());
|
||||
if (asnDetailList.size()>0){
|
||||
AsnDetail asnDetail=asnDetailList.get(0);
|
||||
asnDetailService.receivingAsnDetail(asnDetail,task.getMoveQty());
|
||||
}else {
|
||||
return ApiResult.success(500, "收货单异常!!", "");
|
||||
}
|
||||
AgvTask agvTask=addAgvTask("叉车搬运", "半成品托盘", task.getSrcPoint().getCode(), point.getCode(), BizStatus.OPEN, "ASN2");
|
||||
task.setAgvTask(agvTask);
|
||||
taskRepository.save(task);
|
||||
}
|
||||
}else {
|
||||
return ApiResult.success(500, "任务异常:存储库存不足", "");
|
||||
}
|
||||
}else {
|
||||
//数量不够
|
||||
return ApiResult.success(201, "检测到数量不足一托!!", "");
|
||||
}
|
||||
}else {
|
||||
//未查询半成品入库到数据
|
||||
return ApiResult.success(202, "未检测到数据", "");
|
||||
}
|
||||
|
||||
return ApiResult.success(200, "操作成功", "");
|
||||
}
|
||||
|
||||
|
||||
public void sendStockRk(String storageType, String pointCode) {
|
||||
System.out.println();
|
||||
|
||||
/*AgvTask agvTask = new AgvTask();
|
||||
agvTask.setEndSlotCode(pointCode);
|
||||
agvTask.setType(BizStatus.);
|
||||
this.type=type;
|
||||
this.stockCode=stockCode;
|
||||
this.startSlotCode=startSlotCode;
|
||||
this.endSlotCode=endSlotCode;
|
||||
this.status=status;
|
||||
this.jobType=jobType;*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,22 @@
|
|||
*/
|
||||
package com.youchain.businessdata.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.basicdata.domain.BillType;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.BillTypeRepository;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.service.BillTypeService;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.StockService;
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.repository.AsnRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
|
|
@ -32,14 +42,13 @@ 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.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -53,9 +62,14 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
private final AsnDetailMapper asnDetailMapper;
|
||||
private final AsnService asnService;
|
||||
private final AsnRepository asnRepository;
|
||||
private final EntityManager entityMapper;
|
||||
private final TaskRepository taskRepository;
|
||||
private final ItemRepository itemRepository;
|
||||
private final ItemService itemService;
|
||||
private final StockService stockService;
|
||||
private final BillTypeRepository billTypeRepository;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(AsnDetailQueryCriteria criteria, Pageable pageable){
|
||||
|
|
@ -101,18 +115,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
AsnDetail asnDetail = asnDetailRepository.getById(id);
|
||||
if (asnDetail.getStatus().equals("OPEN")){
|
||||
//修改容器状态
|
||||
Stock stock = asnDetailRepository.getById(id).getStock();
|
||||
stock.setStatus("FREE");
|
||||
stockService.update(stock);
|
||||
//删除关联表的数据 入库单明细(data_asn_detail)
|
||||
if (taskRepository.getAsnDetailIdToId(id)!=null){
|
||||
taskRepository.deleteById(taskRepository.getAsnDetailIdToId(id));
|
||||
}
|
||||
asnDetailRepository.deleteById(id);
|
||||
}
|
||||
asnDetailRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +124,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (AsnDetailDto asnDetail : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("订单序号", asnDetail.getAsnId());
|
||||
map.put("订单序号", asnDetail.getAsn());
|
||||
map.put("物料", asnDetail.getItem());
|
||||
map.put("容器", asnDetail.getStock());
|
||||
map.put("点位", asnDetail.getPoint());
|
||||
|
|
@ -190,17 +193,10 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
|
||||
|
||||
@Override
|
||||
public AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint,String propC1,String gdh){
|
||||
AsnDetail asnDetail = new AsnDetail();
|
||||
asnDetail.setItem(item);
|
||||
asnDetail.setLineNo(1l);
|
||||
asnDetail.setStatus(BizStatus.OPEN);
|
||||
asnDetail.setOrderQty(item.getExtendD1());
|
||||
asnDetail.setDept(item.getDept());
|
||||
asnDetail.setStock(stock);
|
||||
asnDetail.setPoint(srcPoint);
|
||||
asnDetail.setPropC1(propC1);
|
||||
asnDetail.setOrderNumber(gdh);
|
||||
public AsnDetail createAsnDetail(AsnDetail asnDetail){
|
||||
Asn asn=asnRepository.findByRelatedBill1(asnDetail.getAsn().getRelatedBill1());
|
||||
asnDetail.setAsn(asn);
|
||||
asnDetail=asnDetailRepository.save(asnDetail);
|
||||
return asnDetail;
|
||||
}
|
||||
|
||||
|
|
@ -214,4 +210,75 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importAsnApi(JSONObject jsonObject) {
|
||||
System.out.println("接收入库单:"+jsonObject);
|
||||
String relatedBill1=jsonObject.getString("expectedReceiptId");//入库单号
|
||||
String erTime=jsonObject.getString("expectedReceiptDate");//操作时间
|
||||
String billTypeCode=jsonObject.getString("expectedReceiptType");//入库类型
|
||||
String structure=jsonObject.getString("owner");//货主
|
||||
|
||||
List<BillType> billTypeList=billTypeRepository.findBySourceName(billTypeCode);
|
||||
if (billTypeList.size()<1){
|
||||
return "单据类型错误";
|
||||
}
|
||||
BillType billType=billTypeList.get(0);
|
||||
Timestamp er = Timestamp.valueOf(DateUtil.parseLocalDateTimeFormat(erTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
Asn asn = asnService.addAsn(billType,relatedBill1,structure,"SAP推送",er);
|
||||
|
||||
JSONArray erLineList = jsonObject.getJSONArray("erLine");
|
||||
for (int i = 0; i < erLineList.size(); i++) {
|
||||
JSONObject erLine=erLineList.getJSONObject(i);
|
||||
String itemCode=erLine.getString("productId");//料号
|
||||
Item item=itemRepository.findByCode(itemCode);
|
||||
if (item==null){
|
||||
return "没有查询到物料号:"+itemCode;
|
||||
}
|
||||
String lineNo=erLine.getString("lineNumber");//行号
|
||||
String quantityExpected=erLine.getString("quantityExpected");//数量
|
||||
JSONArray attributeValueList=erLine.getJSONArray("attributeValue");
|
||||
Map<String,Object> attributeValue=new HashMap<>();
|
||||
for (int j = 0; j < attributeValueList.size(); j++) {
|
||||
JSONObject at=attributeValueList.getJSONObject(j);
|
||||
attributeValue.put(at.getString("name"),at.getString("value"));
|
||||
}
|
||||
|
||||
AsnDetail asnDetail=new AsnDetail();
|
||||
List<AsnDetail> asnDetailList=asnDetailRepository.findByLineNo(asn.getId(),Long.valueOf(lineNo));
|
||||
if (asnDetailList.size()>0){
|
||||
asnDetail=asnDetailList.get(0);
|
||||
}else {
|
||||
asnDetail.setStatus(BizStatus.OPEN);
|
||||
}
|
||||
asnDetail.setItem(item);
|
||||
asnDetail.setLineNo(Long.valueOf(lineNo));
|
||||
asnDetail.setOrderQty(Double.valueOf(quantityExpected));
|
||||
asnDetail.setAsn(asn);
|
||||
asnDetail.setDept(UserUtils.getDept());
|
||||
asnDetail.setPropC1(attributeValue.get("ztBidName")+"");
|
||||
asnDetail.setPropC2(attributeValue.get("prodMtrlNo")+"");
|
||||
asnDetail.setPropC3(attributeValue.get("loadUnitId")+"");
|
||||
asnDetailRepository.save(asnDetail);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receivingAsnDetail(AsnDetail asnDetail, Double qty) {
|
||||
asnDetail.setReceivedQty(asnDetail.getReceivedQty()+qty);
|
||||
if (asnDetail.getOrderQty()<=asnDetail.getReceivedQty()){
|
||||
asnDetail.setStatus(BizStatus.RECEIVED);
|
||||
List<AsnDetail> asnDetailList=asnDetailRepository.findByAsnId(asnDetail.getAsn().getId(),BizStatus.RECEIVING);
|
||||
if (asnDetailList.size()<1){
|
||||
Asn asn=asnDetail.getAsn();
|
||||
asn.setStatus(BizStatus.RECEIVED);
|
||||
asnRepository.save(asn);
|
||||
}
|
||||
}else {
|
||||
asnDetail.setStatus(BizStatus.RECEIVING);
|
||||
}
|
||||
|
||||
asnDetailRepository.save(asnDetail);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.youchain.businessdata.service.impl;
|
||||
|
||||
import com.youchain.basicdata.domain.BillType;
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.AsnRepository;
|
||||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.businessdata.service.dto.AsnDto;
|
||||
import com.youchain.businessdata.service.dto.AsnQueryCriteria;
|
||||
import com.youchain.businessdata.service.mapstruct.AsnMapper;
|
||||
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.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author hjl
|
||||
* @date 2024-02-29
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AsnServiceImpl implements AsnService {
|
||||
|
||||
private final AsnRepository asnRepository;
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
private final AsnMapper asnMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(AsnQueryCriteria criteria, Pageable pageable){
|
||||
Page<Asn> page = asnRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(asnMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AsnDto> queryAll(AsnQueryCriteria criteria){
|
||||
return asnMapper.toDto(asnRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AsnDto findById(Long id) {
|
||||
Asn asn = asnRepository.findById(id).orElseGet(Asn::new);
|
||||
ValidationUtil.isNull(asn.getId(),"Asn","id",id);
|
||||
return asnMapper.toDto(asn);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AsnDto create(Asn resources) {
|
||||
Asn asn = addAsn(resources.getBillType(), resources.getRelatedBill1(),resources.getStructure(), "WMS",null);
|
||||
return asnMapper.toDto(asn);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Asn resources) {
|
||||
Asn asn = asnRepository.findById(resources.getId()).orElseGet(Asn::new);
|
||||
ValidationUtil.isNull( asn.getId(),"Asn","id",resources.getId());
|
||||
asn.copy(resources);
|
||||
asnRepository.save(asn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
asnRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<AsnDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (AsnDto asn : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("仓库ID", asn.getDept());
|
||||
map.put("单据类型ID", asn.getBillType());
|
||||
map.put("订单来源", asn.getOrderOrigin());
|
||||
map.put("货主", asn.getStructure());
|
||||
map.put("操作时间", asn.getErTime());
|
||||
map.put("系统单号", asn.getRelatedBill1());
|
||||
map.put("客户订单号", asn.getRelatedBill2());
|
||||
map.put("来源名称", asn.getSourceName());
|
||||
map.put("订单状态", asn.getStatus());
|
||||
map.put("地址", asn.getAddress());
|
||||
map.put("创建人", asn.getCreateBy());
|
||||
map.put("修改人", asn.getUpdateBy());
|
||||
map.put("创建时间", asn.getCreateTime());
|
||||
map.put("修改时间", asn.getUpdateTime());
|
||||
map.put("订单时间", asn.getOrderDate());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Asn addAsn(BillType billType, String relatedBill1, String structure,String orderOrigin, Timestamp erTime) {
|
||||
Asn asn;
|
||||
asn = asnRepository.findByRelatedBill1(relatedBill1);
|
||||
if (asn==null){
|
||||
asn = new Asn();
|
||||
asn.setStatus(BizStatus.OPEN);
|
||||
}
|
||||
asn.setBillType(billType);
|
||||
asn.setDept(UserUtils.getDept());
|
||||
asn.setRelatedBill1(relatedBill1);
|
||||
asn.setStructure(structure);
|
||||
asn.setOrderOrigin(orderOrigin);
|
||||
asn.setErTime(erTime);
|
||||
asnRepository.save(asn);
|
||||
return asn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Asn> getAsnList() {
|
||||
return asnRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult startAsn(String id) {
|
||||
Asn asn=asnRepository.getById(Long.valueOf(id));
|
||||
if (asn.getStatus().equals(BizStatus.OPEN)) {
|
||||
asn.setStatus(BizStatus.RECEIVING);
|
||||
asnRepository.save(asn);
|
||||
}else {
|
||||
//状态错误
|
||||
return ApiResult.success(500,"状态错误!",id);
|
||||
}
|
||||
return ApiResult.success(200,"操作成功!",id);
|
||||
}
|
||||
}
|
||||
|
|
@ -150,5 +150,23 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
|||
return itemKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemKey getItemKey(Item item, String propC1, String propC2, String propC3, String propC4, String propC5, String propC6) {
|
||||
ItemKey itemKey;
|
||||
itemKey = itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC6);
|
||||
if (itemKey==null){
|
||||
itemKey=new ItemKey();
|
||||
itemKey.setItem(item);
|
||||
itemKey.setPropC1(propC1);
|
||||
itemKey.setPropC2(propC2);
|
||||
itemKey.setPropC3(propC3);
|
||||
itemKey.setPropC4(propC4);
|
||||
itemKey.setPropC5(propC5);
|
||||
itemKey.setPropC6(propC6.toString());
|
||||
itemKeyRepository.save(itemKey);
|
||||
}
|
||||
return itemKey;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -19,21 +19,24 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.basicdata.service.dto.StockSmallDto;
|
||||
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.inputJson.IPTask;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||
import com.youchain.businessdata.repository.TaskLogRepository;
|
||||
import com.youchain.businessdata.repository.*;
|
||||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.businessdata.service.InventoryLogService;
|
||||
import com.youchain.businessdata.service.ItemKeyService;
|
||||
import com.youchain.businessdata.service.dto.InventoryDto;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.service.TaskService;
|
||||
import com.youchain.businessdata.service.dto.TaskDto;
|
||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||
|
|
@ -66,11 +69,16 @@ public class TaskServiceImpl implements TaskService {
|
|||
|
||||
private final TaskRepository taskRepository;
|
||||
private final TaskMapper taskMapper;
|
||||
private final AsnRepository asnRepository;
|
||||
private final InventoryRepository inventoryRepository;
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
private final InventoryLogService inventoryLogService;
|
||||
private final EntityManager entityMapper;
|
||||
private final StockRepository stockRepository;
|
||||
private final PointRepository pointRepository;
|
||||
private final ItemRepository itemRepository;
|
||||
private final ItemKeyRepository itemKeyRepository;
|
||||
private final ItemKeyService itemKeyService;
|
||||
@Override
|
||||
public Map<String, Object> queryAll(TaskQueryCriteria criteria, Pageable pageable) {
|
||||
Page<Task> page = taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
|
|
@ -265,13 +273,68 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Task> findbyPointCode(Long pointId) {
|
||||
public List<Task> findByPointCode(Long pointId) {
|
||||
String hql=" from Task t where t.dstPoint.id="+pointId+" and t.moveQty=0 ";
|
||||
Query query=entityMapper.createQuery(hql);
|
||||
List<Task> taskList=query.getResultList();
|
||||
return taskList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult readRfid(String rfid) {
|
||||
String[] rfids=rfid.split("\\|");
|
||||
String itemCode=rfids[0]+"";
|
||||
String propC1=rfids[1]+"";
|
||||
String propC2=rfids[2]+"";
|
||||
String propC3=rfids[3]+"";
|
||||
String propC4=rfids[4]+"";
|
||||
String propC5=rfids[5]+"";
|
||||
StringBuffer propC6=new StringBuffer();
|
||||
for (int i = 6; i < rfids.length; i++) {
|
||||
if (propC6.length()<1){
|
||||
propC6.append(rfids[i]);
|
||||
}else {
|
||||
propC6.append(",");
|
||||
propC6.append(rfids[i]);
|
||||
}
|
||||
}
|
||||
if (rfids.length-6!=Integer.valueOf(propC5)){
|
||||
return ApiResult.result(500, "流水号数量和供货数量不一致", "");
|
||||
}
|
||||
Item item=itemRepository.findByCode(itemCode);
|
||||
if (item==null){
|
||||
return ApiResult.result(500, "没有物料", "");
|
||||
}
|
||||
Asn asn=asnRepository.findByRelatedBill1(propC3);
|
||||
if (asn==null){
|
||||
return ApiResult.result(201, "没有入库单", "");
|
||||
}else {
|
||||
if (!asn.getStatus().equals(BizStatus.RECEIVING)){
|
||||
return ApiResult.result(500, "入库单未激活", "");
|
||||
}
|
||||
}
|
||||
if (itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC6.toString())!=null){
|
||||
return ApiResult.result(500, "重复读取", "");
|
||||
};
|
||||
|
||||
ItemKey itemKey=itemKeyService.getItemKey(item, propC1, propC2,propC3,propC4,propC5,propC6.toString());
|
||||
for (int i = 6; i < rfids.length; i++) {
|
||||
Task task=new Task();
|
||||
task.setItemKey(itemKey);
|
||||
task.setPlanQty(1d);
|
||||
task.setDept(UserUtils.getDept());
|
||||
task.setTaskStatus(BizStatus.RECEIVING);
|
||||
task.setBeSkip(1);
|
||||
task.setPutCode(rfids[i]);
|
||||
task.setBillCode(propC3);
|
||||
task.setTaskType(BizStatus.ASN);
|
||||
Point startPoint=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,item.getGoodType());
|
||||
task.setSrcPoint(startPoint);
|
||||
taskRepository.save(task);
|
||||
}
|
||||
return ApiResult.result(200, "操作成功", "");
|
||||
}
|
||||
|
||||
public List<Object[]> queryAreaMonth(String type) {
|
||||
List<Object[]> taskList=null;
|
||||
String hql = "";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.youchain.businessdata.service.mapstruct;
|
||||
|
||||
import com.youchain.base.BaseMapper;
|
||||
import com.youchain.businessdata.domain.Asn;
|
||||
import com.youchain.businessdata.service.dto.AsnDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author hjl
|
||||
* @date 2024-02-29
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface AsnMapper extends BaseMapper<AsnDto, Asn> {
|
||||
|
||||
}
|
||||
|
|
@ -15,13 +15,22 @@
|
|||
*/
|
||||
package com.youchain.modules.quartz.task;
|
||||
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.businessdata.domain.AgvTask;
|
||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
|
|
@ -35,10 +44,13 @@ import java.util.concurrent.BlockingQueue;
|
|||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RestController
|
||||
@RequestMapping("/api/test")
|
||||
public class TestTask {
|
||||
|
||||
@Autowired
|
||||
private AgvTaskRepository agvTaskRepository;
|
||||
private PointRepository pointRepository;
|
||||
|
||||
@Autowired
|
||||
private AgvTaskService agvTaskService;
|
||||
|
|
@ -47,9 +59,18 @@ public class TestTask {
|
|||
private static final long TIMEOUT_MS = 600000; // 10分钟,以毫秒为单位
|
||||
private long lastTaskTime = System.currentTimeMillis();
|
||||
|
||||
public void TestTask2(){
|
||||
|
||||
|
||||
|
||||
@PostMapping("/asnTask")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> asnTask(){
|
||||
/*List<Point> pointList = pointRepository.findByAreaCode("RKGZ");
|
||||
for (int i = 0; i < pointList.size(); i++) {
|
||||
Point point =pointList.get(i);
|
||||
if (point.getStorageType()!=null&&point.getStorageType().length()>0){
|
||||
System.out.println("生成入库搬运任务");
|
||||
}
|
||||
}*/
|
||||
System.out.println("入库任务");
|
||||
ApiResult apiResult = agvTaskService.addAgvAsn();
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ public interface BaseStatus {
|
|||
* 点位类型-缓存点
|
||||
*/
|
||||
public static String STORAGE = "STORAGE";
|
||||
/**
|
||||
* 点位类型-月台
|
||||
*/
|
||||
public static String PLATFORM = "PLATFORM";
|
||||
|
||||
/**
|
||||
* 输送线
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ package com.youchain.utils;
|
|||
* @date 2023-08-17
|
||||
**/
|
||||
public interface BizStatus {
|
||||
/**通用属性-异常*/
|
||||
public static String UNUSUAL = "UNUSUAL";
|
||||
/**
|
||||
* 出入库状态-打开||任务状态-待执行
|
||||
*/
|
||||
|
|
@ -206,4 +208,9 @@ public interface BizStatus {
|
|||
*/
|
||||
public static String EMPTY_OUT = "EMPTY_OUT";
|
||||
|
||||
/** AGV叉车任务*/
|
||||
public static String AGV_F="AGV_F";
|
||||
|
||||
/** AGV潜伏车任务*/
|
||||
public static String AGV_R="AGV_R";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue