add:增加根据出库单送料功能
This commit is contained in:
@@ -50,4 +50,12 @@ public class AcsToWmsController {
|
||||
public ResponseEntity<Object> apply(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(acsToWmsService.apply(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/*接收上游系统出库单请求*/
|
||||
@PostMapping("/receiveOrder")
|
||||
@Log("lms接收wms出库单")
|
||||
@ApiOperation("lms接收wms出库单")
|
||||
public ResponseEntity<Object> receiveTaskStatusAcs(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(acsToWmsService.receiveOrder(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,6 @@ public interface AcsToWmsService {
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject apply(JSONObject whereJson);
|
||||
|
||||
JSONObject receiveOrder(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.nl.wms.ext.acs.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
/**
|
||||
* 接收wms出库单请求参数
|
||||
* @author sxp
|
||||
*/
|
||||
@Data
|
||||
public class ReceiveOrderReq {
|
||||
//wms出库单号
|
||||
private String deliveryno;
|
||||
//wms出库单行号
|
||||
private String deliverylineno;
|
||||
//任务号
|
||||
private String reqCode;
|
||||
//出库单单号
|
||||
private String orderkey;
|
||||
//出库单行号
|
||||
private String orderline;
|
||||
//物料
|
||||
private String sku;
|
||||
//物料描述
|
||||
private String skudesc;
|
||||
//数量
|
||||
private String qty;
|
||||
//库存批
|
||||
private String ctlCode;
|
||||
//拣货单号
|
||||
private String pickdetailkey;
|
||||
//配盘单号
|
||||
private String ppno;
|
||||
//生产批次号
|
||||
private String wbs;
|
||||
//定向号
|
||||
private String lottable09;
|
||||
//配盘点代码
|
||||
private String c_pp_code;
|
||||
//配盘点描述
|
||||
private String c_pp_name;
|
||||
//计量单位
|
||||
private String uom;
|
||||
//需送货时间
|
||||
private String scheduledshipdate;
|
||||
//立库代码
|
||||
private String lk_code;
|
||||
//WMS出库时间
|
||||
private String outboundtime;
|
||||
//供应商名称
|
||||
private String companyname;
|
||||
//供应商代码
|
||||
private String companycode;
|
||||
//货权方
|
||||
private String lottable06;
|
||||
//工厂库存地
|
||||
private String lottable02;
|
||||
//操作人
|
||||
private String editwho;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.ext.acs.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 接收wms出库单返回参数
|
||||
* @author sxp
|
||||
*/
|
||||
@Data
|
||||
public class ReceiveOrderRes {
|
||||
//状态码 200
|
||||
private int statusCode;
|
||||
//是否成功 false\true
|
||||
private boolean isSuccess;
|
||||
//错误码
|
||||
private int errCode;
|
||||
//错误信息
|
||||
private String message;
|
||||
//数据
|
||||
private String data;
|
||||
//timestamp
|
||||
private String timestamp;
|
||||
}
|
||||
@@ -420,6 +420,51 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return resuft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject receiveOrder(JSONObject json) {
|
||||
String reqCode = json.getString("reqCode");
|
||||
String deliveryNo = json.getString("deliveryno");
|
||||
String deliveryLineNo = json.getString("deliverylineno");
|
||||
String sku = json.getString("sku");
|
||||
String lkCode = json.getString("lkCode");
|
||||
String pickDetailKey = json.getString("pickdetailkey");
|
||||
String qty = json.getString("qty");
|
||||
String outboundTime = json.getString("outboundtime");
|
||||
WQLObject noteTab = WQLObject.getWQLObject("ext_delivery_note");//上游系统出库单表
|
||||
JSONObject orderJson = new JSONObject();
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("timestamp", DateUtil.now());
|
||||
res.put("data", null);
|
||||
try {
|
||||
orderJson.put("note_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
orderJson.put("req_code", reqCode);
|
||||
orderJson.put("deliveryno", deliveryNo);
|
||||
orderJson.put("deliverylineno", deliveryLineNo);
|
||||
orderJson.put("sku", sku);
|
||||
orderJson.put("lkCode", lkCode);
|
||||
orderJson.put("pickdetailkey", pickDetailKey);
|
||||
orderJson.put("qty", qty);
|
||||
orderJson.put("outboundtime", outboundTime);
|
||||
orderJson.put("request_param", json);
|
||||
orderJson.put("create_time", DateUtil.now());
|
||||
res.put("statusCode", HttpStatus.OK.value());
|
||||
res.put("isSuccess", true);
|
||||
res.put("errCode", 0);
|
||||
res.put("message", "");
|
||||
orderJson.put("response_param", res);
|
||||
noteTab.insert(orderJson);
|
||||
} catch (Exception e) {
|
||||
String message = ObjectUtil.isEmpty(e.getMessage())
|
||||
? ((InvocationTargetException) e).getTargetException().getMessage()
|
||||
: e.getMessage();
|
||||
res.put("statusCode", HttpStatus.BAD_REQUEST.value());
|
||||
res.put("isSuccess", false);
|
||||
res.put("errCode", HttpStatus.BAD_REQUEST.value());
|
||||
res.put("message", message);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createEmp(JSONObject json) {
|
||||
String vehicle_qty = json.getString("vehicle_qty");
|
||||
|
||||
BIN
lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/wql/ext.xls
Normal file
BIN
lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/wql/ext.xls
Normal file
Binary file not shown.
@@ -211,7 +211,7 @@ public class PadController {
|
||||
return new ResponseEntity<>(resultJSON, HttpStatus.OK);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(padService.send(startPointCode), HttpStatus.OK);
|
||||
return new ResponseEntity<>(padService.send(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,4 +316,14 @@ public class PadController {
|
||||
|
||||
return new ResponseEntity<>(padService.p2p(startPointCode, nextPointCode), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询出库单列表
|
||||
*/
|
||||
@PostMapping("/getOrderList")
|
||||
@Log("查询出库单")
|
||||
@ApiOperation("查询出库单")
|
||||
public ResponseEntity<JSONObject> getOrderList() {
|
||||
return new ResponseEntity<>(padService.getOrderList(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ public interface PadService {
|
||||
/**
|
||||
* 送料(确定起点)
|
||||
*
|
||||
* @param startPointCode 起点编码
|
||||
* @param param 起点编码、出库单ID
|
||||
* @return 提示
|
||||
*/
|
||||
JSONObject send(String startPointCode);
|
||||
JSONObject send(JSONObject param);
|
||||
|
||||
/**
|
||||
* 查询该区域已锁定或未锁定的排号
|
||||
@@ -100,4 +100,7 @@ public interface PadService {
|
||||
* @return 提示
|
||||
*/
|
||||
JSONObject p2p(String startPointCode, String nextPointCode);
|
||||
|
||||
JSONObject getOrderList();
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.nl.wms.sch.tasks.CallTask;
|
||||
import org.nl.wms.sch.tasks.P2PTask;
|
||||
import org.nl.wms.sch.tasks.SendTask;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@@ -312,18 +313,18 @@ public class PadServiceImpl implements PadService {
|
||||
/**
|
||||
* 送料(确定起点)
|
||||
*
|
||||
* @param startPointCode 起点编码
|
||||
* @param param 起点编码、出库单ID
|
||||
* @return 提示
|
||||
*/
|
||||
@Override
|
||||
public JSONObject send(String startPointCode) {
|
||||
public JSONObject send(JSONObject param) {
|
||||
// 返回值
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
|
||||
// 调用送料任务类创建任务
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", startPointCode);
|
||||
// JSONObject param = new JSONObject();
|
||||
// param.put("start_point_code", startPointCode);
|
||||
sendTask.createTask(param);
|
||||
} catch (Exception e) {
|
||||
resultJSON.put("code", "0");
|
||||
@@ -457,4 +458,16 @@ public class PadServiceImpl implements PadService {
|
||||
resultJSON.put("desc", "已创建任务");
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getOrderList() {
|
||||
JSONObject res = new JSONObject();
|
||||
JSONArray arrayList = WQLObject.getWQLObject("ext_delivery_note")
|
||||
.query("", "create_time desc")
|
||||
.getResultJSONArray(0);
|
||||
res.put("code", "1");
|
||||
res.put("desc", "查询成功");
|
||||
res.put("result",arrayList);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
@@ -15,9 +17,15 @@ import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 徐工送料任务类
|
||||
*
|
||||
@@ -146,6 +154,48 @@ public class SendTask extends AbstractAcsTask {
|
||||
startPoint.put("update_optname", username);
|
||||
startPoint.put("update_time", now);
|
||||
WQLObject.getWQLObject("sch_base_point").update(startPoint);
|
||||
//任务绑定的出库单信息
|
||||
JSONObject taskNoteBindInfo= WQLObject.getWQLObject("ext_delivery_note_task").query("task_id = '" + taskId + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskNoteBindInfo)){
|
||||
String noteId = taskNoteBindInfo.getString("note_id");
|
||||
//需要返回物料单信息给上游系统
|
||||
this.feedBackOutBoundRes(noteId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*反馈出库结果*/
|
||||
private void feedBackOutBoundRes(String noteId) {
|
||||
JSONObject deliveryNote = WQLObject
|
||||
.getWQLObject("ext_delivery_note")
|
||||
.query("note_id = '" + noteId + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(deliveryNote)){
|
||||
return;
|
||||
}
|
||||
JSONObject material = new JSONObject();
|
||||
material.put("rowIndex",deliveryNote.getString(""));
|
||||
material.put("qty",deliveryNote.getString("qty"));
|
||||
material.put("orderlineno",deliveryNote.getString("orderlineno"));
|
||||
material.put("pickdetailkey",deliveryNote.getString("pickdetailkey"));
|
||||
JSONArray array = new JSONArray();
|
||||
array.add(material);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("reqCode",deliveryNote.getString("req_code"));
|
||||
param.put("opNo",deliveryNote.getString("deliveryno"));
|
||||
param.put("whseId","WMWHSE12");
|
||||
param.put("lkCode","lk_code");
|
||||
param.put("itemRows",array);
|
||||
String api ="";
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(api)
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
JSONObject result = JSONObject.parseObject(resultMsg);
|
||||
log.info("上游系统反馈结果----------------+" + api + ",---" + result.toString());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
System.out.println(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,13 +212,13 @@ public class SendTask extends AbstractAcsTask {
|
||||
/**
|
||||
* 创建任务
|
||||
*
|
||||
* @param param String start_point_code 点位编码
|
||||
* @param param String start_point_code 点位编码 note_id 出库单号
|
||||
* @return 任务id
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String createTask(JSONObject param) {
|
||||
String startPointCode = param.getString("start_point_code");
|
||||
String startPointCode = param.getString("start_devicecode");
|
||||
|
||||
// 判断点位是否存在
|
||||
JSONObject startPoint = WQLObject
|
||||
@@ -188,6 +238,62 @@ public class SendTask extends AbstractAcsTask {
|
||||
if (StrUtil.equals(startPoint.getString("point_status"), "00")) {
|
||||
throw new BadRequestException("该点位是空位");
|
||||
}
|
||||
String startReginId = startPoint.getString("region_id");
|
||||
JSONObject startPointRegin = WQLObject
|
||||
.getWQLObject("sch_base_region")
|
||||
.query("region_id = '" + startReginId + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(startPointRegin)){
|
||||
throw new BadRequestException("起点区域为空");
|
||||
}
|
||||
//如果起点是原料周转区,需要根据出库单选择对应的终点
|
||||
if ("YL".equals(startPointRegin.getString("region_code"))){
|
||||
String noteId = param.getString("note_id");
|
||||
String col = startPoint.getString("col");
|
||||
String nextPointCode="";
|
||||
if ("1".equals(col)){
|
||||
nextPointCode = "DLZMHC01";
|
||||
}
|
||||
if ("2".equals(col)){
|
||||
nextPointCode = "DZZMHC01";
|
||||
}
|
||||
if ("3".equals(col)){
|
||||
nextPointCode = "XZZMHC01";
|
||||
}
|
||||
if ("7".equals(col)){
|
||||
nextPointCode = "XLZMHC01";
|
||||
}
|
||||
// 判断终点是否存在
|
||||
JSONObject nextPoint = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("point_code = '" + nextPointCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(nextPoint)) {
|
||||
throw new BadRequestException("未找到终点");
|
||||
}
|
||||
|
||||
// 判断终点是否可用
|
||||
if (!"00".equals(nextPoint.getString("lock_type"))) {
|
||||
throw new BadRequestException(startPoint.getString("point_name") + "已被锁定");
|
||||
}
|
||||
if (!"00".equals(nextPoint.getString("point_status"))) {
|
||||
throw new BadRequestException("终点有货");
|
||||
}
|
||||
String taskTd = createTaskRelated(
|
||||
startPoint,
|
||||
nextPoint,
|
||||
param,
|
||||
SendTask.class,
|
||||
"02",
|
||||
CodeUtil.getNewCode("SEND_BILL_CODE"),
|
||||
"2");
|
||||
WQLObject noteTaskTab = WQLObject.getWQLObject("ext_delivery_note_task");
|
||||
Map<String,String> data = new HashMap<>();
|
||||
data.put("task_id",taskTd);
|
||||
data.put("note_id",noteId);
|
||||
noteTaskTab.insert(data);
|
||||
return taskTd;
|
||||
}
|
||||
|
||||
// 查询点位的送料区域
|
||||
String nextRegionId = startPoint.getString("next_region_id");
|
||||
|
||||
Reference in New Issue
Block a user