0805代码更新
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
package com.zg.common.utils.http;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.*;
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URL;
|
||||
@@ -290,4 +286,48 @@ public class HttpUtils
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static String sendPostJson(String url, String jsonBody) {
|
||||
BufferedReader in = null;
|
||||
OutputStream os = null;
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
log.info("sendPostJson - {}", url);
|
||||
URL realUrl = new URL(url);
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)");
|
||||
conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||
conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
|
||||
os = conn.getOutputStream();
|
||||
os.write(jsonBody.getBytes(StandardCharsets.UTF_8));
|
||||
os.flush();
|
||||
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result.append(line);
|
||||
}
|
||||
log.info("recv - {}", result);
|
||||
} catch (Exception e) {
|
||||
log.error("调用HttpUtils.sendPostJson异常, url=" + url + ",param=" + jsonBody, e);
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
log.error("关闭流异常", ex);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -120,6 +120,7 @@ public class SecurityConfig
|
||||
"/system/config/**",
|
||||
"/AutoInventory/**",
|
||||
"/ws/**",
|
||||
"/wisdom/**",
|
||||
"/mock/**",
|
||||
"/information/device/**",
|
||||
"/MatchScan/**",
|
||||
|
||||
@@ -214,7 +214,7 @@ public class RkInfo extends BaseEntity
|
||||
private String hasMoved;
|
||||
|
||||
/** 是否借料(0否 1是) */
|
||||
@Excel(name = "是否借料", readConverterExp = "0=否,1=是")
|
||||
@Excel(name = "是否借料", readConverterExp = "0=否,1=是,2=已归还")
|
||||
private String isBorrowed;
|
||||
|
||||
/** 签字图片URL(image_type = 0) */
|
||||
|
||||
@@ -14,8 +14,8 @@ import java.util.List;
|
||||
public class StockOutDTO {
|
||||
|
||||
/** 领用时间(出库时间) */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date lyTime;
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
// private Date lyTime;
|
||||
|
||||
/** 借用时间 */
|
||||
private Date borrowTime;
|
||||
|
||||
@@ -51,18 +51,18 @@ public class DdTaskServiceImpl implements IDdTaskService {
|
||||
@Autowired
|
||||
private AgyWcsMapper agyWcsMapper;
|
||||
//
|
||||
// @Value("${agv.job.create-url}")
|
||||
// private String agvJobCreateUrl;
|
||||
//
|
||||
// @Value("${wcs.job.create-url}")
|
||||
// private String wcsJobCreateUrl;
|
||||
|
||||
@Value("${mock.agv-job-create-url}")
|
||||
@Value("${agv.job.create-url}")
|
||||
private String agvJobCreateUrl;
|
||||
|
||||
@Value("${mock.wcs-job-create-url}")
|
||||
@Value("${wcs.job.create-url}")
|
||||
private String wcsJobCreateUrl;
|
||||
|
||||
// @Value("${mock.agv-job-create-url}")
|
||||
// private String agvJobCreateUrl;
|
||||
//
|
||||
// @Value("${mock.wcs-job-create-url}")
|
||||
// private String wcsJobCreateUrl;
|
||||
|
||||
@Override
|
||||
public List<DdTask> selectDdTaskList(DdTask ddTask) {
|
||||
return ddTaskMapper.selectDdTaskList(ddTask);
|
||||
@@ -181,9 +181,7 @@ public class DdTaskServiceImpl implements IDdTaskService {
|
||||
}
|
||||
|
||||
log.info("[任务执行] 出库 → 调用WCS,taskId={}, param={}", taskIdParam, wcsParam);
|
||||
response = HttpUtils.sendPost(wcsJobCreateUrl, wcsParam.toJSONString());
|
||||
|
||||
System.out.println("这是打印的出库时调用wcs的响应结果!!!!!!!!" + response);
|
||||
response = HttpUtils.sendPostJson(wcsJobCreateUrl, wcsParam.toJSONString());
|
||||
|
||||
JSONObject respJson;
|
||||
try {
|
||||
@@ -198,7 +196,6 @@ public class DdTaskServiceImpl implements IDdTaskService {
|
||||
throw new ServiceException("WCS任务执行失败: " + msg);
|
||||
}
|
||||
|
||||
// 写入 WCS 执行记录
|
||||
WcsTaskResult wcs = new WcsTaskResult();
|
||||
wcs.setTaskId(taskIdParam);
|
||||
wcs.setTaskStatus("1");
|
||||
@@ -214,7 +211,7 @@ public class DdTaskServiceImpl implements IDdTaskService {
|
||||
wcs.setUpdateTime(now);
|
||||
wcsTaskResultMapper.insertWcsTaskResult(wcs);
|
||||
|
||||
// 调用 AGV(立即)
|
||||
// 调用 AGV
|
||||
requestId = taskNo + "12";
|
||||
JSONObject agvParam = new JSONObject();
|
||||
agvParam.put("owner", "wms");
|
||||
@@ -226,7 +223,7 @@ public class DdTaskServiceImpl implements IDdTaskService {
|
||||
agvParam.put("requestId", requestId);
|
||||
|
||||
log.info("[任务执行] 出库 → 调用AGV,requestId={}, param={}", requestId, agvParam);
|
||||
response = HttpUtils.sendPost(agvJobCreateUrl, agvParam.toJSONString());
|
||||
response = HttpUtils.sendPostJson(agvJobCreateUrl, agvParam.toJSONString());
|
||||
|
||||
try {
|
||||
respJson = JSON.parseObject(response);
|
||||
@@ -256,7 +253,6 @@ public class DdTaskServiceImpl implements IDdTaskService {
|
||||
agv.setUpdateTime(now);
|
||||
agvTaskResultMapper.insertAgvTaskResult(agv);
|
||||
|
||||
// ✅ 保存 WCS 与 AGV 映射关系
|
||||
AgyWcs mapping = new AgyWcs();
|
||||
mapping.setRequestId(requestId);
|
||||
mapping.setTaskId(taskIdParam);
|
||||
@@ -275,11 +271,16 @@ public class DdTaskServiceImpl implements IDdTaskService {
|
||||
param.put("requestId", requestId);
|
||||
|
||||
log.info("[任务执行] 类型={}(AGV),requestId={}, param={}", taskType, requestId, param);
|
||||
response = HttpUtils.sendPost(agvJobCreateUrl, param.toJSONString());
|
||||
response = HttpUtils.sendPostJson(agvJobCreateUrl, param.toJSONString());
|
||||
|
||||
JSONObject respJson = JSON.parseObject(response);
|
||||
code = respJson.getInteger("code");
|
||||
msg = respJson.getString("msg");
|
||||
JSONObject respJson;
|
||||
try {
|
||||
respJson = JSON.parseObject(response);
|
||||
code = respJson.getInteger("code");
|
||||
msg = respJson.getString("msg");
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("AGV响应解析失败: " + response);
|
||||
}
|
||||
|
||||
if (code != 200) {
|
||||
throw new ServiceException("任务执行失败: " + msg);
|
||||
|
||||
@@ -647,7 +647,7 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
update.setBillNoCk(billNo);
|
||||
update.setCkType(dto.getCkType());
|
||||
update.setTeamCode(dto.getTeamCode());
|
||||
update.setLyTime(dto.getLyTime());
|
||||
update.setLyTime(now); // ❗使用后端生成时间
|
||||
update.setCkLihuoY(dto.getCkLihuoY());
|
||||
update.setCkRemark(item.getCkRemark());
|
||||
update.setXmNoCk(dto.getXmNoCk());
|
||||
@@ -663,18 +663,10 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
|
||||
if (needAudit) {
|
||||
update.setStatus("3"); // 出库待审核
|
||||
if ("JLCK".equals(dto.getCkType())) {
|
||||
update.setIsChuku("3"); // 借料出库(待审核)
|
||||
} else {
|
||||
update.setIsChuku("2"); // 普通出库待审核
|
||||
}
|
||||
update.setIsChuku("JLCK".equals(dto.getCkType()) ? "3" : "2");
|
||||
} else {
|
||||
update.setStatus("1"); // 审核通过
|
||||
if ("JLCK".equals(dto.getCkType())) {
|
||||
update.setIsChuku("3"); // 借料出库(已审核)
|
||||
} else {
|
||||
update.setIsChuku("1"); // 普通出库已审核
|
||||
}
|
||||
update.setIsChuku("JLCK".equals(dto.getCkType()) ? "3" : "1");
|
||||
}
|
||||
|
||||
rkInfoMapper.updateById(update);
|
||||
@@ -684,20 +676,18 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
if (needAudit) {
|
||||
List<AuditSignature> recordList = new ArrayList<>();
|
||||
|
||||
// 先检查是否已有发起人记录(逻辑规范化)
|
||||
boolean hasOldSign = auditSignatureMapper.existsCurrentSigner(billNo, "0");
|
||||
if (hasOldSign) {
|
||||
auditSignatureMapper.updateIsCurrentToZero(billNo, "0");
|
||||
}
|
||||
|
||||
// ✅ 插入发起人签字记录(无论是否有签字图)
|
||||
AuditSignature sign = new AuditSignature();
|
||||
sign.setBillNo(billNo);
|
||||
sign.setBillType("1"); // 出库
|
||||
sign.setBillType("1");
|
||||
sign.setSignerId(userId);
|
||||
sign.setSignerRole("0"); // 发起人
|
||||
sign.setSignUrl(dto.getSignatureUrl()); // 允许为空
|
||||
sign.setImageType("0"); // 签字图
|
||||
sign.setSignerRole("0");
|
||||
sign.setSignUrl(dto.getSignatureUrl());
|
||||
sign.setImageType("0");
|
||||
sign.setSignTime(now);
|
||||
sign.setAuditResult("2");
|
||||
sign.setApproverId(dto.getApproverId());
|
||||
@@ -707,7 +697,6 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
sign.setCreateTime(now);
|
||||
recordList.add(sign);
|
||||
|
||||
// ✅ 插入每条出库明细的现场拍照记录(photoUrl不为空才插)
|
||||
for (StockOutItemDTO item : dto.getCkList()) {
|
||||
if (StringUtils.isBlank(item.getPhotoUrl())) continue;
|
||||
|
||||
@@ -715,9 +704,9 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
photo.setBillNo(billNo);
|
||||
photo.setBillType("1");
|
||||
photo.setSignerId(userId);
|
||||
photo.setSignerRole("2"); // 拍照人
|
||||
photo.setSignerRole("2");
|
||||
photo.setSignUrl(item.getPhotoUrl());
|
||||
photo.setImageType("1"); // 现场图
|
||||
photo.setImageType("1");
|
||||
photo.setSignTime(now);
|
||||
photo.setApproverId(dto.getApproverId());
|
||||
photo.setIsCurrent("1");
|
||||
@@ -739,7 +728,6 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
return dto.getCkList().size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void matchWithStatus(QueryDTO dto) {
|
||||
List<String> pcdeIds = dto.getIds();
|
||||
@@ -865,7 +853,7 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
newEntry.setIsChuku("0");
|
||||
newEntry.setPcode(newPcode);
|
||||
newEntry.setRkType(dto.getRkType());
|
||||
newEntry.setReturnTime(DateUtils.getNowDate());
|
||||
newEntry.setRkTime(DateUtils.getNowDate());
|
||||
newEntry.setBillNo(BillNoUtil.generateTodayBillNo("RK"));
|
||||
newEntry.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
newEntry.setCreateTime(DateUtils.getNowDate());
|
||||
@@ -876,10 +864,11 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
// 3. 插入新入库记录
|
||||
int rows = rkInfoMapper.insertRkInfo(newEntry);
|
||||
|
||||
// ✅ 4. 更新原记录的 is_borrowed = '0'
|
||||
// ✅ 4. 更新原记录的 is_borrowed = '2'
|
||||
RkInfo update = new RkInfo();
|
||||
update.setId(originalId);
|
||||
update.setIsBorrowed("0");
|
||||
update.setIsBorrowed("2");
|
||||
update.setReturnTime(DateUtils.getNowDate());
|
||||
update.setUpdateBy(SecurityUtils.getUsername());
|
||||
update.setUpdateTime(DateUtils.getNowDate());
|
||||
rkInfoMapper.updateById(update);
|
||||
|
||||
@@ -6,8 +6,8 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: shzg
|
||||
|
||||
@@ -68,8 +68,8 @@ spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 192.168.1.20
|
||||
# host: 192.168.1.251
|
||||
# host: 192.168.1.20
|
||||
host: 192.168.1.251
|
||||
# host: localhost
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
@@ -146,7 +146,7 @@ gen:
|
||||
|
||||
agv:
|
||||
job:
|
||||
create-url: http://192.168.1.245:9012/agv/task/create
|
||||
create-url: http://192.168.1.155:1880/api/job/create
|
||||
|
||||
wcs:
|
||||
job:
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<result property="taskNo" column="task_no"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="msg" column="msg"/>
|
||||
<result property="jobId" column="job_id"/>
|
||||
<result property="owner" column="owner"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="priority" column="priority"/>
|
||||
<result property="sourceName" column="source_name"/>
|
||||
<result property="targetName" column="target_name"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@@ -18,8 +24,24 @@
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectAgvTaskResultVo">
|
||||
id, request_id, task_no, status, msg, create_by, create_time, update_by, update_time, is_delete
|
||||
id,
|
||||
request_id,
|
||||
task_no,
|
||||
status,
|
||||
msg,
|
||||
job_id,
|
||||
owner,
|
||||
type,
|
||||
priority,
|
||||
source_name,
|
||||
target_name,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
is_delete
|
||||
</sql>
|
||||
|
||||
<select id="selectAgvTaskResultById" resultMap="AgvTaskResultResultMap">
|
||||
@@ -57,8 +79,16 @@
|
||||
<if test="taskNo != null">task_no,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="msg != null">msg,</if>
|
||||
<if test="jobId != null">job_id,</if>
|
||||
<if test="owner != null">owner,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="priority != null">priority,</if>
|
||||
<if test="sourceName != null">source_name,</if>
|
||||
<if test="targetName != null">target_name,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
create_time,
|
||||
update_time,
|
||||
is_delete
|
||||
</trim>
|
||||
VALUES
|
||||
@@ -67,7 +97,15 @@
|
||||
<if test="taskNo != null">#{taskNo},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="msg != null">#{msg},</if>
|
||||
<if test="jobId != null">#{jobId},</if>
|
||||
<if test="owner != null">#{owner},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="priority != null">#{priority},</if>
|
||||
<if test="sourceName != null">#{sourceName},</if>
|
||||
<if test="targetName != null">#{targetName},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
NOW(),
|
||||
NOW(),
|
||||
'0'
|
||||
</trim>
|
||||
|
||||
@@ -67,16 +67,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ri.rk_type, st.type_name AS rk_type_name,
|
||||
ri.wl_type, mt.type_name AS wl_type_name,
|
||||
ri.cangku, wh.warehouse_name AS cangku_name,
|
||||
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.is_borrowed,ri.remark,
|
||||
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.is_borrowed, ri.remark,
|
||||
ri.ck_lihuo_y, ri.ck_type, sot.type_name AS ck_type_name,
|
||||
ri.team_code, ct.team_name,
|
||||
ri.ck_remark,
|
||||
ri.ly_time,
|
||||
ri.borrow_time, ri.return_time,
|
||||
ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms,ri.xm_no_ck, ri.xm_ms_ck,
|
||||
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh,ri.gys_jh_id,
|
||||
ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms, ri.xm_no_ck, ri.xm_ms_ck,
|
||||
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh, ri.gys_jh_id,
|
||||
ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty,
|
||||
ri.pcode, ri.pcode_id, ri.tray_code, ri.entity_id,
|
||||
ri.status, ri.has_moved,
|
||||
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete,
|
||||
u.user_name AS lihuo_y_name
|
||||
FROM rk_info ri
|
||||
@@ -123,21 +124,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertRkInfo" parameterType="RkInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO rk_info (
|
||||
rk_type, wl_type, cangku, rk_time, lihuo_y,
|
||||
is_chuku, remark, bill_no, xj, xm_no, xm_ms,is_borrowed,
|
||||
is_chuku, remark, bill_no, xj, xm_no, xm_ms, is_borrowed,
|
||||
wl_no, wl_ms, gys_no, gys_mc, jh_amt, ht_dj,
|
||||
sap_no, xh, jh_qty, ht_qty, dw, real_qty,
|
||||
pcode, tray_code, entity_id,
|
||||
ck_lihuo_y, ck_type, team_code, ck_remark,
|
||||
ly_time, bill_no_ck, has_moved,
|
||||
gys_jh_id,
|
||||
create_by, create_time, update_by, update_time, is_delete
|
||||
) VALUES (
|
||||
#{rkType}, #{wlType}, #{cangku}, #{rkTime}, #{lihuoY},
|
||||
#{isChuku}, #{remark}, #{billNo}, #{xj}, #{xmNo}, #{xmMs},#{isBorrowed},
|
||||
#{isChuku}, #{remark}, #{billNo}, #{xj}, #{xmNo}, #{xmMs}, #{isBorrowed},
|
||||
#{wlNo}, #{wlMs}, #{gysNo}, #{gysMc}, #{jhAmt}, #{htDj},
|
||||
#{sapNo}, #{xh}, #{jhQty}, #{htQty}, #{dw}, #{realQty},
|
||||
#{pcode}, #{trayCode}, #{entityId},
|
||||
#{ckLihuoY}, #{ckType}, #{teamCode}, #{ckRemark},
|
||||
#{lyTime}, #{billNoCk}, #{hasMoved},
|
||||
#{gysJhId},
|
||||
#{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{isDelete}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
|
||||
<select id="countByTaskId" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
SELECT COUNT(*)
|
||||
FROM wcs_status
|
||||
WHERE TaskID = #{taskId}
|
||||
FROM wcs_task_result
|
||||
WHERE task_id = #{taskId}
|
||||
AND TaskStatus = '1'
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user