Commit 323c891f authored by 李洪明's avatar 李洪明

添加上传进出厂记录

parent 8a7baf31
......@@ -6,6 +6,8 @@ import com.bme.access.upload.common.DateUtils;
import com.bme.access.upload.common.HttpUtils;
import com.bme.access.upload.model.InAndOutDate;
import com.bme.access.upload.model.InAndOutDateUrl;
import com.bme.access.upload.model.MaterialInfo;
import com.bme.access.upload.model.TransportDate;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity;
......@@ -22,11 +24,11 @@ import java.util.Objects;
public class TestController {
private final static String IN_AND_OUT_DATE_URL = "https://dctapi.soszyzg.com/dct/new/addInAndOut";
private final static String CARGO_URL = "https://dctapi.soszyzg.com/dct/addCargo";
private final static String COMPANY_CODE = "1302847854";
@GetMapping("/uploadInAndDate")
public CommonResult uploadInAndDate() throws Exception {
@GetMapping("/uploadInAndOutDate")
public CommonResult uploadInAndOutDate() throws Exception {
// 313683 川L99718 2025-07-09 16:07:36.210 http://192.168.2.80:8080/250709/Vehicle_Plate/16_7_36_140.jpg 2 GC_1MEN http://192.168.2.80:8080/250709/ALL_Vehicle_SmallPlate/16_7_36_207.jpg 2 1 1 1752048456
InAndOutDateUrl inAndOutDateUrl = new InAndOutDateUrl();
inAndOutDateUrl.setId(313683);
......@@ -46,6 +48,28 @@ public class TestController {
return CommonResult.success("成功");
}
@GetMapping("/uploadTransportDate")
public CommonResult uploadTransportDate() throws Exception {
// 川LD8228 废钢 34.03 2024-04-30 19:38:17.000 1 1 202405010001 欧冶链金再生资源有限公司西部分公司 1 2024-04-30 19:38:17.000 1
TransportDate transportDate = new TransportDate();
transportDate.setTransportName("废钢");
transportDate.setTransportVolume(34.03);
transportDate.setInOut(1);
transportDate.setInoutTime("2024-04-30 19:38:17.000");
MaterialInfo materialInfo = this.convertMaterialInfo(transportDate);
try {
String bodyJson = JSONObject.toJSONString(materialInfo);
HttpResponse response = HttpUtils.sendPost(CARGO_URL, null, null, bodyJson);
HttpEntity entity = response.getEntity();
String a = "";
} catch (Exception e) {
log.error(e.getMessage());
}
return CommonResult.success("成功");
}
private InAndOutDate convertInAndOutDate(InAndOutDateUrl inAndOutDateUrl) {
InAndOutDate inAndOutDate = new InAndOutDate();
inAndOutDate.setInOutAttribute("1");
......@@ -74,4 +98,16 @@ public class TestController {
inAndOutDate.setEntryexitflownumber(rsn);
return inAndOutDate;
}
public MaterialInfo convertMaterialInfo(TransportDate transportDate) {
MaterialInfo materialInfo = new MaterialInfo();
materialInfo.setCargoname(transportDate.getTransportName());
materialInfo.setUnit("T");
materialInfo.setCargoquantity(transportDate.getTransportVolume().toString());
// 进出厂流水号
String timeStr = Objects.requireNonNull(DateUtils.format(DateUtils.toDate(transportDate.getInoutTime()), DateUtils.DATE_FORMAT_MIN)).substring(0, DateUtils.DATE_FORMAT_MIN.length());
String rsn = COMPANY_CODE + timeStr + transportDate.getInOut();
materialInfo.setEntryexitflownumber(rsn);
return materialInfo;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment