PDA 改为UNIAPP
parent
82623ca1bb
commit
e3eb773c7a
|
@ -115,7 +115,7 @@ public class ApiController {
|
|||
@RequestMapping(value = "/wmToUpGoodsController/save", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> create2(@RequestParam String wmToUpGoodsstr, UriComponentsBuilder uriBuilder) {
|
||||
return wmToUpGoodsController.create(wmToUpGoodsstr, uriBuilder);
|
||||
return wmInQmIController.save(wmToUpGoodsstr, uriBuilder);
|
||||
}
|
||||
//上架相关接口end
|
||||
|
||||
|
|
|
@ -1147,4 +1147,63 @@ public class WmInQmIController extends BaseController {
|
|||
public void delete(@PathVariable("id") String id) {
|
||||
wmInQmIService.deleteEntityById(WmInQmIEntity.class, id);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/save",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> save(@RequestParam String wmToUpGoodsstr, UriComponentsBuilder uriBuilder) {
|
||||
ResultDO D0 = new ResultDO();
|
||||
WmToUpGoodsEntity wmToUpGoods = (WmToUpGoodsEntity) JSONHelper.json2Object(wmToUpGoodsstr,WmToUpGoodsEntity.class);
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WmToUpGoodsEntity>> failures = validator.validate(wmToUpGoods);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(wmToUpGoods.getKuWeiBianMa())){
|
||||
D0.setOK(false);
|
||||
D0.setErrorMsg("储位不能为空");
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}else{
|
||||
if (!wmUtil.checkbin(wmToUpGoods.getKuWeiBianMa())) {
|
||||
D0.setOK(false);
|
||||
D0.setErrorMsg("储位不存在");
|
||||
return new ResponseEntity(D0, HttpStatus.OK); }
|
||||
}
|
||||
|
||||
|
||||
//保存
|
||||
try{
|
||||
D0.setOK(true);
|
||||
WmInQmIEntity wmInQmIEntity = systemService.get(WmInQmIEntity.class,wmToUpGoods.getWmToUpId());
|
||||
if(wmInQmIEntity!=null){
|
||||
if("Y".equals(wmInQmIEntity.getBinSta())){
|
||||
D0.setOK(false);
|
||||
D0.setErrorMsg("已经上架,不能重复上架");
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
wmInQmIEntity.setBinSta("Y");
|
||||
systemService.updateEntitie(wmInQmIEntity);
|
||||
}else{
|
||||
D0.setOK(false);
|
||||
D0.setErrorMsg("验收任务已经删除,不能上架");
|
||||
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TSBaseUser user = systemService.findUniqueByProperty(TSBaseUser.class,"userName",wmToUpGoods.getCreateBy());
|
||||
if (user != null ) {
|
||||
wmToUpGoods.setCreateName(user.getRealName());
|
||||
}
|
||||
toup(wmToUpGoods.getWmToUpId(),wmToUpGoods.getKuWeiBianMa(),wmToUpGoods.getCreateBy(),wmToUpGoods.getCreateName());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
D0.setOK(false);
|
||||
}
|
||||
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,8 +82,7 @@ public class WmToUpGoodsController extends BaseController {
|
|||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
@Autowired
|
||||
private WmInQmIController wmInQmIController;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -453,6 +452,7 @@ public class WmToUpGoodsController extends BaseController {
|
|||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(wmToUpGoods.getKuWeiBianMa())){
|
||||
D0.setOK(false);
|
||||
D0.setErrorMsg("储位不能为空");
|
||||
|
@ -463,6 +463,8 @@ public class WmToUpGoodsController extends BaseController {
|
|||
D0.setErrorMsg("储位不存在");
|
||||
return new ResponseEntity(D0, HttpStatus.OK); }
|
||||
}
|
||||
|
||||
|
||||
//保存
|
||||
try{
|
||||
D0.setOK(true);
|
||||
|
@ -481,18 +483,34 @@ public class WmToUpGoodsController extends BaseController {
|
|||
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
// wmToUpGoods.setGoodsName(wmInQmIEntity.getGoodsName());
|
||||
// wmToUpGoods.setCreateDate(DateUtils.getDate());
|
||||
if(StringUtil.isNotEmpty(wmToUpGoods.getOrderIdI())){
|
||||
List<WmToUpGoodsEntity> wmToUpGoodsEntity = systemService.findByProperty(WmToUpGoodsEntity.class,"orderIdI",wmToUpGoods.getWmToUpId());
|
||||
if(wmToUpGoodsEntity!=null&&wmToUpGoodsEntity.size()>0){
|
||||
D0.setOK(false);
|
||||
D0.setErrorMsg("已经上架,不能重复上架");
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
}else{
|
||||
D0.setOK(false);
|
||||
D0.setErrorMsg("验收记录为空,不能上架");
|
||||
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
wmToUpGoods.setGoodsName(wmInQmIEntity.getGoodsName());
|
||||
wmToUpGoods.setCreateDate(DateUtils.getDate());
|
||||
|
||||
TSBaseUser user = systemService.findUniqueByProperty(TSBaseUser.class,"userName",wmToUpGoods.getCreateBy());
|
||||
if (user != null ) {
|
||||
wmToUpGoods.setCreateName(user.getRealName());
|
||||
}
|
||||
wmInQmIController.toup(wmToUpGoods.getWmToUpId(),wmToUpGoods.getKuWeiBianMa(),wmToUpGoods.getCreateBy(),user.getRealName());
|
||||
// wmToUpGoodsService.save(wmToUpGoods);
|
||||
|
||||
wmToUpGoodsService.save(wmToUpGoods);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
D0.setOK(false);
|
||||
}
|
||||
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue