完成 辅助追踪系统pda接口
parent
f402ce6df4
commit
7aa5c159f7
@ -0,0 +1,86 @@
|
||||
package com.bgs.webapi.controller;
|
||||
|
||||
|
||||
import com.bgs.common.core.domain.AjaxResult;
|
||||
import com.bgs.webapi.doman.BindingSubmitBeen;
|
||||
import com.bgs.webapi.service.ApiService;
|
||||
import com.bgs.webapi.service.LoginService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wangh on 2020/7/17-15:18。
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class ApiController {
|
||||
@Autowired
|
||||
ApiService service;
|
||||
|
||||
|
||||
@PostMapping("/bindingSubmit")
|
||||
public AjaxResult bindingSubmit(@RequestBody BindingSubmitBeen submitBeen) {
|
||||
List<String> watBills = submitBeen.getWatBills();
|
||||
watBills.forEach(code -> {
|
||||
String epc = service.selectEpcByWaybill(code);
|
||||
if (epc == null) {
|
||||
int i = service.insertLedgerBinding(submitBeen.getEpc(), code);
|
||||
}
|
||||
});
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/findBindingList")
|
||||
public AjaxResult findBindingList(String epc) {
|
||||
List<String> codes = service.findBindingList(epc);
|
||||
if (codes == null || codes.isEmpty()) return AjaxResult.error("没有运单绑定该货框");
|
||||
|
||||
return AjaxResult.success(codes);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteBindingList")
|
||||
public AjaxResult deleteBindingList(String epc) {
|
||||
int i = service.deleteBindingList(epc);
|
||||
if (i>0) return AjaxResult.success("全部解绑成功");
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@PostMapping("/deleteBindingItem")
|
||||
public AjaxResult deleteBindingItem(String epc, String code) {
|
||||
int i = service.deleteBindingItem(epc,code);
|
||||
if (i==1) return AjaxResult.success("运单:" +code +"解绑成功");
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
/* @GetMapping("/getVersion")
|
||||
public String getVersion(){
|
||||
APKVersion apkVersion=service.getVersion();
|
||||
apkVersion.setCode(0);
|
||||
apkVersion.setMsg("");
|
||||
if (apkVersion==null){
|
||||
apkVersion=new APKVersion();
|
||||
apkVersion.setUpdateStatus(0);
|
||||
|
||||
|
||||
}else {
|
||||
apkVersion.setUpdateStatus(1);
|
||||
}
|
||||
|
||||
|
||||
String s = JSONObject.toJSONString(apkVersion);
|
||||
System.out.println("请求版本信息"+s);
|
||||
return s;
|
||||
}*/
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.bgs.webapi.doman;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wanghao
|
||||
* @date 2024/7/11 14:59
|
||||
*/
|
||||
public class BindingSubmitBeen {
|
||||
// private String barCode;
|
||||
private String epc;
|
||||
private String localtion;
|
||||
private String number;
|
||||
private String weight;
|
||||
private List<String> watBills;
|
||||
|
||||
public String getEpc() {
|
||||
return epc;
|
||||
}
|
||||
|
||||
public void setEpc(String epc) {
|
||||
this.epc = epc;
|
||||
}
|
||||
|
||||
public String getLocaltion() {
|
||||
return localtion;
|
||||
}
|
||||
|
||||
public void setLocaltion(String localtion) {
|
||||
this.localtion = localtion;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(String weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public List<String> getWatBills() {
|
||||
return watBills;
|
||||
}
|
||||
|
||||
public void setWatBills(List<String> watBills) {
|
||||
this.watBills = watBills;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.bgs.webapi.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wangh on 2021/4/26-9:32。
|
||||
*/
|
||||
@Repository
|
||||
public interface ApiMapper {
|
||||
|
||||
String selectEpcByWaybill(String code);
|
||||
|
||||
int insertLedgerBinding(String epc, String code);
|
||||
|
||||
|
||||
|
||||
List<String> findBindingList(String epc);
|
||||
|
||||
int deleteBindingList(String epc);
|
||||
|
||||
int deleteBindingItem(String epc, String code);
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.bgs.webapi.service;
|
||||
|
||||
import com.bgs.webapi.mapper.ApiMapper;
|
||||
import com.bgs.webapi.mapper.LoginMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wangh on 2021/4/26-9:27。
|
||||
*/
|
||||
@Service
|
||||
public class ApiService {
|
||||
|
||||
@Autowired
|
||||
ApiMapper mapper;
|
||||
|
||||
public String selectEpcByWaybill(String code) {
|
||||
return mapper.selectEpcByWaybill(code);
|
||||
}
|
||||
|
||||
public int insertLedgerBinding(String epc, String code) {
|
||||
return mapper.insertLedgerBinding(epc,code);
|
||||
}
|
||||
|
||||
|
||||
public List<String> findBindingList(String epc) {
|
||||
return mapper.findBindingList(epc);
|
||||
}
|
||||
|
||||
public int deleteBindingList(String epc) {
|
||||
return mapper.deleteBindingList(epc);
|
||||
}
|
||||
|
||||
public int deleteBindingItem(String epc, String code) {
|
||||
return mapper.deleteBindingItem(epc,code);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bgs.webapi.mapper.ApiMapper">
|
||||
|
||||
<!--登陆-->
|
||||
<select id="selectEpcByWaybill" resultType="string">
|
||||
select cargo_frame_epc from ledger_instant_binding where waybill_number=#{code} limit 1
|
||||
</select>
|
||||
<insert id="insertLedgerBinding">
|
||||
INSERT INTO bgs_wms_2024.ledger_instant_binding (cargo_frame_epc, waybill_number) VALUES (#{param1}, #{param2});
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<select id="findBindingList" resultType="string">
|
||||
select waybill_number from ledger_instant_binding WHERE cargo_frame_epc = #{epc}
|
||||
</select>
|
||||
<delete id="deleteBindingList">
|
||||
delete from ledger_instant_binding WHERE cargo_frame_epc = #{epc}
|
||||
</delete>
|
||||
<delete id="deleteBindingItem">
|
||||
delete from ledger_instant_binding WHERE cargo_frame_epc = #{param1} and waybill_number = #{param2}
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue