格式化

master
erzhongxmu 2024-01-26 14:06:19 +08:00
parent b326ad568f
commit d5619c9523
4 changed files with 2041 additions and 2029 deletions

View File

@ -1,6 +1,8 @@
package com.zzjee.wm.controller;
import com.zzjee.wm.entity.WmPrintModelEntity;
import com.zzjee.wm.service.WmPrintModelServiceI;
import java.util.ArrayList;
import java.util.List;
import java.text.SimpleDateFormat;
@ -29,6 +31,7 @@ import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import java.io.OutputStream;
import org.jeecgframework.core.util.BrowserUtils;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -39,12 +42,16 @@ import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.jeecgframework.core.util.ResourceUtil;
import java.io.IOException;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.Map;
import java.util.HashMap;
import org.jeecgframework.core.util.ExceptionUtil;
import org.springframework.http.ResponseEntity;
@ -58,20 +65,21 @@ import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.net.URI;
import org.springframework.http.MediaType;
import org.springframework.web.util.UriComponentsBuilder;
/**
* @author onlineGenerator
* @version V1.0
* @Title: Controller
* @Description:
* @author onlineGenerator
* @date 2021-08-02 14:51:38
* @version V1.0
*
*/
@Controller
@RequestMapping("/wmPrintModelController")
@ -89,7 +97,6 @@ public class WmPrintModelController extends BaseController {
private Validator validator;
/**
*
*
@ -110,13 +117,13 @@ public class WmPrintModelController extends BaseController {
*/
@RequestMapping(params = "datagrid")
public void datagrid(WmPrintModelEntity wmPrintModel,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
public void datagrid(WmPrintModelEntity wmPrintModel, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmPrintModelEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPrintModel, request.getParameterMap());
try{
try {
//自定义追加查询条件
}catch (Exception e) {
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
@ -136,10 +143,10 @@ public class WmPrintModelController extends BaseController {
AjaxJson j = new AjaxJson();
wmPrintModel = systemService.getEntity(WmPrintModelEntity.class, wmPrintModel.getId());
message = "打印模板删除成功";
try{
try {
wmPrintModelService.delete(wmPrintModel);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "打印模板删除失败";
throw new BusinessException(e.getMessage());
@ -155,19 +162,19 @@ public class WmPrintModelController extends BaseController {
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "打印模板删除成功";
try{
for(String id:ids.split(",")){
try {
for (String id : ids.split(",")) {
WmPrintModelEntity wmPrintModel = systemService.getEntity(WmPrintModelEntity.class,
id
);
wmPrintModelService.delete(wmPrintModel);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "打印模板删除失败";
throw new BusinessException(e.getMessage());
@ -189,10 +196,10 @@ public class WmPrintModelController extends BaseController {
String message = null;
AjaxJson j = new AjaxJson();
message = "打印模板添加成功";
try{
try {
wmPrintModelService.save(wmPrintModel);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "打印模板添加失败";
throw new BusinessException(e.getMessage());
@ -241,6 +248,7 @@ public class WmPrintModelController extends BaseController {
}
return new ModelAndView("com/zzjee/wm/wmPrintModel-add");
}
/**
*
*
@ -262,7 +270,7 @@ public class WmPrintModelController extends BaseController {
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","wmPrintModelController");
req.setAttribute("controller_name", "wmPrintModelController");
return new ModelAndView("common/upload/pub_excel_upload");
}
@ -273,18 +281,19 @@ public class WmPrintModelController extends BaseController {
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(WmPrintModelEntity wmPrintModel,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
public String exportXls(WmPrintModelEntity wmPrintModel, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid, ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(WmPrintModelEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPrintModel, request.getParameterMap());
List<WmPrintModelEntity> wmPrintModels = this.wmPrintModelService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"打印模板");
modelMap.put(NormalExcelConstants.CLASS,WmPrintModelEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("打印模板列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
List<WmPrintModelEntity> wmPrintModels = this.wmPrintModelService.getListByCriteriaQuery(cq, false);
modelMap.put(NormalExcelConstants.FILE_NAME, "打印模板");
modelMap.put(NormalExcelConstants.CLASS, WmPrintModelEntity.class);
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("打印模板列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,wmPrintModels);
modelMap.put(NormalExcelConstants.DATA_LIST, wmPrintModels);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
@ -292,13 +301,13 @@ public class WmPrintModelController extends BaseController {
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(WmPrintModelEntity wmPrintModel,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"打印模板");
modelMap.put(NormalExcelConstants.CLASS,WmPrintModelEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("打印模板列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
public String exportXlsByT(WmPrintModelEntity wmPrintModel, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid, ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME, "打印模板");
modelMap.put(NormalExcelConstants.CLASS, WmPrintModelEntity.class);
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("打印模板列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
@ -317,7 +326,7 @@ public class WmPrintModelController extends BaseController {
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<WmPrintModelEntity> listWmPrintModelEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WmPrintModelEntity.class,params);
List<WmPrintModelEntity> listWmPrintModelEntitys = ExcelImportUtil.importExcel(file.getInputStream(), WmPrintModelEntity.class, params);
for (WmPrintModelEntity wmPrintModel : listWmPrintModelEntitys) {
wmPrintModelService.save(wmPrintModel);
}
@ -325,7 +334,7 @@ public class WmPrintModelController extends BaseController {
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
@ -339,7 +348,7 @@ public class WmPrintModelController extends BaseController {
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public List<WmPrintModelEntity> list() {
List<WmPrintModelEntity> listWmPrintModels=wmPrintModelService.getList(WmPrintModelEntity.class);
List<WmPrintModelEntity> listWmPrintModels = wmPrintModelService.getList(WmPrintModelEntity.class);
return listWmPrintModels;
}
@ -363,7 +372,7 @@ public class WmPrintModelController extends BaseController {
}
//保存
try{
try {
wmPrintModelService.save(wmPrintModel);
} catch (Exception e) {
e.printStackTrace();
@ -387,7 +396,7 @@ public class WmPrintModelController extends BaseController {
}
//保存
try{
try {
wmPrintModelService.saveOrUpdate(wmPrintModel);
} catch (Exception e) {
e.printStackTrace();

View File

@ -1,4 +1,5 @@
package com.zzjee.wm.controller;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -57,12 +58,11 @@ import com.zzjee.wm.service.WmSttInGoodsServiceI;
import com.zzjee.wmutil.wmUtil;
/**
* @author erzhongxmu
* @version V1.0
* @Title: Controller
* @Description:
* @author erzhongxmu
* @date 2017-09-08 21:03:33
* @version V1.0
*
*/
@Controller
@RequestMapping("/wmSttInGoodsController")
@ -80,7 +80,6 @@ public class WmSttInGoodsController extends BaseController {
private Validator validator;
/**
*
*
@ -90,14 +89,17 @@ public class WmSttInGoodsController extends BaseController {
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wmSttInGoodsList");
}
@RequestMapping(params = "listfp")
public ModelAndView listfp(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wmSttInGoodsfpList");
}
@RequestMapping(params = "listcygz")
public ModelAndView listcygz(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wmSttInGoodscygzList");
}
/**
* easyui AJAX
*
@ -107,11 +109,11 @@ public class WmSttInGoodsController extends BaseController {
*/
@RequestMapping(params = "datagrid")
public void datagrid(WmSttInGoodsEntity wmSttInGoods,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
public void datagrid(WmSttInGoodsEntity wmSttInGoods, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmSttInGoodsEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmSttInGoods, request.getParameterMap());
try{
try {
//自定义追加查询条件
@ -129,10 +131,10 @@ public class WmSttInGoodsController extends BaseController {
}
}catch (Exception e) {
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
Map<String,Object> map1 = new HashMap<String,Object>();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc");
cq.setOrder(map1);
cq.notEq("sttSta", "已删除");
@ -143,16 +145,16 @@ public class WmSttInGoodsController extends BaseController {
@RequestMapping(params = "datagridcygz")
public void datagridcygz(WmSttInGoodsEntity wmSttInGoods,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
public void datagridcygz(WmSttInGoodsEntity wmSttInGoods, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmSttInGoodsEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmSttInGoods, request.getParameterMap());
try{
try {
//自定义追加查询条件
}catch (Exception e) {
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
Map<String,Object> map1 = new HashMap<String,Object>();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc");
cq.setOrder(map1);
cq.eq("sttSta", "已完成");
@ -161,7 +163,7 @@ public class WmSttInGoodsController extends BaseController {
List<WmSttInGoodsEntity> resultnew = new ArrayList<WmSttInGoodsEntity>();
List<WmSttInGoodsEntity> resultold = dataGrid.getResults();
for (WmSttInGoodsEntity wmSttInGoodsold : resultold) {
if(!wmSttInGoodsold.getGoodsQua().equals(wmSttInGoodsold.getSttQua())){
if (!wmSttInGoodsold.getGoodsQua().equals(wmSttInGoodsold.getSttQua())) {
resultnew.add(wmSttInGoodsold);
}
}
@ -172,19 +174,17 @@ public class WmSttInGoodsController extends BaseController {
}
@RequestMapping(params = "datagridfp")
public void datagridfp(WmSttInGoodsEntity wmSttInGoods,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
public void datagridfp(WmSttInGoodsEntity wmSttInGoods, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmSttInGoodsEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmSttInGoods, request.getParameterMap());
try{
try {
//自定义追加查询条件
}catch (Exception e) {
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
Map<String,Object> map1 = new HashMap<String,Object>();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc");
cq.setOrder(map1);
cq.eq("sttSta", "已完成");
@ -193,7 +193,7 @@ public class WmSttInGoodsController extends BaseController {
List<WmSttInGoodsEntity> resultnew = new ArrayList<WmSttInGoodsEntity>();
List<WmSttInGoodsEntity> resultold = dataGrid.getResults();
for (WmSttInGoodsEntity wmSttInGoodsold : resultold) {
if(!wmSttInGoodsold.getGoodsQua().equals(wmSttInGoodsold.getSttQua())){
if (!wmSttInGoodsold.getGoodsQua().equals(wmSttInGoodsold.getSttQua())) {
resultnew.add(wmSttInGoodsold);
}
}
@ -215,11 +215,11 @@ public class WmSttInGoodsController extends BaseController {
AjaxJson j = new AjaxJson();
wmSttInGoods = systemService.getEntity(WmSttInGoodsEntity.class, wmSttInGoods.getId());
message = "库存盘点删除成功";
try{
try {
wmSttInGoods.setSttSta("已删除");
wmSttInGoodsService.saveOrUpdate(wmSttInGoods);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "库存盘点删除失败";
throw new BusinessException(e.getMessage());
@ -229,7 +229,6 @@ public class WmSttInGoodsController extends BaseController {
}
@RequestMapping(params = "dorun")
@ResponseBody
public AjaxJson dorun(WmSttInGoodsEntity wmSttInGoods, HttpServletRequest request) {
@ -238,12 +237,12 @@ public class WmSttInGoodsController extends BaseController {
wmSttInGoods = systemService.getEntity(WmSttInGoodsEntity.class, request
.getParameter("id").toString());
message = "库存盘点差异过账成功";
if(wmSttInGoods.getSttSta().equals("已完成")){
if (wmSttInGoods.getSttSta().equals("已完成")) {
if(!wmSttInGoods.getGoodsQua().equals(wmSttInGoods.getSttQua())){
try{
if (!wmSttInGoods.getGoodsQua().equals(wmSttInGoods.getSttQua())) {
try {
// wmSttInGoods.setSttQua("0");
if(Double.parseDouble(wmSttInGoods.getGoodsQua()) > Double.parseDouble(wmSttInGoods.getSttQua())){
if (Double.parseDouble(wmSttInGoods.getGoodsQua()) > Double.parseDouble(wmSttInGoods.getSttQua())) {
//下架
String goodsqua = Double.toString((Double.parseDouble(wmSttInGoods.getGoodsQua()) - Double.parseDouble(wmSttInGoods.getSttQua())));
WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity();
@ -257,7 +256,7 @@ public class WmSttInGoodsController extends BaseController {
mvgoods = systemService.findUniqueByProperty(
MvGoodsEntity.class, "goodsCode",
wmSttInGoods.getGoodsId());
if(mvgoods!=null){
if (mvgoods != null) {
wmToDownGoods.setGoodsId(wmSttInGoods.getGoodsId());
wmToDownGoods.setBinIdFrom(wmSttInGoods.getTinId());
wmToDownGoods.setKuWeiBianMa(wmSttInGoods.getBinId());
@ -268,20 +267,21 @@ public class WmSttInGoodsController extends BaseController {
.getGoodsQuaok());
wmToDownGoods.setCusCode(wmSttInGoods.getCusCode());
if(!wmUtil.checkstcok(wmToDownGoods.getKuWeiBianMa(),wmToDownGoods.getBinIdFrom(),wmToDownGoods.getGoodsId(),wmToDownGoods.getGoodsProData(),wmToDownGoods.getGoodsQua())){
if (!wmUtil.checkstcok(wmToDownGoods.getKuWeiBianMa(), wmToDownGoods.getBinIdFrom(), wmToDownGoods.getGoodsId(), wmToDownGoods.getGoodsProData(), wmToDownGoods.getGoodsQua())) {
message = "库存不足";
j.setMsg(message);
return j;
};
}
;
systemService.save(wmToDownGoods);
wmSttInGoods.setSttSta("已过帐");
wmSttInGoodsService.saveOrUpdate(wmSttInGoods);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}else{
} else {
//上架
String goodsqua = Double.toString(( Double.parseDouble(wmSttInGoods.getSttQua()) - Double.parseDouble(wmSttInGoods.getGoodsQua())));
String goodsqua = Double.toString((Double.parseDouble(wmSttInGoods.getSttQua()) - Double.parseDouble(wmSttInGoods.getGoodsQua())));
WmToUpGoodsEntity wmToUpGoods = new WmToUpGoodsEntity();
wmToUpGoods.setOrderId("ZY");
@ -289,7 +289,7 @@ public class WmSttInGoodsController extends BaseController {
mvgoods = systemService.findUniqueByProperty(
MvGoodsEntity.class, "goodsCode",
wmSttInGoods.getGoodsId());
if(mvgoods!=null){
if (mvgoods != null) {
wmToUpGoods.setBaseUnit(mvgoods.getBaseunit());
wmToUpGoods.setGoodsUnit(mvgoods.getBaseunit());
wmToUpGoods.setBaseGoodscount(goodsqua);
@ -306,12 +306,12 @@ public class WmSttInGoodsController extends BaseController {
}
}
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "库存盘点差异过账失败";
throw new BusinessException(e.getMessage());
}
}else{
} else {
message = "库存盘点差异无需过账";
}
}
@ -328,12 +328,12 @@ public class WmSttInGoodsController extends BaseController {
wmSttInGoods = systemService.getEntity(WmSttInGoodsEntity.class, request
.getParameter("id").toString());
message = "库存盘点添加成功";
try{
try {
wmSttInGoods.setSttQua("0");
wmSttInGoods.setSttSta("计划中");
wmSttInGoodsService.save(wmSttInGoods);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "库存盘点添加失败";
throw new BusinessException(e.getMessage());
@ -349,19 +349,19 @@ public class WmSttInGoodsController extends BaseController {
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "库存盘点删除成功";
try{
for(String id:ids.split(",")){
try {
for (String id : ids.split(",")) {
WmSttInGoodsEntity wmSttInGoods = systemService.getEntity(WmSttInGoodsEntity.class,
id
);
wmSttInGoodsService.delete(wmSttInGoods);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "库存盘点删除失败";
throw new BusinessException(e.getMessage());
@ -382,11 +382,11 @@ public class WmSttInGoodsController extends BaseController {
String message = null;
AjaxJson j = new AjaxJson();
message = "库存盘点添加成功";
try{
try {
wmSttInGoods.setSttSta("计划中");
wmSttInGoodsService.save(wmSttInGoods);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "库存盘点添加失败";
throw new BusinessException(e.getMessage());
@ -434,6 +434,7 @@ public class WmSttInGoodsController extends BaseController {
}
return new ModelAndView("com/zzjee/wm/wmSttInGoods-add");
}
/**
*
*
@ -455,7 +456,7 @@ public class WmSttInGoodsController extends BaseController {
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","wmSttInGoodsController");
req.setAttribute("controller_name", "wmSttInGoodsController");
return new ModelAndView("common/upload/pub_excel_upload");
}
@ -466,18 +467,19 @@ public class WmSttInGoodsController extends BaseController {
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(WmSttInGoodsEntity wmSttInGoods,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
public String exportXls(WmSttInGoodsEntity wmSttInGoods, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid, ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(WmSttInGoodsEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmSttInGoods, request.getParameterMap());
List<WmSttInGoodsEntity> wmSttInGoodss = this.wmSttInGoodsService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"库存盘点");
modelMap.put(NormalExcelConstants.CLASS,WmSttInGoodsEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("库存盘点列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
List<WmSttInGoodsEntity> wmSttInGoodss = this.wmSttInGoodsService.getListByCriteriaQuery(cq, false);
modelMap.put(NormalExcelConstants.FILE_NAME, "库存盘点");
modelMap.put(NormalExcelConstants.CLASS, WmSttInGoodsEntity.class);
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("库存盘点列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,wmSttInGoodss);
modelMap.put(NormalExcelConstants.DATA_LIST, wmSttInGoodss);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
@ -485,13 +487,13 @@ public class WmSttInGoodsController extends BaseController {
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(WmSttInGoodsEntity wmSttInGoods,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"库存盘点");
modelMap.put(NormalExcelConstants.CLASS,WmSttInGoodsEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("库存盘点列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
public String exportXlsByT(WmSttInGoodsEntity wmSttInGoods, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid, ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME, "库存盘点");
modelMap.put(NormalExcelConstants.CLASS, WmSttInGoodsEntity.class);
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("库存盘点列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
@ -510,7 +512,7 @@ public class WmSttInGoodsController extends BaseController {
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<WmSttInGoodsEntity> listWmSttInGoodsEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WmSttInGoodsEntity.class,params);
List<WmSttInGoodsEntity> listWmSttInGoodsEntitys = ExcelImportUtil.importExcel(file.getInputStream(), WmSttInGoodsEntity.class, params);
for (WmSttInGoodsEntity wmSttInGoods : listWmSttInGoodsEntitys) {
wmSttInGoodsService.save(wmSttInGoods);
}
@ -518,7 +520,7 @@ public class WmSttInGoodsController extends BaseController {
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
@ -528,46 +530,47 @@ public class WmSttInGoodsController extends BaseController {
}
return j;
}
//PDA接口
@RequestMapping(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) {
public ResponseEntity<?> list(@RequestParam(value = "username", required = false) String username,
@RequestParam(value = "searchstr", required = false) String searchstr,
@RequestParam(value = "searchstr2", required = false) String searchstr2) {
// return listWvGis;
ResultDO D0 = new ResultDO();
String hql = " from WmSttInGoodsEntity where 1 = 1 and sttSta = '计划中' ";
D0.setOK(true);
if(!StringUtil.isEmpty(searchstr)) {
hql=hql+" and binId like '%" + searchstr + "%'";
if (!StringUtil.isEmpty(searchstr)) {
hql = hql + " and binId like '%" + searchstr + "%'";
}
if(!StringUtil.isEmpty(searchstr2)) {
try{
if (!StringUtil.isEmpty(searchstr2)) {
try {
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
if(StringUtil.isNotEmpty(shpbianma)){
searchstr2=shpbianma;
if (StringUtil.isNotEmpty(shpbianma)) {
searchstr2 = shpbianma;
}
}catch (Exception e){
} catch (Exception e) {
}
hql=hql+" and goodsId like '%" + searchstr2 + "%'";
hql = hql + " and goodsId like '%" + searchstr2 + "%'";
}
List<WmSttInGoodsEntity> listWmSttInGoodss=wmSttInGoodsService.findHql(hql);
List<WmSttInGoodsEntity> listWmSttInGoodss = wmSttInGoodsService.findHql(hql);
D0.setOK(true);
List<WmSttInGoodsEntity> result = new ArrayList<WmSttInGoodsEntity>();
int i = 0;
for (WmSttInGoodsEntity t :listWmSttInGoodss){
for (WmSttInGoodsEntity t : listWmSttInGoodss) {
i++;
if(i>100){
if (i > 100) {
break;
}
result.add(t);
}
if(result.size()<=0){
if (result.size() <= 0) {
D0.setOK(false);
}
D0.setObj(result);
@ -590,9 +593,9 @@ public class WmSttInGoodsController extends BaseController {
public ResponseEntity<?> create(@RequestBody String wmSttInGoodsstr, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
ResultDO D0 = new ResultDO();
WmSttInGoodsEntity wmSttInGoods = (WmSttInGoodsEntity)JSONHelper.json2Object(wmSttInGoodsstr,WmToDownGoodsEntity.class);
WmSttInGoodsEntity wmSttInGoods = (WmSttInGoodsEntity) JSONHelper.json2Object(wmSttInGoodsstr, WmToDownGoodsEntity.class);
//保存
try{
try {
wmSttInGoodsService.save(wmSttInGoods);
D0.setOK(true);
} catch (Exception e) {
@ -611,12 +614,12 @@ public class WmSttInGoodsController extends BaseController {
UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
ResultDO D0 = new ResultDO();
WmSttInGoodsEntity wmSttInGoods = (WmSttInGoodsEntity)JSONHelper.json2Object(wmSttInGoodsstr,WmSttInGoodsEntity.class);
WmSttInGoodsEntity wmSttInGoods = (WmSttInGoodsEntity) JSONHelper.json2Object(wmSttInGoodsstr, WmSttInGoodsEntity.class);
//保存
try{
WmSttInGoodsEntity t = systemService.get(WmSttInGoodsEntity.class,wmSttInGoods.getId());
try {
WmSttInGoodsEntity t = systemService.get(WmSttInGoodsEntity.class, wmSttInGoods.getId());
MyBeanUtils.copyBeanNotNull2Bean(wmSttInGoods,t);
MyBeanUtils.copyBeanNotNull2Bean(wmSttInGoods, t);
t.setSttSta(Constants.wm_sta4);
t.setUpdateDate(new Date());
wmSttInGoodsService.saveOrUpdate(t);

View File

@ -65,12 +65,11 @@ import static com.xiaoleilu.hutool.date.DateTime.now;
import static org.jeecgframework.web.system.sms.util.Constants.wm_sta6;
/**
* @author erzhongxmu
* @version V1.0
* @Title: Controller
* @Description:
* @author erzhongxmu
* @date 2017-08-25 10:40:39
* @version V1.0
*
*/
@Controller
@RequestMapping("/wmToDownGoodsController")
@ -120,21 +119,21 @@ public class WmToDownGoodsController extends BaseController {
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
Map<String,Object> map1 = new HashMap<String,Object>();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc");
cq.setOrder(map1);
cq.add();
this.wmToDownGoodsService.getDataGridReturn(cq, true);
List<WmToDownGoodsEntity> resultold = dataGrid.getResults();
List<WmToDownGoodsEntity> resultnew = new ArrayList<>();
for(WmToDownGoodsEntity t:resultold){
if (StringUtil.isEmpty(t.getGoodsName())){
try{
for (WmToDownGoodsEntity t : resultold) {
if (StringUtil.isEmpty(t.getGoodsName())) {
try {
MvGoodsEntity goods = systemService.findUniqueByProperty(MvGoodsEntity.class, "goodsCode", t.getGoodsId());
if(goods!=null){
if (goods != null) {
t.setGoodsName(goods.getGoodsName());
}
}catch (Exception e){
} catch (Exception e) {
}
@ -162,7 +161,7 @@ public class WmToDownGoodsController extends BaseController {
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
Map<String,Object> map1 = new HashMap<String,Object>();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc");
cq.setOrder(map1);
cq.isNull("downSta");
@ -194,7 +193,7 @@ public class WmToDownGoodsController extends BaseController {
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
Map<String,Object> map1 = new HashMap<String,Object>();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc");
cq.setOrder(map1);
cq.isNull("downSta");
@ -211,6 +210,7 @@ public class WmToDownGoodsController extends BaseController {
dataGrid.setResults(resultnew);
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
@ -265,6 +265,7 @@ public class WmToDownGoodsController extends BaseController {
j.setMsg(message);
return j;
}
/**
*
*/
@ -273,6 +274,7 @@ public class WmToDownGoodsController extends BaseController {
public ModelAndView delListDemo(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/omconf");
}
@RequestMapping(params = "wavedelList")
public ModelAndView wavedelListDemo(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wavedel_rowedtior");
@ -296,12 +298,12 @@ public class WmToDownGoodsController extends BaseController {
try {
t.setDownSta(Constants.wm_sta5);//直接修改状态
wmToDownGoodsService.saveOrUpdate(t);
try{
try {
String orderId = t.getOrderId();
String type = "fh";
String username = ResourceUtil.getSessionUserName().getRealName();
updateUser(orderId,type,username);
}catch (Exception e){
updateUser(orderId, type, username);
} catch (Exception e) {
}
systemService.addLog(message, Globals.Log_Type_UPDATE,
Globals.Log_Leavel_INFO);
@ -315,31 +317,31 @@ public class WmToDownGoodsController extends BaseController {
}
/**
* gengxin
*
* @param page
* @return
*/
@RequestMapping(params = "updateRows")
@ResponseBody
public AjaxJson updateRows(Delrowpage page){
public AjaxJson updateRows(Delrowpage page) {
String message = null;
List<WmToDownGoodsEntity> demos=page.getDownrows();
List<WmToDownGoodsEntity> demos = page.getDownrows();
AjaxJson j = new AjaxJson();
if(CollectionUtils.isNotEmpty(demos)){
for(WmToDownGoodsEntity jeecgDemo:demos){
if (CollectionUtils.isNotEmpty(demos)) {
for (WmToDownGoodsEntity jeecgDemo : demos) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
WmToDownGoodsEntity t =systemService.get(WmToDownGoodsEntity.class, jeecgDemo.getId());
WmToDownGoodsEntity t = systemService.get(WmToDownGoodsEntity.class, jeecgDemo.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(jeecgDemo, t);
systemService.saveOrUpdate(t);
try{
try {
String orderId = t.getOrderId();
String type = "fh";
String username = ResourceUtil.getSessionUserName().getRealName();
updateUser(orderId,type,username);
}catch (Exception e){
updateUser(orderId, type, username);
} catch (Exception e) {
}
} catch (Exception e) {
e.printStackTrace();
@ -352,31 +354,32 @@ public class WmToDownGoodsController extends BaseController {
/**
*
*
* @param page
* @return
*/
@RequestMapping(params = "saveRows")
@ResponseBody
public AjaxJson saveRows(Delrowpage page){
public AjaxJson saveRows(Delrowpage page) {
String message = null;
List<WmToDownGoodsEntity> demos=page.getDownrows();
List<WmToDownGoodsEntity> demos = page.getDownrows();
AjaxJson j = new AjaxJson();
if(CollectionUtils.isNotEmpty(demos)){
for(WmToDownGoodsEntity jeecgDemo:demos){
if (CollectionUtils.isNotEmpty(demos)) {
for (WmToDownGoodsEntity jeecgDemo : demos) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
WmToDownGoodsEntity t =systemService.get(WmToDownGoodsEntity.class, jeecgDemo.getId());
WmToDownGoodsEntity t = systemService.get(WmToDownGoodsEntity.class, jeecgDemo.getId());
try {
message = "装车复核成功";
MyBeanUtils.copyBeanNotNull2Bean(jeecgDemo, t);
t.setDownSta(Constants.wm_sta5);
systemService.saveOrUpdate(t);
try{
try {
String orderId = t.getOrderId();
String type = "fh";
String username = ResourceUtil.getSessionUserName().getRealName();
updateUser(orderId,type,username);
}catch (Exception e){
updateUser(orderId, type, username);
} catch (Exception e) {
}
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
@ -390,12 +393,12 @@ public class WmToDownGoodsController extends BaseController {
}
@RequestMapping(params = "doGetcusname",method ={RequestMethod.GET, RequestMethod.POST})
@RequestMapping(params = "doGetcusname", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public AjaxJson doGetcusname(HttpServletRequest request) {
AjaxJson j = new AjaxJson();
MvCusEntity mvcus = systemService.findUniqueByProperty(MvCusEntity.class, "cusCode", oConvertUtils.getString(request.getParameter("cusCode"))) ;
if(mvcus==null){
MvCusEntity mvcus = systemService.findUniqueByProperty(MvCusEntity.class, "cusCode", oConvertUtils.getString(request.getParameter("cusCode")));
if (mvcus == null) {
j.setSuccess(false);
j.setMsg("不存在货主");
}
@ -404,26 +407,26 @@ public class WmToDownGoodsController extends BaseController {
}
@RequestMapping(params = "doGettextzy",method ={RequestMethod.GET, RequestMethod.POST})
@RequestMapping(params = "doGettextzy", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public AjaxJson doGettextzy(HttpServletRequest request) {
AjaxJson j = new AjaxJson();
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class, "goodsCode", oConvertUtils.getString(request.getParameter("goodsid"))) ;
if(mvgoods==null){
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class, "goodsCode", oConvertUtils.getString(request.getParameter("goodsid")));
if (mvgoods == null) {
j.setSuccess(false);
j.setMsg("不存在此商品");
}else{
} else {
String sql = "select ws.ku_wei_bian_ma,ws.bin_id,ws.shp_ming_cheng,cast(sum(ws.base_goodscount) as signed) as goods_qua, mb.qu_huo_ci_xu, ws.goods_pro_data"
+" from wv_stock ws, md_bin mb where "
+" ws.ku_wei_bian_ma = mb.ku_wei_bian_ma and mb.ting_yong <> 'Y' and ws.kuctype = '库存'"
+" and ws.goods_id = ? "
+" group by ws.ku_wei_bian_ma,ws.bin_id,ws.shp_ming_cheng,mb.qu_huo_ci_xu, ws.goods_pro_data order by ws.goods_pro_data , ws.goods_qua, mb.qu_huo_ci_xu";
+ " from wv_stock ws, md_bin mb where "
+ " ws.ku_wei_bian_ma = mb.ku_wei_bian_ma and mb.ting_yong <> 'Y' and ws.kuctype = '库存'"
+ " and ws.goods_id = ? "
+ " group by ws.ku_wei_bian_ma,ws.bin_id,ws.shp_ming_cheng,mb.qu_huo_ci_xu, ws.goods_pro_data order by ws.goods_pro_data , ws.goods_qua, mb.qu_huo_ci_xu";
Object objs = null;
List<Map<String, Object>> result = systemService.findForJdbc(sql, request.getParameter("goodsid"));
if(result!=null){
if (result != null) {
}else{
} else {
j.setSuccess(false);
j.setMsg("商品没有库存");
}
@ -433,42 +436,42 @@ public class WmToDownGoodsController extends BaseController {
}
@RequestMapping(params = "doGettext",method ={RequestMethod.GET, RequestMethod.POST})
@RequestMapping(params = "doGettext", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public AjaxJson doGettext(HttpServletRequest request) {
AjaxJson j = new AjaxJson();
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class, "goodsCode", oConvertUtils.getString(request.getParameter("goodsid"))) ;
if(mvgoods==null){
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class, "goodsCode", oConvertUtils.getString(request.getParameter("goodsid")));
if (mvgoods == null) {
j.setSuccess(false);
j.setMsg("不存在此商品");
}else{
} else {
double goodsno = 0;
WmOmNoticeHEntity wmOmNoticeHEntity = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", oConvertUtils.getString(request.getParameter("noticeid")));
String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND omNoticeId = ? and goodsId = ? ";
List<WmOmNoticeIEntity> wmOmNoticeIEntityList = systemService
.findHql(hql0, wmOmNoticeHEntity.getOmNoticeId(),oConvertUtils.getString(request.getParameter("goodsid")));//获取行项目
.findHql(hql0, wmOmNoticeHEntity.getOmNoticeId(), oConvertUtils.getString(request.getParameter("goodsid")));//获取行项目
for (WmOmNoticeIEntity wmOmNoticeIEntity : wmOmNoticeIEntityList) {
goodsno = (Double.valueOf(wmOmNoticeIEntity.getGoodsQua()) - Double.valueOf(wmOmNoticeIEntity.getGoodsQuaok())) * Double.valueOf(mvgoods.getChlShl());
if(goodsno > 0 ){
if (goodsno > 0) {
String sql = "select ws.ku_wei_bian_ma,ws.bin_id,ws.shp_ming_cheng,cast(sum(ws.base_goodscount) as signed) as goods_qua, mb.qu_huo_ci_xu, ws.goods_pro_data"
+" from wv_stock ws, md_bin mb where "
+" ws.ku_wei_bian_ma = mb.ku_wei_bian_ma and mb.ting_yong <> 'Y' and ws.kuctype = '库存'"
+" and ws.goods_id = ? "
+" and ws.cus_code = ? "
+" group by ws.ku_wei_bian_ma,ws.bin_id,ws.shp_ming_cheng,mb.qu_huo_ci_xu, ws.goods_pro_data order by ws.goods_pro_data , ws.goods_qua, mb.qu_huo_ci_xu";
+ " from wv_stock ws, md_bin mb where "
+ " ws.ku_wei_bian_ma = mb.ku_wei_bian_ma and mb.ting_yong <> 'Y' and ws.kuctype = '库存'"
+ " and ws.goods_id = ? "
+ " and ws.cus_code = ? "
+ " group by ws.ku_wei_bian_ma,ws.bin_id,ws.shp_ming_cheng,mb.qu_huo_ci_xu, ws.goods_pro_data order by ws.goods_pro_data , ws.goods_qua, mb.qu_huo_ci_xu";
Object objs = null;
List<Map<String, Object>> result = systemService.findForJdbc(sql, wmOmNoticeIEntity.getGoodsId(),wmOmNoticeHEntity.getCusCode());
List<Map<String, Object>> result = systemService.findForJdbc(sql, wmOmNoticeIEntity.getGoodsId(), wmOmNoticeHEntity.getCusCode());
mvgoods.setChlShl(String.valueOf(goodsno));
if(result!=null){
for(int i = 0;i<result.size();i++ ){
if(Double.valueOf(result.get(i).get("goods_qua").toString())>0){
if(Double.valueOf(result.get(i).get("goods_qua").toString())>=goodsno){
if (result != null) {
for (int i = 0; i < result.size(); i++) {
if (Double.valueOf(result.get(i).get("goods_qua").toString()) > 0) {
if (Double.valueOf(result.get(i).get("goods_qua").toString()) >= goodsno) {
mvgoods.setTiJiCm(String.valueOf(goodsno));//数量
mvgoods.setZhlKg("本次可发完");//还需数量
}else{
} else {
double wq = goodsno - Double.valueOf(result.get(i).get("goods_qua").toString());
mvgoods.setTiJiCm(result.get(i).get("goods_qua").toString());//数量setChcDanWei
mvgoods.setZhlKg("还需要发"+Double.toString(wq));//还需数量 setChlKongZhi
mvgoods.setZhlKg("还需要发" + Double.toString(wq));//还需数量 setChlKongZhi
}
mvgoods.setGoodsName(result.get(i).get("shp_ming_cheng").toString());//名称
@ -480,7 +483,7 @@ public class WmToDownGoodsController extends BaseController {
}
}
}else{
} else {
j.setSuccess(false);
j.setMsg("商品没有库存");
}
@ -488,7 +491,7 @@ public class WmToDownGoodsController extends BaseController {
break;
}
}
if(goodsno <=0){
if (goodsno <= 0) {
j.setSuccess(false);
j.setMsg("已经发货完毕");
}
@ -518,7 +521,7 @@ public class WmToDownGoodsController extends BaseController {
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(
MvGoodsEntity.class, "goodsCode",
wmToDownGoods.getGoodsId());
if(mvgoods!=null){
if (mvgoods != null) {
wmToDownGoods.setGoodsName(mvgoods.getGoodsName());
wmToDownGoods.setBaseUnit(mvgoods.getBaseunit());
wmToDownGoods.setGoodsUnit(mvgoods.getShlDanWei());
@ -536,12 +539,13 @@ public class WmToDownGoodsController extends BaseController {
.getGoodsQua());
}
if(!wmUtil.checkstcok(wmToDownGoods.getKuWeiBianMa(),wmToDownGoods.getBinIdFrom(),wmToDownGoods.getGoodsId(),wmToDownGoods.getGoodsProData(),wmToDownGoods.getGoodsQua())){
if (!wmUtil.checkstcok(wmToDownGoods.getKuWeiBianMa(), wmToDownGoods.getBinIdFrom(), wmToDownGoods.getGoodsId(), wmToDownGoods.getGoodsProData(), wmToDownGoods.getGoodsQua())) {
message = "库存不足";
j.setMsg(message);
return j;
};
}
;
wmToDownGoodsService.save(wmToDownGoods);
systemService.addLog(message, Globals.Log_Type_INSERT,
Globals.Log_Leavel_INFO);
@ -725,13 +729,14 @@ public class WmToDownGoodsController extends BaseController {
}
return new ResponseEntity(task, HttpStatus.OK);
}
//下架
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public synchronized ResponseEntity<?> create(@RequestParam String wmToDownGoodsstr,
UriComponentsBuilder uriBuilder) {
ResultDO D0 = new ResultDO();
WmToDownGoodsEntity wmToDownGoods = (WmToDownGoodsEntity)JSONHelper.json2Object(wmToDownGoodsstr,WmToDownGoodsEntity.class);
WmToDownGoodsEntity wmToDownGoods = (WmToDownGoodsEntity) JSONHelper.json2Object(wmToDownGoodsstr, WmToDownGoodsEntity.class);
// 调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
WvGiNoticeEntity t = new WvGiNoticeEntity();
Set<ConstraintViolation<WmToDownGoodsEntity>> failures = validator
@ -740,20 +745,19 @@ public class WmToDownGoodsController extends BaseController {
D0.setOK(false);
}
try{
WmToDownGoodsEntity wmToDownGoods1 = systemService.findUniqueByProperty(WmToDownGoodsEntity.class,"orderIdI",wmToDownGoods.getOrderIdI());
if (wmToDownGoods1!=null){
try {
WmToDownGoodsEntity wmToDownGoods1 = systemService.findUniqueByProperty(WmToDownGoodsEntity.class, "orderIdI", wmToDownGoods.getOrderIdI());
if (wmToDownGoods1 != null) {
D0.setOK(false);
D0.setErrorMsg("重复保存");
return new ResponseEntity(D0,HttpStatus.OK);
return new ResponseEntity(D0, HttpStatus.OK);
}
}catch (Exception e){
} catch (Exception e) {
}
// 保存
try {
//查询create_name
@ -761,11 +765,11 @@ public class WmToDownGoodsController extends BaseController {
if (user != null) {
wmToDownGoods.setCreateName(user.getRealName());
}
todown(wmToDownGoods.getOrderIdI(),wmToDownGoods.getCreateBy(),wmToDownGoods.getCreateName());
todown(wmToDownGoods.getOrderIdI(), wmToDownGoods.getCreateBy(), wmToDownGoods.getCreateName());
} catch (Exception e) {
e.printStackTrace();
D0.setOK(false);
return new ResponseEntity(D0,HttpStatus.OK);
return new ResponseEntity(D0, HttpStatus.OK);
}
return new ResponseEntity(D0, HttpStatus.OK);
@ -774,11 +778,11 @@ public class WmToDownGoodsController extends BaseController {
}
public boolean todown(String id,String username,String realname){
public boolean todown(String id, String username, String realname) {
try {
WmOmQmIEntity wmOmQmI = systemService.getEntity(
WmOmQmIEntity.class, id);
if (wmOmQmI != null&&wmOmQmI.getBinSta().equals("N")) {
if (wmOmQmI != null && wmOmQmI.getBinSta().equals("N")) {
WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity();
wmToDownGoods.setCreateBy(username);
wmToDownGoods.setCreateName(realname);
@ -803,11 +807,11 @@ public class WmToDownGoodsController extends BaseController {
systemService.save(wmToDownGoods);
wmOmQmI.setBinSta("Y");
systemService.saveOrUpdate(wmOmQmI);
try{
try {
String orderId = wmOmQmI.getOmNoticeId();
String type = "jh";
updateUser(orderId,type,username);
}catch (Exception e){
updateUser(orderId, type, username);
} catch (Exception e) {
}
return true;
} else {
@ -825,20 +829,20 @@ public class WmToDownGoodsController extends BaseController {
UriComponentsBuilder uriBuilder) {
// 调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
ResultDO D0 = new ResultDO();
WmToDownGoodsEntity wmToDownGoods = (WmToDownGoodsEntity)JSONHelper.json2Object(wmToDownGoodsstr,WmToDownGoodsEntity.class);
WmToDownGoodsEntity t = wmToDownGoodsService.get(WmToDownGoodsEntity.class,wmToDownGoods.getId());
WmToDownGoodsEntity wmToDownGoods = (WmToDownGoodsEntity) JSONHelper.json2Object(wmToDownGoodsstr, WmToDownGoodsEntity.class);
WmToDownGoodsEntity t = wmToDownGoodsService.get(WmToDownGoodsEntity.class, wmToDownGoods.getId());
// 保存
try {
MyBeanUtils.copyBeanNotNull2Bean(wmToDownGoods, t);
t.setDownSta(Constants.wm_sta5);
t.setUpdateDate(now());
wmToDownGoodsService.saveOrUpdate(t);
try{
try {
String orderId = t.getOrderId();
String type = "fh";
String username = wmToDownGoods.getUpdateBy();
updateUser(orderId,type,username);
}catch (Exception e){
updateUser(orderId, type, username);
} catch (Exception e) {
}
D0.setOK(true);
@ -849,22 +853,24 @@ public class WmToDownGoodsController extends BaseController {
// 按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return new ResponseEntity(D0, HttpStatus.OK);
}
void updateUser(String orderId,String type,String userName){
try{
WmOmNoticeHEntity wmOmNoticeHEntity = systemService.findUniqueByProperty(WmOmNoticeHEntity.class,"omNoticeId",orderId);
if ("jh".equals(type)){
void updateUser(String orderId, String type, String userName) {
try {
WmOmNoticeHEntity wmOmNoticeHEntity = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", orderId);
if ("jh".equals(type)) {
wmOmNoticeHEntity.setJhUser(userName);
}
if ("fh".equals(type)){
if ("fh".equals(type)) {
wmOmNoticeHEntity.setFhUser(userName);
wmOmNoticeHEntity.setOmSta(wm_sta6);
}
systemService.updateEntitie(wmOmNoticeHEntity);
}catch (Exception e){
} catch (Exception e) {
}
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") String id) {

View File

@ -1,4 +1,5 @@
package com.zzjee.wm.controller;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
@ -59,12 +60,11 @@ import com.zzjee.wmutil.wmUtil;
import static com.xiaoleilu.hutool.date.DateTime.now;
/**
* @author erzhongxmu
* @version V1.0
* @Title: Controller
* @Description:
* @author erzhongxmu
* @date 2017-09-08 21:03:22
* @version V1.0
*
*/
@Controller
@RequestMapping("/wmToMoveGoodsController")
@ -82,7 +82,6 @@ public class WmToMoveGoodsController extends BaseController {
private Validator validator;
/**
*
*
@ -102,16 +101,16 @@ public class WmToMoveGoodsController extends BaseController {
*/
@RequestMapping(params = "datagrid")
public void datagrid(WmToMoveGoodsEntity wmToMoveGoods,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
public void datagrid(WmToMoveGoodsEntity wmToMoveGoods, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmToMoveGoodsEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmToMoveGoods, request.getParameterMap());
try{
try {
//自定义追加查询条件
}catch (Exception e) {
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
Map<String,Object> map1 = new HashMap<String,Object>();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc");
cq.setOrder(map1);
cq.add();
@ -131,11 +130,11 @@ public class WmToMoveGoodsController extends BaseController {
AjaxJson j = new AjaxJson();
wmToMoveGoods = systemService.getEntity(WmToMoveGoodsEntity.class, wmToMoveGoods.getId());
message = "库存转移删除成功";
try{
try {
wmToMoveGoods.setMoveSta("已删除");
wmToMoveGoodsService.saveOrUpdate(wmToMoveGoods);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "库存转移删除失败";
throw new BusinessException(e.getMessage());
@ -151,21 +150,21 @@ public class WmToMoveGoodsController extends BaseController {
*/
@RequestMapping(params = "doBatchUpdate")
@ResponseBody
public AjaxJson doBatchUpdate(String ids,String moveSta,HttpServletRequest request){
public AjaxJson doBatchUpdate(String ids, String moveSta, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "批量设置状态成功";
try{
for(String id:ids.split(",")){
try {
for (String id : ids.split(",")) {
WmToMoveGoodsEntity wmToMoveGoods = systemService.getEntity(WmToMoveGoodsEntity.class,
id
);
message = "批量保存成功";
String movesta = "已完成";
try{
try {
movesta = ResourceUtil.getConfigByName("wm.movesta");
}catch (Exception e){
} catch (Exception e) {
}
@ -173,7 +172,7 @@ public class WmToMoveGoodsController extends BaseController {
wmToMoveGoodsService.updateEntitie(wmToMoveGoods);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "批量设置状态失败";
throw new BusinessException(e.getMessage());
@ -189,12 +188,12 @@ public class WmToMoveGoodsController extends BaseController {
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "库存转移删除成功";
try{
for(String id:ids.split(",")){
try {
for (String id : ids.split(",")) {
WmToMoveGoodsEntity wmToMoveGoods = systemService.getEntity(WmToMoveGoodsEntity.class,
id
);
@ -202,7 +201,7 @@ public class WmToMoveGoodsController extends BaseController {
wmToMoveGoodsService.updateEntitie(wmToMoveGoods);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "库存转移删除失败";
throw new BusinessException(e.getMessage());
@ -212,17 +211,14 @@ public class WmToMoveGoodsController extends BaseController {
}
@RequestMapping(params = "doGetstock", method = { RequestMethod.GET,
RequestMethod.POST })
@RequestMapping(params = "doGetstock", method = {RequestMethod.GET,
RequestMethod.POST})
@ResponseBody
public AjaxJson doGetstock(HttpServletRequest request) {
AjaxJson j = new AjaxJson();
WmToMoveGoodsEntity wmToMoveGoods = new WmToMoveGoodsEntity();
j.setObj(wmToMoveGoods);
return j;
}
@ -238,11 +234,11 @@ public class WmToMoveGoodsController extends BaseController {
String message = null;
AjaxJson j = new AjaxJson();
message = "库存转移添加成功";
try{
try {
wmToMoveGoods.setMoveSta("计划中");
wmToMoveGoodsService.save(wmToMoveGoods);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
message = "库存转移添加失败";
throw new BusinessException(e.getMessage());
@ -265,10 +261,10 @@ public class WmToMoveGoodsController extends BaseController {
WmToMoveGoodsEntity t = wmToMoveGoodsService.get(WmToMoveGoodsEntity.class, wmToMoveGoods.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(wmToMoveGoods, t);
try{
MvCusEntity mvcus = systemService.findUniqueByProperty(MvCusEntity.class, "cusCode",wmToMoveGoods.getToCusCode() ) ;
try {
MvCusEntity mvcus = systemService.findUniqueByProperty(MvCusEntity.class, "cusCode", wmToMoveGoods.getToCusCode());
t.setToCusName(mvcus.getCusName());
}catch (Exception e){
} catch (Exception e) {
}
@ -284,31 +280,29 @@ public class WmToMoveGoodsController extends BaseController {
}
/**
*
* @param page
* @return
*/
@RequestMapping(params = "saveRows")
@ResponseBody
public AjaxJson saveRows(wmtomovepage page){
public AjaxJson saveRows(wmtomovepage page) {
String message = null;
List<WmToMoveGoodsEntity> demos=page.getWmtomoverows();
List<WmToMoveGoodsEntity> demos = page.getWmtomoverows();
AjaxJson j = new AjaxJson();
if(CollectionUtils.isNotEmpty(demos)){
for(WmToMoveGoodsEntity jeecgDemo:demos){
if (CollectionUtils.isNotEmpty(demos)) {
for (WmToMoveGoodsEntity jeecgDemo : demos) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
WmToMoveGoodsEntity t =systemService.get(WmToMoveGoodsEntity.class, jeecgDemo.getId());
WmToMoveGoodsEntity t = systemService.get(WmToMoveGoodsEntity.class, jeecgDemo.getId());
try {
if(!wmUtil.checkstcok( jeecgDemo.getBinFrom(),jeecgDemo.getTinFrom(),jeecgDemo.getGoodsId(),jeecgDemo.getGoodsProData(),jeecgDemo.getBaseGoodscount())) {
}else{
if (!wmUtil.checkstcok(jeecgDemo.getBinFrom(), jeecgDemo.getTinFrom(), jeecgDemo.getGoodsId(), jeecgDemo.getGoodsProData(), jeecgDemo.getBaseGoodscount())) {
} else {
message = "批量保存成功";
String movesta = "已完成";
try{
try {
movesta = ResourceUtil.getConfigByName("wm.movesta");
}catch (Exception e){
} catch (Exception e) {
}
t.setMoveSta(movesta);
@ -326,8 +320,6 @@ public class WmToMoveGoodsController extends BaseController {
}
/**
*
*
@ -341,6 +333,7 @@ public class WmToMoveGoodsController extends BaseController {
}
return new ModelAndView("com/zzjee/wm/wmToMoveGoods-add");
}
/**
*
*
@ -362,7 +355,7 @@ public class WmToMoveGoodsController extends BaseController {
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","wmToMoveGoodsController");
req.setAttribute("controller_name", "wmToMoveGoodsController");
return new ModelAndView("common/upload/pub_excel_upload");
}
@ -373,18 +366,19 @@ public class WmToMoveGoodsController extends BaseController {
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(WmToMoveGoodsEntity wmToMoveGoods,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
public String exportXls(WmToMoveGoodsEntity wmToMoveGoods, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid, ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(WmToMoveGoodsEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmToMoveGoods, request.getParameterMap());
List<WmToMoveGoodsEntity> wmToMoveGoodss = this.wmToMoveGoodsService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"库存转移");
modelMap.put(NormalExcelConstants.CLASS,WmToMoveGoodsEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("库存转移列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
List<WmToMoveGoodsEntity> wmToMoveGoodss = this.wmToMoveGoodsService.getListByCriteriaQuery(cq, false);
modelMap.put(NormalExcelConstants.FILE_NAME, "库存转移");
modelMap.put(NormalExcelConstants.CLASS, WmToMoveGoodsEntity.class);
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("库存转移列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,wmToMoveGoodss);
modelMap.put(NormalExcelConstants.DATA_LIST, wmToMoveGoodss);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
@ -392,13 +386,13 @@ public class WmToMoveGoodsController extends BaseController {
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(WmToMoveGoodsEntity wmToMoveGoods,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"库存转移");
modelMap.put(NormalExcelConstants.CLASS,WmToMoveGoodsEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("库存转移列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
public String exportXlsByT(WmToMoveGoodsEntity wmToMoveGoods, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid, ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME, "库存转移");
modelMap.put(NormalExcelConstants.CLASS, WmToMoveGoodsEntity.class);
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("库存转移列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
@ -417,15 +411,15 @@ public class WmToMoveGoodsController extends BaseController {
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<WmToMoveGoodsEntity> listWmToMoveGoodsEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WmToMoveGoodsEntity.class,params);
List<WmToMoveGoodsEntity> listWmToMoveGoodsEntitys = ExcelImportUtil.importExcel(file.getInputStream(), WmToMoveGoodsEntity.class, params);
for (WmToMoveGoodsEntity wmToMoveGoods : listWmToMoveGoodsEntitys) {
if(StringUtil.isNotEmpty(wmToMoveGoods.getOrderIdI())){
try{
WmToMoveGoodsEntity t = systemService.findByProperty(WmToMoveGoodsEntity.class,"orderIdI",wmToMoveGoods.getOrderIdI()).get(0);
if(t!=null){
if (StringUtil.isNotEmpty(wmToMoveGoods.getOrderIdI())) {
try {
WmToMoveGoodsEntity t = systemService.findByProperty(WmToMoveGoodsEntity.class, "orderIdI", wmToMoveGoods.getOrderIdI()).get(0);
if (t != null) {
continue;
}
}catch (Exception e){
} catch (Exception e) {
}
}
@ -436,7 +430,7 @@ public class WmToMoveGoodsController extends BaseController {
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
@ -449,44 +443,44 @@ public class WmToMoveGoodsController extends BaseController {
@RequestMapping(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) {
public ResponseEntity<?> list(@RequestParam(value = "username", required = false) String username,
@RequestParam(value = "searchstr", required = false) String searchstr,
@RequestParam(value = "searchstr2", required = false) String searchstr2) {
// return listWvGis;
ResultDO D0 = new ResultDO();
String hql = " from WmToMoveGoodsEntity where 1 = 1 and moveSta = '计划中' ";
D0.setOK(true);
if(!StringUtil.isEmpty(searchstr)) {
hql=hql+" and binFrom like '%" + searchstr + "%'";
if (!StringUtil.isEmpty(searchstr)) {
hql = hql + " and binFrom like '%" + searchstr + "%'";
}
if(!StringUtil.isEmpty(searchstr2)) {
try{
if (!StringUtil.isEmpty(searchstr2)) {
try {
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
if(StringUtil.isNotEmpty(shpbianma)){
searchstr2=shpbianma;
if (StringUtil.isNotEmpty(shpbianma)) {
searchstr2 = shpbianma;
}
}catch (Exception e){
} catch (Exception e) {
}
hql=hql+" and goodsId like '%" + searchstr2 + "%'";
hql = hql + " and goodsId like '%" + searchstr2 + "%'";
}
List<WmToMoveGoodsEntity> listWmToMoveGoodss=wmToMoveGoodsService.findHql(hql);
List<WmToMoveGoodsEntity> listWmToMoveGoodss = wmToMoveGoodsService.findHql(hql);
List<WmToMoveGoodsEntity> result = new ArrayList<WmToMoveGoodsEntity>();
int i = 0;
for (WmToMoveGoodsEntity t :listWmToMoveGoodss){
for (WmToMoveGoodsEntity t : listWmToMoveGoodss) {
i++;
if(i>100){
if (i > 100) {
break;
}
result.add(t);
}
if(result.size()<=0){
if (result.size() <= 0) {
D0.setOK(false);
}
D0.setObj(result);
@ -513,7 +507,7 @@ public class WmToMoveGoodsController extends BaseController {
}
//保存
try{
try {
wmToMoveGoodsService.save(wmToMoveGoods);
} catch (Exception e) {
e.printStackTrace();
@ -534,17 +528,17 @@ public class WmToMoveGoodsController extends BaseController {
UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
ResultDO D0 = new ResultDO();
WmToMoveGoodsEntity wmToMoveGoods = (WmToMoveGoodsEntity)JSONHelper.json2Object(wmToMoveGoodsstr,WmToMoveGoodsEntity.class);
WmToMoveGoodsEntity wmToMoveGoods = (WmToMoveGoodsEntity) JSONHelper.json2Object(wmToMoveGoodsstr, WmToMoveGoodsEntity.class);
//保存
try{
WmToMoveGoodsEntity t = systemService.get(WmToMoveGoodsEntity.class,wmToMoveGoods.getId());
MyBeanUtils.copyBeanNotNull2Bean(wmToMoveGoods,t);
try{
if(StringUtil.isNotEmpty(wmToMoveGoods.getUpdateBy())){
TSUser tsuser = systemService.findUniqueByProperty(TSUser.class,"",wmToMoveGoods.getUpdateBy());
try {
WmToMoveGoodsEntity t = systemService.get(WmToMoveGoodsEntity.class, wmToMoveGoods.getId());
MyBeanUtils.copyBeanNotNull2Bean(wmToMoveGoods, t);
try {
if (StringUtil.isNotEmpty(wmToMoveGoods.getUpdateBy())) {
TSUser tsuser = systemService.findUniqueByProperty(TSUser.class, "", wmToMoveGoods.getUpdateBy());
t.setUpdateName(tsuser.getRealName());
}
}catch (Exception e){
} catch (Exception e) {
}
t.setUpdateDate(now());
@ -554,10 +548,10 @@ public class WmToMoveGoodsController extends BaseController {
// }else{
String movesta = "已完成";
try{
try {
movesta = ResourceUtil.getConfigByName("wm.movesta");
}catch (Exception e){
} catch (Exception e) {
}
t.setMoveSta(movesta);