Commit 141e65fa sunke

盘点界面

获取工单绑定信息接口
1 个父辈 938faf99
......@@ -325,7 +325,7 @@ IP: 10.85.160.181
12. 包装线AGV获取料架中的任务数,如果当前料架的任务数不为0,需要用当前料架去其他包装仓继续放料
>地址:
>>/rest/api/qisda/device/getShelfLockInfo
>>/rest/api/qisda/device/shelfTaskCount
>
>参数:
>>rfid : RFID
......@@ -340,4 +340,23 @@ IP: 10.85.160.181
>> - taskCount: 当前料架剩余任务数(即还有几盘料没放上去)
13. 盘点时客户端通知服务器某库位是否有料
>地址:
>>/rest/api/qisda/device/posReelCheck
>
>参数:
>>cid : 客户端CID
>>pos : 库位
>>hasReel : 库位是否有料,true表示有料,其他值为无料
>
> 返回:
>>` {"code":0,"msg":"ok","data":""}`
>>
>> - code: 0为正常,其他为异常,
>> - msg:消息,
>> - data:
......@@ -370,7 +370,7 @@ public class InquiryShelfBean {
}
}
}else{
log.error("未找到需求单["+hSerial+"]料架["+rfid+"], 当前Map:" + hSerialShelfMap);
log.error("未找到需求单["+hSerial+"]料架["+rfid+"]");
}
}
return null;
......
package com.myproject.bean.qisda;
/**
* Created by sunke on 2020/6/12.
*/
public class ItemLockInfo {
/**
* 工单序号
*/
private String soseq;
/**
* 站位序号
*/
private int slotlocation;
/**
* 物料编号
*/
private String partNum;
/**
* 需求数量
*/
private int qty;
/**
* 预绑定数量
*/
private int preLockQty;
/**
* 真实绑定数量
*/
private int realLockQty;
/**
* 已发料数量
*/
private int sendQty;
public String getPartNum() {
return partNum;
}
public void setPartNum(String partNum) {
this.partNum = partNum;
}
public int getPreLockQty() {
return preLockQty;
}
public void setPreLockQty(int preLockQty) {
this.preLockQty = preLockQty;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
public int getRealLockQty() {
return realLockQty;
}
public void setRealLockQty(int realLockQty) {
this.realLockQty = realLockQty;
}
public int getSendQty() {
return sendQty;
}
public void setSendQty(int sendQty) {
this.sendQty = sendQty;
}
public int getSlotlocation() {
return slotlocation;
}
public void setSlotlocation(int slotlocation) {
this.slotlocation = slotlocation;
}
public String getSoseq() {
return soseq;
}
public void setSoseq(String soseq) {
this.soseq = soseq;
}
}
package com.myproject.bean.qisda;
import com.myproject.util.DateUtil;
import java.util.Date;
/**
* 料仓盘点详情
* Created by sunke on 2020/6/12.
*/
public class StockCheckItem {
/**
* 库位编号
*/
private String posName;
/**
* 库位Id
*/
private String posId;
/**
* 客户端上传的库位是否有料
*/
private boolean clientHasReel;
/**
* 服务器记录的库位物料,如果没有物料,条码为空
*/
private String barcode = "";
private Date date = new Date();
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public boolean isClientHasReel() {
return clientHasReel;
}
public void setClientHasReel(boolean clientHasReel) {
this.clientHasReel = clientHasReel;
}
public String getPosName() {
return posName;
}
public void setPosName(String posName) {
this.posName = posName;
}
public boolean isRight(){
if(clientHasReel){
//服务端该库位也记录的有值才算一致
return !getBarcode().isEmpty();
}else{
return getBarcode().isEmpty();
}
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getDateStr(){
return DateUtil.toDateTimeString(date);
}
public String getPosId() {
return posId;
}
public void setPosId(String posId) {
this.posId = posId;
}
}
package com.myproject.webapp.controller.qisda;
import com.csvreader.CsvReader;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import com.myproject.bean.qisda.DiffInfo;
import com.myproject.bean.qisda.StockCheckItem;
import com.myproject.bean.update.Barcode;
import com.myproject.bean.update.StoragePos;
import com.myproject.exception.ApiException;
import com.myproject.manager.IStoragePosManager;
import com.myproject.util.QisdaApi;
import com.myproject.webapp.controller.storage.BaseController;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
* 料仓盘点功能
*/
@Controller
public class StockCheckController extends BaseController {
private static Map<String, StockCheckItem> checkItemMap = new ConcurrentHashMap<>();
protected final transient Logger log = LogManager.getLogger(getClass());
/**
*
* 盘点
*/
@RequestMapping("/qisda/stockCheck.html")
public String stockCheck(HttpServletRequest request) throws ApiException {
return "qisda/stockCheck";
}
@RequestMapping(value = "/service/store/qisda/stockCheckItems")
@ResponseBody
public List<StockCheckItem> checkResult(HttpServletRequest request){
List<StockCheckItem> items = new ArrayList<>(checkItemMap.values());
items.sort(new Comparator<StockCheckItem>() {
@Override
public int compare(StockCheckItem o1, StockCheckItem o2) {
return o1.getDate().compareTo(o2.getDate());
}
});
return items;
}
/**
* 更新盘点结果
* @param pos 库位
* @param hasReel 是否有料
*/
public static void updateStockCheckItem(StoragePos pos, boolean hasReel){
if(pos != null){
StockCheckItem checkItem = new StockCheckItem();
checkItem.setPosId(pos.getId());
checkItem.setPosName(pos.getPosName());
checkItem.setClientHasReel(hasReel);
Barcode barcode = pos.getBarcode();
if(barcode != null){
checkItem.setBarcode(barcode.getBarcode());
}
checkItemMap.put(checkItem.getPosName(), checkItem);
}
}
}
......@@ -574,6 +574,12 @@ public class OutInfoCache {
outInfoMap.put(hSerial, outInfo);
outInfoDao.updateTaskFinishNum(hSerial,taskFinishNum);
updateSendStatus(outInfo.gethSerial());
if(outInfo.isTaskEnd()){
//本次任务已结束,清理料架
InquiryShelfBean.clearShelf(outInfo.gethSerial());
}
return outInfo;
......
......@@ -187,9 +187,11 @@ public class SoseqCache {
if(itemMap == null){
List<OutItem> outItems = outItemDao.findByHSerial(outInfo.gethSerial());
outInfo.updateOutItems(outItems);
if(!outInfo.isSendEnd() && !outInfo.isClosed()){
soSeqCacheMap.put(outInfo.getSoseq(), outInfo);
}
}
}
return outInfo;
}
......
......@@ -17,6 +17,7 @@ import com.myproject.exception.ValidateException;
import com.myproject.manager.IComponentManager;
import com.myproject.util.*;
import com.myproject.webapp.controller.qisda.util.OutInfoCache;
import com.myproject.webapp.controller.qisda.util.SoseqCache;
import com.myproject.webapp.controller.storage.BaseController;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -51,6 +52,9 @@ public class QisdaApiController extends BaseController {
@Autowired
private OutInfoCache outInfoCache;
@Autowired
private SoseqCache soseqCache;
@Autowired
private QisdaBindService qisdaBindService;
......@@ -145,6 +149,30 @@ public class QisdaApiController extends BaseController {
QisdaApi.VMIMateriaReceive(barcode, task);
}
}
/**
* 获取工单的绑定信息
*/
@RequestMapping(value = "/soSeqLockInfo")
@ResponseBody
public ResultBean getSoSeqLockInfo(HttpServletRequest request){
String soseq = receiveParamInfo(request,"soseq");
log.info("收到关闭工单请求soseq="+soseq);
OutInfo cutOutInfo = soseqCache.getCutActionInfoFromCache(soseq);
List<ItemLockInfo> itemLockInfoList = new ArrayList<>();
if(cutOutInfo != null){
for (OutItem outItem : cutOutInfo.getOutItems()) {
ItemLockInfo itemLockInfo = new ItemLockInfo();
itemLockInfo.setSoseq(outItem.getSoseq());
itemLockInfo.setPartNum(outItem.getPn());
itemLockInfo.setQty(outItem.getQty());
itemLockInfo.setPreLockQty(outItem.getLockQty());
itemLockInfo.setRealLockQty(outItem.getRealLockQty());
itemLockInfo.setSlotlocation(outItem.getSlotlocation());
itemLockInfoList.add(itemLockInfo);
}
}
return ResultBean.newOkResult(itemLockInfoList);
}
/**
* 检测料盘是否绑定工单
......
......@@ -2,10 +2,7 @@ package com.myproject.webapp.controller.webService;
import com.myproject.bean.CodeBean;
import com.myproject.bean.qisda.*;
import com.myproject.bean.update.AlarmInfo;
import com.myproject.bean.update.Barcode;
import com.myproject.bean.update.DataLog;
import com.myproject.bean.update.Storage;
import com.myproject.bean.update.*;
import com.myproject.bean.update.qisda.OutInfo;
import com.myproject.bean.update.qisda.OutItem;
import com.myproject.dao.mongo.IAlarmInfoDao;
......@@ -16,8 +13,10 @@ import com.myproject.dao.mongo.qisda.IOutItemDao;
import com.myproject.exception.ValidateException;
import com.myproject.manager.IBarcodeManager;
import com.myproject.manager.IComponentManager;
import com.myproject.manager.IStoragePosManager;
import com.myproject.util.QisdaApi;
import com.myproject.util.StorageConstants;
import com.myproject.webapp.controller.qisda.StockCheckController;
import com.myproject.webapp.controller.qisda.util.OutInfoCache;
import com.myproject.webapp.controller.storage.BaseController;
import org.apache.logging.log4j.LogManager;
......@@ -44,6 +43,9 @@ public class QisdaDeviceController extends BaseController {
protected IComponentManager componentManager;
@Autowired
protected IStoragePosManager storagePosManager;
@Autowired
private IBarcodeManager barcodeManager;
@Autowired
......@@ -1084,9 +1086,16 @@ public class QisdaDeviceController extends BaseController {
public ResultBean posReelCheck(HttpServletRequest request){
String cid = request.getParameter("cid");
String posName = request.getParameter("pos");
String hasReel = request.getParameter("hasReel");
String hasReelStr = request.getParameter("hasReel");
log.info("收到客户端["+cid+"]对库位["+posName+"]的盘点结果:" + hasReelStr);
StoragePos pos = storagePosManager.getByPosName(posName);
if(pos != null){
Boolean hasReel = Boolean.valueOf(hasReelStr);
StockCheckController.updateStockCheckItem(pos,hasReel);
}
return ResultBean.newOkResult("");
}
}
......@@ -1907,39 +1907,6 @@ public class TaskService implements ITaskService {
//int slotIndex = task.getAppendInfo().getSlotIndex();
OutInfo outInfo = outInfoCache.incOutNum(outItem.gethSerial(),outItem.getId(), task.getNum());
// if(barcode.hasCutInfo()){
// //分盘料,需要更新对应的需求单出库数量
// final List<Map<String, Object>> cutItems = barcode.getCutItems();
// for (Map<String, Object> cutItem : cutItems) {
// String soseqStr = cutItem.get("soseq").toString();
// String slotlocation = cutItem.get("slotlocation").toString();
// String qty = cutItem.get("qty").toString();
// OutItem cutInfoItem = outItemDao.findCutItem(soseqStr, Integer.valueOf(slotlocation));
// if(cutInfoItem == null){
// log.error("未找到soseq=["+soseqStr+"]slotseq=["+slotlocation+"]的需求信息");
// continue;
// }
// int outQty = outItem.getOutQty() + Integer.valueOf(qty);
// log.info("分盘需求单["+cutInfoItem.gethSerial()+"]["+slotlocation+"]的出库数量增加"+qty+"="+outQty);
// outItem.setOutQty(outQty);
// outItem = outItemDao.save(outItem);
// outInfoCache.updateOutItem(outItem.getId());
// }
// }else{
// int outQty = outItem.getOutQty() + task.getNum();
// outItem.setOutQty(outQty);
//
// if(outItem.isUrgentAction()){
// log.info("紧急料设置发料数量与出库数量一致");
// //紧急料发料数量与出库数量一致
// outItem.setSendQty(outQty);
// }
// outItem = outItemDao.save(outItem);
// outInfoCache.updateOutItem(outItem.getId());
// }
String latest = outInfo.getOutLatest();
QisdaApiController.OutFinished(task, barcode, latest);
......
<%@ include file="/common/taglibs.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<style type="text/css">
.modal-body {
position: relative;
padding: 15px;
height: 360px;
overflow-y: scroll;
}
.td-item{
display: block;
padding:1px;
}
</style>
<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
<fmt:message key="盘点"/>
</h3>
<!-- BEGIN PAGE CONTENT-->
<div class="row">
<div class="col-md-12">
<!-- BEGIN EXAMPLE TABLE PORTLET-->
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-list-alt"></i>
</div>
</div>
<div class="portlet-body">
<table class="table table-striped table-hover table-bordered no-footer" role="grid" aria-describedby="sample_editable_1_info">
<thead class="dataTableHeader">
<tr role="row">
<th><fmt:message key="库位"/></th>
<th><fmt:message key="条码"/></th>
<th><fmt:message key="客户端检测"/></th>
<th><fmt:message key="时间"/></th>
<th><fmt:message key="操作"/></th>
</tr>
</thead>
<tbody class="dataTableBody" id="dataTableItems">
</tbody>
</table>
</div>
</div>
<!-- END EXAMPLE TABLE PORTLET-->
</div>
</div>
<c:set var="scripts" scope="request">
<script type="text/javascript">
$(document).ready(function(){
checkout = function(posId) {
$("#btn"+posId).attr("disabled","true");
$.post("${ctx}/service/store/checkout.html", {pids: posId}, function (data) {
alert(data);
});
}
function flushItems(){
$.post("${ctx}/service/store/qisda/stockCheckItems", {}, function (data) {
var itemsHtml = '';
for(var i in data){
var stockCheckItem = data[i];
var resultColor = "bg-green";
var operate = "";
if(!stockCheckItem.right){
resultColor = "bg-red";
operate = "<button class='btn yellow' onclick=\"checkout('"+stockCheckItem.posId+"')\"> " +
"<i class='fa fa-sign-out'></i><fmt:message key='button.checkout'/></button>";
}
var trHtml = "<tr>" +
"<td class='"+resultColor+" td-item'>"+ stockCheckItem.posName +"</td>" +
"<td>"+ stockCheckItem.barcode +"</td>" +
"<td>"+ stockCheckItem.clientHasReel +"</td>" +
"<td>"+ stockCheckItem.dateStr +"</td>" +
"<td>"+ operate +"</td>" +
"</tr>";
itemsHtml = itemsHtml + trHtml;
}
$("#dataTableItems").html(itemsHtml);
});
}
flushItems();
setInterval(function(){
flushItems();
}, 1000);
});
</script>
</c:set>
\ No newline at end of file
......@@ -50,6 +50,11 @@
</a>
</li>
<li class="classic-menu-dropdown">
<a href="${ctx}/qisda/stockCheck.html" name="qisda">
<fmt:message key="盘点"/><span class="selected"></span>
</a>
</li>
<li class="classic-menu-dropdown">
<a href="${ctx}/qisda/diffInventory.html" name="qisda">
<fmt:message key="库存比对"/><span class="selected"></span>
</a>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!