|
@@ -7,6 +7,7 @@ import java.sql.Connection;
|
|
|
import java.sql.DriverManager;
|
|
|
import java.sql.PreparedStatement;
|
|
|
import java.sql.ResultSet;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.io.IOException;
|
|
@@ -14,9 +15,14 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.xml.namespace.QName;
|
|
|
+import javax.xml.ws.Service;
|
|
|
|
|
|
+import com.alibaba.druid.support.json.JSONUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.apache.cxf.endpoint.Client;
|
|
|
+import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
@@ -452,7 +458,7 @@ public class FbsWorkingStatisticsController {
|
|
|
|
|
|
if(entity.getState().equals("1")){
|
|
|
//把数据传入u8数据库
|
|
|
-
|
|
|
+ saveU8(entity,workshopDispatchList,allHors);
|
|
|
}
|
|
|
|
|
|
res.setCode("0");
|
|
@@ -461,30 +467,68 @@ public class FbsWorkingStatisticsController {
|
|
|
return new ResponseEntity<ResHttpStatus>(res, HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ //入库接口
|
|
|
public void saveU8(FbsWorkingStatistics entity,FbsWorkshopDispatchList workshopDispatchList,BigDecimal allHors){
|
|
|
- //明细
|
|
|
- List<Map<String,Object>> mapList=new ArrayList<>();
|
|
|
- Map<String,Object> itemMap=new LinkedHashMap<>();
|
|
|
- itemMap.put("CINVCODE",entity.getMaterielCode());//成品存货编码
|
|
|
- itemMap.put("IQUANTITY",entity.getQualifiedNumber());//数量
|
|
|
- itemMap.put("MOCODE",workshopDispatchList.getProductionOrderNumberName());//订单号
|
|
|
- itemMap.put("MOROWMO",entity.getRowNumber());//行号
|
|
|
- itemMap.put("CBATCH",entity.getBatchCode());
|
|
|
- mapList.add(itemMap);
|
|
|
- //表头
|
|
|
- Map<String,Object> map=new LinkedHashMap<>();
|
|
|
- map.put("CVOUCHCODE",UUID.randomUUID());//单号
|
|
|
- Date date=new Date();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- map.put("DDATE",sdf.format(date));//入库日期
|
|
|
- map.put("CWHCODE","01");//仓库编码
|
|
|
- map.put("CDEPCODE","07");//部门编码
|
|
|
- map.put("CMAKER",entity.getPersonnelName());//制单人
|
|
|
- map.put("CRDCODE","103");//入库类型编码
|
|
|
- map.put("DETAILList",mapList);
|
|
|
+ if(StringUtils.isNotBlank(entity.getBatchCode())){
|
|
|
+ String[] batchCodes=entity.getBatchCode().split(",");//解析逗号分隔的批号
|
|
|
+ List<Map<String,Object>> mapList=new ArrayList<>();
|
|
|
+ for(String batchCode:batchCodes){
|
|
|
+ //明细
|
|
|
+ Map<String,Object> itemMap=new LinkedHashMap<>();
|
|
|
+ itemMap.put("CINVCODE",entity.getMaterielCode());//成品存货编码
|
|
|
+ itemMap.put("IQUANTITY",entity.getQualifiedNumber());//数量
|
|
|
+ itemMap.put("MOCODE",workshopDispatchList.getProductionOrderNumberName());//订单号
|
|
|
+ itemMap.put("MOROWMO",entity.getRowNumber());//行号
|
|
|
+ itemMap.put("CBATCH",batchCode);//批号
|
|
|
+ itemMap.put("cDefine27",allHors.doubleValue());//实际工时
|
|
|
+ Double number=Double.valueOf(entity.getQualifiedNumber());//数量
|
|
|
+ Double working=Double.valueOf(workshopDispatchList.getStandardWorkingHoursZ());//U8标准工时
|
|
|
+ DecimalFormat df = new DecimalFormat("#.00");
|
|
|
+ String workingTatol=df.format(number*working);
|
|
|
+ itemMap.put("cDefine26",workingTatol);//实际总工时
|
|
|
+ mapList.add(itemMap);
|
|
|
+ }
|
|
|
+ //表头
|
|
|
+ Map<String,Object> map=new LinkedHashMap<>();
|
|
|
+ map.put("CVOUCHCODE",UUID.randomUUID());//单号
|
|
|
+ Date date=new Date();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ map.put("DDATE",sdf.format(date));//入库日期
|
|
|
+ map.put("CWHCODE","01");//仓库编码
|
|
|
+ map.put("CDEPCODE","07");//部门编码
|
|
|
+ map.put("CMAKER",entity.getPersonnelName());//制单人
|
|
|
+ map.put("CRDCODE","103");//入库类型编码
|
|
|
+ map.put("DETAILList",mapList);
|
|
|
+ //调用WebService接口
|
|
|
+ getWebService(map);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ //调用WebService接口
|
|
|
+ public Map<String, Object> getWebService(Map<String,Object> mapR) {
|
|
|
+// if (args.length < 1) {
|
|
|
+// args = new String[]{""};
|
|
|
+// }
|
|
|
+ String jsonObject = JSONUtils.toJSONString(mapR);
|
|
|
+ // 创建动态客户端
|
|
|
+ JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
|
|
|
+ Client client = dcf.createClient("http://10.1.191.191:8090/WebService.asmx");
|
|
|
+ // 需要密码的情况需要加上用户名和密码
|
|
|
+ // client.getOutInterceptors().add(new ClientLoginInterceptor(USER_NAME,PASS_WORD));
|
|
|
+ // 命名空间,方法名
|
|
|
+ QName name = new QName("http://tempuri.org/", "U8_CreateRdrecord10");
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ try {
|
|
|
+ // invoke("方法名",参数1,参数2,参数3....);
|
|
|
+ Object[] objects = client.invoke(name, jsonObject);
|
|
|
+ map.put("result", objects);
|
|
|
+ return map;
|
|
|
+ } catch (java.lang.Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ map.put("result", "接口调用异常");
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|