no message
parent
a26c54f08c
commit
647442eb42
|
|
@ -234,7 +234,6 @@ public class ServerListenerHandler extends SimpleChannelInboundHandler<String> {
|
|||
BoxDto b=bds.get(0);
|
||||
try {
|
||||
log.info("进来WMS按钮的业务......");
|
||||
bsi.callBox(b);
|
||||
} catch (Exception e) {
|
||||
Log log_data=new Log();
|
||||
log_data.setRequestIp(b.getIP());
|
||||
|
|
|
|||
|
|
@ -4,34 +4,24 @@ import cn.hutool.core.date.DateTime;
|
|||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.appupdate.ReturnJson.RLocLayout;
|
||||
import com.youchain.basicdata.service.impl.PointServiceImpl;
|
||||
import com.youchain.businessdata.domain.AgvTask;
|
||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||
import com.youchain.businessdata.service.*;
|
||||
import com.youchain.businessdata.service.impl.AsnDetailServiceImpl;
|
||||
import com.youchain.businessdata.service.impl.InventoryServiceImpl;
|
||||
import com.youchain.businessdata.service.impl.PickDetailServiceImpl;
|
||||
import com.youchain.businessdata.service.impl.TaskServiceImpl;
|
||||
import com.youchain.report_data.utils.PieChart;
|
||||
import com.youchain.utils.AreaNameDic;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.DateUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.icepear.echarts.Option;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
|
|
@ -40,34 +30,13 @@ import java.util.Map;
|
|||
@RequestMapping("/api/screeView")
|
||||
@Slf4j
|
||||
public class ScreenViewController {
|
||||
private final PointServiceImpl pointServiceImpl;
|
||||
private final AsnDetailServiceImpl asnDetailServiceImpl;
|
||||
private final PickDetailServiceImpl pickDetailServiceImpl;
|
||||
private final TaskServiceImpl taskServiceImpl;
|
||||
private final InventoryServiceImpl inventoryServiceImpl;
|
||||
private final AgvTaskRepository agvTaskRepository;
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
private final TaskService taskService;
|
||||
|
||||
@PostMapping(value = "/inForDay")
|
||||
@ApiOperation("每日入库")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> inForDay() {
|
||||
JSONArray array = new JSONArray();
|
||||
List<Object[]> l = asnDetailServiceImpl.queryIn("Day", null, "ALL");
|
||||
int value1 = 0;
|
||||
int value2 = 0;
|
||||
if (l.size() > 0) {
|
||||
Object[] obj = l.get(0);
|
||||
value1 = obj[0] == null ? 0 : ((Double) obj[0]).intValue();
|
||||
value2 = obj[1] == null ? 0 : ((Double) obj[1]).intValue();
|
||||
}
|
||||
array.add(this.formatDay("", "入库", "center", "#ffffff", "bold"));
|
||||
array.add(this.formatDay("当日任务", value1 + "", "center", "#ffffff", "bold"));
|
||||
array.add(this.formatDay("已完成", value2 + "", "center", "#ffffff", "bold"));
|
||||
return new ResponseEntity(array, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/outForDay")
|
||||
@ApiOperation("每日出库")
|
||||
@AnonymousAccess
|
||||
|
|
@ -87,244 +56,6 @@ public class ScreenViewController {
|
|||
return new ResponseEntity(array, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/kmdView")
|
||||
@ApiOperation("库满度")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> kmdView() {
|
||||
JSONArray array = new JSONArray();
|
||||
array.add(this.formatKmd("", 100));
|
||||
List<Object[]> objs = pointServiceImpl.queryPointKmd();
|
||||
HashMap<String, Double> qhtk = new HashMap<String, Double>();
|
||||
HashMap<String, Double> qhtm = new HashMap<String, Double>();
|
||||
int size = objs.size();
|
||||
if (objs.size() > 0) {
|
||||
for (int i = 0; i < objs.size(); i++) {
|
||||
Object[] obj = objs.get(i);
|
||||
String areaName = obj[0].toString();
|
||||
String status = obj[1].toString();
|
||||
Double qty = Double.parseDouble(obj[2].toString());
|
||||
if (areaName.equals(AreaNameDic.DJQ) || areaName.equals(AreaNameDic.XJQ)) {
|
||||
qhtm.put(status, qty);
|
||||
} else if (areaName.equals(AreaNameDic.DJQ) || areaName.equals(AreaNameDic.XJQ)) {
|
||||
qhtk.put(status, qty);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (qhtk != null) {
|
||||
Double k = qhtk.get(BaseStatus.FREE) == null ? 0d : qhtk.get(BaseStatus.FREE);
|
||||
Double m = qhtk.get(BaseStatus.USED) == null ? 0d : qhtk.get(BaseStatus.USED);
|
||||
array.add(this.formatKmd(AreaNameDic.DJQ, m * 100 / (k + m)));
|
||||
}
|
||||
if (qhtm != null) {
|
||||
Double k = qhtm.get(BaseStatus.FREE) == null ? 0d : qhtm.get(BaseStatus.FREE);
|
||||
Double m = qhtm.get(BaseStatus.USED) == null ? 0d : qhtm.get(BaseStatus.USED);
|
||||
array.add(this.formatKmd(AreaNameDic.DJQ, m * 100 / (k + m)));
|
||||
}
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("data", array);
|
||||
JSONArray colors = new JSONArray();
|
||||
colors.add("#ffffff00");
|
||||
if (size >= 1) {
|
||||
colors.add("#cc0099");
|
||||
}
|
||||
if (size >= 2) {
|
||||
colors.add("#99cc33");
|
||||
}
|
||||
if (size >= 3) {
|
||||
colors.add("#00baff");
|
||||
}
|
||||
if (size >= 4) {
|
||||
colors.add("#3de7c9");
|
||||
}
|
||||
map.put("colors", colors);
|
||||
map.put("unit", "%");
|
||||
map.put("showValue", false);
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/inOutForMonth")
|
||||
@ApiOperation("每月出入库")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> inOutForMonth() {
|
||||
int rk = 0;
|
||||
List<Object[]> lr = asnDetailServiceImpl.queryIn("Month", null, "ALL");
|
||||
if (lr.size() > 0) {
|
||||
Object[] obj = lr.get(0);
|
||||
rk = obj[0] == null ? 0 : ((Double) obj[0]).intValue();
|
||||
}
|
||||
int ck = 0;
|
||||
List<Object[]> lc = pickDetailServiceImpl.queryOut("Month", null);
|
||||
if (lc.size() > 0) {
|
||||
Object[] obj = lc.get(0);
|
||||
ck = obj[0] == null ? 0 : ((Double) obj[0]).intValue();
|
||||
}
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("r1", (int) rk / 1000);
|
||||
map.put("r2", (int) rk / 100 % 10);
|
||||
map.put("r3", (int) rk / 10 % 10);
|
||||
map.put("r4", (int) rk % 10);
|
||||
map.put("c1", (int) ck / 1000);
|
||||
map.put("c2", (int) ck / 100 % 10);
|
||||
map.put("c3", (int) ck / 10 % 10);
|
||||
map.put("c4", (int) ck % 10);
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/inMonth")
|
||||
@ApiOperation("每月入库")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> inMonth() {
|
||||
return this.inOutMonth("IN");
|
||||
}
|
||||
|
||||
@PostMapping(value = "/outMonth")
|
||||
@ApiOperation("每月出库")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> outMonth() {
|
||||
return this.inOutMonth("OUT");
|
||||
}
|
||||
|
||||
public ResponseEntity<Object> inOutMonth(String type) {
|
||||
JSONArray array = new JSONArray();
|
||||
List<Object[]> objs = taskServiceImpl.queryAreaMonth(type);
|
||||
HashMap<String, Double> qht = new HashMap<String, Double>();
|
||||
HashMap<String, Double> zc = new HashMap<String, Double>();
|
||||
HashMap<String, Double> mf = new HashMap<String, Double>();
|
||||
HashMap<String, Double> xj = new HashMap<String, Double>();
|
||||
double totalQty = 0;
|
||||
int size = objs.size();
|
||||
if (objs.size() > 0) {
|
||||
for (int i = 0; i < objs.size(); i++) {
|
||||
Object[] obj = objs.get(i);
|
||||
String areaName = obj[0].toString();
|
||||
Double qty = Double.parseDouble(obj[1].toString());
|
||||
totalQty += qty;
|
||||
if (areaName.equals(AreaNameDic.DJQ) || areaName.equals(AreaNameDic.XJQ)) {
|
||||
qht.put(areaName, qty);
|
||||
}
|
||||
}
|
||||
if (qht != null) {
|
||||
double value = qht.get(AreaNameDic.DJQ);
|
||||
array.add(this.formatKmd("前后桶", value * 100 / totalQty));
|
||||
}
|
||||
}
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("data", array);
|
||||
|
||||
JSONArray color = new JSONArray();
|
||||
if (size >= 1) {
|
||||
color.add("#ffcc33");
|
||||
}
|
||||
if (size >= 2) {
|
||||
color.add("#99cccc");
|
||||
}
|
||||
if (size >= 3) {
|
||||
color.add("#3399ff");
|
||||
}
|
||||
if (size >= 4) {
|
||||
color.add("#fff8dc");
|
||||
}
|
||||
map.put("color", color);
|
||||
map.put("lineWidth", 15);
|
||||
map.put("radius", "55%");
|
||||
map.put("activeRadius", "60%");
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/inOutDay")
|
||||
@ApiOperation("每日出入库")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> inOutDay(String type) {
|
||||
JSONArray array = new JSONArray();
|
||||
String date = DateUtil.formatChageDay(new Date(), "DAY", -6);
|
||||
List<Object[]> objsIn = asnDetailServiceImpl.queryIn("InOutDay", date, "ALL");
|
||||
HashMap<String, Object> mapIn = new HashMap<String, Object>();
|
||||
mapIn.put("0", "0");
|
||||
if (objsIn.size() > 0) {
|
||||
for (int i = 0; i < objsIn.size(); i++) {
|
||||
Object[] obj = objsIn.get(i);
|
||||
String day = obj[0].toString();
|
||||
Double qty = Double.parseDouble(obj[1].toString());
|
||||
mapIn.put(day, qty);
|
||||
}
|
||||
}
|
||||
List<Object[]> objsOut = pickDetailServiceImpl.queryOut("InOutDay", date);
|
||||
HashMap<String, Object> mapOut = new HashMap<String, Object>();
|
||||
mapOut.put("0", "0");
|
||||
if (objsOut.size() > 0) {
|
||||
for (int i = 0; i < objsOut.size(); i++) {
|
||||
Object[] obj = objsOut.get(i);
|
||||
String day = obj[0].toString();
|
||||
Double qty = Double.parseDouble(obj[1].toString());
|
||||
mapOut.put(day, qty);
|
||||
}
|
||||
}
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
HashMap<String, Object> dataset = new HashMap<String, Object>();
|
||||
JSONArray source = new JSONArray();
|
||||
JSONArray sourceH = new JSONArray();
|
||||
sourceH.add("product");
|
||||
sourceH.add("入库");
|
||||
sourceH.add("出库");
|
||||
source.add(sourceH);
|
||||
for (int i = -6; i <= 0; i++) {
|
||||
String date1 = DateUtil.formatChageDay(new Date(), "DAY", i);
|
||||
if (mapIn.get(date1) != null || mapOut.get(date1) != null) {
|
||||
JSONArray sourceD = new JSONArray();
|
||||
sourceD.add(date1);
|
||||
sourceD.add(mapIn.get(date1) == null ? 0 : mapIn.get(date1));
|
||||
sourceD.add(mapOut.get(date1) == null ? 0 : mapOut.get(date1));
|
||||
source.add(sourceD);
|
||||
}
|
||||
}
|
||||
dataset.put("source", source);
|
||||
HashMap<String, Object> data = new HashMap<String, Object>();
|
||||
HashMap<String, Object> config = new HashMap<String, Object>();
|
||||
HashMap<String, Object> yAxis = new HashMap<String, Object>();
|
||||
HashMap<String, Object> axisLabel = new HashMap<String, Object>();
|
||||
HashMap<String, Object> xAxis = new HashMap<String, Object>();
|
||||
axisLabel.put("color", "#fff");
|
||||
HashMap<String, Object> nameTextStyle = new HashMap<String, Object>();
|
||||
nameTextStyle.put("color", "#fff");
|
||||
map.put("msg", "");
|
||||
data.put("config", config);
|
||||
config.put("yAxis", yAxis);
|
||||
yAxis.put("axisLabel", axisLabel);
|
||||
yAxis.put("show", true);
|
||||
yAxis.put("nameTextStyle", nameTextStyle);
|
||||
config.put("xAxis", xAxis);
|
||||
xAxis.put("axisLabel", axisLabel);
|
||||
xAxis.put("type", "category");
|
||||
xAxis.put("nameTextStyle", nameTextStyle);
|
||||
HashMap<String, Object> legend = new HashMap<String, Object>();
|
||||
config.put("legend", legend);
|
||||
HashMap<String, Object> grid = new HashMap<String, Object>();
|
||||
grid.put("top", 20);
|
||||
grid.put("bottom", 25);
|
||||
grid.put("width", "auto");
|
||||
grid.put("height", "auto");
|
||||
config.put("grid", grid);
|
||||
JSONArray series = new JSONArray();
|
||||
HashMap<String, Object> c1 = new HashMap<String, Object>();
|
||||
c1.put("color", "#fff68f");
|
||||
c1.put("type", "bar");
|
||||
HashMap<String, Object> c2 = new HashMap<String, Object>();
|
||||
c2.put("color", "#09f");
|
||||
c2.put("type", "bar");
|
||||
series.add(c1);
|
||||
series.add(c2);
|
||||
config.put("series", series);
|
||||
HashMap<String, Object> title = new HashMap<String, Object>();
|
||||
HashMap<String, Object> textStyle = new HashMap<String, Object>();
|
||||
textStyle.put("color", "#fff68f");
|
||||
title.put("textStyle", textStyle);
|
||||
config.put("title", title);
|
||||
config.put("dataset", dataset);
|
||||
data.put("config", config);
|
||||
map.put("data", data);
|
||||
map.put("satus", 1);
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/inventoryView")
|
||||
@ApiOperation("库存余量")
|
||||
|
|
@ -365,49 +96,6 @@ public class ScreenViewController {
|
|||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/taskPerformed")
|
||||
@ApiOperation("前后桶正在执行的任务")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> taskPerformed() {//id【任务id】、type【任务类型】、物料号
|
||||
List<AgvTask> agvTasks = agvTaskRepository.queryAgvTaskPerformedQH();
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
HashMap<String, Object> dataH = new HashMap<String, Object>();
|
||||
HashMap<String, Object> config = new HashMap<String, Object>();
|
||||
if (agvTasks.size() > 0) {
|
||||
JSONArray header = new JSONArray();
|
||||
header.add("料车");
|
||||
header.add("任务类型");
|
||||
header.add("任务ID");
|
||||
config.put("header", header);
|
||||
JSONArray data = new JSONArray();
|
||||
for (AgvTask a : agvTasks) {
|
||||
JSONArray d = new JSONArray();
|
||||
String itemCode = a.getStockCode();
|
||||
if (itemCode == null || itemCode.equals("")) {
|
||||
itemCode = "agv正在前往";
|
||||
}
|
||||
String type = a.getType().equals("ASN") ? "入库" : "出库";
|
||||
String id = a.getId().toString();
|
||||
d.add(itemCode);
|
||||
d.add(type);
|
||||
d.add(id);
|
||||
data.add(d);
|
||||
}
|
||||
config.put("data", data);
|
||||
config.put("rowNum", 8);
|
||||
config.put("waitTime", 2000);
|
||||
config.put("carousel", "single");
|
||||
config.put("headerBGC", "#061a3a");
|
||||
config.put("oddRowBGC", "#06152f");
|
||||
config.put("evenRowBGC", "#071026");
|
||||
dataH.put("config", config);
|
||||
map.put("msg", "");
|
||||
map.put("data", dataH);
|
||||
map.put("satus", "1");
|
||||
}
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
public HashMap<String, Object> formatDay(String title, String content, String textAlign, String fill, String fontWeight) {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("title", title);
|
||||
|
|
@ -429,276 +117,6 @@ public class ScreenViewController {
|
|||
return map;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/locLayout")
|
||||
@ApiOperation("库位布局")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> locLayout(String zoneType) {
|
||||
//0空1满2禁用3空车区满
|
||||
if (zoneType == null) {
|
||||
zoneType = "QHT";
|
||||
}
|
||||
List<Object[]> mins = pointServiceImpl.getPointMinxy(zoneType);
|
||||
List<RLocLayout> ls = pointServiceImpl.queryLayout(zoneType, 0, 0);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("mg_top", 2);
|
||||
map.put("mg_left", 1);
|
||||
HashMap<String, Object> seatList = new HashMap<String, Object>();
|
||||
int type0 = 0;
|
||||
int type1 = 0;
|
||||
int type2 = 0;
|
||||
int type3 = 0;
|
||||
if (ls.size() > 0) {
|
||||
JSONArray seat = new JSONArray();
|
||||
Object[] obj = mins.get(0);
|
||||
double x = Double.parseDouble(obj[0].toString()) - 2;
|
||||
double y = Double.parseDouble(obj[1].toString()) - 2;
|
||||
double maxy = Double.parseDouble(obj[3].toString());
|
||||
HashMap<String, Integer> itemTypes = new HashMap<String, Integer>();
|
||||
for (int i = 0; i < ls.size(); i++) {
|
||||
HashMap<String, Object> d = new HashMap<String, Object>();
|
||||
RLocLayout layout = ls.get(i);
|
||||
d.put("id", layout.getId());
|
||||
d.put("gRow", (int) Math.ceil(layout.getX() - x));
|
||||
d.put("gCol", Math.abs((int) Math.ceil(layout.getY() - maxy)));
|
||||
d.put("type", layout.getType());
|
||||
d.put("code", layout.getCode());
|
||||
if (layout.getType() == 0) {
|
||||
type0++;
|
||||
} else if (layout.getType() == 1) {
|
||||
d.put("code", layout.getItemName());
|
||||
type1++;
|
||||
} else if (layout.getType() == 2) {
|
||||
type2++;
|
||||
} else if (layout.getType() == 3) {
|
||||
type3++;
|
||||
}
|
||||
String itemType = layout.getItemType();
|
||||
if (itemType != null) {
|
||||
if (itemTypes.get(itemType) != null) {
|
||||
itemTypes.put(itemType, itemTypes.get(itemType) + 1);
|
||||
} else {
|
||||
itemTypes.put(itemType, 1);
|
||||
}
|
||||
}
|
||||
seat.add(d);
|
||||
}
|
||||
String movieName = "";
|
||||
if (zoneType.equals("QHT")) {
|
||||
movieName = "前后桶点位图 " + ls.size() + "库位(空点:" + type0 + ",空车:" + type3 + ",满车:" + type1 + ",禁用:" + type2 + ")";
|
||||
} else if (zoneType.equals("ZCKM")) {
|
||||
movieName = "";
|
||||
}
|
||||
map.put("movieName", movieName);//+mes);
|
||||
map.put("seatList", seat);
|
||||
}
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/locJxbLayout")
|
||||
@ApiOperation("机械臂库位布局")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> locJxbLayout(String zoneType) {
|
||||
//0空1满2禁用3空车区满
|
||||
List<Object[]> mins = pointServiceImpl.getPointMinxy(zoneType);
|
||||
List<Object[]> ts = pointServiceImpl.getZcJxb();
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("mg_top", 2);
|
||||
map.put("mg_left", 1);
|
||||
HashMap<String, Object> seatList = new HashMap<String, Object>();
|
||||
if (ts.size() > 0) {
|
||||
JSONArray seat = new JSONArray();
|
||||
Object[] obj = mins.get(0);
|
||||
double x = Double.parseDouble(obj[0].toString()) - 2;
|
||||
double y = Double.parseDouble(obj[1].toString()) - 2;
|
||||
double maxy = Double.parseDouble(obj[3].toString());
|
||||
HashMap<String, Integer> itemTypes = new HashMap<String, Integer>();
|
||||
for (Object[] o : ts) {
|
||||
HashMap<String, Object> d = new HashMap<String, Object>();
|
||||
int j = 0;
|
||||
// for(Object[] o1:ts){
|
||||
// log.info("o1:"+o1.length+"===");
|
||||
// for(int v=0;v<o1.length;v++){
|
||||
// log.info("v:"+obj[v]+"====="+v);
|
||||
// }
|
||||
// }
|
||||
d.put("id", o[j++]);
|
||||
d.put("xh", o[j++]);
|
||||
d.put("code1", o[j++].toString().replace("MA1151-", ""));
|
||||
d.put("code2", o[j++].toString().replace("MA1151-", ""));
|
||||
d.put("status1", o[j++]);
|
||||
d.put("status2", o[j++]);
|
||||
d.put("item1", o[j++]);
|
||||
d.put("item2", o[j++]);
|
||||
Double row = Double.parseDouble(o[j++].toString());
|
||||
Double col = Double.parseDouble(o[j++].toString());
|
||||
d.put("gRow", (int) Math.ceil(row - x));
|
||||
d.put("gCol", Math.abs((int) Math.ceil(col - maxy)));
|
||||
if (d.get("status1").equals(BaseStatus.USED) || d.get("status2").equals(BaseStatus.USED)) {
|
||||
d.put("type", 1);
|
||||
} else {
|
||||
d.put("type", 0);
|
||||
}
|
||||
seat.add(d);
|
||||
}
|
||||
map.put("movieName", null);//+mes);
|
||||
map.put("seatList", seat);
|
||||
}
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/itemTypePie")
|
||||
@ApiOperation("物料类型比列")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> itemTypePie(String itemType) {
|
||||
DecimalFormat df = new DecimalFormat("#.0");
|
||||
int pointCount = pointServiceImpl.getPointCoutType(itemType);
|
||||
int invCount = pointServiceImpl.getInvCoutType(itemType);
|
||||
String color0 = "#ededed";
|
||||
String color1 = "#FF0000";
|
||||
String scoreName = "SCORE";
|
||||
double percentage = invCount * 100 * 0.1 * 10 / pointCount;
|
||||
// percentage=Math.round(percentage);
|
||||
percentage = Double.parseDouble(df.format(percentage));
|
||||
if (itemType.equals("前桶480")) {
|
||||
// color0="#04CDE6";
|
||||
color1 = "#0CC8E6";
|
||||
} else if (itemType.equals("前桶440")) {
|
||||
// color0="#73E239";
|
||||
color1 = "#35B45E";
|
||||
} else if (itemType.equals("后桶1200单洗")) {
|
||||
// color0="#FEBA6B";
|
||||
color1 = "#F29961";
|
||||
} else if (itemType.equals("后桶DF440单洗")) {
|
||||
// color0="#E15E68";
|
||||
color1 = "#E53240";
|
||||
} else if (itemType.equals("后桶1200洗干")) {
|
||||
// color0="#A682E6";
|
||||
color1 = "#6244E6";
|
||||
} else if (itemType.equals("后桶1400单洗")) {
|
||||
// color0="#A682E6";
|
||||
color1 = "#8fbc8f";
|
||||
} else if (itemType.equals("后桶DF440洗干")) {
|
||||
// color0="#A682E6";
|
||||
color1 = "#663300";
|
||||
} else if (itemType.equals("CK")) {
|
||||
// color0="#A682E6";
|
||||
color1 = "#663300";
|
||||
}
|
||||
Option option = PieChart.pieStyle(color0, color1, scoreName, percentage);
|
||||
return new ResponseEntity(option, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/itemTypePieQty")
|
||||
@ApiOperation("物料类型比列数量")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> itemTypePieQty(String itemType) {
|
||||
String invCount = pointServiceImpl.getInvCoutInfo(itemType);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("data", invCount);
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/areaInOutDay")
|
||||
@ApiOperation("库区出入库")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> areaInOutDay(String type, String areaType) {
|
||||
List<Object[]> ts = taskServiceImpl.queryAreaDay(type, areaType);
|
||||
String invCount = "0";
|
||||
if (ts.size() > 0) {
|
||||
Object[] obj = ts.get(0);
|
||||
if (obj[0] != null && obj[1] != null) {
|
||||
invCount = obj[0] + "车" + obj[1];
|
||||
}
|
||||
}
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("data", invCount);
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/locLayoutOld")
|
||||
@ApiOperation("库位布局-旧")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> locLayoutOld() {
|
||||
List<RLocLayout> ls = pointServiceImpl.queryLayout("QHT", 0, 0);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("width", 2.6);
|
||||
map.put("height", 1.95);
|
||||
map.put("mg_top", 2);
|
||||
map.put("mg_left", 1);
|
||||
// map.put("positionDistin",3.1);
|
||||
|
||||
HashMap<String, Object> seatList = new HashMap<String, Object>();
|
||||
int type0 = 0;
|
||||
int type1 = 0;
|
||||
int type2 = 0;
|
||||
if (ls.size() > 0) {
|
||||
int colView = 24;//每行显示的库位数
|
||||
int kbc = 3;//4个库位一个空白格子
|
||||
int kbr = 14;
|
||||
int kbcol = (int) Math.ceil(colView * 1.0 / kbc) - 1;
|
||||
int row = (int) Math.ceil(ls.size() * 1.0 / colView);
|
||||
int v = 0;
|
||||
int kbrow = (int) Math.ceil(row * 1.0 / kbr) - 1;
|
||||
int coutRow = row + kbrow;
|
||||
JSONArray seat = new JSONArray();
|
||||
HashMap<String, Integer> itemTypes = new HashMap<String, Integer>();
|
||||
for (int i = 1; i <= coutRow; i++) {
|
||||
for (int j = 1; j <= colView + kbcol; j++) {
|
||||
HashMap<String, Object> d = new HashMap<String, Object>();
|
||||
if ((j % (kbc + 1) == 0) || (i % (kbr + 1) == 0)) {
|
||||
if ((i % (kbr + 1) == 0)) {
|
||||
d.put("id", v);
|
||||
d.put("gRow", i);
|
||||
d.put("gCol", j);
|
||||
int type = 3;
|
||||
// if((j%(kbc+1)==0)&&(i%(kbr+1)==0)){
|
||||
// type=5;
|
||||
// }else if(i%(kbr+1)==0){
|
||||
// type=3;
|
||||
// }else if(j%(kbc+1)==0){
|
||||
// type=4;
|
||||
// }
|
||||
d.put("type", type);//3横4竖5交叉
|
||||
d.put("code", "");
|
||||
seat.add(d);
|
||||
}
|
||||
} else {
|
||||
RLocLayout layout = ls.get(v++);
|
||||
d.put("id", layout.getId());
|
||||
d.put("gRow", i);
|
||||
d.put("gCol", j);
|
||||
d.put("type", layout.getType());
|
||||
d.put("code", layout.getCode());
|
||||
if (layout.getType() == 0) {
|
||||
type0++;
|
||||
} else if (layout.getType() == 1) {
|
||||
type1++;
|
||||
} else if (layout.getType() == 2) {
|
||||
type2++;
|
||||
}
|
||||
String itemType = layout.getItemType();
|
||||
if (itemType != null) {
|
||||
if (itemTypes.get(itemType) != null) {
|
||||
itemTypes.put(itemType, itemTypes.get(itemType) + 1);
|
||||
} else {
|
||||
itemTypes.put(itemType, 1);
|
||||
}
|
||||
}
|
||||
seat.add(d);
|
||||
if (ls.size() <= v) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String mes = itemTypes.toString();
|
||||
mes = mes.replace("{", " ").replace("}", " ");
|
||||
map.put("movieName", "前后桶 " + ls.size() + "库位(空点:" + type0 + ",满车:" + type1 + ",禁用:" + type2 + ")" + mes);
|
||||
map.put("seatList", seat);
|
||||
}
|
||||
return new ResponseEntity(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/inOutData")
|
||||
@ApiOperation("出入库数据")
|
||||
@AnonymousAccess
|
||||
|
|
@ -714,13 +132,6 @@ public class ScreenViewController {
|
|||
data.put("outDZX", pickDetailRepository.queryOutQHData(beginOfDay.toString(), "ALLOCATE").size());
|
||||
//全部任务
|
||||
data.put("outAll", pickDetailRepository.queryOutQHAllData(beginOfDay.toString()).size());
|
||||
//入库
|
||||
//已完成 + 已取消
|
||||
data.put("inZX", taskService.queryInQHData(beginOfDay.toString(), "FINISH").size() + taskService.queryInQHData(beginOfDay.toString(), "CANCEL").size());
|
||||
//已执行的
|
||||
data.put("inDZX", taskService.queryInQHData(beginOfDay.toString(), "OPEN").size());
|
||||
//全部任务
|
||||
data.put("inAll", taskService.queryInQHALLData(beginOfDay.toString()).size());
|
||||
return new ResponseEntity(data, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,64 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.basicdata.repository;
|
||||
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
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;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author liuxue
|
||||
* @date 2023-07-26
|
||||
**/
|
||||
* @author liuxue
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-07-26
|
||||
**/
|
||||
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(" from Point p " +
|
||||
"where " +
|
||||
"p.enabled=true " +
|
||||
"and p.status='FREE' " +
|
||||
"and p.type = :type " +
|
||||
"and (:areaCode is null or p.area.code = :areaCode)")
|
||||
List<Point> findByTypeAndAreaCode(String type, String areaCode);
|
||||
|
||||
}
|
||||
@Query(" from Point p " +
|
||||
"where p.enabled=true " +
|
||||
"and p.status='FREE' " +
|
||||
"and p.type = :type " +
|
||||
"and (:areaCode is null or p.area.code = :areaCode)")
|
||||
Page<Point> findByTypeAndAreaCode(String type, String areaCode, Pageable pageable);
|
||||
|
||||
@Query(" from Point point where point.enabled = true " +
|
||||
"and (:code IS NULL or point.code = :code) " +
|
||||
"and (:status IS NULL or point.status = :status) " +
|
||||
"and (:type IS NULL or point.type = :type) " +
|
||||
"and (:goodType IS NULL or point.description = :goodType) " +
|
||||
"and (:areaCode IS NULL or point.area.code = :areaCode) " +
|
||||
"and (:itemHeight IS NULL or point.itemHeight = :itemHeight)")
|
||||
Point findByCode(String code, String status, String type, String areaCode, String goodType, Double itemHeight);
|
||||
|
||||
@Query(" from Point p where p.code in :pointCodes")
|
||||
List<Point> findByCodes(Set pointCodes);
|
||||
|
||||
@Query(" from Point p where p.beatCode = :beat_code")
|
||||
List<Point> findByByBeat_code(String beat_code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,48 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.basicdata.repository;
|
||||
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.service.dto.StockSmallDto;
|
||||
import com.youchain.businessdata.domain.Inventory;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author liuxue
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
* @author liuxue
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
public interface StockRepository extends JpaRepository<Stock, Long>, JpaSpecificationExecutor<Stock> {
|
||||
@Query(value = "SELECT u.id,u.code FROM base_stock u WHERE u.enabled=1 and u.status='FREE' and (u.code = ?1 or 1=1 )", nativeQuery = true)
|
||||
List<Map<String,String>> getKyStockList(String code);
|
||||
@Query(value = " from Stock s " +
|
||||
"where " +
|
||||
"s.enabled=true " +
|
||||
"and s.status='FREE' " +
|
||||
"and (:code IS NULL OR s.code=:code )")
|
||||
List<Stock> findByKyStockList(String code);
|
||||
|
||||
@Query("from Stock t where t.code = :code and (:status is null OR t.status = :status)")
|
||||
Stock findByCode(String code, String status);
|
||||
|
||||
@Query(" from Inventory inv where inv.stock.code = :stockCode and inv.quantity - inv.queuedQty > 0")
|
||||
List<Inventory> findByinventoryList(String stockCode);
|
||||
|
||||
@Query(" from Stock s where s.code in :stockCodes")
|
||||
List<Stock> findByCodes(Set stockCodes);
|
||||
|
||||
@Query("FROM Stock t WHERE t.code = :code AND (:status IS NULL OR t.status = :status)")
|
||||
Stock findByCode(String code,String status);
|
||||
@Query(value = "SELECT s FROM Stock s WHERE s.point.id=?1 and s.stockType in ('散件翻包','其他翻包')")
|
||||
List<Stock> findByPointAndFb(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,31 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.basicdata.repository;
|
||||
|
||||
import com.youchain.basicdata.domain.StockType;
|
||||
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
|
||||
* @author liuxue
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
* @author liuxue
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
public interface StockTypeRepository extends JpaRepository<StockType, Long>, JpaSpecificationExecutor<StockType> {
|
||||
}
|
||||
@Query(" from StockType t where t.code = :code")
|
||||
StockType findByCode(String code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package com.youchain.basicdata.rest;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
|
@ -30,11 +29,12 @@ import com.youchain.basicdata.service.PointService;
|
|||
import com.youchain.basicdata.service.dto.AreaDto;
|
||||
import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
||||
import com.youchain.config.FileProperties;
|
||||
import com.youchain.exception.handler.ApiError;
|
||||
import com.youchain.config.thread.ThreadPoolExecutorUtil;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -49,7 +49,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
|
|
@ -77,6 +77,7 @@ public class PointController {
|
|||
|
||||
private final RedisObjectUtils redisObjectUtils;
|
||||
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
|
|
@ -86,8 +87,8 @@ public class PointController {
|
|||
}
|
||||
|
||||
@Log("导入点位")
|
||||
@PostMapping(value = "/import_point")
|
||||
@ApiOperation("导入点位")
|
||||
@PostMapping(value = "/import_point")
|
||||
@PreAuthorize("@el.check('point:importPoint')")
|
||||
public ResponseEntity<Object> importPoint(@RequestParam("file") MultipartFile multipartFile) {
|
||||
//编码、类型、库区、存储类型、坐标X、坐标Y
|
||||
|
|
@ -129,21 +130,24 @@ public class PointController {
|
|||
}
|
||||
}
|
||||
|
||||
//异步处理
|
||||
ExecutorService executor = ThreadPoolExecutorUtil.getPoll("point-import-job");
|
||||
CompletableFuture<Void> createFuture = CompletableFuture.runAsync(() -> {
|
||||
//批量新增Mo票
|
||||
if (!pointsToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(pointsToCreate);
|
||||
}
|
||||
});
|
||||
}, executor);
|
||||
|
||||
CompletableFuture<Void> updateFuture = CompletableFuture.runAsync(() -> {
|
||||
//批量更新Mo票
|
||||
if (!pointsToUpdate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchUpdate(pointsToUpdate);
|
||||
}
|
||||
});
|
||||
}, executor);
|
||||
// 等待所有操作完成
|
||||
CompletableFuture.allOf(createFuture, updateFuture).join();
|
||||
executor.shutdown();//关闭线程池
|
||||
return successRequest("导入成功:" + " 新增(" + pointsToCreate.size() + ")修改(" + pointsToUpdate.size() + ")", "");
|
||||
} catch (Exception e) {
|
||||
return badRequest("导入失败:" + e.getMessage());
|
||||
|
|
@ -204,12 +208,6 @@ public class PointController {
|
|||
return new ResponseEntity<>(pointService.queryAll(criteria), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/queryKyPointList")
|
||||
@ApiOperation("查询可用空闲的点位point")
|
||||
public ResponseEntity<Object> queryKyPointList(PointQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(pointService.queryKyPointList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增point")
|
||||
@ApiOperation("新增point")
|
||||
|
|
@ -237,17 +235,6 @@ public class PointController {
|
|||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryPoint")
|
||||
@Log("光电点位状态查询")
|
||||
@ApiOperation("光电点位状态查询")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> queryPoint(@RequestBody String json) {
|
||||
JSONObject jsonObject = JSON.parseObject(json);
|
||||
String pointCode = jsonObject.getString("pointCode") == null ? "" : jsonObject.getString("pointCode");//输送线、光电编号
|
||||
pointService.queryPoint(pointCode);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/multiAdjust")
|
||||
@Log("点位批量调整")
|
||||
@ApiOperation("点位批量调整")
|
||||
|
|
@ -267,7 +254,7 @@ public class PointController {
|
|||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "存储类型和库区只能选择一项!", ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
List<Point> pointList = pointService.getPointByBeat_code(smallArea);
|
||||
List<Point> pointList = pointService.findByByBeat_code(smallArea);
|
||||
if (pointList.size() <= 0) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), smallArea + "没有小库区对应的点位,请维护!", ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
|
@ -305,8 +292,8 @@ public class PointController {
|
|||
@PostMapping("/queryPointInfo")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> queryPointInfo(@RequestBody CurrentPage currentPage) {
|
||||
List<Point> pointList = pointService.getPoint(BaseStatus.STORAGE, "1F存储区", currentPage.getCurrentPage(), currentPage.getPageSize());
|
||||
int total = pointService.getPoint(BaseStatus.STORAGE, "1F存储区").size();
|
||||
Page<Point> pointList = pointService.findByTypeAndAreaCode(BaseStatus.STORAGE, "1F存储区", currentPage.getCurrentPage(), currentPage.getPageSize());
|
||||
int total = pointService.findByTypeAndAreaCode(BaseStatus.STORAGE, "1F存储区").size();
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("total", total);
|
||||
object.put("data", pointList);
|
||||
|
|
|
|||
|
|
@ -19,15 +19,12 @@ import cn.hutool.poi.excel.ExcelReader;
|
|||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.domain.Area;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.domain.StockType;
|
||||
import com.youchain.basicdata.service.StockService;
|
||||
import com.youchain.basicdata.service.StockTypeService;
|
||||
import com.youchain.basicdata.service.dto.StockQueryCriteria;
|
||||
import com.youchain.config.FileProperties;
|
||||
import com.youchain.exception.handler.ApiError;
|
||||
import com.youchain.config.thread.ThreadPoolExecutorUtil;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
|
|
@ -46,9 +43,8 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
|
@ -69,11 +65,8 @@ public class StockController {
|
|||
|
||||
private final FileProperties properties;
|
||||
|
||||
private final StockTypeService stockTypeService;
|
||||
|
||||
private final BatchCreateOrUpdate batchCreateOrUpdate;
|
||||
|
||||
private final RedisObjectUtils redisObjectUtils;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
|
|
@ -82,10 +75,9 @@ public class StockController {
|
|||
public void exportStock(HttpServletResponse response, StockQueryCriteria criteria) throws IOException {
|
||||
stockService.download(stockService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/import_stock")
|
||||
@Log("容器导入")
|
||||
@ApiOperation("容器导入")
|
||||
@AnonymousAccess
|
||||
@PostMapping(value = "/import_stock")
|
||||
public ResponseEntity<Object> importStock(@RequestParam("file") MultipartFile multipartFile) {
|
||||
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
|
||||
String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename());
|
||||
|
|
@ -122,22 +114,23 @@ public class StockController {
|
|||
stocksToCreate.add(createStock(stockType, UserUtils.getDept(), record));
|
||||
}
|
||||
}
|
||||
|
||||
ExecutorService executor = ThreadPoolExecutorUtil.getPoll("stock-import-job");
|
||||
CompletableFuture<Void> createFuture = CompletableFuture.runAsync(() -> {
|
||||
//批量新增Mo票
|
||||
if (!stocksToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(stocksToCreate);
|
||||
}
|
||||
});
|
||||
}, executor);
|
||||
|
||||
CompletableFuture<Void> updateFuture = CompletableFuture.runAsync(() -> {
|
||||
//批量更新Mo票
|
||||
if (!stocksToUpdate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchUpdate(stocksToUpdate);
|
||||
}
|
||||
});
|
||||
}, executor);
|
||||
// 等待所有操作完成
|
||||
CompletableFuture.allOf(createFuture, updateFuture).join();
|
||||
executor.shutdown();//关闭线程池
|
||||
return successRequest("导入成功:" + " 新增(" + stocksToCreate.size() + ")修改(" + stocksToUpdate.size() + ")", "");
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
@ -171,7 +164,7 @@ public class StockController {
|
|||
@ApiOperation("查询可用空闲的容器stock")
|
||||
@GetMapping(value = "/queryKyStockList")
|
||||
public ResponseEntity<Object> queryKyStockList(StockQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(stockService.queryKyStockList(criteria.getCode()), HttpStatus.OK);
|
||||
return new ResponseEntity<>(stockService.findByKyStockList(criteria.getCode()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.basicdata.rest;
|
||||
|
||||
import com.youchain.annotation.Log;
|
||||
|
|
@ -28,14 +28,15 @@ 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 liuxue
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
* @author liuxue
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "stock_type管理")
|
||||
|
|
@ -53,32 +54,32 @@ public class StockTypeController {
|
|||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询stock_type")
|
||||
public ResponseEntity<Object> queryStockType(StockTypeQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(stockTypeService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
@ApiOperation("查询容器类型")
|
||||
public ResponseEntity<Object> queryStockType(StockTypeQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(stockTypeService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增stock_type")
|
||||
@ApiOperation("新增stock_type")
|
||||
@Log("新增容器类型")
|
||||
@ApiOperation("新增容器类型")
|
||||
@PreAuthorize("@el.check('stockType:add')")
|
||||
public ResponseEntity<Object> createStockType(@Validated @RequestBody StockType resources){
|
||||
public ResponseEntity<Object> createStockType(@Validated @RequestBody StockType resources) {
|
||||
resources.setDept(UserUtils.getDept());
|
||||
return new ResponseEntity<>(stockTypeService.create(resources),HttpStatus.CREATED);
|
||||
return new ResponseEntity<>(stockTypeService.create(resources), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改stock_type")
|
||||
@ApiOperation("修改stock_type")
|
||||
@Log("修改容器类型")
|
||||
@ApiOperation("修改容器类型")
|
||||
@PreAuthorize("@el.check('stockType:edit')")
|
||||
public ResponseEntity<Object> updateStockType(@Validated @RequestBody StockType resources){
|
||||
public ResponseEntity<Object> updateStockType(@Validated @RequestBody StockType resources) {
|
||||
stockTypeService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除stock_type")
|
||||
@ApiOperation("删除stock_type")
|
||||
@Log("删除容器类型")
|
||||
@ApiOperation("删除容器类型")
|
||||
@PreAuthorize("@el.check('stockType:del')")
|
||||
public ResponseEntity<Object> deleteStockType(@RequestBody Long[] ids) {
|
||||
stockTypeService.deleteAll(ids);
|
||||
|
|
|
|||
|
|
@ -95,8 +95,4 @@ public interface BoxService {
|
|||
void download(List<BoxDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
Box toEntity(BoxDto boxDto);
|
||||
|
||||
void callBox(BoxDto boxDto);
|
||||
|
||||
Task createTask(Item item, Stock stock, Point endPoint);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,10 @@
|
|||
*/
|
||||
package com.youchain.basicdata.service;
|
||||
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.service.dto.ItemDto;
|
||||
import com.youchain.basicdata.service.dto.PointDto;
|
||||
import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
||||
import com.youchain.basicdata.service.dto.PointSmallDto;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -55,13 +53,6 @@ public interface PointService {
|
|||
List<PointDto> queryAll(PointQueryCriteria criteria);
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @return List<PointDto>
|
||||
*/
|
||||
List<PointSmallDto> queryKyPointList();
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
|
|
@ -70,14 +61,6 @@ public interface PointService {
|
|||
*/
|
||||
PointDto findById(Long id);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return PointDto
|
||||
*/
|
||||
Point findEntityById(Long id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
|
|
@ -117,13 +100,10 @@ public interface PointService {
|
|||
*/
|
||||
Point toEntity(PointDto pointDto);
|
||||
|
||||
|
||||
void queryPoint(String pointCode);
|
||||
|
||||
List<Point> getPoint(String type, String areaCode);
|
||||
List<Point> findByTypeAndAreaCode(String type, String areaCode);
|
||||
|
||||
|
||||
List<Point> getPoint(String type, String areaCode, int page, int pageSize);
|
||||
Page<Point> findByTypeAndAreaCode(String type, String areaCode, int page, int pageSize);
|
||||
|
||||
/**
|
||||
* 根据code查找库区
|
||||
|
|
@ -137,17 +117,6 @@ public interface PointService {
|
|||
*/
|
||||
Point findByCode(String code, String status, String type, String areaCode, String goodType, Double itemHeight);
|
||||
|
||||
/**
|
||||
* 得到指定点位
|
||||
*
|
||||
* @param code
|
||||
* @param status
|
||||
* @param type
|
||||
* @param areaName
|
||||
* @return
|
||||
*/
|
||||
Point getPoint(String code, String status, String type, String areaName);
|
||||
|
||||
Map<String, Point> findByCodes(Set pointCodes);
|
||||
|
||||
/**
|
||||
|
|
@ -156,6 +125,6 @@ public interface PointService {
|
|||
* @param beat_code
|
||||
* @return
|
||||
*/
|
||||
List<Point> getPointByBeat_code(String beat_code);
|
||||
List<Point> findByByBeat_code(String beat_code);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,14 +16,9 @@
|
|||
package com.youchain.basicdata.service;
|
||||
|
||||
import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.service.dto.ItemDto;
|
||||
import com.youchain.basicdata.service.dto.StockDto;
|
||||
import com.youchain.basicdata.service.dto.StockSmallDto;
|
||||
import com.youchain.basicdata.service.dto.StockQueryCriteria;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -57,13 +52,6 @@ public interface StockService {
|
|||
*/
|
||||
List<StockDto> queryAll(StockQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param code 条件参数
|
||||
* @return List<StockDto>
|
||||
*/
|
||||
List<StockSmallDto> queryKyStockList(String code);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
|
|
@ -112,6 +100,14 @@ public interface StockService {
|
|||
*/
|
||||
Stock toEntity(StockDto stockDto);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param code 条件参数
|
||||
* @return List<Stock>
|
||||
*/
|
||||
List<Stock> findByKyStockList(String code);
|
||||
|
||||
/**
|
||||
* 根据code查找容器
|
||||
*
|
||||
|
|
@ -121,17 +117,8 @@ public interface StockService {
|
|||
*/
|
||||
Stock findByCode(String code, String status);
|
||||
|
||||
/**
|
||||
* 查询已绑定的空料车
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Stock findByKStock(String areaName);
|
||||
|
||||
String getItemCode(String stockCode);
|
||||
|
||||
List<Map<String, String>> getKyStockList(String code);
|
||||
|
||||
/**
|
||||
* 容器入场JSON
|
||||
*
|
||||
|
|
@ -174,6 +161,8 @@ public interface StockService {
|
|||
*/
|
||||
void callContainer(String itemCode, String pointCode, int scene);
|
||||
|
||||
Map<String, Stock> findByCodes(Set stockCodes);
|
||||
|
||||
/**
|
||||
* 扫描Mo
|
||||
*
|
||||
|
|
@ -192,8 +181,6 @@ public interface StockService {
|
|||
*/
|
||||
void materialIn(String stockCode, Set boxNumbers, String pointCode);
|
||||
|
||||
Map<String, Stock> findByCodes(Set stockCodes);
|
||||
|
||||
/**
|
||||
* 扫描托盘
|
||||
*
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package com.youchain.basicdata.service;
|
||||
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.StockType;
|
||||
import com.youchain.basicdata.service.dto.StockTypeDto;
|
||||
import com.youchain.basicdata.service.dto.StockTypeQueryCriteria;
|
||||
|
|
@ -93,4 +92,4 @@ public interface StockTypeService {
|
|||
* @return
|
||||
*/
|
||||
StockType findByCode(String code);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,35 +217,4 @@ public class BoxServiceImpl implements BoxService {
|
|||
public Box toEntity(BoxDto boxDto) {
|
||||
return boxMapper.toEntity(boxDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public synchronized void callBox(BoxDto boxDto) throws RuntimeException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Task createTask(Item item, Stock stock, Point endPoint) {
|
||||
AsnDetail asnDetail = new AsnDetail();
|
||||
asnDetail.setItem(item);
|
||||
asnDetail.setLineNo(1l);
|
||||
asnDetail.setStatus(BizStatus.OPEN);
|
||||
asnDetail.setOrderQty(item.getExtendD1());
|
||||
asnDetail.setDept(item.getDept());
|
||||
Date date = cn.hutool.core.date.DateUtil.date();
|
||||
String propC1 = DateUtil.format(date, "yyyyMMdd");
|
||||
asnDetail.setPropC1(propC1);
|
||||
asnDetailService.create(asnDetail);
|
||||
|
||||
//生成Itemkey
|
||||
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, null, endPoint, null, null, null, endPoint.getCode(), null, BizStatus.OPEN, asnDetail.getOrderQty(), null, null, item.getDept(), null);
|
||||
taskService.create(task);
|
||||
return task;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,29 +15,16 @@
|
|||
*/
|
||||
package com.youchain.basicdata.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.appupdate.ReturnJson.RLocLayout;
|
||||
import com.youchain.basicdata.domain.Area;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
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.utils.*;
|
||||
import jdk.internal.dynalink.beans.StaticClass;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.basicdata.service.dto.PointDto;
|
||||
import com.youchain.basicdata.service.dto.PointSmallDto;
|
||||
import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
||||
import com.youchain.basicdata.service.mapstruct.PointMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dreamlu.mica.core.utils.JsonUtil;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.transform.AliasToEntityMapResultTransformer;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
|
@ -45,12 +32,7 @@ import org.springframework.data.domain.Pageable;
|
|||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
|
|
@ -79,27 +61,6 @@ public class PointServiceImpl implements PointService {
|
|||
return pointMapper.toDto(pointRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PointSmallDto> queryKyPointList() {
|
||||
List<Map<String, String>> maps = pointRepository.getKyPointList();
|
||||
String irsStr = JSON.toJSONString(maps);
|
||||
List<PointSmallDto> evaUserResps = JSON.parseArray(irsStr, PointSmallDto.class);
|
||||
return evaUserResps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Point> getPoint(String type, String areaCode, int page, int pageSize) {
|
||||
String hql = " from Point p where p.enabled=true and p.status='FREE' and p.type='" + type + "' ";
|
||||
if (areaCode != null) {
|
||||
hql += " and p.area.code='" + areaCode + "'";
|
||||
}
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setFirstResult((page - 1) * pageSize);//当前
|
||||
query.setMaxResults(pageSize); // 每页的大小
|
||||
List<Point> pointList = query.getResultList();
|
||||
return pointList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
|
|
@ -109,14 +70,6 @@ public class PointServiceImpl implements PointService {
|
|||
return pointMapper.toDto(point);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Point findEntityById(Long id) {
|
||||
Point point = pointRepository.findById(id).orElseGet(Point::new);
|
||||
ValidationUtil.isNull(point.getId(), "Point", "id", id);
|
||||
return point;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PointDto create(Point resources) {
|
||||
|
|
@ -175,106 +128,26 @@ public class PointServiceImpl implements PointService {
|
|||
return pointMapper.toEntity(pointDto);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void queryPoint(String pointCode) {
|
||||
/* String resultJson= HttpPostUtil.sendPostReq(UrlApi.agv_url, jsonObject.toString());//返回ResponseJson*/
|
||||
String resultJson = "{\n" +
|
||||
"\"status\":200,\n" +
|
||||
"\"message\":\"\",\n" +
|
||||
"\"data\":[{\n" +
|
||||
"\"pointCode\":\"xxxxxx\",\n" +
|
||||
"\"pointStatus\":0\n" +
|
||||
"}]\n" +
|
||||
"}";
|
||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||
String code = resulObject.getString("status") == null ? "" : resulObject.getString("status");
|
||||
if (code.equals("200")) {
|
||||
|
||||
|
||||
}
|
||||
public List<Point> findByTypeAndAreaCode(String type, String areaCode) {
|
||||
return pointRepository.findByTypeAndAreaCode(type, areaCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Point> getPoint(String type, String areaCode) {
|
||||
String hql = " from Point p where p.enabled=true and p.status='FREE' and p.type='" + type + "' ";
|
||||
if (areaCode != null) {
|
||||
hql += " and p.area.code='" + areaCode + "'";
|
||||
}
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
List<Point> pointList = query.getResultList();
|
||||
return pointList;
|
||||
public Page<Point> findByTypeAndAreaCode(String type, String areaCode, int page, int pageSize) {
|
||||
Pageable pageable = PageRequest.of(page - 1, pageSize);
|
||||
return pointRepository.findByTypeAndAreaCode(type, areaCode, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point findByCode(String code, String status, String type, String areaCode, String goodType, Double itemHeight) {
|
||||
StringBuilder hql = new StringBuilder("from Point point where point.enabled = true");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
if (code != null && !code.isEmpty()) {
|
||||
hql.append(" and point.code = :code");
|
||||
params.put("code", code);
|
||||
}
|
||||
if (status != null && !status.isEmpty()) {
|
||||
hql.append(" and point.status = :status");
|
||||
params.put("status", status);
|
||||
}
|
||||
if (type != null && !type.isEmpty()) {
|
||||
hql.append(" and point.type = :type");
|
||||
params.put("type", type);
|
||||
}
|
||||
if (goodType != null && !goodType.isEmpty()) {
|
||||
hql.append(" and point.description = :goodType");
|
||||
params.put("goodType", goodType);
|
||||
}
|
||||
if (areaCode != null && !areaCode.isEmpty()) {
|
||||
hql.append(" and point.area.code = :areaCode");
|
||||
params.put("areaCode", areaCode);
|
||||
}
|
||||
if (itemHeight != null) {
|
||||
hql.append(" and point.itemHeight = :itemHeight");
|
||||
params.put("itemHeight", itemHeight);
|
||||
}
|
||||
Query query = entityMapper.createQuery(hql.toString());
|
||||
params.forEach(query::setParameter);
|
||||
List<Point> pointList = query.getResultList();
|
||||
return pointList.isEmpty() ? null : pointList.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getPoint(String code, String status, String type, String areaName) {
|
||||
StringBuilder hql = new StringBuilder("from Point point where point.enabled = true");
|
||||
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
|
||||
if (StringUtils.isNotBlank(code)) {
|
||||
hql.append(" and point.code = :code");
|
||||
parameters.put("code", code);
|
||||
}
|
||||
if (StringUtils.isNotBlank(status)) {
|
||||
hql.append(" and point.status = :status");
|
||||
parameters.put("status", status);
|
||||
}
|
||||
if (StringUtils.isNotBlank(type)) {
|
||||
hql.append(" and point.type = :type");
|
||||
parameters.put("type", type);
|
||||
}
|
||||
if (StringUtils.isNotBlank(areaName)) {
|
||||
hql.append(" and point.area.name = :areaName");
|
||||
parameters.put("areaName", areaName);
|
||||
}
|
||||
|
||||
Query query = entityMapper.createQuery(hql.toString());
|
||||
parameters.forEach(query::setParameter);
|
||||
|
||||
List<Point> pointList = query.getResultList();
|
||||
return pointList.isEmpty() ? null : pointList.get(0);
|
||||
return pointRepository.findByCode(code, status, type, areaCode, goodType, itemHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Point> findByCodes(Set pointCodes) {
|
||||
String hql = " from Point where code in (:pointCodes)";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("pointCodes", pointCodes);
|
||||
List<Point> pointList = query.getResultList();
|
||||
List<Point> pointList = pointRepository.findByCodes(pointCodes);
|
||||
Map<String, Point> pointMap = new HashMap<>();
|
||||
for (Point point : pointList) {
|
||||
pointMap.put(point.getCode(), point);
|
||||
|
|
@ -283,134 +156,7 @@ public class PointServiceImpl implements PointService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Point> getPointByBeat_code(String beat_code) {
|
||||
String hql = " from Point point where point.beatCode='" + beat_code + "' ";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
List<Point> pointList = query.getResultList();
|
||||
return pointList;
|
||||
|
||||
public List<Point> findByByBeat_code(String beat_code) {
|
||||
return pointRepository.findByByBeat_code(beat_code);
|
||||
}
|
||||
|
||||
public List<Object[]> queryPointKmd() {
|
||||
List<Object[]> pointList = null;
|
||||
String hql = "select p.area.name,p.status,count(p.status) from Point p where p.area.name in " +
|
||||
"('" + AreaNameDic.DJQ + "','" + AreaNameDic.XJQ + "')" +
|
||||
" group by p.area.name,p.status order by p.area.name";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
pointList = query.getResultList();
|
||||
|
||||
return pointList;
|
||||
}
|
||||
|
||||
public List<Object[]> getPointMinxy(String zoneType) {
|
||||
List<Object[]> pointList = null;
|
||||
String hql = "select min(p.posX),min(p.posY) ,max(p.posX),max(p.posY) from Point p where 1=1 and p.posX>0 and p.posY>0";
|
||||
if (zoneType.equals("QHT")) {
|
||||
hql += " and p.area.name in ('" + AreaNameDic.DJQ + "','" + AreaNameDic.XJQ + "')";
|
||||
}
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
pointList = query.getResultList();
|
||||
|
||||
return pointList;
|
||||
}
|
||||
|
||||
public int getPointCoutType(String itemType) {
|
||||
String hql = "select count(p.id) from Point p where 1=1 ";
|
||||
if (itemType.equals("前桶440") || itemType.equals("前桶480")) {
|
||||
hql += " and p.area.name='" + AreaNameDic.DJQ + "' and p.description='" + itemType + "'";
|
||||
} else if (itemType.equals("KC")) {
|
||||
hql = " select count(p.id) from Point p where p.area.id=27 ";//前后桶空车区空车数量
|
||||
} else {
|
||||
hql += " and p.area.name='" + AreaNameDic.XJQ + "' and (p.description is null or p.description ='')";
|
||||
}
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
return Integer.parseInt(query.getResultList().get(0).toString());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public int getInvCoutType(String itemType) {
|
||||
String sql = "select count(inv.id)" +
|
||||
" from data_inventory inv " +
|
||||
"LEFT JOIN data_item_key ik on ik.id=inv.item_key_id\n" +
|
||||
"left join base_item it on it.id=ik.item_id\n" +
|
||||
"where 1=1 and inv.quantity>0 and it.good_type='" + itemType + "'";
|
||||
if (itemType.equals("KC")) {
|
||||
sql = "select count(id) from base_point where area_id=27 and status='USED'";//前后桶空车区空车数量
|
||||
}
|
||||
List ts = entityMapper.createNativeQuery(sql).getResultList();
|
||||
return Integer.parseInt(ts.get(0).toString());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public String getInvCoutInfo2(String itemType) {
|
||||
String sql = "select CONCAT(count(inv.id),'车 ',sum(inv.quantity),'个')" +
|
||||
" from data_inventory inv " +
|
||||
"LEFT JOIN data_item_key ik on ik.id=inv.item_key_id\n" +
|
||||
"left join base_item it on it.id=ik.item_id\n" +
|
||||
"where 1=1 and inv.quantity>0 and it.good_type='" + itemType + "'";
|
||||
|
||||
Object t = entityMapper.createNativeQuery(sql).getSingleResult();
|
||||
// log.info(sql+"===="+ts.get(0).toString()+"==="+ts.size());
|
||||
// for(int i=0;i<ts.size();i++){
|
||||
// log.info(ts.get(i).toString());
|
||||
// }
|
||||
return JsonUtil.toJson(t);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public String getInvCoutInfo(String itemType) {
|
||||
String sql = "select count(inv.id),CAST(sum(inv.quantity) AS SIGNED) " +
|
||||
" from data_inventory inv " +
|
||||
"LEFT JOIN data_item_key ik on ik.id=inv.item_key_id\n" +
|
||||
"left join base_item it on it.id=ik.item_id\n" +
|
||||
"where 1=1 and inv.quantity>0 and it.good_type='" + itemType + "'";
|
||||
if (itemType.equals("KC")) {
|
||||
sql = "select count(id) from base_point where area_id=27 AND status='USED'";//前后桶空车区空车数量
|
||||
List ts = entityMapper.createNativeQuery(sql).getResultList();
|
||||
return ts.get(0).toString();
|
||||
} else {
|
||||
List<Object[]> ts = entityMapper.createNativeQuery(sql).getResultList();
|
||||
Object[] obj = ts.get(0);
|
||||
return obj[0].toString() + "车 " + obj[1].toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<RLocLayout> queryLayout(String zoneType, int minx, int miny) {
|
||||
String sql = "select p.code id,inv.point_id,z.name,p.`status`,SUBSTRING(p.code, -6) code,it.good_type itemType,it.code itemName,\n" +
|
||||
"p.pos_x x,p.pos_y y," +
|
||||
"case when z.`name`= '前后桶空车区' and p.`status`='USED' then 3 when p.enabled=0 then '2' when p.`status`='USED' and inv.point_id>0 then '1' else '0' end type\n" +
|
||||
" from base_point p\n" +
|
||||
"left join data_inventory inv on inv.point_id=p.id and inv.quantity>0\n" +
|
||||
"left join base_area z on z.id=p.area_id\n" +
|
||||
"LEFT JOIN data_item_key ik on ik.id=inv.item_key_id\n" +
|
||||
"left join base_item it on it.id=ik.item_id\n" +
|
||||
"where 1=1 and p.pos_x>0 and p.pos_y>0";
|
||||
if (zoneType.equals("QHT")) {
|
||||
sql += " and z.`name` in ('" + AreaNameDic.DJQ + "','" + AreaNameDic.XJQ + "')";
|
||||
}
|
||||
sql += " order by p.pos_x,p.pos_y";
|
||||
List ts = entityMapper.createNativeQuery(sql)
|
||||
.unwrap(SQLQuery.class)
|
||||
.setResultTransformer(
|
||||
AliasToEntityMapResultTransformer.INSTANCE
|
||||
)
|
||||
.list();
|
||||
List<RLocLayout> l = JSON.parseArray(JSON.toJSONString(ts), RLocLayout.class);
|
||||
return l;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Object[]> getZcJxb() {
|
||||
String sql = "SELECT SUBSTRING(p.code,8,4) jxb ,CAST(SUBSTRING(p.code,10,2) AS SIGNED) xh,p1.code code1,p2.code code2,p1.`status` status1,p2.`status` status2,p1.item_code item_code1,p2.item_code item_code2,p1.pos_x,p1.pos_y\n" +
|
||||
"FROM `base_point` p \n" +
|
||||
"left join base_point p1 on p1.code=CONCAT(SUBSTRING(p.code,1,11),'-01')\n" +
|
||||
"left join base_point p2 on p2.code=CONCAT(SUBSTRING(p.code,1,11),'-02')\n" +
|
||||
"where p.area_id=31 and p.pos_x>0 and p.pos_y>0\n" +
|
||||
"GROUP BY SUBSTRING(p.code,8,4)";
|
||||
List<Object[]> ts = entityMapper.createNativeQuery(sql).getResultList();
|
||||
return ts;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
package com.youchain.basicdata.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
|
|
@ -36,7 +35,6 @@ import lombok.RequiredArgsConstructor;
|
|||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.basicdata.service.StockService;
|
||||
import com.youchain.basicdata.service.dto.StockDto;
|
||||
import com.youchain.basicdata.service.dto.StockSmallDto;
|
||||
import com.youchain.basicdata.service.dto.StockQueryCriteria;
|
||||
import com.youchain.basicdata.service.mapstruct.StockMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -49,8 +47,6 @@ import java.sql.Timestamp;
|
|||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
|
|
@ -70,7 +66,6 @@ public class StockServiceImpl implements StockService {
|
|||
private final PickDetailRepository pickDetailRepository;
|
||||
private final TaskRepository taskRepository;
|
||||
private final InventoryRepository inventoryRepository;
|
||||
|
||||
private final AgvTaskService agvTaskService;
|
||||
private final ItemService itemService;
|
||||
private final InventoryService inventoryService;
|
||||
|
|
@ -80,10 +75,8 @@ public class StockServiceImpl implements StockService {
|
|||
private final ItemKeyService itemKeyService;
|
||||
private final PointService pointService;
|
||||
private final TaskService taskService;
|
||||
|
||||
private final StockTypeToAreaMap stockTypeToAreaMap;
|
||||
private final StockMapper stockMapper;
|
||||
private final EntityManager entityMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(StockQueryCriteria criteria, Pageable pageable) {
|
||||
|
|
@ -97,11 +90,8 @@ public class StockServiceImpl implements StockService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<StockSmallDto> queryKyStockList(String code) {
|
||||
List<Map<String, String>> maps = getKyStockList(code);
|
||||
String irsStr = JSON.toJSONString(maps);
|
||||
List<StockSmallDto> evaUserResps = JSON.parseArray(irsStr, StockSmallDto.class);
|
||||
return evaUserResps;
|
||||
public List<Stock> findByKyStockList(String code) {
|
||||
return stockRepository.findByKyStockList(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -187,37 +177,15 @@ public class StockServiceImpl implements StockService {
|
|||
return stockRepository.findByCode(code, status);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Stock findByKStock(String areaName) {
|
||||
String hql = "from Stock t where t.point.area.name = :areaName " +
|
||||
"and t.point.id > 0 " +
|
||||
"and t.point.status = 'USED' " +
|
||||
"and t.status = 'FREE' " +
|
||||
"and t.point.type = 'STORAGE'";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("areaName", areaName);
|
||||
Optional<Stock> ts = query.getResultStream().findFirst();
|
||||
return ts.isPresent() ? ts.get() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemCode(String stockCode) {
|
||||
String hql = "FROM Inventory inv WHERE inv.stock.code = :stockCode AND inv.quantity - inv.queuedQty > 0";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("stockCode", stockCode);
|
||||
List<Inventory> inventoryList = query.getResultList();
|
||||
List<Inventory> inventoryList = stockRepository.findByinventoryList(stockCode);
|
||||
if (!inventoryList.isEmpty()) {
|
||||
return inventoryList.get(0).getItemKey().getItem().getCode();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> getKyStockList(String code) {
|
||||
return stockRepository.getKyStockList(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized String containerInJson(String containerCode, String position) {
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
|
|
@ -341,7 +309,7 @@ public class StockServiceImpl implements StockService {
|
|||
throw new RuntimeException(srcPoint.getCode() + "为" + srcPointAreaName + "不能入库!");
|
||||
}
|
||||
|
||||
List<AsnDetail> asnDetailList = asnDetailRepository.fingByAsnDetail(boxNumbers);
|
||||
List<AsnDetail> asnDetailList = asnDetailRepository.findByBoxNumbers(boxNumbers);
|
||||
if (asnDetailList.isEmpty()) {
|
||||
throw new RuntimeException(boxNumbers + "箱号无入库明细记录!");
|
||||
}
|
||||
|
|
@ -406,10 +374,7 @@ public class StockServiceImpl implements StockService {
|
|||
|
||||
@Override
|
||||
public Map<String, Stock> findByCodes(Set stockCodes) {
|
||||
String hql = " from Stock where code in (:stockCodes)";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("stockCodes", stockCodes);
|
||||
List<Stock> stockList = query.getResultList();
|
||||
List<Stock> stockList = stockRepository.findByCodes(stockCodes);
|
||||
Map<String, Stock> stockMap = new HashMap<>();
|
||||
for (Stock stock : stockList) {
|
||||
stockMap.put(stock.getCode(), stock);
|
||||
|
|
@ -671,15 +636,21 @@ public class StockServiceImpl implements StockService {
|
|||
if (!isValidMCJLArea(endPointAreaCode)) {
|
||||
throw new RuntimeException(endPoint.getCode() + "点位不能叫满车!");
|
||||
}
|
||||
String areaCode = AreaNameDic.DJQ + "," + AreaNameDic.XJQ;
|
||||
List<Inventory> inventoryList = inventoryService.queryInventory(item.getId(), areaCode);
|
||||
String areaCode = null;
|
||||
if (item.getGoodType().contains("大件")) {
|
||||
areaCode = stockTypeToAreaMap.getValueByKey("大件入库");
|
||||
}else if (item.getGoodType().contains("小件")) {
|
||||
areaCode = stockTypeToAreaMap.getValueByKey("小件入库");
|
||||
}
|
||||
Set<String> areaCodes = Collections.singleton(areaCode);
|
||||
List<Inventory> inventoryList = inventoryService.findByItemIdAndAreaCode(item.getId(), areaCodes);
|
||||
if (inventoryList.isEmpty()) {
|
||||
throw new RuntimeException(itemCode + "物料无库存,呼叫失败!");
|
||||
}
|
||||
PickDetail pickDetail = pickDetailService.createPickDetail(item, "");
|
||||
try {
|
||||
pickDetailService.allocateAll(pickDetail.getId(), endPoint, areaCode);
|
||||
List<Task> taskList = taskService.getPickNotAllTask(pickDetail.getId());
|
||||
List<Task> taskList = taskService.findByPickNotAllTask(pickDetail.getId());
|
||||
AgvTask agvTask = taskList.get(0).getAgvTask();
|
||||
sendAgvTaskAndHandleResponse(agvTask);
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,20 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.basicdata.service.impl;
|
||||
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.StockType;
|
||||
import com.youchain.utils.FileUtil;
|
||||
import com.youchain.utils.PageUtil;
|
||||
|
|
@ -37,15 +36,14 @@ import org.springframework.data.domain.Pageable;
|
|||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author liuxue
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
* @author liuxue
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class StockTypeServiceImpl implements StockTypeService {
|
||||
|
|
@ -55,22 +53,22 @@ public class StockTypeServiceImpl implements StockTypeService {
|
|||
private final EntityManager entityMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(StockTypeQueryCriteria criteria, Pageable pageable){
|
||||
Page<StockType> page = stockTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
public Map<String, Object> queryAll(StockTypeQueryCriteria criteria, Pageable pageable) {
|
||||
Page<StockType> page = stockTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
return PageUtil.toPage(page.map(stockTypeMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StockTypeDto> queryAll(StockTypeQueryCriteria criteria){
|
||||
return stockTypeMapper.toDto(stockTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
public List<StockTypeDto> queryAll(StockTypeQueryCriteria criteria) {
|
||||
return stockTypeMapper.toDto(stockTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String ,StockType> queryAll(){
|
||||
List<StockType> stockTypeList= stockTypeRepository.findAll();
|
||||
public Map<String, StockType> queryAll() {
|
||||
List<StockType> stockTypeList = stockTypeRepository.findAll();
|
||||
Map<String, StockType> map = new HashMap<>();
|
||||
for (StockType s:stockTypeList ) {
|
||||
map.put(s.getCode(),s);
|
||||
for (StockType s : stockTypeList) {
|
||||
map.put(s.getCode(), s);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
@ -79,7 +77,7 @@ public class StockTypeServiceImpl implements StockTypeService {
|
|||
@Transactional
|
||||
public StockTypeDto findById(Long id) {
|
||||
StockType stockType = stockTypeRepository.findById(id).orElseGet(StockType::new);
|
||||
ValidationUtil.isNull(stockType.getId(),"StockType","id",id);
|
||||
ValidationUtil.isNull(stockType.getId(), "StockType", "id", id);
|
||||
return stockTypeMapper.toDto(stockType);
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +85,7 @@ public class StockTypeServiceImpl implements StockTypeService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public StockTypeDto create(StockType resources) {
|
||||
Snowflake snowflake = IdUtil.createSnowflake(1, 1);
|
||||
resources.setId(snowflake.nextId());
|
||||
resources.setId(snowflake.nextId());
|
||||
return stockTypeMapper.toDto(stockTypeRepository.save(resources));
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +93,7 @@ public class StockTypeServiceImpl implements StockTypeService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(StockType resources) {
|
||||
StockType stockType = stockTypeRepository.findById(resources.getId()).orElseGet(StockType::new);
|
||||
ValidationUtil.isNull( stockType.getId(),"StockType","id",resources.getId());
|
||||
ValidationUtil.isNull(stockType.getId(), "StockType", "id", resources.getId());
|
||||
stockType.copy(resources);
|
||||
stockTypeRepository.save(stockType);
|
||||
}
|
||||
|
|
@ -111,7 +109,7 @@ public class StockTypeServiceImpl implements StockTypeService {
|
|||
public void download(List<StockTypeDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (StockTypeDto stockType : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("名称", stockType.getName());
|
||||
map.put("代码", stockType.getCode());
|
||||
map.put("长", stockType.getLength());
|
||||
|
|
@ -125,13 +123,7 @@ public class StockTypeServiceImpl implements StockTypeService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StockType findByCode(String code){
|
||||
String hql="select t from StockType t where t.code='"+code+"'";
|
||||
Query query=entityMapper.createQuery(hql);
|
||||
List<StockType> ts=query.getResultList();
|
||||
if(ts.size()>0){
|
||||
return ts.get(0);
|
||||
}
|
||||
return null;
|
||||
public StockType findByCode(String code) {
|
||||
return stockTypeRepository.findByCode(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class AgvTask extends BaseEntity implements Serializable {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
@Column(name = "`stock_code`",nullable = true)
|
||||
@NotBlank
|
||||
|
|
|
|||
|
|
@ -27,45 +27,11 @@ import java.util.List;
|
|||
* @website https://eladmin.vip
|
||||
* @date 2023-08-18
|
||||
**/
|
||||
public interface AgvTaskRepository extends JpaRepository<AgvTask, Integer>, JpaSpecificationExecutor<AgvTask> {
|
||||
|
||||
/**
|
||||
* 查询前后桶正在执行的任务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select * FROM data_agv_task a where a.`status` in ('ATCALL','UP_CONTAINER','OPEN') AND a.end_slot_code like 'MA1151-QH%'" +
|
||||
" UNION select * FROM data_agv_task a where a.`status` in ('ATCALL','UP_CONTAINER','OPEN') AND a.start_slot_code like 'MA1151-QH%' ", nativeQuery = true)
|
||||
List<AgvTask> queryAgvTaskPerformedQH();
|
||||
|
||||
/**
|
||||
* @param status-状态
|
||||
* @param type-类型
|
||||
* @param be_scan-是否扫描
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "SELECT * FROM data_agv_task where 1=1 and if((?1 !='' or ?1 is not null) ,stock_code=?1,1=1) and status=?2 and type=?3 and be_scan=?4 and job_type=?5 order by update_time ", nativeQuery = true)
|
||||
List<AgvTask> queryByAgvTask(String stockCode, String status, String type, int be_scan, String jobType);
|
||||
|
||||
/**
|
||||
* 根据线边分组
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select line_slot_code from data_agv_task where type='PICK' and `status`='OPEN' and line_slot_code is not null GROUP BY line_slot_code order by line_slot_code ", nativeQuery = true)
|
||||
List<Object> queryGroupAgvTask();
|
||||
|
||||
/**
|
||||
* 查询线边任务待执行的任务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select * from data_agv_task where line_slot_code=?1 and type='PICK' and `status`='OPEN' and line_slot_code is not null ORDER BY create_time ", nativeQuery = true)
|
||||
List<AgvTask> queryLineAgvTask(String line_slot_code);
|
||||
public interface AgvTaskRepository extends JpaRepository<AgvTask, Long>, JpaSpecificationExecutor<AgvTask> {
|
||||
|
||||
/**
|
||||
* 去重
|
||||
*/
|
||||
@Query(value = " FROM AgvTask agv where agv.startSlotCode=?1 and agv.endSlotCode=?2 and agv.status in ('OPEN','ATCALL','ATWORK')")
|
||||
@Query(value = " from AgvTask agv where agv.startSlotCode=:startSlotCode and agv.endSlotCode=:endSlotCode and agv.status in ('OPEN','ATCALL','ATWORK','CANCEL')")
|
||||
List<AgvTask> findRepeat(String startSlotCode, String endSlotCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,16 @@ import java.util.Set;
|
|||
* @date 2023-08-14
|
||||
**/
|
||||
public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, JpaSpecificationExecutor<AsnDetail> {
|
||||
|
||||
@Query(value = " from AsnDetail ad WHERE ad.stock.code =:code and ad.status=:status ")
|
||||
AsnDetail findByStock(String code, String status);
|
||||
|
||||
@Query(value = " from AsnDetail ad WHERE ad.orderNumber =:orderNumber ")
|
||||
List<AsnDetail> findByOrderNumber(String orderNumber);
|
||||
|
||||
@Query(value = " FROM AsnDetail ad WHERE ad.stock.code =?1 and ad.status not in('RECEIVED') ")
|
||||
List<AsnDetail> findByStockCode(String stockCode);
|
||||
|
||||
@Query(value = " FROM AsnDetail ad WHERE ad.orderNumber in :boxNumbers and ad.status not in('RECEIVED') ")
|
||||
List<AsnDetail> fingByAsnDetail(Set boxNumbers);
|
||||
@Query(value = " FROM AsnDetail ad WHERE ad.orderNumber in :boxNumbers ")
|
||||
List<AsnDetail> findByBoxNumbers(Set boxNumbers);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,34 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.CountDetail;
|
||||
import com.youchain.businessdata.domain.CountPlan;
|
||||
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 houjianlan
|
||||
* @date 2023-10-19
|
||||
**/
|
||||
* @author houjianlan
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-10-19
|
||||
**/
|
||||
public interface CountPlanRepository extends JpaRepository<CountPlan, Long>, JpaSpecificationExecutor<CountPlan> {
|
||||
}
|
||||
@Query(value = " from CountDetail cd WHERE cd.plan.id =:planId ")
|
||||
List<CountDetail> findByPlanId(Long planId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,17 @@
|
|||
package com.youchain.businessdata.repository;
|
||||
|
||||
import com.youchain.basicdata.domain.Box;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.businessdata.domain.Inventory;
|
||||
import com.youchain.businessdata.domain.ItemKey;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
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.Set;
|
||||
|
||||
/**
|
||||
* @author huojin
|
||||
|
|
@ -29,5 +34,25 @@ import java.util.List;
|
|||
* @date 2023-08-22
|
||||
**/
|
||||
public interface InventoryRepository extends JpaRepository<Inventory, Long>, JpaSpecificationExecutor<Inventory> {
|
||||
@Query("from Inventory inv where inv.itemKey.item.id =:itemId and inv.point.area.code in :areaCode order by inv.itemKey.propC1")
|
||||
List<Inventory> findByItemIdAndAreaCode(long itemId, Set areaCode);
|
||||
|
||||
@Query("from Inventory inv where inv.quantity > 0 " +
|
||||
"and (:itemKeyId is null or inv.itemKey.id = :itemKeyId) " +
|
||||
"and (:pointId is null or inv.point.id = :pointId) " +
|
||||
"and (:stockId is null or inv.stock.id = :stockId) " +
|
||||
"and (:deptId is null or inv.dept.id = :deptId)")
|
||||
List<Inventory> fingByInventory(Long itemKeyId, Long pointId, Long stockId, Long deptId);
|
||||
|
||||
@Query("from Inventory inv where inv.stock.id=:stockId and inv.quantity>0")
|
||||
List<Inventory> fingByStock(Long stockId);
|
||||
|
||||
@Query("from Inventory inv where inv.queuedQty <= 0 and inv.quantity >= 0 " +
|
||||
"and (:areaId is null or inv.point.area.id = :areaId) " +
|
||||
"and (:itemId is null or inv.itemKey.item.id = :itemId) " +
|
||||
"and (:type is null or " +
|
||||
"(:type = 'ZONE' and inv.point.area.id = :areaId) or " +
|
||||
"(:type = 'ITEM' and inv.itemKey.item.id = :itemId) or " +
|
||||
"(:type = 'WAREHOUSE'))")
|
||||
List<Inventory> getInvForPlan(String type, Long areaId, Long itemId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.basicdata.domain.Item;
|
||||
import com.youchain.businessdata.domain.Inventory;
|
||||
import com.youchain.businessdata.domain.ItemKey;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
|
@ -24,9 +25,16 @@ import org.springframework.data.jpa.repository.Query;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author houjianlan
|
||||
* @date 2023-08-21
|
||||
**/
|
||||
* @author houjianlan
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-08-21
|
||||
**/
|
||||
public interface ItemKeyRepository extends JpaRepository<ItemKey, Long>, JpaSpecificationExecutor<ItemKey> {
|
||||
}
|
||||
|
||||
@Query("from ItemKey inv " +
|
||||
"where " +
|
||||
"(:itemId is null or inv.item.id =:itemId) " +
|
||||
"and (:propC1 is null or inv.propC1 =:propC1)" +
|
||||
"and (:orderNumber is null or inv.orderNumber =:orderNumber)")
|
||||
List<ItemKey> findByItemAndPropC1AndOrderNumber(Long itemId, String propC1, String orderNumber);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,14 +15,11 @@
|
|||
*/
|
||||
package com.youchain.businessdata.repository;
|
||||
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.domain.Task;
|
||||
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;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
|
@ -31,6 +28,27 @@ import java.util.Set;
|
|||
* @date 2023-08-16
|
||||
**/
|
||||
public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificationExecutor<Task> {
|
||||
/**
|
||||
* 根据出库单明细查询未完成的Task集合
|
||||
*
|
||||
* @param pickDetailId
|
||||
* @return
|
||||
*/
|
||||
@Query("from Task t where t.pickDetail.id =:pickDetailId and t.planQty > t.moveQty")
|
||||
List<Task> findByPickNotAllTask(Long pickDetailId);
|
||||
|
||||
/**
|
||||
* 根据出库单明细查询已完成的Task集合
|
||||
*
|
||||
* @param pickDetailId
|
||||
* @return
|
||||
*/
|
||||
@Query("from Task t where t.pickDetail.id =:pickDetailId and t.planQty = t.moveQty")
|
||||
List<Task> findByPickAllTask(Long pickDetailId);
|
||||
|
||||
@Query(value = "from Task t where t.agvTask.id =:agvTaskId")
|
||||
List<Task> findByAgvTaskId(Long agvTaskId);
|
||||
|
||||
/**
|
||||
* 根据asnDetailIds查询任务
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@
|
|||
package com.youchain.businessdata.rest;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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;
|
||||
import com.youchain.businessdata.domain.AgvTask;
|
||||
|
|
@ -26,7 +24,6 @@ import com.youchain.businessdata.service.AgvTaskService;
|
|||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.StringUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -38,7 +35,6 @@ import io.swagger.annotations.*;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
|
@ -105,7 +101,7 @@ public class AgvTaskController {
|
|||
@Log("删除agvTask")
|
||||
@ApiOperation("删除agvTask")
|
||||
@PreAuthorize("@el.check('agvTask:del')")
|
||||
public ResponseEntity<Object> deleteAgvTask(@RequestBody Integer[] ids) {
|
||||
public ResponseEntity<Object> deleteAgvTask(@RequestBody Long[] ids) {
|
||||
agvTaskService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,34 +15,13 @@
|
|||
*/
|
||||
package com.youchain.businessdata.rest;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.domain.*;
|
||||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.StockService;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.basicdata.service.mapstruct.ItemMapper;
|
||||
import com.youchain.basicdata.service.mapstruct.PointMapper;
|
||||
import com.youchain.businessdata.ReturnJson.RRkMo;
|
||||
import com.youchain.businessdata.inputJson.IRkConfirm;
|
||||
import com.youchain.businessdata.inputJson.IRkInv;
|
||||
import com.youchain.businessdata.inputJson.IRkStockCode;
|
||||
import com.youchain.businessdata.inputJson.IScanPut;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.service.*;
|
||||
import com.youchain.businessdata.service.dto.AsnDetailDto;
|
||||
import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria;
|
||||
import com.youchain.config.FileProperties;
|
||||
import com.youchain.exception.handler.ApiError;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
|
@ -55,17 +34,9 @@ import org.springframework.web.bind.annotation.*;
|
|||
import io.swagger.annotations.*;
|
||||
|
||||
import java.beans.Transient;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
|
||||
/**
|
||||
* @author hjl
|
||||
|
|
@ -81,22 +52,7 @@ public class AsnDetailController {
|
|||
|
||||
private final AsnDetailService asnDetailService;
|
||||
|
||||
private final ItemService itemService;
|
||||
|
||||
private final TaskService taskService;
|
||||
|
||||
private final StockService stockService;
|
||||
private final StockRepository stockRepository;
|
||||
|
||||
private final ItemKeyService itemKeyService;
|
||||
|
||||
private final InventoryService invService;
|
||||
|
||||
private final InventoryLogService invLogService;
|
||||
|
||||
private final PointService pointService;
|
||||
|
||||
private final FileProperties properties;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
|
|
@ -107,14 +63,14 @@ public class AsnDetailController {
|
|||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询asn_detail")
|
||||
@ApiOperation("查询入库明细")
|
||||
public ResponseEntity<Object> queryAsnDetail(AsnDetailQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(asnDetailService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增asn_detail")
|
||||
@ApiOperation("新增asn_detail")
|
||||
@Log("新增入库明细")
|
||||
@ApiOperation("新增入库明细")
|
||||
@PreAuthorize("@el.check('asnDetail:add')")
|
||||
@Transient
|
||||
public ResponseEntity<Object> createAsnDetail(@Validated @RequestBody AsnDetail asnDetail) {
|
||||
|
|
@ -128,15 +84,6 @@ public class AsnDetailController {
|
|||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("采集MO票")
|
||||
@ApiOperation("新增createMoInfo")
|
||||
@PostMapping(value = "/createMoInfo")
|
||||
@PreAuthorize("@el.check('asnDetail:createMoInfo')")
|
||||
@Transient
|
||||
public ResponseEntity<Object> storeMO(@Validated @RequestBody AsnDetail asnDetail) {
|
||||
return addDetailMo(asnDetail, asnDetail.getPo(), asnDetail.getStock().getCode());
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Log("修改asn_detail")
|
||||
|
|
@ -147,22 +94,6 @@ public class AsnDetailController {
|
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PutMapping("/updateContainer")
|
||||
@Log("修改容器")
|
||||
@ApiOperation("修改容器")
|
||||
@PreAuthorize("@el.check('asnDetail:edit')")
|
||||
public ResponseEntity<Object> updateContainer(@Validated @RequestBody AsnDetail resources, @RequestParam("stockId") Long stockId) {
|
||||
Stock stockData = stockRepository.getById(stockId);
|
||||
Stock stock = resources.getStock();
|
||||
stockData.setStatus("FREE");
|
||||
stock.setStatus("USED");
|
||||
resources.setStock(stock);
|
||||
asnDetailService.update(resources);
|
||||
stockService.update(stockData);
|
||||
stockService.update(stock);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除asn_detail")
|
||||
@ApiOperation("删除asn_detail")
|
||||
|
|
@ -171,366 +102,4 @@ public class AsnDetailController {
|
|||
asnDetailService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("收货")
|
||||
@ApiOperation("收货数据")
|
||||
@PutMapping(value = "/checkAsn")
|
||||
@PreAuthorize("@el.check('asnDetail:checkAsn')")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> checkAsn(@RequestBody Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
AsnDetail d = asnDetailService.toEntity(asnDetailService.findById(id));
|
||||
String areaCode = null;
|
||||
String goodType = d.getItem().getGoodType();
|
||||
if (goodType != null && goodType.equals(BizStatus.ZC)) {
|
||||
areaCode = "ZCMCK";
|
||||
}
|
||||
List<Point> points = pointService.getPoint(BaseStatus.STORAGE, areaCode);
|
||||
Point dstPoint = null;
|
||||
if (points.size() > 0) {
|
||||
dstPoint = points.get(0);
|
||||
} else {
|
||||
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), "找不到空闲点位");
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
|
||||
ApiResult r1 = putawayInv(d, d.getPoint(), dstPoint);
|
||||
if (r1.getStatus() == 400) {
|
||||
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), r1.getMessage());
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
public ApiResult putawayInv(@RequestBody AsnDetail d, Point srcPoint, Point dstPoint) {
|
||||
if (d.getOrderQty() - d.getReceivedQty() > 0) {
|
||||
ItemKey ik = itemKeyService.getItemKey(d.getItem(), d.getPropC1(), d.getPropC3());
|
||||
Task t = new Task();
|
||||
t.setAsnDetail(d);
|
||||
t.setSrcStock(d.getStock());
|
||||
t.setSrcStockCode(d.getStock().getCode());
|
||||
t.setDstStock(d.getStock());
|
||||
t.setDstStockCode(d.getStock().getCode());
|
||||
t.setTaskStatus(BizStatus.OPEN);
|
||||
t.setItem(d.getItem());
|
||||
t.setPlanQty(d.getOrderQty());
|
||||
t.setItemKey(ik);
|
||||
if (srcPoint != null) {
|
||||
t.setSrcPoint(srcPoint);
|
||||
t.setSrcPointCode(srcPoint.getCode());
|
||||
}
|
||||
t.setDstPoint(dstPoint);
|
||||
t.setDstPointCode(dstPoint.getCode());
|
||||
taskService.create(t);
|
||||
d.setReceivedQty(d.getOrderQty());
|
||||
d.setStatus(BizStatus.RECEIVED);
|
||||
asnDetailService.update(d);
|
||||
dstPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(dstPoint);
|
||||
double srcQty = 0d;
|
||||
Inventory inv = invService.getInventory(ik, dstPoint, d.getStock(), d.getDept(), BizStatus.RECEIVING_UP);
|
||||
t.setInventory(inv);
|
||||
taskService.update(t);
|
||||
srcQty = inv.getQuantity();
|
||||
inv.addQty(inv, d.getOrderQty());
|
||||
invService.update(inv);
|
||||
invLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, null, ik, srcPoint, dstPoint, d.getStock(), d.getStock(), srcQty, d.getOrderQty(),
|
||||
BizStatus.ASN, d.getId(), inv.getId(), d.getRemark());
|
||||
} else {
|
||||
return ApiResult.result(400, d.getItem().getCode() + "已收货", "obj");
|
||||
}
|
||||
|
||||
return ApiResult.result(200, null, "obj");
|
||||
}
|
||||
|
||||
@PostMapping(value = "/import_mo")
|
||||
@ApiOperation("导入MO")
|
||||
@javax.transaction.Transactional
|
||||
@PreAuthorize("@el.check('asnDetail:list')")
|
||||
public ResponseEntity<Object> importMo(@RequestParam("file") MultipartFile multipartFile) {
|
||||
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
|
||||
String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename());
|
||||
String type = FileUtil.getFileType(suffix);
|
||||
log.error("--" + properties.getPath().getPath() + type + File.separator);
|
||||
File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator);
|
||||
//MO票、容器代码
|
||||
ExcelReader reader = ExcelUtil.getReader(file);
|
||||
Dept dept = UserUtils.getDept();
|
||||
int i = 0;
|
||||
int new_len = 0;
|
||||
try {
|
||||
List<Map<String, Object>> readAll = reader.readAll();
|
||||
for (i = 0; i < readAll.size(); i++) {
|
||||
log.error(i + "=====");
|
||||
String mo = readAll.get(i).get("MO票").toString().trim();
|
||||
String stockCode = readAll.get(i).get("容器代码").toString().trim();
|
||||
String[] str = mo.split("]");
|
||||
int j = 0;
|
||||
IScanPut s = new IScanPut();
|
||||
s.setScanCode(mo);
|
||||
ApiResult r1 = analysisMO(s);
|
||||
if (r1.getStatus() == 400) {
|
||||
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), r1.getMessage());
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
RRkMo rmo = (RRkMo) r1.getData();
|
||||
ApiResult r2 = retrievalStockCode(new IRkStockCode(rmo.getItemId(), stockCode));
|
||||
if (r2.getStatus() == 400) {
|
||||
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), r2.getMessage());
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
JSONObject obj = (JSONObject) r2.getData();
|
||||
Long stockId = (Long) obj.get("stockId");
|
||||
ApiResult r3 = createAsnDetail(new IRkConfirm(mo, rmo.getItemId(), rmo.getItemCode(), stockId, stockCode, rmo.getQty(), rmo.getPch(), rmo.getCjbh()));
|
||||
if (r3.getStatus() == 400) {
|
||||
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), r3.getMessage());
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
new_len++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ApiError apiError = ApiError.errorJosn(HttpStatus.BAD_REQUEST.value(), "导入异常---第" + (i + 1) + "行:" + e.toString());
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
ApiError apiError = ApiError.errorJosn(HttpStatus.OK.value(), "导入成功:" + (i) + "行 新增(" + new_len + ")");
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
@Log("保存MO票,生成入库采集数据")
|
||||
@ApiOperation("新增addDetailMo")
|
||||
@PostMapping(value = "/addDetailMo")
|
||||
@PreAuthorize("@el.check('asnDetail:addDetailMo')")
|
||||
@Transient
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> addDetailMo(AsnDetail asnDetail, String MO, String stockCode) {
|
||||
log.error("join.....addDetailMo:" + MO + "=====:" + stockCode);
|
||||
//MO票解析规则 LB]A0008157]230729]12122000026352]20]230729283171]]
|
||||
int j = 0;
|
||||
IScanPut s = new IScanPut();
|
||||
s.setScanCode(MO);
|
||||
ApiResult r1 = analysisMO(s);
|
||||
if (r1.getStatus() == 400) {
|
||||
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), r1.getMessage());
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
RRkMo rmo = (RRkMo) r1.getData();
|
||||
ApiResult r2 = retrievalStockCode(new IRkStockCode(rmo.getItemId(), stockCode));
|
||||
if (r2.getStatus() == 400) {
|
||||
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), r2.getMessage());
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
JSONObject obj = (JSONObject) r2.getData();
|
||||
Long stockId = (Long) obj.get("stockId");
|
||||
ApiResult r3 = createAsnDetail(new IRkConfirm(MO, rmo.getItemId(), rmo.getItemCode(), stockId, stockCode, rmo.getQty(), rmo.getPch(), rmo.getCjbh()));
|
||||
if (r3.getStatus() == 400) {
|
||||
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), r3.getMessage());
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/scanMO")
|
||||
@Log("扫描MO")
|
||||
@ApiOperation("扫描MO票接口")
|
||||
@PreAuthorize("@el.check('asnDetail:scanMO')")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> scanMO(@RequestBody IScanPut s) {
|
||||
ApiResult r = analysisMO(s);
|
||||
return HttpUtils.handle(r);
|
||||
}
|
||||
|
||||
public ApiResult analysisMO(IScanPut s) {
|
||||
//MO票解析规则 LB]A0008157]230729]12122000026352]20]230729283171]]
|
||||
String mo = s.getScanCode();
|
||||
String[] str = mo.split("]");
|
||||
RRkMo rm = new RRkMo();
|
||||
int j = 0;
|
||||
if (str.length <= 5) {
|
||||
rm.setMsg(mo + "格式不正确");
|
||||
String msg = mo + "格式不正确";
|
||||
return ApiResult.result(400, msg, rm);
|
||||
}
|
||||
String itemCode = str[3];
|
||||
Double qty = Double.parseDouble(str[4]);
|
||||
String pch = str[2];
|
||||
String cjbh = str[1];
|
||||
|
||||
rm.setCjbh(cjbh);
|
||||
rm.setQty(qty);
|
||||
rm.setPch(pch);
|
||||
rm.setItemCode(itemCode);
|
||||
Item it = itemService.existItem(itemCode);
|
||||
if (it == null) {
|
||||
rm.setMsg(itemCode + "不存在");
|
||||
String msg = itemCode + "不存在";
|
||||
return ApiResult.result(400, msg, rm);
|
||||
}
|
||||
rm.setItemId(it.getId());
|
||||
rm.setItemName(it.getName());
|
||||
return ApiResult.result(200, null, rm);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/scanStockCode")
|
||||
@Log("MO票采集,扫描容器号")
|
||||
@ApiOperation("MO票采集,扫描容器号")
|
||||
@PreAuthorize("@el.check('asnDetail:scanStockCode')")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> scanStockCode(@RequestBody IRkStockCode s) {
|
||||
ApiResult r = retrievalStockCode(s);
|
||||
return HttpUtils.handle(r);
|
||||
}
|
||||
|
||||
public ApiResult retrievalStockCode(IRkStockCode s) {
|
||||
JSONObject obj = new JSONObject();
|
||||
Long itemId = s.getItemId();
|
||||
String stockCode = s.getStockCode();
|
||||
Stock st = stockService.findByCode(stockCode, BaseStatus.FREE);
|
||||
if (st == null) {
|
||||
return ApiResult.result(400, stockCode + "不存在或已使用", obj);
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("stockId", st.getId());
|
||||
obj.putAll(map);
|
||||
return ApiResult.result(200, null, obj);
|
||||
}
|
||||
|
||||
@PostMapping("/putawayStock")
|
||||
@Log("APP入库上架")
|
||||
@ApiOperation("APP入库上架-容器号")
|
||||
@PreAuthorize("@el.check('asnDetail:putawayStock')")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> putawayStock(@RequestBody IRkInv rk) {
|
||||
String stockCode = rk.getStockCode();
|
||||
AsnDetail ad = asnDetailService.findByStock(stockCode);
|
||||
if (ad == null) {
|
||||
ApiError apiError = ApiError.errorJosn(HttpStatus.BAD_REQUEST.value(), stockCode + "找不到收货记录");
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
} else {
|
||||
rk.setAsnDetailId(ad.getId());
|
||||
return new ResponseEntity<>(rk, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/putawaySrcPoint")
|
||||
@Log("APP入库上架")
|
||||
@ApiOperation("APP入库上架-起点")
|
||||
@PreAuthorize("@el.check('asnDetail:putawaySrcPoint')")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> putawaySrcPoint(@RequestBody IRkInv rk) {
|
||||
String srcPointCode = rk.getSrcPointCode();
|
||||
Point srcPoint = pointService.findByCode(srcPointCode, null, null, null, null,null);
|
||||
if (srcPoint == null) {
|
||||
ApiError apiError = ApiError.errorJosn(HttpStatus.BAD_REQUEST.value(), srcPointCode + "找不到起点");
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
} else {
|
||||
rk.setSrcPointId(srcPoint.getId());
|
||||
return new ResponseEntity<>(rk, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/putawayConfirmApp")
|
||||
@Log("APP入库上架")
|
||||
@ApiOperation("APP入库上架")
|
||||
@PreAuthorize("@el.check('asnDetail:putawayConfirmApp')")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> putawayConfirmApp(@RequestBody IRkInv rk) {
|
||||
ApiResult r = putawayConfirm(rk);
|
||||
return HttpUtils.handle(r);
|
||||
}
|
||||
|
||||
|
||||
public ApiResult putawayConfirm(IRkInv rk) {
|
||||
JSONObject obj = new JSONObject();
|
||||
//查找容器是否有未完成记录
|
||||
// String stockCode=rk.getStockCode();
|
||||
// AsnDetail ad=asnDetailService.findByStock(stockCode);
|
||||
// if(ad==null){
|
||||
// return ApiResult.result(400,stockCode+"找不到收货记录",obj);
|
||||
// }
|
||||
//
|
||||
// String srcPointCode=rk.getSrcPointCode();
|
||||
String dstPointCode = rk.getDstPoinCode();
|
||||
AsnDetail ad = asnDetailService.toEntity(asnDetailService.findById(rk.getAsnDetailId()));
|
||||
Point srcPoint = pointService.findEntityById(rk.getSrcPointId());
|
||||
// Point srcPoint=pointService.findByCode(srcPointCode,null,null);
|
||||
// if (srcPoint == null) {
|
||||
// return ApiResult.result(400,srcPointCode+"找不到起点",obj);
|
||||
// }
|
||||
Point dstPoint = pointService.findByCode(dstPointCode, BaseStatus.FREE, BaseStatus.STORAGE, "", null,null);
|
||||
if (dstPoint == null) {
|
||||
return ApiResult.result(400, dstPoint + "找不到终点或状态不对", obj);
|
||||
}
|
||||
ApiResult r1 = putawayInv(ad, srcPoint, dstPoint);
|
||||
if (r1.getStatus() == 400) {
|
||||
return r1;
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
obj.putAll(map);
|
||||
return ApiResult.result(200, null, obj);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/storeAsnDetail")
|
||||
@Log("MO票确认绑定")
|
||||
@ApiOperation("MO票确认绑定")
|
||||
@PreAuthorize("@el.check('asnDetail:storeAsnDetail')")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> storeAsnDetail(@RequestBody IRkConfirm cf) {
|
||||
ApiResult r = createAsnDetail(cf);
|
||||
return HttpUtils.handle(r);
|
||||
}
|
||||
|
||||
public ApiResult createAsnDetail(IRkConfirm cf) {
|
||||
AsnDetail asnDetail = new AsnDetail();
|
||||
int j = 0;
|
||||
String mo = cf.getMo();
|
||||
String itemCode = cf.getItemCode();
|
||||
Double qty = cf.getQty();
|
||||
String pc = cf.getPch();
|
||||
String cjbh = cf.getCjbh();
|
||||
Long itemId = cf.getItemId();
|
||||
Long stockId = cf.getStockId();
|
||||
Item it = itemService.findByItemId(itemId);
|
||||
Stock st = stockService.toEntity(stockService.findById(stockId));
|
||||
|
||||
asnDetail.setPropC1(pc);
|
||||
asnDetail.setPropC2(cjbh);
|
||||
asnDetail.setOrderQty(qty);
|
||||
asnDetail.setDept(UserUtils.getDept());
|
||||
asnDetail.setItem(it);
|
||||
asnDetail.setStock(st);
|
||||
asnDetail.setStatus(BizStatus.OPEN);
|
||||
asnDetail.setPo(mo);
|
||||
asnDetail.setDept(UserUtils.getDept());
|
||||
asnDetailService.create(asnDetail);
|
||||
st.setStatus(BaseStatus.USED);
|
||||
stockService.update(st);
|
||||
return ApiResult.result(200, "绑定成功", "");
|
||||
}
|
||||
|
||||
@PostMapping("/scanStock")
|
||||
@Log("输送线扫码接口")
|
||||
@ApiOperation("输送线扫码接口")
|
||||
@AnonymousAccess
|
||||
public synchronized ResponseEntity<Object> boxTask(@RequestBody String json) {
|
||||
JSONObject jsonObject = JSON.parseObject(json);
|
||||
String stockCode = jsonObject.getString("stockCode");
|
||||
String taskCode = jsonObject.getString("taskCode");
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,26 +15,13 @@
|
|||
*/
|
||||
package com.youchain.businessdata.rest;
|
||||
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.service.dto.PointDto;
|
||||
import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
||||
import com.youchain.businessdata.domain.AgvTask;
|
||||
import com.youchain.businessdata.domain.BaseCode;
|
||||
import com.youchain.businessdata.repository.BaseCodeRepository;
|
||||
import com.youchain.businessdata.service.BaseCodeService;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||
import com.youchain.businessdata.service.dto.BaseCodeDto;
|
||||
import com.youchain.businessdata.service.dto.BaseCodeQueryCriteria;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.CodeForYmYtil;
|
||||
|
||||
import com.youchain.businessdata.domain.BaseCode;
|
||||
import com.youchain.businessdata.service.BaseCodeService;
|
||||
import com.youchain.businessdata.service.dto.BaseCodeQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
|
@ -42,10 +29,6 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
|
|
@ -100,14 +83,4 @@ public class BaseCodeController {
|
|||
baseCodeService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取baseCode
|
||||
* @param key_code 单头
|
||||
* @param len 流水号
|
||||
* @return
|
||||
*/
|
||||
public String baseCodeFor(String key_code, int len){
|
||||
return baseCodeService.baseCodeFor(key_code,len);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,23 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.Log;
|
||||
import com.youchain.businessdata.domain.Inventory;
|
||||
import com.youchain.businessdata.service.InventoryService;
|
||||
import com.youchain.businessdata.service.ItemKeyService;
|
||||
import com.youchain.businessdata.service.dto.InvQueryCriteria;
|
||||
import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -30,14 +29,15 @@ 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 huojin
|
||||
* @date 2023-08-22
|
||||
**/
|
||||
* @author huojin
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-08-22
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "inventory管理")
|
||||
|
|
@ -46,7 +46,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class InventoryController {
|
||||
|
||||
private final InventoryService inventoryService;
|
||||
private final ItemKeyService itemKeyService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
|
|
@ -58,26 +57,26 @@ public class InventoryController {
|
|||
|
||||
@GetMapping
|
||||
@ApiOperation("查询inventory")
|
||||
public ResponseEntity<Object> queryInventory(InventoryQueryCriteria criteria, Pageable pageable){
|
||||
if (criteria.getItemCodeOne()!=null&&criteria.getItemCode()!=null){
|
||||
public ResponseEntity<Object> queryInventory(InventoryQueryCriteria criteria, Pageable pageable) {
|
||||
if (criteria.getItemCodeOne() != null && criteria.getItemCode() != null) {
|
||||
criteria.setItemCodeOne(null);
|
||||
}
|
||||
return new ResponseEntity<>(inventoryService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
return new ResponseEntity<>(inventoryService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增inventory")
|
||||
@ApiOperation("新增inventory")
|
||||
@PreAuthorize("@el.check('inventory:add')")
|
||||
public ResponseEntity<Object> createInventory(@Validated @RequestBody Inventory resources){
|
||||
return new ResponseEntity<>(inventoryService.create(resources),HttpStatus.CREATED);
|
||||
public ResponseEntity<Object> createInventory(@Validated @RequestBody Inventory resources) {
|
||||
return new ResponseEntity<>(inventoryService.create(resources), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改inventory")
|
||||
@ApiOperation("修改inventory")
|
||||
@PreAuthorize("@el.check('inventory:edit')")
|
||||
public ResponseEntity<Object> updateInventory(@Validated @RequestBody Inventory resources){
|
||||
public ResponseEntity<Object> updateInventory(@Validated @RequestBody Inventory resources) {
|
||||
inventoryService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
|
@ -93,7 +92,7 @@ public class InventoryController {
|
|||
|
||||
@GetMapping(value = "/queryInv")
|
||||
@ApiOperation("查询inventory")
|
||||
public ResponseEntity<Object> queryInv(InvQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(inventoryService.queryAll(criteria),HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryInv(InvQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(inventoryService.queryAll(criteria), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class KMReSController {
|
|||
String missionStatus = missionStateCallback.getMissionStatus();//作业当前状态
|
||||
try {
|
||||
//货架任务
|
||||
AgvTaskDto agvTaskDto = agvTaskService.findById(Integer.parseInt(id));
|
||||
AgvTaskDto agvTaskDto = agvTaskService.findById(Long.parseLong(id));
|
||||
AgvTask agvTask = agvTaskService.toEntity(agvTaskDto);//转实体
|
||||
agvTaskService.agvTaskCallback(agvTask, missionStatus, containerCode);
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
||||
|
|
|
|||
|
|
@ -158,16 +158,6 @@ public class PickDetailController {
|
|||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryTaskApp")
|
||||
@Log("查询拣货列表")
|
||||
@ApiOperation("查询拣货列表")
|
||||
@PreAuthorize("@el.check('pickDetail:queryTaskApp')")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> queryTaskApp(@RequestBody IScanPut s){
|
||||
List<RPTaskList> t=taskService.queryTaskApp(null);
|
||||
return new ResponseEntity<>(t,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/pickingApp")
|
||||
@Log("APP拣货确认")
|
||||
@ApiOperation("APP拣货确认")
|
||||
|
|
@ -187,7 +177,7 @@ public class PickDetailController {
|
|||
|
||||
public ResponseEntity<Object> pick_in(Long pickDetailId){
|
||||
//查询未完成的拣货任务
|
||||
List<Task> Tasks = taskService.getPickNotAllTask(pickDetailId);
|
||||
List<Task> Tasks = taskService.findByPickNotAllTask(pickDetailId);
|
||||
if (Tasks.size() > 0) {
|
||||
try {
|
||||
for (Task task : Tasks) {
|
||||
|
|
@ -213,7 +203,7 @@ public class PickDetailController {
|
|||
@AnonymousAccess
|
||||
public synchronized ResponseEntity<Object> pickBarBack(@RequestBody Long pickDetailId) throws Exception {
|
||||
//查询已完成的拣货任务
|
||||
List<Task> Tasks = taskService.getPickAllTask(pickDetailId);
|
||||
List<Task> Tasks = taskService.findByPickAllTask(pickDetailId);
|
||||
if (Tasks.size() > 0) {
|
||||
try {
|
||||
for (Task task : Tasks) {
|
||||
|
|
|
|||
|
|
@ -17,16 +17,10 @@ package com.youchain.businessdata.rest;
|
|||
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.service.dto.PointDto;
|
||||
import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
||||
import com.youchain.businessdata.domain.Task;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
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;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -36,7 +30,6 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
|
|
@ -52,8 +45,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class TaskController {
|
||||
|
||||
private final TaskService taskService;
|
||||
private final TaskRepository taskRepository;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
|
|
@ -72,8 +63,6 @@ public class TaskController {
|
|||
@GetMapping(value = "/queryAsnTask")
|
||||
@ApiOperation("查询task")
|
||||
public ResponseEntity<Object> queryAsnTask(TaskQueryCriteria criteria){
|
||||
// TaskQueryCriteria tq=new TaskQueryCriteria();
|
||||
// tq.setAsnDetailId(id);
|
||||
return new ResponseEntity<>(taskService.queryAll(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,12 +15,10 @@
|
|||
*/
|
||||
package com.youchain.businessdata.service;
|
||||
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.businessdata.domain.AgvTask;
|
||||
import com.youchain.businessdata.domain.Pick;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -59,7 +57,7 @@ public interface AgvTaskService {
|
|||
* @param id ID
|
||||
* @return AgvTaskDto
|
||||
*/
|
||||
AgvTaskDto findById(Integer id);
|
||||
AgvTaskDto findById(Long id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
|
|
@ -81,7 +79,7 @@ public interface AgvTaskService {
|
|||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
|
|
@ -92,6 +90,8 @@ public interface AgvTaskService {
|
|||
*/
|
||||
void download(List<AgvTaskDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
AgvTask toEntity(AgvTaskDto agvTaskDto);
|
||||
|
||||
/**
|
||||
* 发送货架搬运接口任务
|
||||
*
|
||||
|
|
@ -117,16 +117,6 @@ public interface AgvTaskService {
|
|||
*/
|
||||
String sendAgvTaskGTImpl(List<AgvTask> agvTasks1, List<AgvTask> agvTasks2);
|
||||
|
||||
/**
|
||||
* 查询输送线上料箱总数
|
||||
*
|
||||
* @param taskCode-输送线编号
|
||||
* @return
|
||||
*/
|
||||
int QueryCount(String taskCode);
|
||||
|
||||
AgvTask toEntity(AgvTaskDto agvTaskDto);
|
||||
|
||||
/**
|
||||
* 任务回报更新状态
|
||||
*
|
||||
|
|
@ -136,14 +126,4 @@ public interface AgvTaskService {
|
|||
*/
|
||||
void agvTaskCallback(AgvTask agvTask, String status, String containerCode);
|
||||
|
||||
boolean findByendSlotCode(String endSlotCode, String type, String jobType);
|
||||
|
||||
List<AgvTask> findById(List<Integer> ids);
|
||||
|
||||
/**
|
||||
* 根据出库单备料
|
||||
*
|
||||
* @param pick->出库单
|
||||
*/
|
||||
void materialPick(Pick pick);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package com.youchain.businessdata.service;
|
|||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.service.dto.StockDto;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.service.dto.AsnDetailDto;
|
||||
import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria;
|
||||
|
|
@ -60,8 +59,6 @@ public interface AsnDetailService {
|
|||
*/
|
||||
AsnDetailDto findById(Long id);
|
||||
|
||||
AsnDetail getEntity(Long id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
|
|
@ -101,7 +98,7 @@ public interface AsnDetailService {
|
|||
* @param code
|
||||
* @return
|
||||
*/
|
||||
AsnDetail findByStock(String code);
|
||||
AsnDetail findByStock(String code, String status);
|
||||
|
||||
/**
|
||||
* 自动生成AsnDetail
|
||||
|
|
@ -123,6 +120,4 @@ public interface AsnDetailService {
|
|||
* @return
|
||||
*/
|
||||
boolean existsByboxNumber(String boxNumber);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,11 +81,4 @@ public interface BaseCodeService {
|
|||
*/
|
||||
void download(List<BaseCodeDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 获取BaseCode
|
||||
* @param key_code 表头
|
||||
* @param len 流水号
|
||||
* @return
|
||||
*/
|
||||
String baseCodeFor(String key_code, int len);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,8 @@
|
|||
*/
|
||||
package com.youchain.businessdata.service;
|
||||
|
||||
import com.youchain.basicdata.domain.Box;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.service.dto.BoxDto;
|
||||
import com.youchain.businessdata.domain.Inventory;
|
||||
import com.youchain.businessdata.domain.ItemKey;
|
||||
import com.youchain.businessdata.domain.Task;
|
||||
|
|
@ -31,6 +29,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
|
|
@ -102,7 +101,7 @@ public interface InventoryService {
|
|||
|
||||
Inventory toEntity(InventoryDto inventoryDto);
|
||||
|
||||
List<Inventory> queryInventory(long itemId, String areaCode);
|
||||
List<Inventory> findByItemIdAndAreaCode(long itemId, Set areaCode);
|
||||
|
||||
Inventory getInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, String type);
|
||||
|
||||
|
|
|
|||
|
|
@ -123,4 +123,13 @@ public interface PickService {
|
|||
* @param station->工位
|
||||
*/
|
||||
Pick createPick(Gd gd, int lineNo, String cpCodeOrpCode, String station);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据出库单备料
|
||||
*
|
||||
* @param pick->出库单
|
||||
*/
|
||||
void materialPick(Pick pick);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,9 @@ package com.youchain.businessdata.service;
|
|||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
||||
import com.youchain.businessdata.domain.AgvTask;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.domain.ItemKey;
|
||||
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 org.springframework.data.domain.Pageable;
|
||||
|
|
@ -109,7 +106,7 @@ public interface TaskService {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Task> getPickNotAllTask(Long id);
|
||||
List<Task> findByPickNotAllTask(Long id);
|
||||
|
||||
/**
|
||||
* 根据出库单明细查询已完成的Task集合
|
||||
|
|
@ -117,7 +114,7 @@ public interface TaskService {
|
|||
* @param pickDetailId
|
||||
* @return
|
||||
*/
|
||||
List<Task> getPickAllTask(Long pickDetailId);
|
||||
List<Task> findByPickAllTask(Long pickDetailId);
|
||||
|
||||
/**
|
||||
* 拣货
|
||||
|
|
@ -135,21 +132,7 @@ public interface TaskService {
|
|||
*/
|
||||
void pickBarBack(long taskId, double pickedQuantity) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询待拣货任务
|
||||
*
|
||||
* @param t 条件参数
|
||||
* @return List<TaskDto>
|
||||
*/
|
||||
List<RPTaskList> queryTaskApp(IPTask t);
|
||||
|
||||
Task createTask(Item item, ItemKey itemKey, AsnDetail asnDetail, Stock stock, Point point);
|
||||
|
||||
List<Task> getAgvTaskList(Integer agvTaskId);
|
||||
|
||||
Long getAsnDetailIdToId(Long id);
|
||||
|
||||
List<Task> queryInQHData(String time, String status);
|
||||
|
||||
List<Task> queryInQHALLData(String time);
|
||||
List<Task> getAgvTaskList(Long agvTaskId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import java.io.Serializable;
|
|||
public class AgvTaskDto implements Serializable {
|
||||
|
||||
/** 任务ID */
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
/** 容器码 */
|
||||
private String stockCode;
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@ import com.youchain.basicdata.domain.Point;
|
|||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.basicdata.service.StockService;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.repository.PickRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.service.*;
|
||||
import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
||||
|
|
@ -43,8 +41,6 @@ import org.springframework.data.domain.Pageable;
|
|||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
|
|
@ -67,9 +63,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
private final InventoryLogService inventoryLogService;
|
||||
private final PointService pointService;
|
||||
private final AsnDetailService asnDetailService;
|
||||
private final PickRepository pickRepository;
|
||||
private final StockRepository stockRepository;
|
||||
private final EntityManager entityMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(AgvTaskQueryCriteria criteria, Pageable pageable) {
|
||||
|
|
@ -84,7 +78,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public AgvTaskDto findById(Integer id) {
|
||||
public AgvTaskDto findById(Long id) {
|
||||
AgvTask agvTask = agvTaskRepository.findById(id).orElseGet(AgvTask::new);
|
||||
ValidationUtil.isNull(agvTask.getId(), "AgvTask", "id", id);
|
||||
return agvTaskMapper.toDto(agvTask);
|
||||
|
|
@ -106,8 +100,8 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
agvTaskRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -390,15 +384,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int QueryCount(String taskCode) {
|
||||
|
||||
String jsonObject = "{\"taskCode\":\"" + taskCode + "\"}";//查询出库缓存输送线上满料箱总数
|
||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.QueryCount(), jsonObject);
|
||||
JSONObject json = JSON.parseObject(resultJson);
|
||||
String queryCount = json.getString("queryCount");
|
||||
|
||||
return Integer.parseInt(queryCount);
|
||||
}
|
||||
|
||||
public AgvTask toEntity(AgvTaskDto agvTaskDto) {
|
||||
return agvTaskMapper.toEntity(agvTaskDto);
|
||||
|
|
@ -811,50 +796,4 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
pointService.update(point);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean findByendSlotCode(String endSlotCode, String type, String jobType) {
|
||||
String hql = " from AgvTask agv " + " where agv.endSlotCode='" + endSlotCode + "' " + " and agv.type='" + type + "' " + " and agv.jobType='" + jobType + "' " + " and agv.status in ('ATCALL','UP_CONTAINER') ";
|
||||
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
List<AgvTask> agvTaskList = query.getResultList();
|
||||
if (agvTaskList.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AgvTask> findById(List<Integer> ids) {
|
||||
String agvTaskIds = StringUtils.strip(ids.toString(), "[]");
|
||||
String hql = " from AgvTask agv where agv.id in (" + agvTaskIds + ") ";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
List<AgvTask> agvTaskList = query.getResultList();
|
||||
return agvTaskList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void materialPick(Pick pick) {
|
||||
AgvTask agvTask = null;
|
||||
List<Task> taskList = taskRepository.findByNotPickTask(pick.getId());
|
||||
for (Task task : taskList) {
|
||||
/*生成搬运任务*/
|
||||
List<AgvTask> agvTaskList = agvTaskRepository.findRepeat(task.getSrcPointCode(), task.getDstPointCode());
|
||||
if (agvTaskList.size() > 0) {
|
||||
agvTask = agvTaskList.get(0);
|
||||
} else {
|
||||
agvTask = new AgvTask(BizStatus.PICK, task.getSrcStockCode(), task.getSrcPointCode(), task.getDstPointCode(), BizStatus.OPEN, "");
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
task.setAgvTask(agvTask);
|
||||
taskRepository.save(task);
|
||||
sendAgvTaskImpl(agvTask);
|
||||
}
|
||||
/*更新出库单状态*/
|
||||
pick.setStatus(BizStatus.PICKUP);
|
||||
pickRepository.save(pick);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import com.youchain.basicdata.domain.Item;
|
|||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.basicdata.service.StockService;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.service.TaskService;
|
||||
import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
||||
|
|
@ -40,7 +39,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
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;
|
||||
|
|
@ -58,10 +56,7 @@ import cn.hutool.core.date.DateUtil;
|
|||
public class AsnDetailServiceImpl implements AsnDetailService {
|
||||
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
private final StockRepository stockRepository;
|
||||
private final AsnDetailMapper asnDetailMapper;
|
||||
private final EntityManager entityMapper;
|
||||
private final TaskService taskService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(AsnDetailQueryCriteria criteria, Pageable pageable) {
|
||||
|
|
@ -82,13 +77,6 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
return asnDetailMapper.toDto(asnDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AsnDetail getEntity(Long id) {
|
||||
AsnDetail asnDetail = asnDetailRepository.findById(id).orElseGet(AsnDetail::new);
|
||||
return asnDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AsnDetailDto create(AsnDetail resources) {
|
||||
|
|
@ -107,18 +95,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");
|
||||
stockRepository.save(stock);
|
||||
//删除关联表的数据 入库单明细(data_asn_detail)
|
||||
if (taskService.getAsnDetailIdToId(id) != null) {
|
||||
taskService.deleteById(taskService.getAsnDetailIdToId(id));
|
||||
}
|
||||
asnDetailRepository.deleteById(id);
|
||||
}
|
||||
asnDetailRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -167,35 +144,10 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AsnDetail findByStock(String code) {
|
||||
String hql = "select d from AsnDetail d where d.stock.code='" + code + "' and d.status='" + BizStatus.OPEN + "'";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
List<AsnDetail> ts = query.getResultList();
|
||||
if (ts.size() > 0) {
|
||||
return ts.get(0);
|
||||
}
|
||||
return null;
|
||||
public AsnDetail findByStock(String code, String status) {
|
||||
return asnDetailRepository.findByStock(code, status);
|
||||
}
|
||||
|
||||
public List<Object[]> queryIn(String type, String date, String zoneType) {
|
||||
String hql = "";
|
||||
if (type.equals("Day")) {
|
||||
hql = "select sum(d.orderQty),sum(d.receivedQty) from AsnDetail d " +
|
||||
" where DATE_FORMAT(d.createTime,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d')";
|
||||
} else if (type.equals("Month")) {
|
||||
hql = "select sum(d.orderQty),sum(d.receivedQty) from AsnDetail d " +
|
||||
" where DATE_FORMAT(d.createTime,'%Y-%m')=DATE_FORMAT(now(),'%Y-%m')";
|
||||
} else if (type.equals("InOutDay")) {
|
||||
hql = "select DATE_FORMAT(d.createTime,'%Y-%m-%d'),sum(d.receivedQty) from AsnDetail d " +
|
||||
" where DATE_FORMAT(d.createTime,'%Y-%m-%d')>='" + date + "' " +
|
||||
" group by DATE_FORMAT(d.createTime,'%Y-%m-%d')";
|
||||
}
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
List<Object[]> ts = query.getResultList();
|
||||
return ts;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint, String propC1, String gdh, String propC3, Timestamp propD1, Double orderQty, String Po) {
|
||||
AsnDetail asnDetail = new AsnDetail();
|
||||
|
|
@ -234,10 +186,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
|
||||
@Override
|
||||
public boolean existsByboxNumber(String boxNumber) {
|
||||
String hql = " from AsnDetail ad where ad.orderNumber=:boxNumber ";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("boxNumber", boxNumber);
|
||||
List<AsnDetail> asnDetailList = query.getResultList();
|
||||
List<AsnDetail> asnDetailList = asnDetailRepository.findByOrderNumber(boxNumber);
|
||||
if (asnDetailList.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.businessdata.domain.BaseCode;
|
||||
|
|
@ -28,18 +28,16 @@ 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.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author baobinglin
|
||||
* @date 2023-08-22
|
||||
**/
|
||||
* @author baobinglin
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @date 2023-08-22
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BaseCodeServiceImpl implements BaseCodeService {
|
||||
|
|
@ -48,29 +46,29 @@ public class BaseCodeServiceImpl implements BaseCodeService {
|
|||
private final BaseCodeMapper baseCodeMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(BaseCodeQueryCriteria criteria, Pageable pageable){
|
||||
Page<BaseCode> page = baseCodeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
public Map<String, Object> queryAll(BaseCodeQueryCriteria criteria, Pageable pageable) {
|
||||
Page<BaseCode> page = baseCodeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
return PageUtil.toPage(page.map(baseCodeMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseCodeDto> queryAll(BaseCodeQueryCriteria criteria){
|
||||
return baseCodeMapper.toDto(baseCodeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
public List<BaseCodeDto> queryAll(BaseCodeQueryCriteria criteria) {
|
||||
return baseCodeMapper.toDto(baseCodeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public BaseCodeDto findById(Integer id) {
|
||||
BaseCode baseCode = baseCodeRepository.findById(id).orElseGet(BaseCode::new);
|
||||
ValidationUtil.isNull(baseCode.getId(),"BaseCode","id",id);
|
||||
ValidationUtil.isNull(baseCode.getId(), "BaseCode", "id", id);
|
||||
return baseCodeMapper.toDto(baseCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseCodeDto create(BaseCode resources) {
|
||||
if(baseCodeRepository.findByCode(resources.getCode()) != null){
|
||||
throw new EntityExistException(BaseCode.class,"code",resources.getCode());
|
||||
if (baseCodeRepository.findByCode(resources.getCode()) != null) {
|
||||
throw new EntityExistException(BaseCode.class, "code", resources.getCode());
|
||||
}
|
||||
return baseCodeMapper.toDto(baseCodeRepository.save(resources));
|
||||
}
|
||||
|
|
@ -79,7 +77,7 @@ public class BaseCodeServiceImpl implements BaseCodeService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(BaseCode resources) {
|
||||
BaseCode baseCode = baseCodeRepository.findById(resources.getId()).orElseGet(BaseCode::new);
|
||||
ValidationUtil.isNull( baseCode.getId(),"BaseCode","id",resources.getId());
|
||||
ValidationUtil.isNull(baseCode.getId(), "BaseCode", "id", resources.getId());
|
||||
baseCode = baseCodeRepository.findById(resources.getId()).get();
|
||||
/*if(baseCode != null && !baseCode.getId().equals(baseCode.getId())){
|
||||
throw new EntityExistException(BaseCode.class,"code",resources.getCode());
|
||||
|
|
@ -99,41 +97,13 @@ public class BaseCodeServiceImpl implements BaseCodeService {
|
|||
public void download(List<BaseCodeDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (BaseCodeDto baseCode : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put(" code", baseCode.getCode());
|
||||
map.put(" key", baseCode.getKey());
|
||||
map.put(" value", baseCode.getValue());
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put(" code", baseCode.getCode());
|
||||
map.put(" key", baseCode.getKey());
|
||||
map.put(" value", baseCode.getValue());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
private static String key_time_type="yyMMdd";//时间
|
||||
@Override
|
||||
public synchronized String baseCodeFor(String key_code, int len){
|
||||
String code="";
|
||||
String key_time = new SimpleDateFormat(key_time_type).format(Calendar.getInstance().getTime());
|
||||
String key=key_code+key_time;
|
||||
|
||||
String value;
|
||||
BaseCodeQueryCriteria queryBaseCode=new BaseCodeQueryCriteria();
|
||||
queryBaseCode.setKey(key);
|
||||
List<BaseCodeDto> baseCodeDtos = queryAll(queryBaseCode);
|
||||
BaseCode baseCode = new BaseCode();
|
||||
if (baseCodeDtos.size()<1){
|
||||
baseCode.setKey(key);
|
||||
baseCode.setValue("0");
|
||||
create(baseCode);
|
||||
}else {
|
||||
baseCode=baseCodeMapper.toEntity(baseCodeDtos.get(0));
|
||||
}
|
||||
value = (Integer.valueOf(baseCode.getValue().toString())+1)+"";
|
||||
baseCode.setValue(value);
|
||||
while (value.length()<len){
|
||||
value="0"+value;
|
||||
}
|
||||
code=key+value;
|
||||
baseCode.setCode(code);
|
||||
update(baseCode);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,22 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.Point;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.domain.CountDetail;
|
||||
import com.youchain.businessdata.domain.CountPlan;
|
||||
import com.youchain.businessdata.service.dto.AsnDetailDto;
|
||||
import com.youchain.utils.FileUtil;
|
||||
import com.youchain.utils.PageUtil;
|
||||
import com.youchain.utils.QueryHelp;
|
||||
|
|
@ -36,21 +33,21 @@ import cn.hutool.core.lang.Snowflake;
|
|||
import cn.hutool.core.util.IdUtil;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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
|
||||
* @description 服务实现
|
||||
* @author houjianlan
|
||||
* @date 2023-10-19
|
||||
**/
|
||||
* @author houjianlan
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @date 2023-10-19
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CountPlanServiceImpl implements CountPlanService {
|
||||
|
|
@ -60,21 +57,21 @@ public class CountPlanServiceImpl implements CountPlanService {
|
|||
private final EntityManager entityMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(CountPlanQueryCriteria criteria, Pageable pageable){
|
||||
Page<CountPlan> page = countPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
public Map<String, Object> queryAll(CountPlanQueryCriteria criteria, Pageable pageable) {
|
||||
Page<CountPlan> page = countPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
return PageUtil.toPage(page.map(countPlanMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CountPlanDto> queryAll(CountPlanQueryCriteria criteria){
|
||||
return countPlanMapper.toDto(countPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
public List<CountPlanDto> queryAll(CountPlanQueryCriteria criteria) {
|
||||
return countPlanMapper.toDto(countPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public CountPlanDto findById(Long id) {
|
||||
CountPlan countPlan = countPlanRepository.findById(id).orElseGet(CountPlan::new);
|
||||
ValidationUtil.isNull(countPlan.getId(),"CountPlan","id",id);
|
||||
ValidationUtil.isNull(countPlan.getId(), "CountPlan", "id", id);
|
||||
return countPlanMapper.toDto(countPlan);
|
||||
}
|
||||
|
||||
|
|
@ -82,7 +79,7 @@ public class CountPlanServiceImpl implements CountPlanService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public CountPlanDto create(CountPlan resources) {
|
||||
Snowflake snowflake = IdUtil.createSnowflake(1, 1);
|
||||
resources.setId(snowflake.nextId());
|
||||
resources.setId(snowflake.nextId());
|
||||
return countPlanMapper.toDto(countPlanRepository.save(resources));
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +87,7 @@ public class CountPlanServiceImpl implements CountPlanService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(CountPlan resources) {
|
||||
CountPlan countPlan = countPlanRepository.findById(resources.getId()).orElseGet(CountPlan::new);
|
||||
ValidationUtil.isNull( countPlan.getId(),"CountPlan","id",resources.getId());
|
||||
ValidationUtil.isNull(countPlan.getId(), "CountPlan", "id", resources.getId());
|
||||
countPlan.copy(resources);
|
||||
countPlanRepository.save(countPlan);
|
||||
}
|
||||
|
|
@ -106,7 +103,7 @@ public class CountPlanServiceImpl implements CountPlanService {
|
|||
public void download(List<CountPlanDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (CountPlanDto countPlan : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("代码", countPlan.getCode());
|
||||
map.put("名称", countPlan.getName());
|
||||
map.put("仓库ID", countPlan.getDept());
|
||||
|
|
@ -132,10 +129,7 @@ public class CountPlanServiceImpl implements CountPlanService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<CountDetail> findAllDetail(Long planId){
|
||||
String hql=" from CountDetail d where d.plan.id= "+planId;
|
||||
Query query=entityMapper.createQuery(hql);
|
||||
List<CountDetail> detailList=query.getResultList();
|
||||
return detailList;
|
||||
public List<CountDetail> findAllDetail(Long planId) {
|
||||
return countPlanRepository.findByPlanId(planId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,18 +21,15 @@ import com.youchain.RequestData.ZcData;
|
|||
import com.youchain.basicdata.domain.BigItem;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.PackageCheck;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.repository.BigItemRepository;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.repository.PackageCheckRepository;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.businessdata.domain.Gd;
|
||||
import com.youchain.businessdata.domain.GdDetail;
|
||||
import com.youchain.businessdata.domain.Pick;
|
||||
import com.youchain.businessdata.repository.GdDetailRepository;
|
||||
import com.youchain.businessdata.repository.PickRepository;
|
||||
import com.youchain.businessdata.service.PickDetailService;
|
||||
import com.youchain.businessdata.service.PickService;
|
||||
import com.youchain.config.thread.ThreadPoolExecutorUtil;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.modules.system.service.DeptService;
|
||||
import com.youchain.utils.*;
|
||||
|
|
@ -50,6 +47,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -65,12 +63,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class GdServiceImpl implements GdService {
|
||||
|
||||
private final GdRepository gdRepository;
|
||||
private final GdDetailRepository gdDetailRepository;
|
||||
private final BigItemRepository bigItemRepository;
|
||||
private final ItemRepository itemRepository;
|
||||
private final PickService pickService;
|
||||
private final PickRepository pickRepository;
|
||||
private final PointRepository pointRepository;
|
||||
private final PickDetailService pickDetailService;
|
||||
private final DeptService deptService;
|
||||
private final GdMapper gdMapper;
|
||||
|
|
@ -78,6 +73,8 @@ public class GdServiceImpl implements GdService {
|
|||
private final PackageCheckRepository packageCheckRepository;
|
||||
private final BatchCreateOrUpdate batchCreateOrUpdate;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(GdQueryCriteria criteria, Pageable pageable) {
|
||||
Page<Gd> page = gdRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
|
|
@ -275,11 +272,14 @@ public class GdServiceImpl implements GdService {
|
|||
gdDetailsCreate.addAll(gdDetailsCreateDP);
|
||||
|
||||
/** 批量保存工单明细 */
|
||||
ExecutorService executor = ThreadPoolExecutorUtil.getPoll("gdDetail-create-job");
|
||||
CompletableFuture<List<GdDetail>> future = CompletableFuture.supplyAsync(() -> {
|
||||
batchCreateOrUpdate.batchCreate(gdDetailsCreate);
|
||||
return gdDetailsCreate;
|
||||
});
|
||||
return future.join();// 返回结果
|
||||
}, executor);
|
||||
List<GdDetail> gdDetails = future.join();
|
||||
executor.shutdown();// 关闭线程池
|
||||
return gdDetails;// 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -395,9 +395,6 @@ public class GdServiceImpl implements GdService {
|
|||
Map<String, List<GdDetail>> groupedByCpCodeMap = cpGdDetailList.stream()
|
||||
.collect(Collectors.groupingBy(gdDetail -> gdDetail.getBigItem().getCode()));
|
||||
|
||||
/** 根据成品工单明细生成出库单和出库单明细 */
|
||||
createPickAndPickDetail(gd, groupedByCpCodeMap, lineNo);
|
||||
|
||||
/** 单品工单明细集合 */
|
||||
List<GdDetail> dpGdDetailList = gdDetailList.stream()
|
||||
.filter(gdDetail -> BaseStatus.GD_TYPE_DP.equals(gdDetail.getOrderType()))
|
||||
|
|
@ -407,6 +404,9 @@ public class GdServiceImpl implements GdService {
|
|||
Map<String, List<GdDetail>> groupedByDpCodeMap = dpGdDetailList.stream()
|
||||
.collect(Collectors.groupingBy(gdDetail -> gdDetail.getItem().getCode()));
|
||||
|
||||
/** 根据成品工单明细生成出库单和出库单明细 */
|
||||
createPickAndPickDetail(gd, groupedByCpCodeMap, lineNo);
|
||||
|
||||
/** 根据单品工单明细生成出库单和出库单明细 */
|
||||
createPickAndPickDetail(gd, groupedByDpCodeMap, lineNo);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import org.springframework.data.domain.Pageable;
|
|||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -137,47 +136,15 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Inventory> queryInventory(long itemId, String areaCode) {
|
||||
StringBuilder hql = new StringBuilder("FROM Inventory inv WHERE inv.itemKey.item.id = :itemId AND inv.quantity > inv.queuedQty ");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("itemId", itemId);
|
||||
if (areaCode.contains(",")) {
|
||||
List<String> areas = Arrays.asList(areaCode.split(","));
|
||||
hql.append(" AND inv.point.area.code IN (:areaCode)");
|
||||
params.put("areaCode", areas);
|
||||
} else {
|
||||
hql.append(" AND inv.point.area.code = :areaCode");
|
||||
params.put("areaCode", areaCode);
|
||||
}
|
||||
|
||||
hql.append(" ORDER BY inv.createTime");
|
||||
Query query = entityManager.createQuery(hql.toString());
|
||||
params.forEach(query::setParameter);
|
||||
|
||||
return query.getResultList();
|
||||
public List<Inventory> findByItemIdAndAreaCode(long itemId, Set areaCode) {
|
||||
return inventoryRepository.findByItemIdAndAreaCode(itemId, areaCode);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Inventory getInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, String type) {
|
||||
//生成Inventory
|
||||
String hql = " from Inventory inv where 1=1 and inv.quantity>0 ";
|
||||
if (itemKey != null) {
|
||||
hql += " and inv.itemKey.id=" + itemKey.getId() + " ";
|
||||
}
|
||||
if (point != null) {
|
||||
hql += " and inv.point.id=" + point.getId() + " ";
|
||||
}
|
||||
if (stock != null) {
|
||||
hql += " and inv.stock.id=" + stock.getId() + " ";
|
||||
}
|
||||
|
||||
if (dept != null) {
|
||||
hql += " and inv.dept.id=" + dept.getId() + " ";
|
||||
}
|
||||
Query query = entityManager.createQuery(hql);
|
||||
List<Inventory> inventoryList = query.getResultList();
|
||||
List<Inventory> inventoryList = inventoryRepository.fingByInventory(itemKey.getId(), point.getId(), stock.getId(), dept.getId());
|
||||
Inventory inventory = null;
|
||||
if (inventoryList.size() > 0) {
|
||||
inventory = inventoryList.get(0);
|
||||
|
|
@ -199,25 +166,12 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
|
||||
@Override
|
||||
public List<Inventory> queryInventory(Stock stock) {
|
||||
String hql = " from Inventory inv where inv.stock.id=:stockId and inv.quantity>0 ";
|
||||
Query query = entityManager.createQuery(hql);
|
||||
query.setParameter("stockId", stock.getId());
|
||||
return query.getResultList();
|
||||
return inventoryRepository.fingByStock(stock.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Inventory> getInvForPlan(String type, Long areaId, Long itemId, Long deptId) {
|
||||
String hql = " from Inventory inv where 1=1 and inv.queuedQty<=0 and inv.quantity>=0";
|
||||
if (type.equals(BizStatus.ZONE)) {
|
||||
hql += " and inv.point.area.id=" + areaId;
|
||||
} else if (type.equals(BizStatus.ITEM)) {
|
||||
hql += " and inv.itemKey.item.id=" + itemId;
|
||||
} else if (type.equals(BizStatus.WAREHOUSE)) {
|
||||
hql += " and 1=1";
|
||||
}
|
||||
Query query = entityManager.createQuery(hql);
|
||||
List<Inventory> list = query.getResultList();
|
||||
return list;
|
||||
return inventoryRepository.getInvForPlan(type, areaId, itemId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import org.springframework.data.domain.Pageable;
|
|||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
|
|
@ -120,26 +119,9 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ItemKey getItemKey(Item item, String propC1, String orderNumber) {
|
||||
StringBuilder hql = new StringBuilder(" from ItemKey ik where 1=1 ");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
if (item != null) {
|
||||
hql.append(" and ik.item.id = :itemId");
|
||||
params.put("itemId", item.getId());
|
||||
}
|
||||
if (propC1 != null && !propC1.isEmpty()) {
|
||||
hql.append(" and ik.propC1 = :propC1");
|
||||
params.put("propC1", propC1);
|
||||
}
|
||||
if (orderNumber != null && !orderNumber.isEmpty()) {
|
||||
hql.append(" and ik.orderNumber = :orderNumber");
|
||||
params.put("orderNumber", orderNumber);
|
||||
}
|
||||
Query query = entityManager.createQuery(hql.toString());
|
||||
params.forEach(query::setParameter);
|
||||
|
||||
Optional<ItemKey> itemKey = query.getResultStream().findFirst();
|
||||
if (itemKey.isPresent()) {
|
||||
return itemKey.get();
|
||||
List<ItemKey> itemKeyList = itemKeyRepository.findByItemAndPropC1AndOrderNumber(item.getId(), propC1, orderNumber);
|
||||
if (!itemKeyList.isEmpty()) {
|
||||
return itemKeyList.get(0);
|
||||
} else {
|
||||
ItemKey newItemKey = new ItemKey();
|
||||
newItemKey.setItem(item);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import com.youchain.basicdata.service.PointService;
|
|||
import com.youchain.basicdata.service.dto.ItemDto;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.repository.*;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.businessdata.service.InventoryService;
|
||||
import com.youchain.businessdata.service.TaskService;
|
||||
import com.youchain.businessdata.service.dto.InventoryDto;
|
||||
|
|
@ -147,7 +146,8 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
if (pd.getAllocatedQty() >= pd.getOrderQty()) {
|
||||
return pick.getCode() + "出库单;" + item.getCode() + "数量已分配!";
|
||||
}
|
||||
List<Inventory> Inventorys = inventoryService.queryInventory(item.getId(), areaCode);
|
||||
Set<String> areaCodes = Collections.singleton(areaCode);
|
||||
List<Inventory> Inventorys = inventoryService.findByItemIdAndAreaCode(item.getId(), areaCodes);
|
||||
if (Inventorys.isEmpty()) {
|
||||
return pick.getCode() + "出库单;" + item.getCode() + "物料库存不足,请先补充库存!";
|
||||
}
|
||||
|
|
@ -210,7 +210,8 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
ItemDto itemDto = pickDetailDto.getItem();
|
||||
Item item = itemService.toEntity(itemDto);
|
||||
Dept dept = item.getDept();//仓库
|
||||
List<Inventory> Inventorys = inventoryService.queryInventory(item.getId(), areaCode);
|
||||
Set<String> areaCodes = Collections.singleton(areaCode);
|
||||
List<Inventory> Inventorys = inventoryService.findByItemIdAndAreaCode(item.getId(), areaCodes);
|
||||
if (Inventorys.size() > 0) {
|
||||
Inventory inv = Inventorys.get(0);
|
||||
//库存冻结状态不允许出库
|
||||
|
|
@ -262,7 +263,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
|
||||
PickDetailDto pickDetailDto = findById(id);
|
||||
PickDetail pd = toEntity(pickDetailDto);
|
||||
List<Task> Tasks = taskService.getPickNotAllTask(id);
|
||||
List<Task> Tasks = taskService.findByPickNotAllTask(id);
|
||||
for (Task task : Tasks) {
|
||||
//根据Taskz找到对应的库存
|
||||
InventoryDto inventoryDto = inventoryService.findById(task.getInventory().getId());
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@
|
|||
*/
|
||||
package com.youchain.businessdata.service.impl;
|
||||
|
||||
import com.youchain.businessdata.domain.Gd;
|
||||
import com.youchain.businessdata.domain.GdDetail;
|
||||
import com.youchain.businessdata.domain.Pick;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.PickRepository;
|
||||
|
|
@ -48,6 +49,9 @@ import java.util.LinkedHashMap;
|
|||
public class PickServiceImpl implements PickService {
|
||||
|
||||
private final PickRepository pickRepository;
|
||||
private final TaskRepository taskRepository;
|
||||
private final AgvTaskRepository agvTaskRepository;
|
||||
private final AgvTaskService agvTaskService;
|
||||
private final PickMapper pickMapper;
|
||||
|
||||
@Override
|
||||
|
|
@ -168,4 +172,29 @@ public class PickServiceImpl implements PickService {
|
|||
pickRepository.save(pick);
|
||||
return pick;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void materialPick(Pick pick) {
|
||||
AgvTask agvTask = null;
|
||||
List<Task> taskList = taskRepository.findByNotPickTask(pick.getId());
|
||||
for (Task task : taskList) {
|
||||
/*生成搬运任务*/
|
||||
List<AgvTask> agvTaskList = agvTaskRepository.findRepeat(task.getSrcPointCode(), task.getDstPointCode());
|
||||
if (agvTaskList.size() > 0) {
|
||||
agvTask = agvTaskList.get(0);
|
||||
} else {
|
||||
agvTask = new AgvTask(BizStatus.PICK, task.getSrcStockCode(), task.getSrcPointCode(), task.getDstPointCode(), BizStatus.OPEN, "");
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
task.setAgvTask(agvTask);
|
||||
taskRepository.save(task);
|
||||
agvTaskService.sendAgvTaskImpl(agvTask);
|
||||
}
|
||||
/*更新出库单状态*/
|
||||
pick.setStatus(BizStatus.PICKUP);
|
||||
pickRepository.save(pick);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,19 +15,14 @@
|
|||
*/
|
||||
package com.youchain.businessdata.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.inputJson.IPTask;
|
||||
import com.youchain.businessdata.repository.*;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.businessdata.service.InventoryLogService;
|
||||
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -36,8 +31,6 @@ import com.youchain.businessdata.service.dto.TaskDto;
|
|||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||
import com.youchain.businessdata.service.mapstruct.TaskMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.transform.AliasToEntityMapResultTransformer;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
|
@ -46,7 +39,6 @@ import org.springframework.data.domain.Pageable;
|
|||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
|
|
@ -65,11 +57,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
private final InventoryRepository inventoryRepository;
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
private final InventoryLogService inventoryLogService;
|
||||
private final PointService pointService;
|
||||
private final EntityManager entityMapper;
|
||||
private final StockRepository stockRepository;
|
||||
private final StockTypeToAreaMap stockTypeToAreaMap;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(TaskQueryCriteria criteria, Pageable pageable) {
|
||||
Page<Task> page = taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
|
|
@ -149,21 +137,13 @@ public class TaskServiceImpl implements TaskService {
|
|||
|
||||
|
||||
@Override
|
||||
public List<Task> getPickNotAllTask(Long pickDetailId) {
|
||||
String hql = " from Task t where t.pickDetail.id =:pickDetailId and t.planQty > t.moveQty ";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("pickDetailId", pickDetailId);
|
||||
List<Task> tasks = query.getResultList();
|
||||
return tasks;
|
||||
public List<Task> findByPickNotAllTask(Long pickDetailId) {
|
||||
return taskRepository.findByPickNotAllTask(pickDetailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Task> getPickAllTask(Long pickDetailId) {
|
||||
String hql = " from Task t where t.pickDetail.id =:pickDetailId and t.planQty = t.moveQty ";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("pickDetailId", pickDetailId);
|
||||
List<Task> tasks = query.getResultList();
|
||||
return tasks;
|
||||
public List<Task> findByPickAllTask(Long pickDetailId) {
|
||||
return taskRepository.findByPickAllTask(pickDetailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -252,26 +232,6 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<RPTaskList> queryTaskApp(IPTask t) {
|
||||
String sql = "SELECT t.pick_detail_id pickDetailId, it.code itemCode,it.`name` itemName,t.plan_qty qty,ik.prop_c1 pch,t.src_point_code srcPointCode,t.src_stock_code stockCode,t.dst_point_code dstPointCode\n" +
|
||||
" from data_task t\n" +
|
||||
"left join data_pick_detail d on t.pick_detail_id=d.id\n" +
|
||||
"left join data_item_key ik on ik.id=t.item_key_id\n" +
|
||||
"left join base_item it on it.id=ik.item_id\n" +
|
||||
"where d.`status`='ALLOCATE' \n" +
|
||||
"ORDER BY it.code";
|
||||
List ts = entityMapper.createNativeQuery(sql)
|
||||
.unwrap(SQLQuery.class)
|
||||
.setResultTransformer(
|
||||
AliasToEntityMapResultTransformer.INSTANCE
|
||||
)
|
||||
.list();
|
||||
log.error(JSON.toJSONString(ts));
|
||||
List<RPTaskList> l = JSON.parseArray(JSON.toJSONString(ts), RPTaskList.class);
|
||||
return l;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Task createTask(Item item, ItemKey itemKey, AsnDetail asnDetail, Stock stock, Point point) {
|
||||
Task task = new Task(item, itemKey, asnDetail.getOrderNumber(), BizStatus.ASN, asnDetail,
|
||||
|
|
@ -283,73 +243,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Task> getAgvTaskList(Integer agvTaskId) {
|
||||
String hql = " from Task t where t.agvTask.id =:agvTaskId ";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("agvTaskId", agvTaskId);
|
||||
List<Task> tasks = query.getResultList();
|
||||
return tasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getAsnDetailIdToId(Long asnDetailId) {
|
||||
String hql = " select t.id from Task t where t.asnDetail.id =:asnDetailId ";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("asnDetailId", asnDetailId);
|
||||
Long taskId = (Long) query.getSingleResult();
|
||||
return taskId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Task> queryInQHData(String time, String status) {
|
||||
String hql = " from Task t where t.dstPoint.code like :dstPointCode and DATE_FORMAT(t.createTime , '%Y-%m-%d')> :startTime and t.taskStatus = :status ";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("dstPointCode", "MA1151-QHL%");
|
||||
query.setParameter("startTime", time);
|
||||
query.setParameter("status", status);
|
||||
List<Task> tasks = query.getResultList();
|
||||
return tasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Task> queryInQHALLData(String time) {
|
||||
String hql = " from Task t where t.dstPoint.code like :dstPointCode and DATE_FORMAT(t.createTime , '%Y-%m-%d')> :startTime ";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
query.setParameter("dstPointCode", "MA1151-QHL%");
|
||||
query.setParameter("startTime", time);
|
||||
List<Task> tasks = query.getResultList();
|
||||
return tasks;
|
||||
}
|
||||
|
||||
|
||||
public List<Object[]> queryAreaMonth(String type) {
|
||||
List<Object[]> taskList = null;
|
||||
String hql = "";
|
||||
if (type.equals("IN")) {
|
||||
hql += " select t.dstPoint.area.name,count(t.id) from Task t where t.dstPoint.area.name in ('" + AreaNameDic.DJQ + "','" + AreaNameDic.XJQ + "')";
|
||||
hql += " and t.asnDetail.id is not null ";
|
||||
hql += " group by t.dstPoint.area.name";
|
||||
} else if (type.equals("OUT")) {
|
||||
hql += " select t.srcPoint.area.name,count(t.id) from Task t where t.srcPoint.area.name in ('" + AreaNameDic.DJQ + "','" + AreaNameDic.XJQ + "')";
|
||||
hql += " and t.pickDetail.id is not null ";
|
||||
hql += " group by t.srcPoint.area.name";
|
||||
}
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
taskList = query.getResultList();
|
||||
return taskList;
|
||||
}
|
||||
|
||||
public List<Object[]> queryAreaDay(String type, String zoneType) {
|
||||
List<Object[]> taskList = null;
|
||||
String hql = "select count(t.id),CAST(sum(t.moveQty) as integer )from Task t where 1=1";
|
||||
if (type.equals("IN")) {
|
||||
hql += " and t.asnDetail.id is not null ";
|
||||
} else if (type.equals("OUT")) {
|
||||
hql += " and t.pickDetail.id is not null ";
|
||||
}
|
||||
hql += " and DATE_FORMAT(t.createTime,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d')";
|
||||
Query query = entityMapper.createQuery(hql);
|
||||
taskList = query.getResultList();
|
||||
return taskList;
|
||||
public List<Task> getAgvTaskList(Long agvTaskId) {
|
||||
return taskRepository.findByAgvTaskId(agvTaskId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,11 +17,13 @@ package com.youchain.config.thread;
|
|||
|
||||
import com.youchain.utils.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* 自定义线程名称
|
||||
*
|
||||
* @author Liu Xue
|
||||
* @date 2019年10月31日17:49:55
|
||||
*/
|
||||
|
|
@ -39,7 +41,7 @@ public class TheadFactoryName implements ThreadFactory {
|
|||
this(DEF_NAME);
|
||||
}
|
||||
|
||||
public TheadFactoryName(String name){
|
||||
public TheadFactoryName(String name) {
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
group = (s != null) ? s.getThreadGroup() :
|
||||
Thread.currentThread().getThreadGroup();
|
||||
|
|
@ -51,7 +53,7 @@ public class TheadFactoryName implements ThreadFactory {
|
|||
public Thread newThread(Runnable r) {
|
||||
//此时线程的名字 就是 namePrefix + -exec- + 这个线程池中第几个执行的线程
|
||||
Thread t = new Thread(group, r,
|
||||
namePrefix + "-exec-"+threadNumber.getAndIncrement(),
|
||||
namePrefix + "-exec-" + threadNumber.getAndIncrement(),
|
||||
0);
|
||||
if (t.isDaemon()) {
|
||||
t.setDaemon(false);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.youchain.businessdata.domain.Pick;
|
|||
import com.youchain.businessdata.repository.PickRepository;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.businessdata.service.PickDetailService;
|
||||
import com.youchain.businessdata.service.PickService;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -25,8 +26,7 @@ public class pickTask {
|
|||
public PickDetailService pickDetailService;
|
||||
|
||||
@Autowired
|
||||
public AgvTaskService agvTaskService;
|
||||
|
||||
public PickService pickService;
|
||||
|
||||
/**
|
||||
* 定时检测打开和分配中的出库单,分配库存
|
||||
|
|
@ -39,7 +39,6 @@ public class pickTask {
|
|||
} else {
|
||||
for (Pick pick : pickList) {
|
||||
pickDetailService.allocatePick(pick);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +55,7 @@ public class pickTask {
|
|||
throw new RuntimeException("无已分配的出库单,下发任务失败!");
|
||||
} else {
|
||||
for (Pick pick : pickList) {
|
||||
agvTaskService.materialPick(pick);
|
||||
pickService.materialPick(pick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
package com.youchain.utils;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author houjianlan
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-08-17
|
||||
**/
|
||||
public interface BizStatus {
|
||||
public interface BizStatus {
|
||||
/**
|
||||
* 出入库状态-打开||任务状态-待执行
|
||||
*/
|
||||
|
|
@ -33,7 +34,9 @@ public interface BizStatus {
|
|||
* 出入库状态-已关闭
|
||||
*/
|
||||
public static String CLOSE = "CLOSE";
|
||||
/** 分配中*/
|
||||
/**
|
||||
* 分配中
|
||||
*/
|
||||
public static String ASSIGN = "ASSIGN";
|
||||
/**
|
||||
* 出库状态-分配完成;
|
||||
|
|
@ -59,7 +62,7 @@ public interface BizStatus {
|
|||
/**
|
||||
* 任务状态-执行中
|
||||
*/
|
||||
public static String ATCALL = "ATCALL";
|
||||
public static String ATCALL = "ATCALL";
|
||||
|
||||
/**
|
||||
* 任务状态-工作中
|
||||
|
|
@ -81,8 +84,6 @@ public interface BizStatus {
|
|||
*/
|
||||
public static String FB_RETURN = "FB_RETURN";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 任务状态-完成
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.youchain.businessdata.domain.AgvTask;
|
|||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.domain.GdDetail;
|
||||
import com.youchain.businessdata.domain.PickDetail;
|
||||
import com.youchain.utils.StringUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
|
|
@ -26,6 +27,22 @@ public class EladminSystemApplicationTests {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String name = "point-import-job";
|
||||
StringUtils.isNotBlank(name);
|
||||
if(StringUtils.isNotBlank(name)){
|
||||
System.out.println("name is not blank");
|
||||
}else{
|
||||
System.out.println("name is blank");
|
||||
}
|
||||
}
|
||||
|
||||
private static final int MAX_TASK_COUNT = 4;
|
||||
private static final long TIMEOUT_MS = 600000; // 10分钟,以毫秒为单位
|
||||
private long lastTaskTime = System.currentTimeMillis();
|
||||
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
||||
|
||||
void aa() {
|
||||
|
||||
PickDetail pickDetail1 = new PickDetail();
|
||||
pickDetail1.setId(1L);
|
||||
pickDetail1.setOrderQty(2d);
|
||||
|
|
@ -56,14 +73,6 @@ public class EladminSystemApplicationTests {
|
|||
System.out.println("部分已分配");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final int MAX_TASK_COUNT = 4;
|
||||
private static final long TIMEOUT_MS = 600000; // 10分钟,以毫秒为单位
|
||||
private long lastTaskTime = System.currentTimeMillis();
|
||||
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
||||
|
||||
void aa() {
|
||||
List<Integer> list1 = Arrays.asList();
|
||||
List<Integer> list2 = Arrays.asList();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue