Commit d1d4522c sunke

物料查询页面锁定物料也允许出库

物料尺寸上传功能
1 个父辈 fd35a274
正在显示 42 个修改的文件 包含 979 行增加42 行删除
PN,supplier,count,w,h
PP001,3002,1500,7,8
PP002,3002,1500,7,8
PP003,3003,1500,7,12
2020-12-23 13:36:09 INFO [BarcodeRule.java:394] - 准备发送到ministock
2020-12-23 13:37:26 INFO [BarcodeRule.java:394] - 准备发送到ministock
2020-12-08 10:25:13 INFO [BarcodeRule.java:48] - 开始解析二维码规则:1@2@3@PPN@5@6@7@8@9@10@xxPRODATEyyyyMMdd@xxxEXPDATEyyyyMMdd@13@14@15@16@VSP@3SRI@xQTYxxxxxx@20@21@22@23
2020-12-08 10:25:13 INFO [BarcodeRule.java:73] - 分割符为:@长度为:23
2020-12-08 10:25:13 INFO [BarcodeRule.java:77] - partNumber: 为{name='PN', index=3, prefix='P', suffix=''}
2020-12-08 10:25:13 INFO [BarcodeRule.java:90] - produceDate: 为{name='PRODATE', index=10, prefix='xx', suffix='yyyyMMdd'}
2020-12-08 10:25:13 INFO [BarcodeRule.java:92] - expireDate: 为{name='EXPDATE', index=11, prefix='xxx', suffix='yyyyMMdd'}
2020-12-08 10:25:13 INFO [BarcodeRule.java:87] - supplier: 为{name='SP', index=16, prefix='V', suffix=''}
2020-12-08 10:25:13 INFO [BarcodeRule.java:79] - reelId: 为{name='RI', index=17, prefix='3S', suffix=''}
2020-12-08 10:25:13 INFO [BarcodeRule.java:84] - quantity: 为{name='QTY', index=18, prefix='x', suffix='xxxxxx'}
2020-12-08 10:25:13 INFO [BarcodeRule.java:216] - 开始解析条码[[)>@06@12S0002@P1267360241@1P@31P@12V71862569@10VPHL-MADUYA@2P@20P@6D20201026@14D20221105@30PY@ZN@K@16K@V0000002262@3SS000002493953@Q5000NAR000@20T1@1T204413664H@2T@1Z@@]
package com.myproject.bean.czshelf;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
/**
* SMTLINENO线别, PARTNO料号, SENDTIME发料时间, SMEDSCANTIME smed扫料时间, SMEDPACKAGEID packageid, SPLICEREELBAR matid, TOID 同, SAPPLANTID
可以根据数据packageid与扫描入库packageid检索出线别和前后侧位置,例如:根据packageid检索出这盘物料是Line28后侧物料,软件应该会自动创建库位号=Line28-R-1001(1001表示电子料架库位号)
*/
public class ApiEcall {
/**
* 产线编号
*/
@JsonProperty("SMTLINENO")
private String smtLineNo;
/**
* ] 料号
*/
@JsonProperty("PARTNO")
private String partNo;
/**
* SENDTIME发料时间
*/
// @JsonProperty("")
// private Date sendTime;
/**
* SMEDSCANTIME smed扫料时间
*/
// @JsonProperty("")
// private Date smedScanTime;
/**
* SPLICEREELBAR matid,
*/
@JsonProperty("REELBAR")
private String spliceReelbar;
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getSmtLineNo() {
return smtLineNo;
}
public void setSmtLineNo(String smtLineNo) {
this.smtLineNo = smtLineNo;
}
public String getSpliceReelbar() {
return spliceReelbar;
}
public void setSpliceReelbar(String spliceReelbar) {
this.spliceReelbar = spliceReelbar;
}
@Override
public String toString() {
return "Ecall{" +
"partNo='" + partNo + '\'' +
", smtLineNo='" + smtLineNo + '\'' +
", spliceReelbar='" + spliceReelbar + '\'' +
'}';
}
}
package com.myproject.bean.czshelf;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by sunke on 2020/11/23.
* 获取正在SMD使用的物料信息
*/
public class ApiRemainingTime {
/**
* GUID
*/
@JsonProperty("GUID")
private String guid;
/**
* 产线编号
*/
@JsonProperty("SMTLINENO")
private int smtlineno;
/**
* 设备编号
*/
@JsonProperty("SMDSTATIONNO")
private int smdstationno;
/**
* SLOT
*/
@JsonProperty("SLOT")
private int slot;
/**
* SUBSLOT
*/
@JsonProperty("SUBSLOT")
private int subslot;
/**
* ] 料号
*/
@JsonProperty("PARTNO")
private String partNo;
/**
* 0=failure,1=sending,2=waiting,3=success,4=pick,5=smed,6=ministock,7=notEnough,8=cancel,9=spliced
*/
@JsonProperty("STATUSNO")
private int statusno;
/**
*
*/
@JsonProperty("PITCHVALUE")
private int pitchvalue;
/**
* 可用数量
*/
@JsonProperty("CURRENTQUANTITY")
private int currentquantity;
/**
* 物料消耗时间 可用时间= CURRENTQUANTITY*CYCLETIME,可能会用到的列名在上面表格中说明。
*/
@JsonProperty("CYCLETIME")
private float cycletime;
/**
* 物料唯一码matid
*/
@JsonProperty("REELBAR")
private String reelbar;
/**
* 0=普通料,2=MSD,3=Flash
*/
@JsonProperty("MATERIALTYPE")
private int materialtype;
/**
* 错误信息
*/
@JsonProperty("REQUESTEDAT")
private String requestedat;
public int getCurrentquantity() {
return currentquantity;
}
public void setCurrentquantity(int currentquantity) {
this.currentquantity = currentquantity;
}
public float getCycletime() {
return cycletime;
}
public void setCycletime(float cycletime) {
this.cycletime = cycletime;
}
public int getMaterialtype() {
return materialtype;
}
public void setMaterialtype(int materialtype) {
this.materialtype = materialtype;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getReelbar() {
return reelbar;
}
public void setReelbar(String reelbar) {
this.reelbar = reelbar;
}
public String getRequestedat() {
return requestedat;
}
public void setRequestedat(String requestedat) {
this.requestedat = requestedat;
}
public int getSlot() {
return slot;
}
public void setSlot(int slot) {
this.slot = slot;
}
public int getSmdstationno() {
return smdstationno;
}
public void setSmdstationno(int smdstationno) {
this.smdstationno = smdstationno;
}
public int getSmtlineno() {
return smtlineno;
}
public void setSmtlineno(int smtlineno) {
this.smtlineno = smtlineno;
}
public int getStatusno() {
return statusno;
}
public void setStatusno(int statusno) {
this.statusno = statusno;
}
public int getSubslot() {
return subslot;
}
public void setSubslot(int subslot) {
this.subslot = subslot;
}
public int getPitchvalue() {
return pitchvalue;
}
public void setPitchvalue(int pitchvalue) {
this.pitchvalue = pitchvalue;
}
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public RemainingTime toRemainingTime(){
RemainingTime rt = new RemainingTime();
rt.setGuid(this.getGuid());
rt.setLineNo(this.getSmtlineno());
//产品型号
//rt.setmCFileName();
rt.setSlot(this.getSlot());
//L/R 左右 0=左1=右
rt.setSubslot(this.getSubslot());
//Slot=110008
//Table/台车=如果slot为5位取第1位,slot为6位取前两位, 奇数是F,偶数是R
//Feeder/料枪=最后两位
String slotStr = this.getSlot() + "";
int tableNo = -1;
if(slotStr.length() == 5){
tableNo = Integer.valueOf(slotStr.substring(0,1));
}else{
tableNo = Integer.valueOf(slotStr.substring(0,2));
}
if(tableNo > 0){
if(tableNo%2 == 0){
tableNo = 2;
}else{
tableNo = 1;
}
}
rt.setTableNo(tableNo);
//料枪=最后两位 SlotNum
int slotNo = Integer.valueOf(slotStr.substring(slotStr.length() -2));
rt.setSlotNum(slotNo);
rt.setPartNo(this.getPartNo());
//时间
//rt.setTime_on();
rt.setReelbar(this.getReelbar());
rt.setCurrent_remaining_quantity(this.getCurrentquantity());
rt.setStatus(this.getStatusno());
//发料时间
//rt.setSendTime();
//库位
//rt.setCabinet();
//可使用的剩余时间 可用时间= CURRENTQUANTITY*CYCLETIME,可能会用到的列名在上面表格中说明。
//
float delataQty = 0;
if(this.getPitchvalue() >0){
delataQty = 1200f/this.getPitchvalue();
}
Float remainTime = this.getCycletime() * (this.getCurrentquantity()-delataQty)/60;
rt.setRemainingTime(remainTime.intValue());
//接料时间
//rt.setPartTimeOn();
return rt;
}
@Override
public String toString() {
return "ApiRemainingTime{" +
"currentquantity=" + currentquantity +
", smtlineno=" + smtlineno +
", smdstationno=" + smdstationno +
", slot=" + slot +
", subslot=" + subslot +
", partNo='" + partNo + '\'' +
", statusno=" + statusno +
", cycletime=" + cycletime +
", reelbar='" + reelbar + '\'' +
", materialtype=" + materialtype +
", requestedat='" + requestedat + '\'' +
'}';
}
}
package com.myproject.bean.czshelf;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
/**
* 接料信息
* Created by sunke on 2019/6/27.
*/
public class ApiSplice {
/**
* 产线编号
*/
@JsonProperty("SMTLINENO")
private String lineNo;
/**
* feeder位置
*/
@JsonProperty("SLOT")
private int slot;
/**
* feeder位置
*/
@JsonProperty("SUBSLOT")
private int subslot;
/**
* ] 料号
*/
@JsonProperty("PARTNO")
private String partNo;
/**
* 接料时间
*/
@JsonProperty("SPLICETIME")
private String spliceTime;
/**
* 物料唯一码matid
*/
@JsonProperty("REELBAR")
private String reelbar;
public String getLineNo() {
return lineNo;
}
public void setLineNo(String lineNo) {
this.lineNo = lineNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getReelbar() {
return reelbar;
}
public void setReelbar(String reelbar) {
this.reelbar = reelbar;
}
public int getSlot() {
return slot;
}
public void setSlot(int slot) {
this.slot = slot;
}
public int getSubslot() {
return subslot;
}
public void setSubslot(int subslot) {
this.subslot = subslot;
}
public String getSpliceTime() {
return spliceTime;
}
public void setSpliceTime(String spliceTime) {
this.spliceTime = spliceTime;
}
public String getKey(){
return lineNo + "-" + slot + "-" + subslot + "-" + partNo;
}
}
package com.myproject.util;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.myproject.bean.czshelf.ApiEcall;
import com.myproject.bean.czshelf.ApiRemainingTime;
import com.myproject.bean.czshelf.ApiSplice;
import com.myproject.bean.czshelf.RemainingTime;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by sunke on 2020/12/4.
*/
public class BoshApiUtil {
protected static final transient Logger log = LogManager.getLogger(BoshApiUtil.class);
/**
* 获取线别信息(http://10.8.140.154:8001/api/ECall/GetLineInfo?matID=30224SFRJF000EE17D)
* @param serverAddress
{
"REQUESTEDGUID": "3c028b50-1c8f-4372-bdba-8a3ee81c8e0f",
"SMTLINENO": 2,
"SLOT": 70011,
"SUBSLOT": 1,
"PARTNO": "1267360247",
"REQUESTEDAT": "2020-12-04T02:40:45",
"TOCREATEDAT": "2020-12-04T02:47:06",
"WHPICKAT": "0001-01-01T00:00:00",
"SMEDCONFIRMAT": "2020-12-04T03:04:09",
"PACKAGEID": "[)>@06@12S0002@P1267360247@1PERJ8ENF1002V@31PERJ8ENF1002V@12V654562560@10VJPN-FUKUI1@2P@20P@6D20201014@14D20221014@30PY@Z1@K0@16K0@V30224@3SSFRJF000EE17D@Q5000NAR000@20T1@1T8640415000E@2T@1Z@@",
"REELBAR": "30224SFRJF000EE17D",
"MATERIALTYPE": 0,
"SPLICETIME": "0001-01-01T00:00:00",
"SPLICELINENO": 0,
"CABINET": null,
"MINISTOCKID": null,
"STATUS": 2,
"REQUESTFOR": 0,
"SAPPLANTID": 1,
"LOADTIME": "2020-12-04T02:48:12",
"REQUESTFROM": 0,
"SOLDERSTOCKID": null,
"TOID": "6042923706",
"SUID": "5034590649",
"QUANTITY": 3572,
"COMMENTS": null,
"COMMENTREELBAR": null,
"COMMENTATOR": null,
"TOPOSITIONID": "0001",
"EXPIRATIONDATE": "2022-10-14T00:00:00",
"PRODUCTIONDATE": "2020-10-14T00:00:00",
"UNLOADINGPOINT": "0207"
}
*/
public static ApiEcall getEcallLineInfo(String serverAddress, String matID) {
ApiEcall apiEcall = null;
if (!Strings.isNullOrEmpty(serverAddress)) {
String lineInfoApi = serverAddress + "/api/ECall/GetLineInfo";
try {
Map<String, String> paramMap = new HashMap<>();
paramMap.put("matID",matID);
String jsonStr = HttpHelper.get(lineInfoApi, paramMap);
apiEcall = JsonUtil.toObj(jsonStr, ApiEcall.class);
} catch (Exception e) {
log.error("获取Ecall中获取线别信息出错", e);
}
} else {
log.info("获取Ecall中获取线别信息出错:未配置API地址");
}
return apiEcall;
}
/**
* 从Ecall Api获取数据,并转换为RemainingTime
* @return
* [
{
"GUID": "e635fbae-023c-4169-98ad-1c80554fb0dd",
"SMTLINENO": 6,
"CELLNO": 1061,
"SMDSTATIONNO": 2,
"SLOT": 50009,
"SUBSLOT": 1,
"PARTNO": "1267370612",
"CHIP": 0,
"CURRENTQUANTITY": 41633,
"PRODUCTTIME": "2020-12-04T10:35:20",
"LOADTIME": "2020-12-04T10:34:12",
"REELBAR": "97294419SP2001031GTWT",
"REQUESTEDAT": null,
"TOCREATEDAT": null,
"STATUSNO": 2,
"CABINET": null,
"MATERIALTYPE": 0,
"PITCHVALUE": 0,
"ALREADYORDERED": 0,
"CYCLETIME": 0,
"UNLOADINGPOINT": "0605",
"TORESULT": null,
"TOID": null,
"ISAUTO": 1,
"PROGRAMNAME": "2261042471SU00",
"PCBAPARTNO": "2261042471",
"ISUSED": 1,
"SAPPLANTID": 1,
"REQUESTFROM": 0,
"REQUESTBY": null,
"REQUESTBYCARD": null
},
{
"GUID": "526e9ff1-1572-4ef5-8cfd-326e0f9815d8",
"SMTLINENO": 18,
"CELLNO": 1072,
"SMDSTATIONNO": 2,
"SLOT": 40030,
"SUBSLOT": 1,
"PARTNO": "1267370539",
"CHIP": 0,
"CURRENTQUANTITY": 7387,
"PRODUCTTIME": "2020-12-04T10:45:13",
"LOADTIME": "2020-12-04T10:45:30",
"REELBAR": "77124SIA20J227081D",
"REQUESTEDAT": null,
"TOCREATEDAT": null,
"STATUSNO": 2,
"CABINET": null,
"MATERIALTYPE": 0,
"PITCHVALUE": 0,
"ALREADYORDERED": 0,
"CYCLETIME": 0,
"UNLOADINGPOINT": "1804",
"TORESULT": null,
"TOID": null,
"ISAUTO": 1,
"PROGRAMNAME": "2261041592SO00",
"PCBAPARTNO": "2261041592",
"ISUSED": 1,
"SAPPLANTID": 1,
"REQUESTFROM": 0,
"REQUESTBY": null,
"REQUESTBYCARD": null
}
*/
public static List<RemainingTime> getRemainingList(String serverAddress){
List<RemainingTime> remainingTimeList = Lists.newArrayList();
// http:// 10.179.244.152:8003/api/ECall/GetSMDRequestList
if(!Strings.isNullOrEmpty(serverAddress)){
String ecallApi = serverAddress + "/api/ECall/GetSMDRequestList";
try {
Map<String,Object> paramMap = new HashMap<>();
String jsonStr = HttpHelper.postParam(ecallApi,paramMap);
List<ApiRemainingTime> list = JsonUtil.toList(jsonStr, ApiRemainingTime.class);
for (ApiRemainingTime smdreq : list) {
//if(smdreq.getSmtlineno() == 1){
log.debug(smdreq);
//}
remainingTimeList.add(smdreq.toRemainingTime());
}
} catch (Exception e) {
log.error("获取Ecall中剩余时间数据出错",e);
}
}else{
log.info("未配置Ecall的API地址");
}
return remainingTimeList;
}
/**
*
* 获取接料数据(http://10.8.140.154:8001/api/ECall/GetLineInfo?matID=30224SFRJF000EE17D)
*
{
"GUID": "0b2b3622-fe9f-4485-912d-4e5d09f4c06a",
"SMTLINENO": 24,
"PARTNO": "1267360247",
"SLOT": 60011,
"SUBSLOT": 0,
"CELLNO": 1018,
"QUANTITY": 5000,
"OPERATORNAME": "88950773",
"REELBAR": "30224SFRJF000EE186",
"PCBAPARTNO": "1038408776",
"PROGRAMNAME": "1038408776SO09",
"STATUS": 0,
"SPLICETIME": "2020-12-04T11:06:46"
},
{
"GUID": "ff52fa28-8961-4fe7-ac78-0133984d097a",
"SMTLINENO": 18,
"PARTNO": "2261098546",
"SLOT": 90027,
"SUBSLOT": 0,
"CELLNO": 1079,
"QUANTITY": 750,
"OPERATORNAME": "88661773",
"REELBAR": "450981S201027014001",
"PCBAPARTNO": "2261041592",
"PROGRAMNAME": "2261041592SO00",
"STATUS": 0,
"SPLICETIME": "2020-12-04T11:00:43"
}*/
public static List<ApiSplice> getSpliceList(String serverAddress){
List<ApiSplice> spliceList = new ArrayList<>();
if(!Strings.isNullOrEmpty(serverAddress)){
String spliceApi = serverAddress + "/api/ECall/GetSpliceInfo";
try {
Map<String,String> paramMap = new HashMap<>();
String jsonStr = HttpHelper.get(spliceApi,paramMap);
spliceList = JsonUtil.toList(jsonStr, ApiSplice.class);
} catch (Exception e) {
log.error("获取Ecall中接料信息数据出错",e);
}
}else{
log.info("获取Ecall中接料信息数据出错:未配置API地址");
}
return spliceList;
}
}
package com.myproject.util;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.myproject.bean.czshelf.ApiRemainingTime;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by sunke on 2019/11/30.
*/
public class JsonUtil {
protected final static Logger log = LogManager.getLogger(JsonUtil.class);
// 定义jackson对象
private static final ObjectMapper MAPPER = new ObjectMapper();
static{
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
/**
* 将对象转换成json字符串。
* <p>Title: pojoToJson</p>
* <p>Description: </p>
* @param data
* @return
*/
public static String toJsonStr(Object data) {
try {
String string = MAPPER.writeValueAsString(data);
return string;
} catch (Exception e) {
log.info("转换JSON字符串出错:",e);
}
return null;
}
/**
* 将json结果集转化为对象
*
* @param jsonStr json数据
* @param beanType 对象中的object类型
* @return
*/
public static <T> T toObj(String jsonStr, Class<T> beanType) {
try {
T t = MAPPER.readValue(jsonStr, beanType);
return t;
} catch (Exception e) {
log.info(jsonStr + "转换对象出错:",e);
}
return null;
}
/**
* 将json数据转换成对象list
* <p>Title: jsonToList</p>
* <p>Description: </p>
* @param jsonStr
* @param beanType
* @return
*/
public static <T>List<T> toList(String jsonStr, Class<T> beanType) {
JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType);
try {
List<T> list = MAPPER.readValue(jsonStr, javaType);
return list;
} catch (Exception e) {
log.info(jsonStr + "转换List出错:",e);
}
return new ArrayList<>();
}
public static Map<String, Object> toMap(String jsonStr){
//JavaType javaType = MAPPER.getTypeFactory().constructParametricType(HashMap.class, String.class, String.class);
try {
//Map<String, String> map = MAPPER.readValue(jsonStr, javaType);
Map<String, Object> map = MAPPER.readValue(jsonStr, Map.class);
return map;
} catch (Exception e) {
log.info(jsonStr + "转换Map出错:",e);
}
return new HashMap<>();
}
public static void main(String args[]) throws Exception{
String jsonStr = "[{\n" +
" \"action\": \"补料\",\n" +
" \"hSerial\": \"82\",\n" +
" \"so\": \"879235\",\n" +
"\"refno\": \"F001_879235N_1\",\n" +
"\"partNum\": \"7H.47134.1F1\",\n" +
" \"slot\": \"1-11\",\n" +
"\"qty\": \"2006\",\n" +
"\"facility\": \"SU\",\n" +
"\"sdte\": \"20191118\",\n" +
"\"stme\": \"85957\",\n" +
"\"reelcut\": \"N\",\n" +
"\"mdte\": \"20191115\",\n" +
"\"mtme\": \"172238\"\n" +
"},\n{\n" +
" \"action\": \"补料\",\n" +
" \"hSerial\": \"82\",\n" +
" \"so\": \"879235\",\n" +
"\"refno\": \"F001_879235N_1\",\n" +
"\"partNum\": \"7H.47134.1F1\",\n" +
" \"slot\": \"1-11\",\n" +
"\"qty\": \"2006\",\n" +
"\"facility\": \"SU\",\n" +
"\"sdte\": \"20191118\",\n" +
"\"stme\": \"85957\",\n" +
"\"reelcut\": \"N\",\n" +
"\"mdte\": \"20191115\",\n" +
"\"mtme\": \"172238\"\n" +
"}\n]";
// List<RequestOutItemBean> items = JsonUtil.toList(jsonStr, RequestOutItemBean.class);
// for (RequestOutItemBean item : items) {
// System.out.println(item);
// }
// System.out.println(DateUtil.toDateString(new Date(),"yyyyMMddHHmmssS"));
// System.out.println(DateUtil.toDateString(new Date(),"yyyyMMddHHmmssS"));
// System.out.println(DateUtil.toDateString(new Date(),"yyyyMMddHHmmssS"));
// System.out.println(DateUtil.toDateString(new Date(),"yyyyMMddHHmmssS"));
//
// System.out.println(System.nanoTime());
// System.out.println(System.nanoTime());
// System.out.println(System.currentTimeMillis());
// System.out.println(System.currentTimeMillis());
jsonStr = "{\"state\":\"0\",\"msg\":\"鏂欏嵎浣嶆暟涓嶅尮閰??\",\"info\":{\"so\":\"\",\"facility\":\"12334\",\"company\":\"\",\"qty\":\"\",\"soseq\":\"\"}}";
jsonStr = " [{\n" +
"\n" +
" \"GUID\": \"797c3141-efce-4571-b1d5-ee001b18af66\",\n" +
"\n" +
" \"SMTLINENO\": 1,\n" +
"\n" +
" \"CELLNO\": 1006,\n" +
"\n" +
" \"SMDSTATIONNO\": 3,\n" +
"\n" +
" \"SLOT\": 110008,\n" +
"\n" +
" \"SUBSLOT\": 0,\n" +
"\n" +
" \"PARTNO\": \"1267360244\",\n" +
"\n" +
" \"CHIP\": 5000,\n" +
"\n" +
" \"CURRENTQUANTITY\": 121,\n" +
"\n" +
" \"PRODUCTTIME\": \"2020-06-15T11:42:46\",\n" +
"\n" +
" \"LOADTIME\": \"2020-06-15T11:42:27\",\n" +
"\n" +
" \"REELBAR\": \"30224SFRJF004VB0GA\",\n" +
"\n" +
" \"REQUESTEDAT\": \"2020-06-15T09:20:14\",\n" +
"\n" +
" \"TOCREATEDAT\": \"2020-06-15T09:27:07\",\n" +
"\n" +
" \"STATUSNO\": 9,\n" +
"\n" +
" \"CABINET\": null,\n" +
"\n" +
" \"MATERIALTYPE\": 0,\n" +
"\n" +
" \"PITCHVALUE\": 4,\n" +
"\n" +
" \"ALREADYORDERED\": 1,\n" +
"\n" +
" \"CYCLETIME\": 3.0804,\n" +
"\n" +
" \"UNLOADINGPOINT\": \"0111\",\n" +
"\n" +
" \"TORESULT\": \"1 transfer orders were created\",\n" +
"\n" +
" \"TOID\": \"6037571689\",\n" +
"\n" +
" \"ISAUTO\": 1,\n" +
"\n" +
" \"PROGRAMNAME\": \"1038408886SO09\",\n" +
"\n" +
" \"PCBAPARTNO\": \"1038408886\",\n" +
"\n" +
" \"ISUSED\": 1,\n" +
"\n" +
" \"SAPPLANTID\": 1,\n" +
"\n" +
" \"REQUESTFROM\": 0,\n" +
"\n" +
" \"REQUESTBY\": null,\n" +
"\n" +
" \"REQUESTBYCARD\": null\n" +
"\n" +
" }]";
List<ApiRemainingTime> list = JsonUtil.toList(jsonStr, ApiRemainingTime.class);
for (ApiRemainingTime smdreq : list) {
System.out.println(smdreq.getPartNo() + " " + smdreq.getSmtlineno());
}
}
}
...@@ -11,13 +11,13 @@ import java.util.Map; ...@@ -11,13 +11,13 @@ import java.util.Map;
public class StorageConstants { public class StorageConstants {
public final static String COMPONENT = "component"; public final static String COMPONENT = "component";
public final static String COMPONENT_SEARCH_VIEW = "redirect:componentSearch.html"; public final static String COMPONENT_SEARCH_VIEW = "/component/componentSearch.html";
public final static String BOM_TYPE = "bom"; public final static String BOM_TYPE = "bom";
public final static String BOM_SEARCH_VIEW = "redirect:bomSearch.html"; public final static String BOM_SEARCH_VIEW = "redirect:bomSearch.html";
public final static String BARCODE_TYPE = "barcode"; public final static String BARCODE_TYPE = "barcode";
public final static String BARCODE_SEARCH_VIEW = "redirect:barcodeSearch.html"; public final static String BARCODE_SEARCH_VIEW = "redirect:barcodeSearch.html";
public final static String STORAGE_TYPE = "storage"; public final static String STORAGE_TYPE = "storage";
public final static String STORAGE_UPDATE_VIEW = "redirect:storageUpdate.html"; public final static String STORAGE_UPDATE_VIEW = "redirect:/storage/storageUpdate.html";
// public final static int STA_PUT_IN_FINISHED = 3; // public final static int STA_PUT_IN_FINISHED = 3;
// public final static int STA_CHECKOUT_FINISHED = 4; // public final static int STA_CHECKOUT_FINISHED = 4;
......
...@@ -24,8 +24,11 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -24,8 +24,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -59,7 +62,7 @@ public class FileUploadController extends BaseFormController { ...@@ -59,7 +62,7 @@ public class FileUploadController extends BaseFormController {
public FileUploadController() { public FileUploadController() {
setCancelView("redirect:/home"); setCancelView("redirect:/home");
setSuccessView("uploadDisplay"); setSuccessView("fileUpload");
} }
@ModelAttribute @ModelAttribute
...@@ -70,7 +73,7 @@ public class FileUploadController extends BaseFormController { ...@@ -70,7 +73,7 @@ public class FileUploadController extends BaseFormController {
@RequestMapping(method = RequestMethod.POST) @RequestMapping(method = RequestMethod.POST)
public String onSubmit( public String onSubmit(
/** FileUpload fileUpload, BindingResult errors,*/ HttpServletRequest request) throws Exception { /** FileUpload fileUpload, BindingResult errors,*/ HttpServletRequest request, HttpServletResponse response) throws Exception {
String type = request.getParameter("type"); String type = request.getParameter("type");
String param = request.getParameter("param"); String param = request.getParameter("param");
...@@ -147,13 +150,14 @@ public class FileUploadController extends BaseFormController { ...@@ -147,13 +150,14 @@ public class FileUploadController extends BaseFormController {
if (StorageConstants.COMPONENT.equals(type)) { if (StorageConstants.COMPONENT.equals(type)) {
String message = handleComponent(fileURL); String message = handleComponent(fileURL);
saveMessage(request,message); saveMessage(request,message);
} else if (StorageConstants.BOM_TYPE.equals(type)) { } else if (StorageConstants.BOM_TYPE.equals(type)) {
return handleBom(fileURL); handleBom(fileURL);
} else if (StorageConstants.BARCODE_TYPE.equals(type)) { } else if (StorageConstants.BARCODE_TYPE.equals(type)) {
return handleBarcode(fileURL); handleBarcode(fileURL);
} else if (StorageConstants.STORAGE_TYPE.equals(type)) { } else if (StorageConstants.STORAGE_TYPE.equals(type)) {
String message = handleStoragePos(fileURL, param); handleStoragePos(fileURL, param);
saveMessage(request,message); //saveMessage(request,message);
} }
} catch (ExcelParseException e) { } catch (ExcelParseException e) {
log.error(e); log.error(e);
...@@ -170,7 +174,9 @@ public class FileUploadController extends BaseFormController { ...@@ -170,7 +174,9 @@ public class FileUploadController extends BaseFormController {
saveError(request, errorMsg); saveError(request, errorMsg);
} finally { } finally {
if (StorageConstants.COMPONENT.equals(type)) { if (StorageConstants.COMPONENT.equals(type)) {
return StorageConstants.COMPONENT_SEARCH_VIEW; response.sendRedirect(StorageConstants.COMPONENT_SEARCH_VIEW);
//return StorageConstants.COMPONENT_SEARCH_VIEW;
return null;
} else if (StorageConstants.BOM_TYPE.equals(type)) { } else if (StorageConstants.BOM_TYPE.equals(type)) {
return StorageConstants.BOM_SEARCH_VIEW; return StorageConstants.BOM_SEARCH_VIEW;
} else if (StorageConstants.BARCODE_TYPE.equals(type)) { } else if (StorageConstants.BARCODE_TYPE.equals(type)) {
...@@ -184,7 +190,7 @@ public class FileUploadController extends BaseFormController { ...@@ -184,7 +190,7 @@ public class FileUploadController extends BaseFormController {
return getSuccessView(); return getSuccessView();
} }
protected String handleBom(String fileURL) throws ExcelParseException, IOException, ValidateException, IllegalAccessException, InvocationTargetException { protected ModelAndView handleBom(String fileURL) throws ExcelParseException, IOException, ValidateException, IllegalAccessException, InvocationTargetException {
BomXlsParser bomXlsParser = new BomXlsParser(); BomXlsParser bomXlsParser = new BomXlsParser();
List<BomExcel> list = bomXlsParser.readXls(fileURL); List<BomExcel> list = bomXlsParser.readXls(fileURL);
log.debug("Parse bom to list with size: " + list.size()); log.debug("Parse bom to list with size: " + list.size());
...@@ -222,7 +228,7 @@ public class FileUploadController extends BaseFormController { ...@@ -222,7 +228,7 @@ public class FileUploadController extends BaseFormController {
bomManager.save(bom); bomManager.save(bom);
} }
} }
return StorageConstants.BOM_SEARCH_VIEW; return new ModelAndView(StorageConstants.BOM_SEARCH_VIEW);
} }
protected String handleComponent(String fileURL) throws ExcelParseException, IOException, ValidateException, IllegalAccessException, InvocationTargetException { protected String handleComponent(String fileURL) throws ExcelParseException, IOException, ValidateException, IllegalAccessException, InvocationTargetException {
...@@ -235,35 +241,35 @@ public class FileUploadController extends BaseFormController { ...@@ -235,35 +241,35 @@ public class FileUploadController extends BaseFormController {
int pnIndex = csvRead.getIndex("物编","PN"); int pnIndex = csvRead.getIndex("物编","PN");
if(pnIndex == -1){ if(pnIndex == -1){
log.info("未包含【物编】或【PN】列"); log.info("未包含【物编】或【PN】列");
return "必须包含【物编】或【PN】列"; throw new ValidateException("必须包含【物编】或【PN】列");
} }
int countIndex = csvRead.getIndex("数量","count"); int countIndex = csvRead.getIndex("数量","count");
if (countIndex == -1){ if (countIndex == -1){
log.info("未包含【数量】或【count】列"); log.info("未包含【数量】或【count】列");
return "必须包含【数量】或【count】列"; throw new ValidateException("必须包含【数量】或【count】列");
} }
int wIndex = csvRead.getIndex("宽度","w"); int wIndex = csvRead.getIndex("宽度","w");
if (wIndex == -1){ if (wIndex == -1){
log.info("未包含【宽度】或【w】列"); log.info("未包含【宽度】或【w】列");
return "必须包含【宽度】列"; throw new ValidateException("必须包含【宽度】或[w]列");
} }
int hIndex = csvRead.getIndex("高度","h"); int hIndex = csvRead.getIndex("高度","h");
if (hIndex == -1){ if (hIndex == -1){
log.info("未包含【高度】或【h】列"); log.info("未包含【高度】或【h】列");
return "必须包含【高度】列"; throw new ValidateException("必须包含【高度】或[h]列");
} }
int supplierIndex = csvRead.getIndex("供应商","supplier"); int supplierIndex = csvRead.getIndex("供应商","supplier");
if (supplierIndex == -1){ if (supplierIndex == -1){
log.info("未包含【供应商】或【supplier】列"); log.info("未包含【供应商】或【supplier】列");
return "必须包含【供应商】或【supplier】列"; throw new ValidateException("必须包含【供应商】或【supplier】列");
} }
int typeIndex = csvRead.getIndex("类型","type"); // int typeIndex = csvRead.getIndex("类型","type");
if (typeIndex == -1){ // if (typeIndex == -1){
log.info("未包含【类型】或【type】列"); // log.info("未包含【类型】或【type】列");
return "必须包含【类型】或【type】列"; // return "必须包含【类型】或【type】列";
} // }
List<Component> list = new ArrayList<Component>(); List<Component> list = new ArrayList<Component>();
while(csvRead.readRecord()){ while(csvRead.readRecord()){
...@@ -273,7 +279,7 @@ public class FileUploadController extends BaseFormController { ...@@ -273,7 +279,7 @@ public class FileUploadController extends BaseFormController {
String wStr = lineValues[wIndex]; String wStr = lineValues[wIndex];
String hStr = lineValues[hIndex]; String hStr = lineValues[hIndex];
String supplier = lineValues[supplierIndex]; String supplier = lineValues[supplierIndex];
String typeStr = lineValues[typeIndex]; //String typeStr = lineValues[typeIndex];
if(pn.isEmpty() || countStr.isEmpty() || wStr.isEmpty() || hStr.isEmpty()){ if(pn.isEmpty() || countStr.isEmpty() || wStr.isEmpty() || hStr.isEmpty()){
log.warn("行[PN="+pn+"count="+countStr+"w="+wStr+" h="+hStr+"]中有空白内容,此行忽略"); log.warn("行[PN="+pn+"count="+countStr+"w="+wStr+" h="+hStr+"]中有空白内容,此行忽略");
}else{ }else{
...@@ -284,7 +290,7 @@ public class FileUploadController extends BaseFormController { ...@@ -284,7 +290,7 @@ public class FileUploadController extends BaseFormController {
component.setPlateSize(Integer.valueOf(wStr)); component.setPlateSize(Integer.valueOf(wStr));
component.setHeight(Integer.valueOf(hStr)); component.setHeight(Integer.valueOf(hStr));
component.setProvider(supplier); component.setProvider(supplier);
component.setType(Integer.valueOf(typeStr)); //component.setType(Integer.valueOf(typeStr));
list.add(component); list.add(component);
} }
} }
...@@ -292,7 +298,7 @@ public class FileUploadController extends BaseFormController { ...@@ -292,7 +298,7 @@ public class FileUploadController extends BaseFormController {
int updateRowCount = 0; int updateRowCount = 0;
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (Component c : list) { for (Component c : list) {
Component component = componentManager.findByPartNumber(c.getPartNumber()); Component component = componentManager.findByPartNumberAndProvider(c.getPartNumber(),c.getProvider());
if (component == null) { if (component == null) {
component = c; component = c;
newRowCount ++; newRowCount ++;
...@@ -358,7 +364,7 @@ public class FileUploadController extends BaseFormController { ...@@ -358,7 +364,7 @@ public class FileUploadController extends BaseFormController {
* @param params * @param params
* @return * @return
*/ */
protected String handleStoragePos(String fileURL, String params) throws ExcelParseException, IOException, ValidateException, IllegalAccessException, InvocationTargetException protected void handleStoragePos(String fileURL, String params) throws ExcelParseException, IOException, ValidateException, IllegalAccessException, InvocationTargetException
{ {
log.info("开始更新料仓【"+params+"】的位置信息"); log.info("开始更新料仓【"+params+"】的位置信息");
if (StringUtils.isEmpty(params)) { if (StringUtils.isEmpty(params)) {
...@@ -377,22 +383,22 @@ public class FileUploadController extends BaseFormController { ...@@ -377,22 +383,22 @@ public class FileUploadController extends BaseFormController {
int posIndex = csvRead.getIndex("位置","pos"); int posIndex = csvRead.getIndex("位置","pos");
if(posIndex == -1){ if(posIndex == -1){
log.info("未包含【位置】或【pos】列"); log.info("未包含【位置】或【pos】列");
return "必须包含[位置]列"; throw new ValidateException("必须包含[位置]列");
} }
int priIndex = csvRead.getIndex("优先级","pri"); int priIndex = csvRead.getIndex("优先级","pri");
if (priIndex == -1){ if (priIndex == -1){
log.info("未包含【优先级】或【pri】列"); log.info("未包含【优先级】或【pri】列");
return "必须包含[优先级]列"; throw new ValidateException("必须包含[优先级]列");
} }
int hIndex = csvRead.getIndex("高度","h"); int hIndex = csvRead.getIndex("高度","h");
if (hIndex == -1){ if (hIndex == -1){
log.info("未包含【高度】或【h】列"); log.info("未包含【高度】或【h】列");
return "必须包含【高度】列"; throw new ValidateException("必须包含【高度】列");
} }
int wIndex = csvRead.getIndex("宽度","w"); int wIndex = csvRead.getIndex("宽度","w");
if (wIndex == -1){ if (wIndex == -1){
log.info("未包含【宽度】或【w】列"); log.info("未包含【宽度】或【w】列");
return "必须包含【宽度】列"; throw new ValidateException("必须包含【宽度】列");
} }
List<StoragePosExcel> list = new ArrayList<StoragePosExcel>(); List<StoragePosExcel> list = new ArrayList<StoragePosExcel>();
while(csvRead.readRecord()){ while(csvRead.readRecord()){
...@@ -434,8 +440,6 @@ public class FileUploadController extends BaseFormController { ...@@ -434,8 +440,6 @@ public class FileUploadController extends BaseFormController {
dataCache.updateStorage(storage); dataCache.updateStorage(storage);
String msg = "读取到["+list.size()+"]个位置信息:新增【"+newRowCount+"】更新【" +updateRowCount +"】"; String msg = "读取到["+list.size()+"]个位置信息:新增【"+newRowCount+"】更新【" +updateRowCount +"】";
log.info(msg); log.info(msg);
return msg;
} }
/*protected String handleStoragePos(String fileURL, String params) throws ExcelParseException, IOException, ValidateException, IllegalAccessException, InvocationTargetException { /*protected String handleStoragePos(String fileURL, String params) throws ExcelParseException, IOException, ValidateException, IllegalAccessException, InvocationTargetException {
if (StringUtils.isEmpty(params)) { if (StringUtils.isEmpty(params)) {
......
...@@ -34,6 +34,13 @@ ...@@ -34,6 +34,13 @@
</h3> </h3>
<c:set var="fileType" value="<%=StorageConstants.COMPONENT%>"/>
<c:set var="fileParam" value="${storage.id}"/>
<%@ include file="/common/fileUpload.jsp" %>
<%@include file="/common/success.jsp" %>
<%@include file="/common/error.jsp" %>
<c:if test="${type != 1 && type !=2 && type !=4}"> <c:if test="${type != 1 && type !=2 && type !=4}">
<!-- BEGIN PAGE CONTENT--> <!-- BEGIN PAGE CONTENT-->
...@@ -50,9 +57,9 @@ ...@@ -50,9 +57,9 @@
<div class="actions"> <div class="actions">
<a href="componentUpdate.html?type=${type}" class="btn btn-default btn-sm"> <a href="componentUpdate.html?type=${type}" class="btn btn-default btn-sm">
<i class="fa fa-plus"></i> <fmt:message key="button.add"/> </a> <i class="fa fa-plus"></i> <fmt:message key="button.add"/> </a>
<%--<a class="btn btn-default btn-sm" data-toggle="modal" href="#basic"><i--%> <a class="btn btn-default btn-sm" data-toggle="modal" href="#basic"><i
<%--class="fa fa-upload"></i><fmt:message--%> class="fa fa-upload"></i><fmt:message
<%--key="button.uploadFile"/></a>--%> key="button.uploadFile"/></a>
</div> </div>
</div> </div>
<div class="portlet-body"> <div class="portlet-body">
......
...@@ -196,11 +196,11 @@ ...@@ -196,11 +196,11 @@
</display:column> </display:column>
<%--<display:column property="barcode.memo" titleKey="备注"/>--%> <%--<display:column property="barcode.memo" titleKey="备注"/>--%>
<display:column titleKey="checkOut.operate" media="html"> <display:column titleKey="checkOut.operate" media="html">
<c:if test="${!limitCheckOut}"> <%--<c:if test="${!limitCheckOut}">--%>
<button class="btn yellow limit${pos.barcode.inFixture}" id="btn${pos.id}" <button class="btn yellow limit${pos.barcode.inFixture}" id="btn${pos.id}"
onclick="checkoutStorage('${pos.id}')"> onclick="checkoutStorage('${pos.id}')">
<i class="fa fa-sign-out"></i><fmt:message key="button.checkout"/></button> <i class="fa fa-sign-out"></i><fmt:message key="button.checkout"/></button>
</c:if> <%--</c:if>--%>
</display:column> </display:column>
<c:if test="${limitCheckOut}"> <c:if test="${limitCheckOut}">
<c:set var="limitCodes" value="${pos.barcode.inFixture},${limitCodes}"/> <c:set var="limitCodes" value="${pos.barcode.inFixture},${limitCodes}"/>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
function printErrorMessage(message) { function printErrorMessage(message) {
$('#successMessage').html('<div class="alert alert-danger display-hide" style="display: block;"> ' + $('#errorMessage').html('<div class="alert alert-danger display-hide" style="display: block;"> ' +
'<button class="close" data-close="alert"></button> ' + message + '<button class="close" data-close="alert"></button> ' + message +
'</div>'); '</div>');
} }
......
...@@ -17,15 +17,17 @@ ...@@ -17,15 +17,17 @@
<c:set var="fileParam" value="${fileUpload.param}"/> <c:set var="fileParam" value="${fileUpload.param}"/>
</c:if> </c:if>
<div class="modal-body"> <div class="modal-body">
<%@include file="/common/success.jsp" %>
<%@include file="/common/error.jsp" %>
<form method="post" action="${ctx}/storage/fileupload?type=${fileType}&param=${fileParam}" <form method="post" action="${ctx}/storage/fileupload?type=${fileType}&param=${fileParam}"
enctype="multipart/form-data" enctype="multipart/form-data"
onsubmit="return validateFileUpload(this)" id="uploadForm" cssClass="well"> onsubmit="return validateFileUpload(this)" id="uploadForm" cssClass="well">
<%--<spring:bind path="fileUpload.name">--%> <%--<spring:bind path="fileUpload.name">--%>
<div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}"> <%--<div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">--%>
<%--</spring:bind>--%> <%--&lt;%&ndash;</spring:bind>&ndash;%&gt;--%>
<appfuse:label key="uploadForm.name" styleClass="control-label"/> <%--<appfuse:label key="uploadForm.name" styleClass="control-label"/>--%>
<input cssClass="form-control" name="name" id="name" type="text"/> <%--<input cssClass="form-control" name="name" id="name" type="text"/>--%>
</div> <%--</div>--%>
<%--<spring:bind path="fileUpload.file">--%> <%--<spring:bind path="fileUpload.file">--%>
<div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}"> <div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">
<%--</spring:bind>--%> <%--</spring:bind>--%>
......
PN,supplier,count,w,h
PP001,3002,1500,7,8
PP002,3002,1500,7,8
PP003,3003,1500,7,12
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!