|
@@ -16,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
@@ -76,8 +79,9 @@ public class MachineController {
|
|
|
JSONObject jsonObject = nodes.getJSONObject(i);
|
|
|
String processNo = jsonObject.getString("processId"); //工序编号
|
|
|
String nodeNo = jsonObject.getString("nodeId"); //工序选项编号
|
|
|
- Long logsProcessTime = jsonObject.getLong("logsProcessTime"); //工序执行时间 (时间戳)
|
|
|
- Date logsProcessDate = new Date(logsProcessTime);
|
|
|
+ String logsProcessTime = jsonObject.getString("logsProcessTime"); //工序执行时间 (时间戳)
|
|
|
+ Date logsProcessDate = timeConversions(logsProcessTime);
|
|
|
+ /*Date logsProcessDate = new Date(logsProcessTime);*/
|
|
|
Produce produce = produceService.getProduce(produceNo);//根据产品编号获取产品信息
|
|
|
ProduceProcess produceProcess = produceService.getProduceProcess(produce.getProduceId(),processNo);
|
|
|
ProcessNode processNode = produceService.getprocessNode(produceProcess.getProcessId(),nodeNo);
|
|
@@ -178,4 +182,33 @@ public class MachineController {
|
|
|
rj.addResponseKeyValue("barcodeTail",berQrcode.substring(berQrcode.length()-4, berQrcode.length()));
|
|
|
return rj;
|
|
|
}
|
|
|
+ private static Date timeConversions(String time){
|
|
|
+ if(time == null || time.equals("")){
|
|
|
+ return new Date();
|
|
|
+ }
|
|
|
+ //08311112
|
|
|
+ Calendar date = Calendar.getInstance();
|
|
|
+ String year = String.valueOf(date.get(Calendar.YEAR));//年
|
|
|
+ String months = null;//月
|
|
|
+ String sky = null;//天
|
|
|
+ String when = null;//时
|
|
|
+ String subdivision = null;//分
|
|
|
+ months = time.substring(0,2);
|
|
|
+ sky = time.substring(2,4);
|
|
|
+ when = time.substring(4,6);
|
|
|
+ subdivision = time.substring(6,8);
|
|
|
+ time = year + "-" + months + "-" + sky + " " + when + ":" + subdivision;
|
|
|
+ Date dates = new Date();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ dates = sdf.parse(time);
|
|
|
+ }
|
|
|
+ catch (ParseException e)
|
|
|
+ {
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return dates;
|
|
|
+ }
|
|
|
}
|