提交 | 用户 | 时间
|
fd2207
|
1 |
package com.jcdm.quartz.task; |
懒 |
2 |
|
55b0cb
|
3 |
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
懒 |
4 |
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
04b8ef
|
5 |
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
Y |
6 |
import com.jcdm.main.da.passingStationCollection.service.impl.DaPassingStationCollectionServiceImpl; |
55b0cb
|
7 |
import com.jcdm.main.webservice.service.ReceivingServices; |
懒 |
8 |
import org.springframework.beans.factory.annotation.Autowired; |
fd2207
|
9 |
import org.springframework.stereotype.Component; |
懒 |
10 |
import com.jcdm.common.utils.StringUtils; |
1a444b
|
11 |
import org.slf4j.Logger; |
Y |
12 |
import org.slf4j.LoggerFactory; |
55b0cb
|
13 |
|
懒 |
14 |
import java.util.List; |
fd2207
|
15 |
|
懒 |
16 |
/** |
|
17 |
* 定时任务调度测试 |
|
18 |
* |
|
19 |
* @author jc |
|
20 |
*/ |
|
21 |
@Component("ryTask") |
|
22 |
public class RyTask |
|
23 |
{ |
04b8ef
|
24 |
@Autowired |
Y |
25 |
private DaPassingStationCollectionServiceImpl passingStationCollectionServiceImpl; |
|
26 |
@Autowired |
|
27 |
private IBsOrderSchedulingService bsOrderSchedulingService; |
1a444b
|
28 |
private static final Logger logger = LoggerFactory.getLogger("sys-user"); |
fd2207
|
29 |
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) |
懒 |
30 |
{ |
|
31 |
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); |
|
32 |
} |
|
33 |
|
|
34 |
public void ryParams(String params) |
|
35 |
{ |
|
36 |
System.out.println("执行有参方法:" + params); |
|
37 |
} |
|
38 |
|
|
39 |
public void ryNoParams() |
|
40 |
{ |
04b8ef
|
41 |
String a=passingStationCollectionServiceImpl.SelectSN("88","OP010"); |
Y |
42 |
System.out.println("执行过程返回:" + a); |
fd2207
|
43 |
} |
55b0cb
|
44 |
|
282556
|
45 |
String url = "http://podqapp.cfmoto.com.cn:50100/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_MES&receiverParty=&receiverService=&interface=SI_ZPP_CF_BC_001_SYN_OUT&interfaceNamespace=http://cfmoto.com/xi/MES"; |
55b0cb
|
46 |
public void workReportingTasks(){ |
懒 |
47 |
report10(); |
|
48 |
report20(); |
|
49 |
} |
|
50 |
|
|
51 |
public void report10(){ |
|
52 |
BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
|
53 |
bsOrderScheduling.setReport10("0"); |
|
54 |
List<BsOrderScheduling> bsOrderSchedulings = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling); |
5030f3
|
55 |
String status=""; |
Y |
56 |
String ev_meassage=""; |
55b0cb
|
57 |
for (BsOrderScheduling orderScheduling : bsOrderSchedulings) { |
5030f3
|
58 |
try { |
Y |
59 |
String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(), "0010")); |
|
60 |
ev_meassage=ReceivingServices.xmlToJSON1(xmlResult); |
|
61 |
status = ReceivingServices.xmlToJSON3(xmlResult); |
|
62 |
} catch (Exception e) { |
|
63 |
status="3"; |
|
64 |
} |
|
65 |
if(status.equals("1")) { |
55b0cb
|
66 |
orderScheduling.setReport10("1"); |
懒 |
67 |
int i = bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
5030f3
|
68 |
logger.info("{}合箱报工成功",orderScheduling.getOrderNo()); |
Y |
69 |
}else { |
|
70 |
if(StringUtils.isEmpty(orderScheduling.getSpareField1())){ |
|
71 |
orderScheduling.setSpareField1("1"); |
|
72 |
bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
|
73 |
}else{ |
|
74 |
if(Integer.valueOf(orderScheduling.getSpareField1())+1>=3) { |
|
75 |
//累计报工异常超过3次 |
|
76 |
orderScheduling.setReport10("3"); |
|
77 |
orderScheduling.setSpareField1(String.valueOf(Integer.valueOf(orderScheduling.getSpareField1()) + 1)); |
|
78 |
}else { |
|
79 |
orderScheduling.setSpareField1(String.valueOf(Integer.valueOf(orderScheduling.getSpareField1()) + 1)); |
|
80 |
} |
|
81 |
bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
|
82 |
} |
|
83 |
if(status.equals("3")) |
|
84 |
logger.info("{}合箱报工因为网络原因,报工失败!",orderScheduling.getOrderNo()); |
|
85 |
else |
|
86 |
logger.info("{}合箱报工失败,原因:{}",orderScheduling.getOrderNo(),ev_meassage); |
55b0cb
|
87 |
} |
懒 |
88 |
} |
|
89 |
} |
|
90 |
|
|
91 |
public void report20(){ |
|
92 |
BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
|
93 |
bsOrderScheduling.setReport20("0"); |
|
94 |
List<BsOrderScheduling> bsOrderSchedulings = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling); |
5030f3
|
95 |
String status=""; |
Y |
96 |
String ev_meassage=""; |
55b0cb
|
97 |
for (BsOrderScheduling orderScheduling : bsOrderSchedulings) { |
5030f3
|
98 |
try { |
Y |
99 |
String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(), "0020")); |
|
100 |
ev_meassage=ReceivingServices.xmlToJSON1(xmlResult); |
|
101 |
status = ReceivingServices.xmlToJSON3(xmlResult); |
|
102 |
} catch (Exception e) { |
|
103 |
status="3"; |
|
104 |
} |
55b0cb
|
105 |
if(status.equals("1")){ |
1a444b
|
106 |
orderScheduling.setReport20("1"); |
55b0cb
|
107 |
int i = bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
5030f3
|
108 |
logger.info("{}总装报工成功",orderScheduling.getOrderNo()); |
Y |
109 |
}else { |
|
110 |
if(StringUtils.isEmpty(orderScheduling.getSpareField2())){ |
|
111 |
orderScheduling.setSpareField2("1"); |
|
112 |
bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
|
113 |
}else{ |
|
114 |
if(Integer.valueOf(orderScheduling.getSpareField2())+1>=3) { |
|
115 |
//累计报工异常超过3次 |
|
116 |
orderScheduling.setReport20("3"); |
|
117 |
orderScheduling.setSpareField2(String.valueOf(Integer.valueOf(orderScheduling.getSpareField2()) + 1)); |
|
118 |
}else{ |
|
119 |
orderScheduling.setSpareField2(String.valueOf(Integer.valueOf(orderScheduling.getSpareField2()) + 1)); |
|
120 |
} |
|
121 |
bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
|
122 |
if(status.equals("3")) |
|
123 |
logger.info("{}总装报工因为网络原因,报工失败!",orderScheduling.getOrderNo()); |
|
124 |
else |
|
125 |
logger.info("{}总装报工失败,原因:{}",orderScheduling.getOrderNo(),ev_meassage); |
|
126 |
} |
55b0cb
|
127 |
} |
懒 |
128 |
} |
|
129 |
} |
|
130 |
|
|
131 |
public static String getProductionPlanInformationXml(String orderNo,String location){ |
|
132 |
String content = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">\n" + |
|
133 |
" <soapenv:Header/>\n" + |
|
134 |
" <soapenv:Body>\n" + |
|
135 |
" <urn:ZPP_BC_001>\n" + |
|
136 |
" <IV_AUFNR>"+orderNo+"</IV_AUFNR>\n" + |
|
137 |
" <IV_VORNR>"+location+"</IV_VORNR>\n" + |
|
138 |
" <IV_LMNGA>1</IV_LMNGA>\n" + |
|
139 |
" <IV_XMNGA>0</IV_XMNGA> \n" + |
|
140 |
" <IV_STATU>1</IV_STATU> \n" + |
|
141 |
" </urn:ZPP_BC_001>\n" + |
|
142 |
" </soapenv:Body>\n" + |
|
143 |
"</soapenv:Envelope>"; |
d4f437
|
144 |
//logger.info("{}",content); |
55b0cb
|
145 |
return content; |
懒 |
146 |
} |
fd2207
|
147 |
} |