You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
202 lines
6.5 KiB
Java
202 lines
6.5 KiB
Java
|
6 months ago
|
package com.ruoyi.webapi.controller;
|
||
|
|
|
||
|
|
|
||
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||
|
|
import com.ruoyi.manager.domain.*;
|
||
|
|
import com.ruoyi.manager.domain.BaseManufacturer;
|
||
|
|
import com.ruoyi.manager.domain.LedgerInstantBinding;
|
||
|
|
import com.ruoyi.manager.domain.RecordBasketRepair;
|
||
|
|
import com.ruoyi.manager.service.IBaseBasketInfoService;
|
||
|
|
import com.ruoyi.manager.service.IBaseManufacturerService;
|
||
|
|
import com.ruoyi.manager.service.IRecordBasketRepairService;
|
||
|
|
import com.ruoyi.webapi.doman.BindingSubmitBeen;
|
||
|
|
import com.ruoyi.webapi.doman.JoinSubmitBeen;
|
||
|
|
import com.ruoyi.webapi.service.ApiService;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
|
||
|
|
import java.util.Date;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Created by wangh on 2020/7/17-15:18。
|
||
|
|
*/
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/api")
|
||
|
|
public class ApiController {
|
||
|
|
@Autowired
|
||
|
|
ApiService service;
|
||
|
|
@Autowired
|
||
|
|
private IBaseManufacturerService baseManufacturerService;
|
||
|
|
@Autowired
|
||
|
|
private IBaseBasketInfoService baseBasketInfoService;
|
||
|
|
@Autowired
|
||
|
|
private IRecordBasketRepairService recordBasketRepairService;
|
||
|
|
|
||
|
|
@PostMapping("/bindingSubmit")
|
||
|
|
public AjaxResult bindingSubmit(@RequestBody BindingSubmitBeen submitBeen) {
|
||
|
|
List<String> watBills = submitBeen.getWatBills();
|
||
|
|
String user = submitBeen.getUser();
|
||
|
|
watBills.forEach(code -> {
|
||
|
|
String epc = service.selectEpcByWaybill(code);
|
||
|
|
if (epc == null) {
|
||
|
|
int i = service.insertLedgerBinding(submitBeen.getEpc(), code, user);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
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();
|
||
|
|
}
|
||
|
|
|
||
|
|
@PostMapping("/deleteLocationCode")
|
||
|
|
public AjaxResult deleteLocationCode(String dbCode, String hkCode) {
|
||
|
|
int i = service.delectLocationInfoRemarkByDbCode(dbCode, hkCode);
|
||
|
|
if (i == 1) return AjaxResult.success();
|
||
|
|
return AjaxResult.error();
|
||
|
|
}
|
||
|
|
|
||
|
|
@PostMapping("/blueToothSubmit")
|
||
|
|
public AjaxResult blueToothSubmit(String locationCode, String hkCode) {
|
||
|
|
int i = service.blueToothSubmit(locationCode, hkCode);
|
||
|
|
if (i > 0) {
|
||
|
|
return AjaxResult.success();
|
||
|
|
}
|
||
|
|
return AjaxResult.error("库位没有维护");
|
||
|
|
}
|
||
|
|
|
||
|
|
@PostMapping("/jion/select")
|
||
|
|
public AjaxResult jionSelect(String user) {
|
||
|
|
List<LedgerInstantBinding> list = service.jionSelect(user);
|
||
|
|
if (list == null || list.isEmpty()) return AjaxResult.error("账号无绑定记录");
|
||
|
|
return AjaxResult.success(list);
|
||
|
|
}
|
||
|
|
|
||
|
|
//交货提交
|
||
|
|
@PostMapping("/join/jiaoSubmit")
|
||
|
|
public AjaxResult joinJiaoSubmit(@RequestBody JoinSubmitBeen been) {
|
||
|
|
int i = service.joinSelectByUser(been);
|
||
|
|
if (i == 0) {
|
||
|
|
return AjaxResult.success();
|
||
|
|
}
|
||
|
|
return AjaxResult.error();
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
//接货提交
|
||
|
|
@PostMapping("/join/shouSubmit")
|
||
|
|
public AjaxResult joinJieSubmit(@RequestBody JoinSubmitBeen been) {
|
||
|
|
int i = service.joinShouSubmit(been);
|
||
|
|
|
||
|
|
if (i >= been.getList().size()) {
|
||
|
|
return AjaxResult.success();
|
||
|
|
}
|
||
|
|
return AjaxResult.error();
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询所有生产厂家
|
||
|
|
*/
|
||
|
|
@PostMapping("/manufacturerList")
|
||
|
|
public AjaxResult manufacturerList() {
|
||
|
|
List<BaseManufacturer> list = baseManufacturerService.selectBaseManufacturerList(new BaseManufacturer());
|
||
|
|
if (list == null || list.isEmpty()) return AjaxResult.error("没有维护生产厂家");
|
||
|
|
return AjaxResult.success(list);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 新增保存资产信息
|
||
|
|
*/
|
||
|
|
@PostMapping("/saveBasketInfo")
|
||
|
|
public AjaxResult saveBasketInfo(@RequestBody BaseBasketInfo baseBasketInfo) {
|
||
|
|
baseBasketInfo.setUpdatedTime(new Date());
|
||
|
|
int i=0;
|
||
|
|
if (baseBasketInfo.getObjId() == null) {
|
||
|
|
i = baseBasketInfoService.insertBaseBasketInfo(baseBasketInfo);
|
||
|
|
}else {
|
||
|
|
baseBasketInfo.setUpdatedBy(baseBasketInfo.getCreatedBy());
|
||
|
|
baseBasketInfo.setCreatedBy(null);
|
||
|
|
i = baseBasketInfoService.updateBaseBasketInfo(baseBasketInfo);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
if (i > 0) return AjaxResult.success();
|
||
|
|
return AjaxResult.error();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 新增保存维修记录
|
||
|
|
*/
|
||
|
|
@PostMapping("/saveRepairInfo")
|
||
|
|
public AjaxResult saveRepairInfo(@RequestBody RecordBasketRepair recordBasketRepair) {
|
||
|
|
|
||
|
|
int i = recordBasketRepairService.insertRecordBasketRepair(recordBasketRepair);
|
||
|
|
if (i > 0) return AjaxResult.success();
|
||
|
|
return AjaxResult.error();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 通过RFID查询资产
|
||
|
|
*/
|
||
|
|
@PostMapping("/findBasketInfoByEpc")
|
||
|
|
public AjaxResult findBasketInfoByEpc(String epc) {
|
||
|
|
BaseBasketInfo baseBasketInfo = baseBasketInfoService.selectBaseBasketInfoByEpc(epc);
|
||
|
|
if (baseBasketInfo == null) return AjaxResult.error("没有维护该资产");
|
||
|
|
return AjaxResult.success(baseBasketInfo);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 通过资产编号查询资产
|
||
|
|
*/
|
||
|
|
@GetMapping("/getBasketInfoBySearchCode")
|
||
|
|
public AjaxResult getBasketInfoBySearchCode(String searchCode) {
|
||
|
|
BaseBasketInfo baseBasketInfo = baseBasketInfoService.selectBaseBasketInfoBySearchCode(searchCode);
|
||
|
|
if (baseBasketInfo == null) return AjaxResult.error("没有维护该资产");
|
||
|
|
return AjaxResult.success(baseBasketInfo);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/* @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;
|
||
|
|
}*/
|
||
|
|
|
||
|
|
|
||
|
|
}
|