Commit 953b3202 孙克

增加冻结和解冻过期物料接口

加载未完成的需求单从60天改为30天
1 个父辈 05d7048e
API接口
2024.1.9
# 1 过期物料冻结
冻结已过期物料, 冻结后物料不会绑定到工单,已绑定工单的物料不再出库
地址: http://10.85.36.152/myproject/rest/api/qisda/freezeExpiredReel
参数: paramInfo=["R201492021020575813","R035042020102630428"]
注: 传参方式与检测料盘是否绑定工单接口/checkLockReel一样
# 2 解冻已冻解的过期物料
地址: http://10.85.36.152/myproject/rest/api/qisda/freezeExpiredReel
参数: paramInfo=["R201492021020575813","R035042020102630428"]
注: 传参方式与检测料盘是否绑定工单接口/checkLockReel一样
......@@ -84,4 +84,8 @@ public interface IStoragePosDao extends IMongoDao {
StoragePos findByBarcode(String barcode);
StoragePos unbindReel(StoragePos storagePos);
void freezeExpiredReels(List<String> reelIds);
void unfreezeExpiredReels(List<String> reelIds);
}
......@@ -23,6 +23,7 @@ import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.Fields;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Repository;
import java.util.*;
......@@ -278,7 +279,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
@Override
public List<StoragePos> listPnFacility(String pn, String facility){
//PN和Facility一样
Criteria c = Criteria.where("barcode.partNumber").is(pn).and("barcode.appendInfo.facility").is(facility);
Criteria c = Criteria.where("barcode.partNumber").is(pn).and("barcode.appendInfo.facility").is(facility).and("barcode.lockId").is(null);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.produceDateStr").and(new Sort(Sort.Direction.ASC, "barcode.amount")));
return findByQuery(q);
......@@ -290,7 +291,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
@Override
public StoragePos findNoBindMinQty(String pn, String facility){
//PN和Facility一样,但没有绑定的(需求单号为NULL,并且没有分过盘的),且数量最小的一条数据
Criteria c = Criteria.where("barcode.partNumber").is(pn).and("barcode.appendInfo.facility").is(facility).and("barcode.appendInfo.so").is(null);
Criteria c = Criteria.where("barcode.partNumber").is(pn).and("barcode.appendInfo.facility").is(facility).and("barcode.appendInfo.so").is(null).and("barcode.lockId").is(null);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.produceDateStr").and(new Sort(Sort.Direction.ASC, "barcode.amount")));
return findOne(q);
......@@ -302,7 +303,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
@Override
public StoragePos findNoBindNoCutMinQty(String pn, String facility){
//PN和Facility一样,但没有绑定的(需求单号为NULL,并且没有分过盘的),且数量最小的一条数据
Criteria c = Criteria.where("barcode.partNumber").is(pn).and("barcode.appendInfo.facility").is(facility).and("barcode.appendInfo.so").is(null).and("barcode.appendInfo.cutMap").is(null);
Criteria c = Criteria.where("barcode.partNumber").is(pn).and("barcode.appendInfo.facility").is(facility).and("barcode.appendInfo.so").is(null).and("barcode.appendInfo.cutMap").is(null).and("barcode.lockId").is(null);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.produceDateStr").and(new Sort(Sort.Direction.ASC, "barcode.amount")));
return findOne(q);
......@@ -324,7 +325,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
@Override
public List<StoragePos> findPreBindList(String soseq, int slotlocation) {
String bindSlot = "" + slotlocation;
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.preBindSlot").is(bindSlot).and("barcode.appendInfo.bindSlot").is(null);
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.preBindSlot").is(bindSlot).and("barcode.appendInfo.bindSlot").is(null).and("barcode.lockId").is(null);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.amount"));
return findByQuery(q);
......@@ -343,7 +344,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
String preBindSlot = "" + slotlocation;
//同一个预绑定站位,且与生产日期一致,小于盈余数量的一盘料
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.preBindSlot").is(preBindSlot)
.and("barcode.appendInfo.bindSlot").is(null).and("barcode.produceDateStr").is(produceDateStr).and("barcode.amount").lte(surplusQty);
.and("barcode.appendInfo.bindSlot").is(null).and("barcode.produceDateStr").is(produceDateStr).and("barcode.amount").lte(surplusQty).and("barcode.lockId").is(null);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.DESC, "barcode.amount"));
return findOne(q);
......@@ -357,7 +358,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
String bindSlot = "" + slotlocation;
//同一个预绑定站位,且与生产日期一致,小于盈余数量的一盘料
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.bindSlot").is(bindSlot)
.and("barcode.produceDateStr").is(produceDateStr).and("barcode.amount").lte(surplusQty);
.and("barcode.produceDateStr").is(produceDateStr).and("barcode.amount").lte(surplusQty).and("barcode.lockId").is(null);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.DESC, "barcode.amount"));
return findOne(q);
......@@ -370,7 +371,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
public StoragePos findMaxQtyBindReel(String soseq, int slotlocation){
String bindSlot = "" + slotlocation;
//同一个预绑定站位,且与生产日期一致,小于盈余数量的一盘料
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.bindSlot").is(bindSlot);
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.bindSlot").is(bindSlot).and("barcode.lockId").is(null);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.DESC, "barcode.amount"));
return findOne(q);
......@@ -386,7 +387,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
public List<StoragePos> findCutList(String so, int slotlocation, String soseq){
String outItemKey = so + "@" + slotlocation + "@" + soseq;
String mapKey = "barcode.appendInfo.cutMap." + outItemKey;
Criteria c = Criteria.where(mapKey).exists(true);
Criteria c = Criteria.where(mapKey).exists(true).and("barcode.lockId").is(null);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.amount"));
return findByQuery(q);
......@@ -408,7 +409,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
@Override
public List<StoragePos> findBindList(String soseq, int slotlocation) {
String bindSlot = "" + slotlocation;
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.preBindSlot").is(bindSlot);
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.preBindSlot").is(bindSlot).and("barcode.lockId").is(null);
//去除的仓位
Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.amount"));
......@@ -423,7 +424,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
*/
@Override
public List<StoragePos> findBindByPn(String soseq, String pn){
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.partNumber").is(pn);
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.partNumber").is(pn).and("barcode.lockId").is(null);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.DESC, "barcode.amount"));
return findByQuery(q);
......@@ -437,7 +438,7 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
if(Strings.isBlank(soseq)){
return new ArrayList<>();
}
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq);
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.lockId").is(null);
Query q = new Query(c);
return findByQuery(q);
}
......@@ -458,4 +459,22 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
storagePos = save(storagePos);
return storagePos;
}
@Override
public void freezeExpiredReels(List<String> reelIds){
Criteria c = Criteria.where("barcode.barcode").in(reelIds);
Query query = Query.query(c);
Update update = new Update();
update.set("barcode.lockId","1000");
updateMulti(query,update);
}
@Override
public void unfreezeExpiredReels(List<String> reelIds){
Criteria c = Criteria.where("barcode.barcode").in(reelIds);
Query query = Query.query(c);
Update update = new Update();
update.set("barcode.lockId", null);
updateMulti(query,update);
}
}
......@@ -520,8 +520,8 @@ public class OutInfoCache {
List<OutInfo> unEndOutInfoList = outInfoDao.findUnEndOutInfos();
long now = System.currentTimeMillis();
for (OutInfo outInfo : unEndOutInfoList) {
if(now - outInfo.getMdate().getTime() > 60 * 24 * 60 * 60 * 1000){
log.info(outInfo.gethSerial() + "为两个月前需求单,忽略");
if(now - outInfo.getMdate().getTime() > 30 * 24 * 60 * 60 * 1000){
log.info(outInfo.gethSerial() + "为30天前需求单,忽略");
}
// if(now - outInfo.getMdate().getTime() > 10 * 24 * 60 * 60 * 1000){
// //10天前的需求单(非紧急料),关闭,并解绑
......
......@@ -112,8 +112,14 @@ public class StoragePosFindController extends BaseSearchController {
request.setAttribute("expire",expire);
}
addLikeParam(request, baseCriteria,"barcode.lockId");
String lockId = request.getParameter("lockId");
if(!Strings.isNullOrEmpty(lockId)){
request.setAttribute("lockId",lockId);
if(lockId.equalsIgnoreCase("-1")){
lockId = null;
}
baseCriteria.and("barcode.lockId").is(lockId);
}
addLikeParam(baseCriteria, request, "otherField1");
addLikeParam(baseCriteria, request, "otherField2");
......
......@@ -331,6 +331,48 @@ public class QisdaApiController extends BaseController {
}
/**
* 冻结已过期物料, 冻结后物料不会绑定到工单,已绑定工单的物料不再出库
*/
@RequestMapping(value = "/freezeExpiredReel",method = RequestMethod.POST)
@ResponseBody
public ResultBean freezeExpiredReel(HttpServletRequest request) {
try {
String paramInfo = receiveParamInfo(request, "paramInfo");
log.info("收到冻结过期物料请求:" + paramInfo);
if (paramInfo == null) {
return ResultBean.newErrorResult(-1, "参数为空");
}
List<String> reelIds = JsonUtil.toList(paramInfo, String.class);
storagePosDao.freezeExpiredReels(reelIds);
} catch (Exception e) {
log.error("冻结过期物料请求处理出错", e);
return ResultBean.newErrorResult(1001, "内部错误:" + e.getMessage());
}
return ResultBean.newOkResult("");
}
/**
* 解冻已冻解的过期物料
*/
@RequestMapping(value = "/unfreezeExpiredReel",method = RequestMethod.POST)
@ResponseBody
public ResultBean unfreezeExpiredReel(HttpServletRequest request) {
try {
String paramInfo = receiveParamInfo(request, "paramInfo");
log.info("收到解冻过期物料请求:" + paramInfo);
if (paramInfo == null) {
return ResultBean.newErrorResult(-1, "参数为空");
}
List<String> reelIds = JsonUtil.toList(paramInfo, String.class);
storagePosDao.unfreezeExpiredReels(reelIds);
} catch (Exception e) {
log.error("解冻过期物料请求处理出错", e);
return ResultBean.newErrorResult(1001, "内部错误:" + e.getMessage());
}
return ResultBean.newOkResult("");
}
/**
* 检测料盘是否绑定工单
*/
@RequestMapping(value = "/checkLockReel",method = RequestMethod.POST)
......
......@@ -117,6 +117,15 @@
<input type="text" name="facility" class="form-control" value="${facility}"/>
</div>
</div>
<label class="control-label col-md-1 col-xs-2"><fmt:message key="过期冻结"/></label>
<div class="col-md-2">
<select id="lockId" name="lockId" class="form-control">
<option value=""><fmt:message key="select.all"/></option>
<option value="1000" <c:if test="${lockId=='1000'}"> selected </c:if> >是</option>
<option value="-1" <c:if test="${lockId=='-1'}"> selected </c:if> >否</option>
</select>
</div>
</div>
</form:form>
......@@ -205,6 +214,9 @@
<display:column titleKey="Slot" sortProperty="barcode.appendInfo.slotIndex" sortable="true">
${pos.barcode.appendInfo.bindSlot}
</display:column>
<display:column titleKey="过期锁定" sortable="false">
<c:if test="${pos.barcode.lockId != null}">是</c:if>
</display:column>
<%--<display:column titleKey="barcode.expireDate" sortProperty="barcode.expireDate" sortable="true">--%>
<%--<fmt:formatDate value="${pos.barcode.expireDate}" pattern="yyyy-MM-dd"/>--%>
......
......@@ -12,6 +12,24 @@
<div class="row">
<div class="col-md-12">
<ul class="timeline">
<li class="timeline-yellow">
<div class="timeline-time">
<span class="date">2024</span>
<span class="time">01-09</span>
</div>
<div class="timeline-icon">
<i class="fa fa-clock-o"></i>
</div>
<div class="timeline-body">
<h2>版本: V2024010917</h2>
<div class="timeline-content">
<ul>
<li>增加冻结和解冻过期物料接口</li>
<li>加载未完成的需求单从60天改为30天</li>
</ul>
</div>
</div>
</li>
<li class="timeline-grey">
<div class="timeline-time">
<span class="date">2023</span>
......
......@@ -239,7 +239,7 @@
<div class="page-footer-inner">
2016&copy; <a href="${ctx}/updateHistory.html">SMD BOX</a>
</div>
<span class="right" style="color: #a3a3a3;">Version: V2023112816</span>
<span class="right" style="color: #a3a3a3;">Version: V2024010917</span>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!