From 08192aa7aebc8ca582b61fe2803dcd877329eca3 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期六, 03 十二月 2022 16:08:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/xjhswcs' into xjhswcs
---
src/main/resources/mapper/BasRgvErrLogMapper.xml | 32 ++
src/main/java/com/zy/asrs/mapper/BasRgvErrLogMapper.java | 12
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 562 ++++++++++++++++++++++++++--------
src/main/java/com/zy/asrs/service/BasRgvErrLogService.java | 13
src/main/java/com/zy/asrs/mapper/WrkMastMapper.java | 14
src/main/resources/mapper/WrkMastMapper.xml | 8
src/main/java/com/zy/asrs/entity/BasRgvErrLog.java | 261 ++++++++++++++++
src/main/java/com/zy/core/MainProcess.java | 4
src/main/java/com/zy/asrs/service/impl/BasRgvErrLogServiceImpl.java | 41 ++
src/main/java/com/zy/common/CodeBuilder.java | 2
src/main/resources/application.yml | 2
11 files changed, 816 insertions(+), 135 deletions(-)
diff --git a/src/main/java/com/zy/asrs/entity/BasRgvErrLog.java b/src/main/java/com/zy/asrs/entity/BasRgvErrLog.java
new file mode 100644
index 0000000..149170a
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/BasRgvErrLog.java
@@ -0,0 +1,261 @@
+package com.zy.asrs.entity;
+
+import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.enums.IdType;
+import com.baomidou.mybatisplus.annotations.TableField;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import org.springframework.format.annotation.DateTimeFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import com.baomidou.mybatisplus.annotations.TableName;
+import java.io.Serializable;
+
+@Data
+@TableName("asr_bas_rgv_err_log")
+public class BasRgvErrLog implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value= "")
+ @TableId(value = "id", type = IdType.INPUT)
+ private Long id;
+
+ /**
+ * 缂栧彿
+ */
+ @ApiModelProperty(value= "缂栧彿")
+ private String uuid;
+
+ /**
+ * 宸ヤ綔鍙�
+ */
+ @ApiModelProperty(value= "宸ヤ綔鍙�")
+ @TableField("wrk_no")
+ private Integer wrkNo;
+
+ /**
+ * 鍙戠敓鏃堕棿
+ */
+ @ApiModelProperty(value= "鍙戠敓鏃堕棿")
+ @TableField("start_time")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date startTime;
+
+ /**
+ * 缁撴潫鏃堕棿
+ */
+ @ApiModelProperty(value= "缁撴潫鏃堕棿")
+ @TableField("end_time")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date endTime;
+
+ /**
+ * 宸ヤ綔鐘舵��
+ */
+ @ApiModelProperty(value= "宸ヤ綔鐘舵��")
+ @TableField("wrk_sts")
+ private Long wrkSts;
+
+ /**
+ * 鍏ュ嚭搴撶被鍨�
+ */
+ @ApiModelProperty(value= "鍏ュ嚭搴撶被鍨�")
+ @TableField("io_type")
+ private Integer ioType;
+
+ /**
+ * 绌挎杞�
+ */
+ @ApiModelProperty(value= "绌挎杞�")
+ @TableField("rgv_no")
+ private Integer rgvNo;
+
+ /**
+ * plc
+ */
+ @ApiModelProperty(value= "plc")
+ @TableField("plc_no")
+ private Integer plcNo;
+
+ /**
+ * 鐩爣搴撲綅
+ */
+ @ApiModelProperty(value= "鐩爣搴撲綅")
+ @TableField("loc_no")
+ private String locNo;
+
+ /**
+ * 鐩爣绔�
+ */
+ @ApiModelProperty(value= "鐩爣绔�")
+ @TableField("sta_no")
+ private Integer staNo;
+
+ /**
+ * 婧愮珯
+ */
+ @ApiModelProperty(value= "婧愮珯")
+ @TableField("source_sta_no")
+ private Integer sourceStaNo;
+
+ /**
+ * 婧愬簱浣�
+ */
+ @ApiModelProperty(value= "婧愬簱浣�")
+ @TableField("source_loc_no")
+ private String sourceLocNo;
+
+ /**
+ * 鏉$爜
+ */
+ @ApiModelProperty(value= "鏉$爜")
+ private String barcode;
+
+ /**
+ * 寮傚父鐮�
+ */
+ @ApiModelProperty(value= "寮傚父鐮�")
+ @TableField("err_code")
+ private Integer errCode;
+
+ /**
+ * 寮傚父
+ */
+ @ApiModelProperty(value= "寮傚父")
+ private String error;
+
+ /**
+ * 寮傚父鎯呭喌 1: 鏈鐞� 2: 宸蹭慨澶�
+ */
+ @ApiModelProperty(value= "寮傚父鎯呭喌 1: 鏈鐞� 2: 宸蹭慨澶� ")
+ private Integer status;
+
+ /**
+ * 娣诲姞鏃堕棿
+ */
+ @ApiModelProperty(value= "娣诲姞鏃堕棿")
+ @TableField("create_time")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date createTime;
+
+ /**
+ * 娣诲姞浜哄憳
+ */
+ @ApiModelProperty(value= "娣诲姞浜哄憳")
+ @TableField("create_by")
+ private Long createBy;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty(value= "淇敼鏃堕棿")
+ @TableField("update_time")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date updateTime;
+
+ /**
+ * 淇敼浜哄憳
+ */
+ @ApiModelProperty(value= "淇敼浜哄憳")
+ @TableField("update_by")
+ private Long updateBy;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty(value= "澶囨敞")
+ private String memo;
+
+ public BasRgvErrLog() {}
+
+ public BasRgvErrLog(String uuid,Integer wrkNo,Date startTime,Date endTime,Long wrkSts,Integer ioType,Integer rgvNo,Integer plcNo,String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String barcode,Integer errCode,String error,Integer status,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) {
+ this.uuid = uuid;
+ this.wrkNo = wrkNo;
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.wrkSts = wrkSts;
+ this.ioType = ioType;
+ this.rgvNo = rgvNo;
+ this.plcNo = plcNo;
+ this.locNo = locNo;
+ this.staNo = staNo;
+ this.sourceStaNo = sourceStaNo;
+ this.sourceLocNo = sourceLocNo;
+ this.barcode = barcode;
+ this.errCode = errCode;
+ this.error = error;
+ this.status = status;
+ this.createTime = createTime;
+ this.createBy = createBy;
+ this.updateTime = updateTime;
+ this.updateBy = updateBy;
+ this.memo = memo;
+ }
+
+// BasRgvErrLog basRgvErrLog = new BasRgvErrLog(
+// null, // [闈炵┖]
+// null, // 缂栧彿
+// null, // 宸ヤ綔鍙�
+// null, // 鍙戠敓鏃堕棿
+// null, // 缁撴潫鏃堕棿
+// null, // 宸ヤ綔鐘舵��
+// null, // 鍏ュ嚭搴撶被鍨�
+// null, // 绌挎杞�
+// null, // plc
+// null, // 鐩爣搴撲綅
+// null, // 鐩爣绔�
+// null, // 婧愮珯
+// null, // 婧愬簱浣�
+// null, // 鏉$爜
+// null, // 寮傚父鐮�
+// null, // 寮傚父
+// null, // 寮傚父鎯呭喌
+// null, // 娣诲姞鏃堕棿
+// null, // 娣诲姞浜哄憳
+// null, // 淇敼鏃堕棿
+// null, // 淇敼浜哄憳
+// null // 澶囨敞
+// );
+
+ public String getStartTime$(){
+ if (Cools.isEmpty(this.startTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.startTime);
+ }
+
+ public String getEndTime$(){
+ if (Cools.isEmpty(this.endTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.endTime);
+ }
+
+ public String getStatus$(){
+ if (null == this.status){ return null; }
+ switch (this.status){
+ case 1:
+ return "鏈鐞�";
+ case 2:
+ return "宸蹭慨澶�";
+ default:
+ return String.valueOf(this.status);
+ }
+ }
+
+ public String getCreateTime$(){
+ if (Cools.isEmpty(this.createTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
+ }
+
+ public String getUpdateTime$(){
+ if (Cools.isEmpty(this.updateTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/mapper/BasRgvErrLogMapper.java b/src/main/java/com/zy/asrs/mapper/BasRgvErrLogMapper.java
new file mode 100644
index 0000000..ba2d4f2
--- /dev/null
+++ b/src/main/java/com/zy/asrs/mapper/BasRgvErrLogMapper.java
@@ -0,0 +1,12 @@
+package com.zy.asrs.mapper;
+
+import com.zy.asrs.entity.BasRgvErrLog;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface BasRgvErrLogMapper extends BaseMapper<BasRgvErrLog> {
+
+}
diff --git a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
index ac14bfa..c860c1f 100644
--- a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
@@ -31,6 +31,13 @@
// @Select("select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC")
WrkMast selectPakInStep2(@Param("crnNo")Integer crnNo, @Param("workNo")Integer workNo, @Param("staNo")Integer staNo);
+ /**
+ * 鏌ヨ鍚屼竴鍙板爢鍨涙満涓嬫墍鏈夊嚭搴撲换鍔�
+ * @param crnNo
+ * @return
+ */
+ List<WrkMast> selectPakInStep12(@Param("crnNo")Integer crnNo);
+
// 鍏ュ簱绗笁姝ワ紝褰撳爢鍨涙満鎶婅揣鏀惧叆搴撲綅鏃�
// @Select("select top 1 from dbo.asr_wrk_mast where wrk_no=#{workNo}")
WrkMast selectPakInStep3(@Param("workNo")Integer workNo);
@@ -101,6 +108,13 @@
*/
List<WrkMast> selectPakOutStep11(@Param("crnNo")Integer crnNO, @Param("sourceStaNo")Integer sourceStaNo);
+ /**
+ * 鏌ヨ鍚屼竴鍙板爢鍨涙満涓嬫墍鏈夊嚭搴撲换鍔�
+ * @param crnNO
+ * @return
+ */
+ List<WrkMast> selectPakOutStep12(@Param("crnNo")Integer crnNO);
+
WrkMast selectWorkingPakin(@Param("sourceStaNo")Integer sourceStaNo);
WrkMast selectWorkingPakout(@Param("sourceStaNo")Integer sourceStaNo);
diff --git a/src/main/java/com/zy/asrs/service/BasRgvErrLogService.java b/src/main/java/com/zy/asrs/service/BasRgvErrLogService.java
new file mode 100644
index 0000000..d9ae3f1
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/BasRgvErrLogService.java
@@ -0,0 +1,13 @@
+package com.zy.asrs.service;
+
+import com.zy.asrs.entity.BasErrLog;
+import com.zy.asrs.entity.BasRgvErrLog;
+import com.baomidou.mybatisplus.service.IService;
+
+public interface BasRgvErrLogService extends IService<BasRgvErrLog> {
+
+ BasRgvErrLog findLatestByTaskNo(Integer rgvNo, Integer taskNo);
+
+ BasRgvErrLog findLatest(Integer rgvNo);
+
+}
diff --git a/src/main/java/com/zy/asrs/service/impl/BasRgvErrLogServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/BasRgvErrLogServiceImpl.java
new file mode 100644
index 0000000..de9ec38
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/impl/BasRgvErrLogServiceImpl.java
@@ -0,0 +1,41 @@
+package com.zy.asrs.service.impl;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.zy.asrs.entity.BasErrLog;
+import com.zy.asrs.mapper.BasRgvErrLogMapper;
+import com.zy.asrs.entity.BasRgvErrLog;
+import com.zy.asrs.service.BasRgvErrLogService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("basRgvErrLogService")
+public class BasRgvErrLogServiceImpl extends ServiceImpl<BasRgvErrLogMapper, BasRgvErrLog> implements BasRgvErrLogService {
+
+ @Override
+ public BasRgvErrLog findLatestByTaskNo(Integer rgvNo, Integer taskNo) {
+ List<BasRgvErrLog> basRgvErrLog = this.baseMapper.selectList(new EntityWrapper<BasRgvErrLog>()
+ .eq("rgv_no", rgvNo)
+ .eq("wrk_no", taskNo)
+ .orderBy("start_time", false));
+ if (basRgvErrLog == null || basRgvErrLog.size() == 0) {
+ return null;
+ } else {
+ return basRgvErrLog.get(0);
+ }
+ }
+
+ @Override
+ public BasRgvErrLog findLatest(Integer crnNo) {
+ List<BasRgvErrLog> basErrLogs = this.baseMapper.selectList(new EntityWrapper<BasRgvErrLog>()
+ .eq("rgv_no", crnNo)
+ .orderBy("start_time", false));
+ if (basErrLogs == null || basErrLogs.size() == 0) {
+ return null;
+ } else {
+ return basErrLogs.get(0);
+ }
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 40d0589..44c8d87 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -9,6 +9,7 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.mapper.BasCrnErrorMapper;
+import com.zy.asrs.mapper.BasRgvErrMapper;
import com.zy.asrs.mapper.WaitPakinMapper;
import com.zy.asrs.mapper.WrkMastMapper;
import com.zy.asrs.service.*;
@@ -68,8 +69,6 @@
@Autowired
private WrkDetlService wrkDetlService;
@Autowired
- private WaitPakinMapper waitPakinMapper;
- @Autowired
private LocMastService locMastService;
@Autowired
private StaDescService staDescService;
@@ -85,6 +84,10 @@
private BasErrLogService basErrLogService;
@Autowired
private BasCrnErrorMapper basCrnErrorMapper;
+ @Autowired
+ private BasRgvErrMapper basRgvErrMapper;
+ @Autowired
+ private BasRgvErrLogService basRgvErrLogService;
@Value("${wms.url}")
private String wmsUrl;
@@ -93,7 +96,7 @@
* 缁勬墭
* 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 2
*/
- public void generateStoreWrkFile() {
+ public synchronized void generateStoreWrkFile() {
// 鏍规嵁杈撻�佺嚎plc閬嶅巻
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻鍏ュ簱鍙�
@@ -212,7 +215,7 @@
* wms鍏ュ簱
* 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 1 ==>> 2
*/
- public void generateStoreWrkFile0() {
+ public synchronized void generateStoreWrkFile0() {
// 鏍规嵁杈撻�佺嚎plc閬嶅巻
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻鍏ュ簱鍙�
@@ -478,20 +481,20 @@
// 濡傛灉鏈�杩戜竴娆℃槸鍏ュ簱妯″紡
if (crnProtocol.getLastIo().equals("I")) {
if (basCrnp.getInEnable().equals("Y")) {
- this.crnStnToLoc(crn, crnProtocol); // 鍏ュ簱
+ this.crnStnToLoc1(crn, crnProtocol); // 鍏ュ簱
crnProtocol.setLastIo("O");
} else if (basCrnp.getOutEnable().equals("Y")) {
- this.locToCrnStn(crn, crnProtocol); // 鍑哄簱
+ this.locToCrnStn1(crn, crnProtocol); // 鍑哄簱
crnProtocol.setLastIo("I");
}
}
// 濡傛灉鏈�杩戜竴娆℃槸鍑哄簱妯″紡
else if (crnProtocol.getLastIo().equals("O")) {
if (basCrnp.getOutEnable().equals("Y")) {
- this.locToCrnStn(crn, crnProtocol); // 鍑哄簱
+ this.locToCrnStn1(crn, crnProtocol); // 鍑哄簱
crnProtocol.setLastIo("I");
} else if (basCrnp.getInEnable().equals("Y")) {
- this.crnStnToLoc(crn, crnProtocol); // 鍏ュ簱
+ this.crnStnToLoc1(crn, crnProtocol); // 鍏ュ簱
crnProtocol.setLastIo("O");
}
}
@@ -691,7 +694,7 @@
}
continue;
} else if (shallowLoc.getLocSts().equals("Q")) {
- WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
+ WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
continue;
}
@@ -739,10 +742,144 @@
}
/**
+ * 鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鍒板簱浣�
+ * 2022-12-03 TQS淇敼锛屽厛閬嶅巻鏌ヨ鍚屽彴鍫嗗灈鏈哄伐浣滄。鎵�鏈夌珯鐐瑰叆搴撲换鍔IST锛屾牴鎹伐浣滄。浠诲姟鎺掑簭浼樺厛绾ч珮浜� 鏍规嵁鍫嗗灈鏈哄叆搴撶珯鐐规帓搴�
+ */
+ public synchronized void crnStnToLoc1(CrnSlave slave, CrnProtocol crnProtocol) {
+ List<WrkMast> wrkMasts = wrkMastMapper.selectPakInStep12(slave.getId());
+ for(WrkMast wrkMast : wrkMasts){
+ if (wrkMast == null) {
+ continue;
+ }
+
+ CrnSlave.CrnStn crnStn = null;
+ for (CrnSlave.CrnStn crnStn1 : slave.getCrnInStn()){
+ if(crnStn1.getStaNo() == wrkMast.getStaNo()){
+ crnStn = crnStn1;
+ break;
+ } else {
+ continue;
+ }
+ }
+ if(Cools.isEmpty(crnStn)){
+ continue;
+ }
+
+ boolean flag = false;
+ // 鑾峰彇鍫嗗灈鏈哄叆搴撶珯淇℃伅
+ DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ // 鏌ヨ绔欑偣璇︾粏淇℃伅
+ BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo());
+ if (staDetl == null) {
+ log.error("鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
+ continue;
+ }
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
+ && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
+ flag = true;
+ }
+ if (!flag) {
+ continue;
+ }
+
+ // 鑾峰彇搴撲綅淇℃伅
+ LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
+ if (locMast == null) {
+ log.error("鏌ヨ搴撳瓨鏃犳暟鎹�--搴撲綅鍙穥}", wrkMast.getLocNo());
+ continue;
+ }
+ if (!locMast.getLocSts().equals("S") && !locMast.getLocSts().equals("Q")) {
+ log.error("鍏ュ簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), locMast.getLocSts());
+ continue;
+ }
+
+ // 鍫嗗灈鏈烘帶鍒惰繃婊�
+ if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) {
+ continue;
+ }
+
+ // 宸茬粡瀛樺湪鍚婅溅鎵ц浠诲姟鏃讹紝鍒欒繃婊�
+ if (wrkMastMapper.selectWorking(slave.getId()) != null) {
+ continue;
+ }
+
+ // 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞�
+ if (Utils.isDeepLoc(slaveProperties, wrkMast.getLocNo())) {
+ String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getLocNo());
+ LocMast shallowLoc = locMastService.selectById(shallowLocNo);
+ // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒
+ if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
+ WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
+ if (null == waitWrkMast) {
+ log.error("{}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo);
+ } else {
+ waitWrkMast.setIoPri(15D);
+ waitWrkMast.setModiTime(new Date());
+ if (wrkMastMapper.updateById(waitWrkMast) == 0) {
+ log.error("璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo());
+ }
+ continue;
+ }
+
+ } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
+ // 姝ゆ爣璁伴伩鍏嶅娆℃墽琛岀Щ搴撲换鍔�
+ if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())) {
+ wrkMast.setUpdMk("Y");
+ wrkMast.setIoPri(14D);
+ wrkMastMapper.updateById(wrkMast);
+ // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
+ moveLocForDeepLoc(slave, shallowLoc);
+ // 鐢熸垚宸ヤ綔妗c�佹敼鍙樻祬搴撲綅鐨勬簮搴�/鐩爣搴� 搴撲綅鐘舵�併�佷笅鍙戝爢鍨涙満鍛戒护锛堢珛椹墽琛�)
+// moveLocForDeepLocPakin(slave, shallowLoc, wrkMast);
+ }
+ continue;
+ } else if (shallowLoc.getLocSts().equals("Q")) {
+ WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
+ if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
+ continue;
+ }
+ }
+ }
+
+ // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+ CrnCommand crnCommand = new CrnCommand();
+ crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
+ crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
+ crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣�
+ crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 浠诲姟妯″紡: 搴撲綅绉昏浆
+ crnCommand.setSourcePosX(crnStn.getRow().shortValue()); // 婧愬簱浣嶆帓
+ crnCommand.setSourcePosY(crnStn.getBay().shortValue()); // 婧愬簱浣嶅垪
+ crnCommand.setSourcePosZ(crnStn.getLev().shortValue()); // 婧愬簱浣嶅眰
+ crnCommand.setDestinationPosX(locMast.getRow1().shortValue()); // 鐩爣搴撲綅鎺�
+ crnCommand.setDestinationPosY(locMast.getBay1().shortValue()); // 鐩爣搴撲綅鍒�
+ crnCommand.setDestinationPosZ(locMast.getLev1().shortValue()); // 鐩爣搴撲綅灞�
+ if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
+ log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
+ } else {
+ // 淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓�
+ Date now = new Date();
+ wrkMast.setWrkSts(3L);
+ wrkMast.setCrnStrTime(now);
+ wrkMast.setModiTime(now);
+ if (wrkMastMapper.updateById(wrkMast) == 0) {
+ log.error("淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+ }
+ }
+ }
+
+ }
+
+ /**
* 鍑哄簱 ===>> 搴撲綅鍒板爢鍨涙満绔�
* 2022-06-09 TQS淇敼锛屾煡璇㈠伐浣滄。LIST锛岄亶鍘嗕笅鍙戯紝闃叉绗竴涓换鍔″牭濉炲嚭搴�
*/
- public void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol) {
+ public synchronized void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol) {
for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) {
// 鑾峰彇宸ヤ綔鐘舵�佷负11锛堢敓鎴愬嚭搴揑D锛夌殑鍑哄簱宸ヤ綔妗�
// WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo());
@@ -833,7 +970,7 @@
log.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛佹祬搴撲綅鍙�:{}", wrkMast.getWrkNo(), shallowLocNo);
continue;
} else if (shallowLoc.getLocSts().equals("Q") || shallowLoc.getLocSts().equals("S")) {
- WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
+ WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
continue;
}
@@ -876,122 +1013,154 @@
}
}
-// /**
-// * 鍑哄簱 ===>> 搴撲綅鍒板爢鍨涙満绔�
-// */
-// public void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol){
-// for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) {
-// // 鑾峰彇宸ヤ綔鐘舵�佷负11锛堢敓鎴愬嚭搴揑D锛夌殑鍑哄簱宸ヤ綔妗�
-// WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo());
-// if (wrkMast == null) {
-// continue;
-// }
-// // 宸ヤ綔妗g姸鎬佸垽鏂�
-// if (wrkMast.getIoType() < 100 || wrkMast.getSourceStaNo() == null){
-// log.error("鏌ヨ宸ヤ綔妗f暟鎹笉绗﹀悎鏉′欢--鍏ュ嚭绫诲瀷/绔欑偣, 宸ヤ綔鍙�={}锛屾簮搴撲綅={}锛屽叆鍑虹被鍨�={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType());
-// continue;
-// }
-// // 鑾峰彇婧愬簱浣嶄俊鎭�
-// LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
-// if (!sourceSta.getLocSts().equals("R") &&!sourceSta.getLocSts().equals("P")) {
-// log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), sourceSta.getLocSts());
-// continue;
-// }
-// // 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅
-// SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
-// StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
-// if (staProtocol == null) {
-// continue;
-// } else {
-// staProtocol = staProtocol.clone();
-// }
-//
-//// // 鍏ュ嚭搴撴ā寮忓垽鏂�
-//// if (devpThread.ioMode != IoModeType.PAKOUT_MODE) { continue; }
-//
-//
-// // 鏌ヨ绔欑偣璇︾粏淇℃伅
-// BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo());
-// if (staDetl == null) {
-// log.error("鍑哄簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
-// continue;
-// }
-// // 鍒ゆ柇鍫嗗灈鏈哄嚭搴撶珯鐘舵��
-// if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() !=null && staDetl.getCanouting().equals("Y")
-// && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) {
-// // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
-//
-// // 鍫嗗灈鏈烘帶鍒惰繃婊�
-// if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) {
+ /**
+ * 鍑哄簱 ===>> 搴撲綅鍒板爢鍨涙満绔�
+ * 2022-12-03 TQS淇敼锛屽厛閬嶅巻鏌ヨ宸ヤ綔妗f墍鏈夌珯鐐瑰嚭搴撲换鍔IST锛屾牴鎹伐浣滄。浠诲姟鎺掑簭浼樺厛绾ч珮浜� 鏍规嵁鍫嗗灈鏈哄叆搴撶珯鐐规帓搴�
+ */
+ public synchronized void locToCrnStn1(CrnSlave slave, CrnProtocol crnProtocol) {
+ List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep12(slave.getId());
+ for (WrkMast wrkMast : wrkMasts) {
+ if (wrkMast == null) {
+ continue;
+ }
+
+ CrnSlave.CrnStn crnStn = null;
+ for (CrnSlave.CrnStn crnStn1 : slave.getCrnOutStn()){
+ if(crnStn1.getStaNo() == wrkMast.getSourceStaNo()){
+ crnStn = crnStn1;
+ break;
+ } else {
+ continue;
+ }
+ }
+ if(Cools.isEmpty(crnStn)){
+ continue;
+ }
+
+ // 宸ヤ綔妗g姸鎬佸垽鏂�
+ if (wrkMast.getIoType() < 100 || wrkMast.getSourceStaNo() == null) {
+ log.error("鏌ヨ宸ヤ綔妗f暟鎹笉绗﹀悎鏉′欢--鍏ュ嚭绫诲瀷/绔欑偣, 宸ヤ綔鍙�={}锛屾簮搴撲綅={}锛屽叆鍑虹被鍨�={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType());
+ continue;
+ }
+ // 鑾峰彇婧愬簱浣嶄俊鎭�
+ LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
+ if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("P")) {
+ log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), sourceSta.getLocSts());
+ continue;
+ }
+ // 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
+ if (staProtocol == null) {
+ break;
// continue;
-// }
-//
-// // 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞�
-// if (Utils.isDeepLoc(slaveProperties, wrkMast.getSourceLocNo())) {
-// String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getSourceLocNo());
-// LocMast shallowLoc = locMastService.selectById(shallowLocNo);
-// // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒
-// if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
-// WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
-// if (null == waitWrkMast) {
-// log.error("{}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo);
-// } else {
-// if(waitWrkMast.getWrkSts() == 11) {
-// waitWrkMast.setIoPri(15D);
-// waitWrkMast.setModiTime(new Date());
-// if (wrkMastMapper.updateById(waitWrkMast) == 0) {
-// log.error("璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo());
-// }
-// continue;
-// } else {
-//
-// }
-// }
-// } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
-// // 姝ゆ爣璁伴伩鍏嶅娆℃墽琛岀Щ搴撲换鍔�
-// if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())) {
-// wrkMast.setUpdMk("Y");
-// wrkMastMapper.updateById(wrkMast);
-// // 鐢熸垚宸ヤ綔妗c�佹敼鍙樻祬搴撲綅鐨勬簮搴�/鐩爣搴� 搴撲綅鐘舵�併�佷笅鍙戝爢鍨涙満鍛戒护锛堢珛椹墽琛�)
-// moveLocForDeepLoc(slave, shallowLoc);
-// }
-// log.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛�", wrkMast.getWrkNo());
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+
+// // 鍏ュ嚭搴撴ā寮忓垽鏂�
+// if (devpThread.ioMode != IoModeType.PAKOUT_MODE) { continue; }
+ if (wrkMast.getStaNo() == 204 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) {
+ continue;
+ }
+
+ // 鏌ヨ绔欑偣璇︾粏淇℃伅
+ BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo());
+ if (staDetl == null) {
+ log.error("鍑哄簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
+ break;
+// continue;
+ }
+ // 鍒ゆ柇鍫嗗灈鏈哄嚭搴撶珯鐘舵��
+ if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")
+ && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) {
+ // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+
+ // 鍫嗗灈鏈烘帶鍒惰繃婊�
+ if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) {
// continue;
-// }
-// }
-//
-// // 宸茬粡瀛樺湪鍚婅溅鎵ц浠诲姟鏃讹紝鍒欒繃婊�
-// if (wrkMastMapper.selectWorking(slave.getId()) != null) {
-// return;
-// }
-//
-// // 1.鍫嗗灈鏈哄紑濮嬬Щ鍔�
-// CrnCommand crnCommand = new CrnCommand();
-// crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
-// crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
-// crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣�
-// crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 浠诲姟妯″紡: 搴撲綅绉昏浆
-// crnCommand.setSourcePosX(sourceSta.getRow1().shortValue()); // 婧愬簱浣嶆帓
-// crnCommand.setSourcePosY(sourceSta.getBay1().shortValue()); // 婧愬簱浣嶅垪
-// crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue()); // 婧愬簱浣嶅眰
-// crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 鐩爣搴撲綅鎺�
-// crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 鐩爣搴撲綅鍒�
-// crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 鐩爣搴撲綅灞�
-// if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
-// log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
-// } else {
-// // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓�
-// Date now = new Date();
-// wrkMast.setWrkSts(12L);
-// wrkMast.setCrnStrTime(now);
-// wrkMast.setModiTime(now);
-// if (wrkMastMapper.updateById(wrkMast) == 0) {
-// log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
-// }
-// }
-// }
-// }
-// }
+ break;
+ }
+
+ // 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞�
+ if (Utils.isDeepLoc(slaveProperties, wrkMast.getSourceLocNo())) {
+ String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getSourceLocNo());
+ LocMast shallowLoc = locMastService.selectById(shallowLocNo);
+ // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒
+ if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
+ WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
+ if (null == waitWrkMast) {
+ log.error("{}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo);
+ } else {
+ if (waitWrkMast.getWrkSts() == 11) {
+ waitWrkMast.setIoPri(15D);
+ waitWrkMast.setModiTime(new Date());
+ if (wrkMastMapper.updateById(waitWrkMast) == 0) {
+ log.error("璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo());
+ }
+ continue;
+ } else {
+
+ }
+ }
+ } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
+// WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
+ //2022-08-16 modify,涓嶆牴鎹畊pdmk鏍囪绉诲簱浠诲姟(瀹规槗琚彇娑堝鑷村牭濉�)锛屾煡璇㈠伐浣滄。鏄惁瀛樺湪浠诲姟
+ WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
+ // 姝ゆ爣璁伴伩鍏嶅娆℃墽琛岀Щ搴撲换鍔�
+// if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())
+// || Cools.isEmpty(waitWrkMast)) {
+ if (Cools.isEmpty(waitWrkMast)) {
+ wrkMast.setUpdMk("Y");
+ wrkMastMapper.updateById(wrkMast);
+ // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
+ moveLocForDeepLoc(slave, shallowLoc);
+ }
+ log.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛佹祬搴撲綅鍙�:{}", wrkMast.getWrkNo(), shallowLocNo);
+ continue;
+ } else if (shallowLoc.getLocSts().equals("Q") || shallowLoc.getLocSts().equals("S")) {
+ WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
+ if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
+ continue;
+ }
+ }
+ }
+
+ // 宸茬粡瀛樺湪鍚婅溅鎵ц浠诲姟鏃讹紝鍒欒繃婊�
+ if (wrkMastMapper.selectWorking(slave.getId()) != null) {
+ break;
+// return;
+ }
+
+ // 1.鍫嗗灈鏈哄紑濮嬬Щ鍔�
+ CrnCommand crnCommand = new CrnCommand();
+ crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
+ crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
+ crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣�
+ crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 浠诲姟妯″紡: 搴撲綅绉昏浆
+ crnCommand.setSourcePosX(sourceSta.getRow1().shortValue()); // 婧愬簱浣嶆帓
+ crnCommand.setSourcePosY(sourceSta.getBay1().shortValue()); // 婧愬簱浣嶅垪
+ crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue()); // 婧愬簱浣嶅眰
+ crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 鐩爣搴撲綅鎺�
+ crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 鐩爣搴撲綅鍒�
+ crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 鐩爣搴撲綅灞�
+ if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
+ log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
+ } else {
+ // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓�
+ Date now = new Date();
+ wrkMast.setWrkSts(12L);
+ wrkMast.setCrnStrTime(now);
+ wrkMast.setModiTime(now);
+ if (wrkMastMapper.updateById(wrkMast) == 0) {
+ log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+ }
+ break;
+ }
+ }
+ }
+
+ }
/**
* 鏌ユ壘宸ヤ綔鐘舵�佷负2锛堣澶囦笂璧帮級,涓擱GV鍏ュ簱鎺ラ┏绔欑鍚堢殑鐨勫叆搴撳伐浣滄。锛屾彁鍙栧嚭鏈�澶�2绗�
@@ -1627,7 +1796,7 @@
/**
* 搴撲綅绉昏浆
*/
- public void locToLoc(CrnSlave slave, CrnProtocol crnProtocol) {
+ public synchronized void locToLoc(CrnSlave slave, CrnProtocol crnProtocol) {
// 鑾峰彇宸ヤ綔妗d俊鎭�
WrkMast wrkMast = wrkMastMapper.selectLocMove(slave.getId());
if (null == wrkMast) {
@@ -1732,6 +1901,138 @@
}
}
+ }
+ }
+
+ /**
+ * 寮傚父淇℃伅璁板綍
+ */
+ public synchronized void recErr() {
+ try {
+ this.recCrnErr();
+ this.recRgvErr();
+ } catch (Exception e) {
+ log.error("recErr fail", e);
+ }
+ }
+
+ /**
+ * RGV寮傚父淇℃伅璁板綍
+ */
+ public synchronized void recRgvErr() {
+ Date now = new Date();
+ for (RgvSlave rgv : slaveProperties.getRgv()) {
+ // 鑾峰彇RGV淇℃伅
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId());
+ RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol == null) {
+ continue;
+ }
+ if (true) {
+ // 鏈変换鍔�
+ if (rgvProtocol.getTaskNo1() != 0 || rgvProtocol.getTaskNo2() != 0) {
+ Integer taskNo = rgvProtocol.getTaskNo1() > 0 ? rgvProtocol.getTaskNo1().intValue() : rgvProtocol.getTaskNo2().intValue();
+ BasRgvErrLog latest = basRgvErrLogService.findLatestByTaskNo(rgv.getId(), taskNo);
+ // 鏈夊紓甯�
+ if (latest == null) {
+ if (rgvProtocol.getAlarm() != null && rgvProtocol.getAlarm() > 0) {
+ WrkMast wrkMast = wrkMastMapper.selectById(taskNo);
+ if (wrkMast == null) {
+ continue;
+ }
+ BasRgvErr rgvErr = basRgvErrMapper.selectById(rgvProtocol.getAlarm());
+ String errName = rgvErr == null ? String.valueOf(rgvProtocol.getAlarm()) : rgvErr.getErrName();
+ BasRgvErrLog basRgvErrLog = new BasRgvErrLog(
+ null, // 缂栧彿
+ wrkMast.getWrkNo(), // 宸ヤ綔鍙�
+ now, // 鍙戠敓鏃堕棿
+ null, // 缁撴潫鏃堕棿
+ wrkMast.getWrkSts(), // 宸ヤ綔鐘舵��
+ wrkMast.getIoType(), // 鍏ュ嚭搴撶被鍨�
+ rgv.getId(), // 鍫嗗灈鏈�
+ null, // plc
+ wrkMast.getLocNo(), // 鐩爣搴撲綅
+ wrkMast.getStaNo(), // 鐩爣绔�
+ wrkMast.getSourceStaNo(), // 婧愮珯
+ wrkMast.getSourceLocNo(), // 婧愬簱浣�
+ wrkMast.getBarcode(), // 鏉$爜
+ (int) rgvProtocol.getAlarm(), // 寮傚父鐮�
+ errName, // 寮傚父
+ 1, // 寮傚父鎯呭喌
+ now, // 娣诲姞鏃堕棿
+ null, // 娣诲姞浜哄憳
+ now, // 淇敼鏃堕棿
+ null, // 淇敼浜哄憳
+ "浠诲姟涓紓甯�" // 澶囨敞
+ );
+
+ if (!basRgvErrLogService.insert(basRgvErrLog)) {
+ log.error("RGV寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", rgv.getId(), errName);
+ }
+ }
+ } else {
+ // 寮傚父淇
+ if (rgvProtocol.getAlarm() == null || rgvProtocol.getAlarm() == 0) {
+ latest.setEndTime(now);
+ latest.setUpdateTime(now);
+ latest.setStatus(2);
+ if (!basRgvErrLogService.updateById(latest)) {
+ log.error("鍫嗗灈鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", rgv.getId(), latest.getId());
+ }
+ }
+ }
+ // 鏃犱换鍔�
+ } else {
+ BasRgvErrLog latest = basRgvErrLogService.findLatest(rgv.getId());
+ // 鏈夊紓甯�
+ if (rgvProtocol.getAlarm() != null && rgvProtocol.getAlarm() > 0) {
+ // 璁板綍鏂板紓甯�
+ if (latest == null || (latest.getErrCode() != rgvProtocol.getAlarm().intValue())) {
+ BasRgvErr rgvErr = basRgvErrMapper.selectById(rgvProtocol.getAlarm());
+ String errName = rgvErr == null ? String.valueOf(rgvProtocol.getAlarm()) : rgvErr.getErrName();
+ BasRgvErrLog basRgvErrLog = new BasRgvErrLog(
+ null, // 缂栧彿
+ null, // 宸ヤ綔鍙�
+ now, // 鍙戠敓鏃堕棿
+ null, // 缁撴潫鏃堕棿
+ null, // 宸ヤ綔鐘舵��
+ null, // 鍏ュ嚭搴撶被鍨�
+ rgv.getId(), // 鍫嗗灈鏈�
+ null, // plc
+ null, // 鐩爣搴撲綅
+ null, // 鐩爣绔�
+ null, // 婧愮珯
+ null, // 婧愬簱浣�
+ null, // 鏉$爜
+ (int) rgvProtocol.getAlarm(), // 寮傚父鐮�
+ errName, // 寮傚父
+ 1, // 寮傚父鎯呭喌
+ now, // 娣诲姞鏃堕棿
+ null, // 娣诲姞浜哄憳
+ now, // 淇敼鏃堕棿
+ null, // 淇敼浜哄憳
+ "鏃犱换鍔″紓甯�" // 澶囨敞
+ );
+
+ if (!basRgvErrLogService.insert(basRgvErrLog)) {
+ log.error("RGV寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", rgv.getId(), errName);
+ }
+ }
+ // 鏃犲紓甯�
+ } else {
+ // 寮傚父淇
+ if (latest != null && latest.getStatus() == 1) {
+ latest.setEndTime(now);
+ latest.setUpdateTime(now);
+ latest.setStatus(2);
+ if (!basRgvErrLogService.updateById(latest)) {
+ log.error("RGV寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", rgv.getId(), latest.getId());
+ }
+ }
+ }
+ }
+ }
+
}
}
@@ -1852,7 +2153,6 @@
}
}
-
// -------------------------------------------------------------------------------
@@ -2477,7 +2777,7 @@
/**
* 鍏ュ嚭搴撴ā寮忓垏鎹㈠嚱鏁�
*/
- public void ioConvert() {
+ public synchronized void ioConvert() {
try {
// 鏍规嵁杈撻�佺嚎plc閬嶅巻
for (DevpSlave devp : slaveProperties.getDevp()) {
@@ -2537,7 +2837,7 @@
}
- public void outOfDevp() {
+ public synchronized void outOfDevp() {
List<WrkMast> wrkMasts = wrkMastMapper.selectPick();
for (WrkMast wrkMast : wrkMasts) {
if (basDevpService.selectCount(new EntityWrapper<BasDevp>().eq("wrk_no", wrkMast.getWrkNo())) == 0) {
@@ -2551,7 +2851,7 @@
}
- public void autoEmptyOut() {
+ public synchronized void autoEmptyOut() {
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
Integer autoOutSite = 12;
//濡傛灉绔欑偣鍙嚭绂佺敤锛屽垯涓嶇敓鎴愮┖鐩樺嚭搴撲换鍔�
@@ -2590,7 +2890,7 @@
}
}
- public void autoEmptyIn() {
+ public synchronized void autoEmptyIn() {
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
Integer autoInSite = 12;
StaProtocol staProtocol = devpThread.getStation().get(autoInSite);
diff --git a/src/main/java/com/zy/common/CodeBuilder.java b/src/main/java/com/zy/common/CodeBuilder.java
index d0c963a..33131f2 100644
--- a/src/main/java/com/zy/common/CodeBuilder.java
+++ b/src/main/java/com/zy/common/CodeBuilder.java
@@ -20,7 +20,7 @@
generator.url="localhost:1433;databasename=xjhsasrs";
generator.username="sa";
generator.password="sa@123";
- generator.table="asr_bas_rgv_err";
+ generator.table="asr_bas_rgv_err_log";
generator.packagePath="com.zy.asrs";
generator.controller = false;
diff --git a/src/main/java/com/zy/core/MainProcess.java b/src/main/java/com/zy/core/MainProcess.java
index 9634d57..ad935a8 100644
--- a/src/main/java/com/zy/core/MainProcess.java
+++ b/src/main/java/com/zy/core/MainProcess.java
@@ -72,8 +72,8 @@
// mainService.rgvOutDStnToOutStn();
//////////////////////////////////////////////////////////////////
- // 鍫嗗灈鏈哄紓甯镐俊鎭褰�
- mainService.recCrnErr();
+ // 寮傚父淇℃伅璁板綍
+ mainService.recErr();
// 鍏ュ簱 ===>> 绌烘爤鏉垮垵濮嬪寲鍏ュ簱,鍙夎溅鍏ュ簱绔欐斁璐�
mainService.storeEmptyPlt();
// 鍑哄簱 ===>> 宸ヤ綔妗d俊鎭啓鍏ed鏄剧ず鍣�
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index e62f9fb..a0150f3 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -36,7 +36,7 @@
enable: false
wms:
- url: localhost:8080/stwms
+ url: localhost:8080/hswms
# 涓嬩綅鏈洪厤缃�
wcs-slave:
diff --git a/src/main/resources/mapper/BasRgvErrLogMapper.xml b/src/main/resources/mapper/BasRgvErrLogMapper.xml
new file mode 100644
index 0000000..ed6908f
--- /dev/null
+++ b/src/main/resources/mapper/BasRgvErrLogMapper.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zy.asrs.mapper.BasRgvErrLogMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.zy.asrs.entity.BasRgvErrLog">
+ <result column="id" property="id" />
+ <result column="uuid" property="uuid" />
+ <result column="wrk_no" property="wrkNo" />
+ <result column="start_time" property="startTime" />
+ <result column="end_time" property="endTime" />
+ <result column="wrk_sts" property="wrkSts" />
+ <result column="io_type" property="ioType" />
+ <result column="rtv_no" property="rgvNo" />
+ <result column="plc_no" property="plcNo" />
+ <result column="loc_no" property="locNo" />
+ <result column="sta_no" property="staNo" />
+ <result column="source_sta_no" property="sourceStaNo" />
+ <result column="source_loc_no" property="sourceLocNo" />
+ <result column="barcode" property="barcode" />
+ <result column="err_code" property="errCode" />
+ <result column="error" property="error" />
+ <result column="status" property="status" />
+ <result column="create_time" property="createTime" />
+ <result column="create_by" property="createBy" />
+ <result column="update_time" property="updateTime" />
+ <result column="update_by" property="updateBy" />
+ <result column="memo" property="memo" />
+
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/WrkMastMapper.xml b/src/main/resources/mapper/WrkMastMapper.xml
index 7356f6d..1db0665 100644
--- a/src/main/resources/mapper/WrkMastMapper.xml
+++ b/src/main/resources/mapper/WrkMastMapper.xml
@@ -98,6 +98,10 @@
select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and sta_no=#{staNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC
</select>
+ <select id="selectPakInStep12" resultMap="BaseResultMap">
+ select * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC
+ </select>
+
<select id="selectPakInStep3" resultMap="BaseResultMap">
select top 1 * from dbo.asr_wrk_mast where wrk_no=#{workNo}
</select>
@@ -163,6 +167,10 @@
select * from dbo.asr_wrk_mast where crn_no=#{crnNo} and source_sta_no=#{sourceStaNo} and wrk_sts=11 and io_type>100 order by io_pri desc,io_time,wrk_no asc
</select>
+ <select id="selectPakOutStep12" resultMap="BaseResultMap">
+ select * from dbo.asr_wrk_mast where crn_no=#{crnNo} and wrk_sts=11 and io_type>100 order by io_pri desc,io_time,wrk_no asc
+ </select>
+
<!-- 鍏ュ嚭搴撴ā寮忕浉鍏� -->
<select id="selectWorkingPakin" resultMap="BaseResultMap">
select top 1 * from dbo.asr_wrk_mast where wrk_sts in (2,3,4) and io_type != 11 and source_sta_no = #{sourceStaNo} order by io_time,wrk_no
--
Gitblit v1.9.1