package com.zy.asrs.controller;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.core.annotations.ManagerAuth;
|
import com.core.common.BaseRes;
|
import com.core.common.Cools;
|
import com.core.common.R;
|
import com.zy.asrs.entity.*;
|
import com.zy.asrs.entity.param.CombParam;
|
import com.zy.asrs.entity.param.MobileAdjustParam;
|
import com.zy.asrs.entity.result.MobileAdjustResult;
|
import com.zy.asrs.service.*;
|
import com.zy.common.model.MobileLocDetlVo;
|
import com.zy.common.web.BaseController;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 移动端接口控制器
|
* Created by vincent on 2020/6/10
|
*/
|
@RestController
|
@RequestMapping("mobile")
|
public class MobileController extends BaseController {
|
|
@Autowired
|
private MobileService mobileService;
|
@Autowired
|
private LocMastService locMastService;
|
@Autowired
|
private LocDetlService locDetlService;
|
@Autowired
|
private OrderService orderService;
|
@Autowired
|
private DocTypeService docTypeService;
|
@Autowired
|
private WrkMastService wrkMastService;
|
@Autowired
|
private WrkDetlService wrkDetlService;
|
@Autowired
|
private BasDevpService basDevpService;
|
@Autowired
|
private PackService packService;
|
|
// 组托 ----------------------------------------------------------------------------------------------------
|
|
/**
|
* 根据单号检索单据数据
|
* http://localhost:8081/jkwms/mobile/order/serach/orderNo/auth?orderNo=123123
|
*/
|
@RequestMapping("/order/search/orderNo/auth")
|
@ManagerAuth
|
public R orderSearchByBarcode(@RequestParam String orderNo){
|
Order order = orderService.selectByNo(orderNo);
|
if (order == null) {
|
return R.ok();
|
}
|
DocType docType = docTypeService.selectById(order.getDocType());
|
if (docType.getPakin() == null || docType.getPakin() != 1) {
|
return R.ok();
|
}
|
if (order.getSettle() > 2) {
|
return R.ok();
|
}
|
List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId());
|
if (Cools.isEmpty(orderDetls)) {
|
return R.ok();
|
}
|
return R.ok().add(orderDetls);
|
}
|
|
|
@RequestMapping("/comb/auth")
|
@ManagerAuth(memo = "组托")
|
public R comb(@RequestBody CombParam combParam){
|
mobileService.comb(combParam, getUserId());
|
return R.ok("组托成功");
|
}
|
|
|
@RequestMapping("/pack/get/auth")
|
@ManagerAuth
|
public R packGet(@RequestParam String barcode){
|
Pack pack = packService.selectByBarcode(barcode);
|
if (pack == null) {
|
return R.ok();
|
}
|
if (pack.getSettle() == 1L) {
|
return R.ok().add(pack);
|
}
|
return R.ok("组托成功");
|
}
|
|
@RequestMapping("/pack/comb/auth")
|
@ManagerAuth(memo = "组托")
|
public R packComb(@RequestBody CombParam combParam){
|
mobileService.packComb(combParam, getUserId());
|
return R.ok("组托成功");
|
}
|
|
|
// 盘点 ----------------------------------------------------------------------------------------------------
|
|
@RequestMapping("/checkDetl/auth")
|
@ManagerAuth
|
public R getCheckDetl(@RequestParam(required = false) Integer staNo) {
|
if (null == staNo || staNo == 0) {
|
return R.ok();
|
}
|
BasDevp basDevp = basDevpService.selectById(staNo);
|
if (null != basDevp && basDevp.getWrkNo() != null) {
|
WrkMast wrkMast = wrkMastService.selectById(basDevp.getWrkNo());
|
if (wrkMast != null && wrkMast.getIoType() == 107) {
|
List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
|
if (!Cools.isEmpty(wrkDetls)) {
|
MobileAdjustResult result = new MobileAdjustResult();
|
result.setStaNo(staNo);
|
result.setWrkNo(wrkMast.getWrkNo());
|
result.setWrkDetls(wrkDetls);
|
return R.ok().add(result);
|
}
|
}
|
}
|
return R.ok();
|
}
|
|
@RequestMapping("/adjust/auth")
|
@ManagerAuth(memo = "盘点")
|
public R adjust(@RequestBody MobileAdjustParam combParam){
|
mobileService.adjust(combParam, getUserId());
|
return R.ok("盘点成功");
|
}
|
|
|
/**
|
* 根据库位号查找库存明细
|
*/
|
@RequestMapping("/locDetl")
|
@ManagerAuth
|
public R getLocDetl(@RequestParam(required = false)String locNo,
|
@RequestParam(required = false)String matNo){
|
if (!Cools.isEmpty(locNo)) {
|
LocMast locMast = locMastService.selectById(locNo);
|
if (null == locMast || !"F".equals(locMast.getLocSts())) {
|
return R.parse(BaseRes.EMPTY);
|
}
|
List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
|
.eq("loc_no", locNo).orderBy("appe_time", false));
|
List<MobileLocDetlVo> res = new ArrayList<>();
|
locDetls.forEach(locDetl -> {
|
MobileLocDetlVo vo = new MobileLocDetlVo();
|
vo.setLocNo(locDetl.getLocNo());
|
vo.setMatnr(locDetl.getMatnr());
|
vo.setMaktx(locDetl.getMaktx());
|
vo.setCount(locDetl.getAnfme());
|
res.add(vo);
|
});
|
return R.ok().add(res);
|
}
|
if (!Cools.isEmpty(matNo)) {
|
List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
|
.eq("matnr", matNo).orderBy("appe_time", false));
|
List<MobileLocDetlVo> res = new ArrayList<>();
|
locDetls.forEach(locDetl -> {
|
MobileLocDetlVo vo = new MobileLocDetlVo();
|
vo.setLocNo(locDetl.getLocNo());
|
vo.setMatnr(locDetl.getMatnr());
|
vo.setMaktx(locDetl.getMaktx());
|
vo.setCount(locDetl.getAnfme());
|
res.add(vo);
|
});
|
return R.ok().add(res);
|
}
|
return R.parse(BaseRes.PARAM);
|
}
|
}
|