master
e 2020-01-03 08:32:23 +08:00
parent 55fc40011f
commit df59eb0cb2
2 changed files with 89 additions and 52 deletions

View File

@ -1,4 +1,5 @@
package com.zzjee.wave.controller; package com.zzjee.wave.controller;
import com.zzjee.api.ResultDO;
import com.zzjee.wave.entity.WaveToDownEntity; import com.zzjee.wave.entity.WaveToDownEntity;
import com.zzjee.wave.service.WaveToDownServiceI; import com.zzjee.wave.service.WaveToDownServiceI;
import java.util.ArrayList; import java.util.ArrayList;
@ -7,12 +8,14 @@ import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zzjee.wm.entity.WmOmQmIEntity;
import com.zzjee.wm.entity.WmToDownGoodsEntity;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jeecgframework.core.util.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
@ -22,14 +25,12 @@ import org.jeecgframework.core.common.model.common.TreeChildCount;
import org.jeecgframework.core.common.model.json.AjaxJson; import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid; import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals; import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.pojo.base.TSDepart; import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService; import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import java.io.OutputStream; import java.io.OutputStream;
import org.jeecgframework.core.util.BrowserUtils;
import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
@ -38,23 +39,19 @@ import org.jeecgframework.poi.excel.entity.TemplateExportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants; import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.jeecgframework.core.util.ResourceUtil;
import java.io.IOException; import java.io.IOException;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import org.jeecgframework.core.util.ExceptionUtil;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.jeecgframework.core.beanvalidator.BeanValidators; import org.jeecgframework.core.beanvalidator.BeanValidators;
@ -342,29 +339,59 @@ public class WaveToDownController extends BaseController {
List<WaveToDownEntity> listWaveToDowns=waveToDownService.getList(WaveToDownEntity.class); List<WaveToDownEntity> listWaveToDowns=waveToDownService.getList(WaveToDownEntity.class);
return listWaveToDowns; return listWaveToDowns;
} }
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> get(@PathVariable("id") String id) {
WaveToDownEntity task = waveToDownService.get(WaveToDownEntity.class, id);
if (task == null) {
return new ResponseEntity(HttpStatus.NOT_FOUND);
}
return new ResponseEntity(task, HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/list/todown", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> create(@RequestBody WaveToDownEntity waveToDown, UriComponentsBuilder uriBuilder) { public ResponseEntity<?> list(@RequestParam(value="username", required=false) String username,
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. @RequestParam(value="searchstr", required=false)String searchstr,
Set<ConstraintViolation<WaveToDownEntity>> failures = validator.validate(waveToDown); @RequestParam(value="searchstr2", required=false)String searchstr2) {
if (!failures.isEmpty()) { ResultDO D0 = new ResultDO();
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); D0.setOK(true);
}
List<WaveToDownEntity> listWaveToDowns=waveToDownService.getList(WaveToDownEntity.class);
D0.setObj(listWaveToDowns);
return new ResponseEntity(D0, HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public ResponseEntity<?> create(@RequestParam String waveToDownstr ,UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
ResultDO D0 = new ResultDO();
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
WaveToDownEntity waveToDown = (WaveToDownEntity)JSONHelper.json2Object(waveToDownstr,WaveToDownEntity.class);
//保存 //保存
try{ try{
waveToDownService.save(waveToDown); String hql = "from WmOmQmIEntity where waveId = ? and goodsId = ? and proData = ? and tinId = ? and binId = ? and binSta = ?";
List<WmOmQmIEntity> listwavedown = systemService.findHql(hql,waveToDown.getWaveId(),waveToDown.getGoodsId(),waveToDown.getProData(),waveToDown.getTinId(),waveToDown.getBinId(),"N");
for(WmOmQmIEntity wmOmQmI: listwavedown){
WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity();
wmToDownGoods.setBinIdFrom(wmOmQmI.getTinId());//下架托盘
wmToDownGoods.setKuWeiBianMa(wmOmQmI.getBinId());//储位
wmToDownGoods.setBinIdTo(wmOmQmI.getOmNoticeId());//到托盘
wmToDownGoods.setCusCode(wmOmQmI.getCusCode());//货主
wmToDownGoods.setGoodsId(wmOmQmI.getGoodsId());//
wmToDownGoods.setGoodsProData(wmOmQmI.getProData());//生产日期
wmToDownGoods.setOrderId(wmOmQmI.getOmNoticeId());//出货通知单
wmToDownGoods.setOrderIdI(wmOmQmI.getId());//出货通知项目
wmToDownGoods.setBaseUnit(wmOmQmI.getBaseUnit());//基本单位
wmToDownGoods.setBaseGoodscount(wmOmQmI.getBaseGoodscount());//基本单位数量
wmToDownGoods.setGoodsUnit(wmOmQmI.getGoodsUnit());//出货单位
wmToDownGoods.setGoodsQua(wmOmQmI.getQmOkQuat());//出货数量
wmToDownGoods.setGoodsQuaok(wmOmQmI.getQmOkQuat());//出货数量
wmToDownGoods.setGoodsName(wmOmQmI.getGoodsName());//商品名称
wmToDownGoods.setOmBeizhu(wmOmQmI.getOmBeizhu());//备注
wmToDownGoods.setImCusCode(wmOmQmI.getImCusCode());//客户单号
wmToDownGoods.setOrderType("01");//默认为01
systemService.save(wmToDownGoods);
wmOmQmI.setBinSta("H");
systemService.saveOrUpdate(wmOmQmI);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);

View File

@ -1,4 +1,5 @@
package com.zzjee.wave.controller; package com.zzjee.wave.controller;
import com.zzjee.api.ResultDO;
import com.zzjee.wave.entity.WaveToFjEntity; import com.zzjee.wave.entity.WaveToFjEntity;
import com.zzjee.wave.service.WaveToFjServiceI; import com.zzjee.wave.service.WaveToFjServiceI;
import java.util.ArrayList; import java.util.ArrayList;
@ -7,12 +8,14 @@ import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zzjee.wm.entity.WmOmQmIEntity;
import com.zzjee.wm.entity.WmToDownGoodsEntity;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jeecgframework.core.util.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
@ -22,14 +25,12 @@ import org.jeecgframework.core.common.model.common.TreeChildCount;
import org.jeecgframework.core.common.model.json.AjaxJson; import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid; import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals; import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.pojo.base.TSDepart; import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService; import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import java.io.OutputStream; import java.io.OutputStream;
import org.jeecgframework.core.util.BrowserUtils;
import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
@ -38,23 +39,19 @@ import org.jeecgframework.poi.excel.entity.TemplateExportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants; import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.jeecgframework.core.util.ResourceUtil;
import java.io.IOException; import java.io.IOException;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import org.jeecgframework.core.util.ExceptionUtil;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.jeecgframework.core.beanvalidator.BeanValidators; import org.jeecgframework.core.beanvalidator.BeanValidators;
@ -342,7 +339,19 @@ public class WaveToFjController extends BaseController {
List<WaveToFjEntity> listWaveToFjs=waveToFjService.getList(WaveToFjEntity.class); List<WaveToFjEntity> listWaveToFjs=waveToFjService.getList(WaveToFjEntity.class);
return listWaveToFjs; return listWaveToFjs;
} }
@RequestMapping(value = "/list/tofj", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> list(@RequestParam(value="username", required=false) String username,
@RequestParam(value="searchstr", required=false)String searchstr,
@RequestParam(value="searchstr2", required=false)String searchstr2) {
ResultDO D0 = new ResultDO();
D0.setOK(true);
List<WaveToFjEntity> listWaveToFjs=waveToFjService.getList(WaveToFjEntity.class);
D0.setObj(listWaveToFjs);
return new ResponseEntity(D0, HttpStatus.OK);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> get(@PathVariable("id") String id) { public ResponseEntity<?> get(@PathVariable("id") String id) {
@ -353,24 +362,25 @@ public class WaveToFjController extends BaseController {
return new ResponseEntity(task, HttpStatus.OK); return new ResponseEntity(task, HttpStatus.OK);
} }
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
public ResponseEntity<?> create(@RequestBody WaveToFjEntity waveToFj, UriComponentsBuilder uriBuilder) { public ResponseEntity<?> create(@RequestParam String waveToFjstr , UriComponentsBuilder uriBuilder) {
ResultDO D0 = new ResultDO();
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<WaveToFjEntity>> failures = validator.validate(waveToFj); WaveToFjEntity waveToFj = (WaveToFjEntity)JSONHelper.json2Object(waveToFjstr,WaveToFjEntity.class);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存 //保存
try{ try{
waveToFjService.save(waveToFj); WmOmQmIEntity wmOmQmI = systemService.getEntity(
} catch (Exception e) { WmOmQmIEntity.class, waveToFj.getId());
if (wmOmQmI != null&&wmOmQmI.getBinSta().equals("H")) {
wmOmQmI.setBinSta("Y");
systemService.saveOrUpdate(wmOmQmI);
}
} catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
return new ResponseEntity(waveToFj, HttpStatus.OK); return new ResponseEntity(waveToFj, HttpStatus.OK);
} }