7 changed files with 509 additions and 62 deletions
-
12src/main/java/com/gaotao/modules/app/controller/PageController.java
-
82src/main/java/com/gaotao/modules/pda/controller/SapController.java
-
130src/main/java/com/gaotao/modules/pda/data/InRollInfoData.java
-
39src/main/java/com/gaotao/modules/pda/service/SapService.java
-
98src/main/java/com/gaotao/modules/pda/service/impl/SapServiceImpl.java
-
116src/main/resources/static/pda/js/sap/sap_part_location.js
-
94src/main/resources/templates/pda/sap/sap_part_location.ftl
@ -0,0 +1,82 @@ |
|||
package com.gaotao.modules.pda.controller; |
|||
|
|||
|
|||
import com.gaotao.common.annotation.RepeatSubmit; |
|||
import com.gaotao.modules.pda.config.XuJieConfig; |
|||
import com.gaotao.modules.pda.service.SapService; |
|||
import com.gaotao.modules.pda.utils.ResponseData; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpSession; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* |
|||
* @ClassName: SapController |
|||
* @Description: 修改sap的库位 |
|||
* @author lirui |
|||
* @date 2018年4月11日 |
|||
* |
|||
*/ |
|||
@RequestMapping(value="/sap") |
|||
@Controller |
|||
public class SapController { |
|||
|
|||
@Autowired |
|||
private SapService sapService; |
|||
@Autowired |
|||
XuJieConfig xuJieConfig; |
|||
|
|||
/** |
|||
* |
|||
* @Title: scanRollNo |
|||
* @Description: 扫描卷号, |
|||
* @author lirui |
|||
* @date 2018年4月4日 |
|||
* @throws |
|||
*/ |
|||
@PostMapping(value="/scanRollNo") |
|||
@ResponseBody |
|||
public Object scanRollNo(String rollNo){ |
|||
ResponseData responseData = new ResponseData(); |
|||
try { |
|||
responseData = sapService.scanRollNo(rollNo); |
|||
responseData.setCode("200"); |
|||
responseData.setMsg("操作成功!"); |
|||
} catch (Exception e) { |
|||
responseData.setCode("500"); |
|||
responseData.setMsg(e.getMessage()); |
|||
} |
|||
return responseData; |
|||
} |
|||
|
|||
/** |
|||
* |
|||
* @Title: endCurrentScan |
|||
* @Description: 结束当前扫描任务 |
|||
* @author lirui |
|||
* @date 2018年4月7日 |
|||
* @throws |
|||
*/ |
|||
@PostMapping(value="/endCurrentScan") |
|||
@ResponseBody |
|||
@RepeatSubmit |
|||
public Object endCurrentScan(String partNo, String locationNo){ |
|||
ResponseData responseData = new ResponseData(); |
|||
try { |
|||
responseData = sapService.endCurrentScan(partNo, locationNo); |
|||
responseData.setCode("200"); |
|||
responseData.setMsg("操作成功!"); |
|||
} catch (Exception e) { |
|||
responseData.setCode("500"); |
|||
responseData.setMsg(e.getMessage()); |
|||
} |
|||
return responseData; |
|||
} |
|||
|
|||
} |
|||
@ -1,91 +1,97 @@ |
|||
package com.gaotao.modules.pda.data; |
|||
|
|||
/** |
|||
* |
|||
* @author lirui |
|||
* @ClassName: InRollInfoData |
|||
* @Description: TODO(这里用一句话描述这个类的作用) |
|||
* @author lirui |
|||
* @date 2018年4月9日 |
|||
* |
|||
*/ |
|||
public class InRollInfoData { |
|||
private String site;// 厂商编码 |
|||
private String rollNo;// 内部卷号 |
|||
private String suppRollNo;// 供应商编码 |
|||
private String suppRollNoFlag;// 供应商卷号 |
|||
private String statusDB;// 库存状态 |
|||
private String status;// 状态 |
|||
private String site;// 厂商编码 |
|||
private String rollNo;// 内部卷号 |
|||
private String partNo;// 物料编码 |
|||
private String suppRollNo;// 供应商编码 |
|||
private String suppRollNoFlag;// 供应商卷号 |
|||
private String statusDB;// 库存状态 |
|||
private String status;// 状态 |
|||
|
|||
private String specialStatus; // 特殊状态,转储时使用 |
|||
|
|||
private String specialStatus; // 特殊状态,转储时使用 |
|||
private String warehouseId; |
|||
|
|||
private String warehouseId; |
|||
public String getWarehouseId() { |
|||
return warehouseId; |
|||
} |
|||
|
|||
public String getWarehouseId() { |
|||
return warehouseId; |
|||
} |
|||
public void setWarehouseId(String warehouseId) { |
|||
this.warehouseId = warehouseId; |
|||
} |
|||
|
|||
public void setWarehouseId(String warehouseId) { |
|||
this.warehouseId = warehouseId; |
|||
} |
|||
public String getSpecialStatus() { |
|||
return specialStatus; |
|||
} |
|||
|
|||
public String getSpecialStatus() { |
|||
return specialStatus; |
|||
} |
|||
public void setSpecialStatus(String specialStatus) { |
|||
this.specialStatus = specialStatus; |
|||
} |
|||
|
|||
public void setSpecialStatus(String specialStatus) { |
|||
this.specialStatus = specialStatus; |
|||
} |
|||
public InRollInfoData() { |
|||
// TODO Auto-generated constructor stub |
|||
} |
|||
|
|||
public InRollInfoData() { |
|||
// TODO Auto-generated constructor stub |
|||
} |
|||
public String getSite() { |
|||
return site; |
|||
} |
|||
|
|||
public String getSite() { |
|||
return site; |
|||
} |
|||
public void setSite(String site) { |
|||
this.site = site; |
|||
} |
|||
|
|||
public void setSite(String site) { |
|||
this.site = site; |
|||
} |
|||
public String getRollNo() { |
|||
return rollNo; |
|||
} |
|||
|
|||
public String getRollNo() { |
|||
return rollNo; |
|||
} |
|||
public void setRollNo(String rollNo) { |
|||
this.rollNo = rollNo; |
|||
} |
|||
|
|||
public void setRollNo(String rollNo) { |
|||
this.rollNo = rollNo; |
|||
} |
|||
public String getSuppRollNo() { |
|||
return suppRollNo; |
|||
} |
|||
|
|||
public String getSuppRollNo() { |
|||
return suppRollNo; |
|||
} |
|||
public void setSuppRollNo(String suppRollNo) { |
|||
this.suppRollNo = suppRollNo; |
|||
} |
|||
|
|||
public void setSuppRollNo(String suppRollNo) { |
|||
this.suppRollNo = suppRollNo; |
|||
} |
|||
public String getSuppRollNoFlag() { |
|||
return suppRollNoFlag; |
|||
} |
|||
|
|||
public String getSuppRollNoFlag() { |
|||
return suppRollNoFlag; |
|||
} |
|||
public void setSuppRollNoFlag(String suppRollNoFlag) { |
|||
this.suppRollNoFlag = suppRollNoFlag; |
|||
} |
|||
|
|||
public void setSuppRollNoFlag(String suppRollNoFlag) { |
|||
this.suppRollNoFlag = suppRollNoFlag; |
|||
} |
|||
public String getStatusDB() { |
|||
return statusDB; |
|||
} |
|||
|
|||
public String getStatusDB() { |
|||
return statusDB; |
|||
} |
|||
public void setStatusDB(String statusDB) { |
|||
this.statusDB = statusDB; |
|||
} |
|||
|
|||
public void setStatusDB(String statusDB) { |
|||
this.statusDB = statusDB; |
|||
} |
|||
public String getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public String getStatus() { |
|||
return status; |
|||
} |
|||
public void setStatus(String status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
public void setStatus(String status) { |
|||
this.status = status; |
|||
} |
|||
public String getPartNo() { |
|||
return partNo; |
|||
} |
|||
|
|||
public void setPartNo(String partNo) { |
|||
this.partNo = partNo; |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
package com.gaotao.modules.pda.service; |
|||
|
|||
|
|||
import com.gaotao.modules.pda.utils.ResponseData; |
|||
|
|||
/** |
|||
* |
|||
* @ClassName: Produce |
|||
* @Description: sap使用的service |
|||
* @author lirui |
|||
* @date 2018年4月11日 |
|||
* |
|||
*/ |
|||
public interface SapService { |
|||
|
|||
/** |
|||
* |
|||
* @Title: scanRollNo |
|||
* @Description: 扫描卷号设置缓存 |
|||
* @author lirui |
|||
* @date 2018年4月11日 |
|||
* @return ResponseData 返回类型 |
|||
* @throws |
|||
*/ |
|||
ResponseData scanRollNo(String rollNo); |
|||
|
|||
/** |
|||
* |
|||
* @Title: endCurrentScan |
|||
* @Description: 结束扫描,发送数据 |
|||
* @author lirui |
|||
* @date 2018年4月11日 |
|||
* @param @return 参数 |
|||
* @return ResponseData 返回类型 |
|||
* @throws |
|||
*/ |
|||
ResponseData endCurrentScan(String partNo, String locationNo); |
|||
|
|||
} |
|||
@ -0,0 +1,98 @@ |
|||
package com.gaotao.modules.pda.service.impl; |
|||
|
|||
import com.gaotao.common.exception.XJException; |
|||
import com.gaotao.modules.pda.dao.*; |
|||
import com.gaotao.modules.pda.data.FPRollsOutData; |
|||
import com.gaotao.modules.pda.data.InRollInfoData; |
|||
import com.gaotao.modules.pda.entity.TransDetail; |
|||
import com.gaotao.modules.pda.entity.TransDetailSub; |
|||
import com.gaotao.modules.pda.entity.TransHeader; |
|||
import com.gaotao.modules.pda.service.SapService; |
|||
import com.gaotao.modules.pda.utils.DateUtils; |
|||
import com.gaotao.modules.pda.utils.HttpClientUtil; |
|||
import com.gaotao.modules.pda.utils.ResponseData; |
|||
import com.gaotao.modules.schedule.mapper.ProcedureMapper; |
|||
import com.gaotao.modules.sys.entity.SysUserEntity; |
|||
import net.sf.json.JSONObject; |
|||
import net.sf.json.xml.XMLSerializer; |
|||
import org.apache.shiro.SecurityUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Repository; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpSession; |
|||
import java.util.*; |
|||
|
|||
/** |
|||
* |
|||
* @ClassName: ProduceServiceImpl |
|||
* @Description: 生产使用的service实现 |
|||
* @author lirui |
|||
* @date 2018年4月11日 |
|||
* |
|||
*/ |
|||
@Repository |
|||
public class SapServiceImpl implements SapService { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(SapServiceImpl.class); |
|||
|
|||
@Autowired |
|||
private FPRollsDao fPRollsDao; |
|||
|
|||
@Autowired |
|||
private ProcedureMapper procedureMapper; |
|||
|
|||
@Override |
|||
public ResponseData scanRollNo(String rollNo) { |
|||
ResponseData responseData = new ResponseData(); |
|||
//获取当前的成品卷信息 |
|||
InRollInfoData inData = new InRollInfoData(); |
|||
inData.setRollNo(rollNo); |
|||
inData.setSite("1"); |
|||
// 通过rollNo获取成品卷信息 |
|||
FPRollsOutData rollInfo = fPRollsDao.getSplitRollByRollNo(inData); |
|||
if(null== rollInfo){ |
|||
throw new RuntimeException("当前卷不存在,请检查后再扫描!"); |
|||
} |
|||
responseData.setObj(rollInfo); |
|||
return responseData; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public ResponseData endCurrentScan(String partNo, String locationNo) { |
|||
ResponseData responseData = new ResponseData(); |
|||
//调用存储过程 处理SAP的库位信息 |
|||
Map<String, Object> resultMap = this.processSapPartLocation(partNo, locationNo); |
|||
//判断是否检验成功 |
|||
String resultCode = String.valueOf(resultMap.get("resultCode")); |
|||
if (!"200".equalsIgnoreCase(resultCode)) { |
|||
String msg = String.valueOf(resultMap.get("resultMsg")); |
|||
throw new XJException(msg, Integer.parseInt(resultCode)); |
|||
} |
|||
return responseData; |
|||
} |
|||
|
|||
/** |
|||
* @description: 处理SAP的库位 |
|||
* @author LR |
|||
* @date 2023/1/13 17:54 |
|||
* @version 1.0 |
|||
*/ |
|||
public Map<String, Object> processSapPartLocation(String partNo, String locationNo) { |
|||
List<Object> params = new ArrayList<>(); |
|||
params.add(partNo); |
|||
params.add(locationNo); |
|||
//调用存储过程 |
|||
List<Map<String, Object>> resultList = procedureMapper.getProcedureData("processSapPartLocation", params); |
|||
//处理返回的结果 |
|||
Map<String, Object> resultMap = resultList.get(0); |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,116 @@ |
|||
//为内部卷号绑定一个失去焦点事件
|
|||
$("#rollNo").bind("keydown",function(event){ |
|||
if (event.keyCode == 13) { |
|||
var rollNo = $("#rollNo").val(); |
|||
if(null==rollNo||rollNo==""){ |
|||
layer.alert("成品卷号不能为空!"); |
|||
}else{ |
|||
scanRollNo(rollNo); |
|||
return false; |
|||
} |
|||
} |
|||
return true; |
|||
}); |
|||
|
|||
//库位绑定一个失去焦点事件
|
|||
$("#location_no").bind("keydown",function(event){ |
|||
if (event.keyCode == 13) { |
|||
var locationNo = $(this).val(); |
|||
if(null==locationNo||locationNo==""){ |
|||
layer.alert("库位编码不能为空!"); |
|||
}else{ |
|||
endCurrentScan(); |
|||
return false; |
|||
} |
|||
} |
|||
return true; |
|||
}); |
|||
|
|||
// 页面初始化加在数据
|
|||
$(function(){ |
|||
//获取焦点
|
|||
$("#rollNo").focus();//获取焦点
|
|||
}); |
|||
|
|||
// 通过卷号获取信息
|
|||
function scanRollNo(rollNo){ |
|||
$.ajax({ |
|||
url : "/sap/scanRollNo", |
|||
type : "POST", |
|||
data : {rollNo: rollNo |
|||
}, |
|||
dataType : "json", |
|||
beforeSend: function(request) { |
|||
request.setRequestHeader("token", $.cookie("token")); |
|||
}, |
|||
success : function(data) { |
|||
var code = data.code; |
|||
if (code=='200') { |
|||
// 赋值
|
|||
var rollData = data.obj; |
|||
$("#rollNo").attr("disabled", "disabled"); |
|||
//赋值当前的物料编码
|
|||
$("#part_no").val(rollData.partNo); |
|||
// 获取焦点
|
|||
$("#location_no").focus(); |
|||
} else if (code=='500') { |
|||
layer.alert(data.msg); |
|||
$("#rollNo").val(""); |
|||
//获取焦点
|
|||
$("#rollNo").focus(); |
|||
} |
|||
}, |
|||
error : function(data) { |
|||
} |
|||
}); |
|||
} |
|||
|
|||
//返回主界面清除缓存信息
|
|||
function goBack(){ |
|||
layer.confirm("返回主界面将会删除当前扫描信息!!", { |
|||
btn : [ '确认', '取消' ] |
|||
// 按钮
|
|||
}, function() { |
|||
layer.closeAll('dialog'); |
|||
goBackHome(); |
|||
}, function() { |
|||
layer.closeAll('dialog'); |
|||
}); |
|||
} |
|||
|
|||
// 清楚信息
|
|||
function clear(){ |
|||
//刷新信息 处理数据
|
|||
$("#rollNo").removeAttr("disabled"); |
|||
//赋值当前的物料编码
|
|||
$("#part_no").val(""); |
|||
$("#rollNo").val(""); |
|||
$("#location_no").val(""); |
|||
// 获取焦点
|
|||
$("#rollNo").focus(); |
|||
} |
|||
|
|||
// 结束当前扫描操作
|
|||
function endCurrentScan(){ |
|||
$.ajax({ |
|||
url : "/sap/endCurrentScan", |
|||
type : "POST", |
|||
data : {"partNo": $("#part_no").val(), "locationNo": $("#location_no").val()}, |
|||
dataType : "json", |
|||
beforeSend: function(request) { |
|||
request.setRequestHeader("token", $.cookie("token")); |
|||
}, |
|||
success : function(data) { |
|||
var code = data.code; |
|||
if(code=='200'){ |
|||
layer.msg(data.msg); |
|||
clear(); |
|||
}else if(code=='500'){ |
|||
layer.msg(data.msg); |
|||
} |
|||
}, |
|||
error : function(data) { |
|||
layer.alert(data.msg); |
|||
} |
|||
}); |
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh-CN"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> |
|||
<meta name="description" content=""> |
|||
<meta name="author" content=""> |
|||
<link rel="icon" href="/favicon.ico"> |
|||
<title>${projectTitle!"MESPda"}</title> |
|||
<!-- Bootstrap core CSS --> |
|||
<link href="/pda/bootstrap/3.3.7/bootstrap.min.css" rel="stylesheet"> |
|||
<link href="/pda/bootstrap/3.3.7/bootstrap-theme.min.css" rel="stylesheet"> |
|||
|
|||
<link rel="stylesheet" type="text/css" |
|||
href="/pda/jeasyui/themes/default/easyui.css"> |
|||
<link rel="stylesheet" type="text/css" href="/pda/jeasyui/themes/icon.css"> |
|||
|
|||
<!-- Custom styles for this template --> |
|||
<link href="/pda/css/base.css" rel="stylesheet"> |
|||
<link rel="stylesheet" type="text/css" href="/css/button.css"> |
|||
<style type="text/css"> |
|||
.ivu-input[disabled], fieldset[disabled] .ivu-input { |
|||
background-color: #f3f3f3; |
|||
opacity: 1; |
|||
cursor: not-allowed; |
|||
color: #0E2D5F; |
|||
} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<div id="app"> |
|||
<input type="hidden" id="flag" value="${Session.produce_flag!'N'}"> |
|||
<input type="hidden" id="produce_cache_flag" value="${Session.produce_cache_flag!'N' }" > |
|||
<div class="mint-tab-container screenHeight"> |
|||
<header class="mint-header is-fixed"> |
|||
<div class="mint-header-button is-left"> |
|||
<div class="header-title"> |
|||
<a onclick="goBack()" class="go-back"><i class="mintui mintui-back"></i></a> |
|||
<span>SAP库位处理</span> |
|||
</div> |
|||
</div> |
|||
<h1 class="mint-header-title"></h1> |
|||
<div class="mint-header-button is-right"></div> |
|||
</header> |
|||
<form autocomplete="off" class="ivu-form ivu-form-label-right"> |
|||
<div class="ivu-form-item"> |
|||
<label class="ivu-form-item-label" style="width: 90px;">请扫描卷号:</label> |
|||
<div class="ivu-form-item-content" style="margin-left: 90px;"> |
|||
<div class="ivu-input-wrapper ivu-input-type"> |
|||
<textarea autocomplete="off" spellcheck="false" id="rollNo" |
|||
placeholder="请扫描卷号..." rows="2" autofocus="autofocus" |
|||
class="ivu-input" |
|||
style="height: 52px; min-height: 52px; max-height: 52px;"></textarea> |
|||
</div> |
|||
<!----> |
|||
</div> |
|||
</div> |
|||
<div class="ivu-form-item"> |
|||
<div class="ivu-col ivu-col-span-6" style="">物料编码:</div> |
|||
<textarea autocomplete="off" spellcheck="false" id="part_no" disabled |
|||
rows="1" cols="30" |
|||
class="ivu-input" |
|||
style="height: 32px; min-height: 28px; min-width: 200px; max-width: 200px;"></textarea> |
|||
</div> |
|||
<div class="ivu-form-item"> |
|||
<label class="ivu-form-item-label" style="width: 90px;">请扫描库位:</label> |
|||
<div class="ivu-form-item-content" style="margin-left: 90px;"> |
|||
<div class="ivu-input-wrapper ivu-input-type"> |
|||
<textarea autocomplete="off" spellcheck="false" id="location_no" |
|||
placeholder="请扫描库位..." rows="2" autofocus="autofocus" |
|||
class="ivu-input" |
|||
style="height: 52px; min-height: 52px; max-height: 52px;"></textarea> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
|
|||
<div class="ivu-row" style="margin-top: 10px;margin-left: 120px;"> |
|||
<div class="ivu-col ivu-col-span-11"> |
|||
<button onclick="goBack()" class="ivu-btn ivu-btn-primary"> |
|||
<span>返回</span> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
<script type="text/javascript" src="/js/jquery/jquery-2.1.4.js"></script> |
|||
<script type="text/javascript" src="/pda/layer/layer.js"></script> |
|||
<script type="text/javascript" src="/pda/js/sap/sap_part_location.js"></script> |
|||
<script type="text/javascript" src="/js/jquery/jquery.cookie.js"></script> |
|||
</html> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue