OrdersFixAssetController.java 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831
  1. package cn.com.lzt.ordersfixasset.controller;
  2. import cn.com.lzt.arrangeduty.dao.UserOrgMinidao;
  3. import cn.com.lzt.arrangeduty.dto.UserOrgDto;
  4. import cn.com.lzt.common.controller.BaseLztController;
  5. import cn.com.lzt.common.util.DictUtil;
  6. import cn.com.lzt.common.util.LztUtil;
  7. import cn.com.lzt.common.util.UserUtil;
  8. import cn.com.lzt.common.view.JsonDataModelAndView;
  9. import cn.com.lzt.goodscategory.entity.TBGoodsCategoryEntity;
  10. import cn.com.lzt.goodsinfo.entity.TBGoodsInfoEntity;
  11. import cn.com.lzt.logistics.entity.TBLogisticsEntity;
  12. import cn.com.lzt.orders.entity.OrderMonthsEntity;
  13. import cn.com.lzt.orders.entity.OrdersFlowDto;
  14. import cn.com.lzt.ordersfixasset.dao.OrdersFixAssetDao;
  15. import cn.com.lzt.ordersfixasset.entity.OrderFixAssetProductsEntity;
  16. import cn.com.lzt.ordersfixasset.entity.OrdersFixAssetEntity;
  17. import cn.com.lzt.ordersfixasset.page.OrdersFixAssetPage;
  18. import cn.com.lzt.ordersfixasset.service.OrdersFixAssetServiceI;
  19. import cn.com.lzt.priceinfo.entity.TBPriceInfoEntity;
  20. import cn.com.lzt.relatedunits.entity.RelatedUnitsEntity;
  21. import cn.com.lzt.relatedunits.service.RelatedUnitsServiceI;
  22. import cn.com.lzt.tools.OrderNumTools;
  23. import cn.com.lzt.tools.SCMConsole;
  24. import cn.com.lzt.useractiviti.data.dao.UseractivitiDataDao;
  25. import cn.com.lzt.useractiviti.data.util.ActivitiPdfExport;
  26. import cn.com.lzt.useractiviti.data.util.ActivitiTools;
  27. import cn.com.lzt.warehouse.entity.WarehouseEntity;
  28. import com.lowagie.text.pdf.PdfPTable;
  29. import com.jeecg.qianbao.util.FormProcUtil;
  30. import com.xcgl.utils.XcglDateUtils;
  31. import com.xcgl.weixin.entity.WXAjaxJson;
  32. import com.xcgl.weixin.service.WXServiceI;
  33. import org.activiti.engine.HistoryService;
  34. import org.activiti.engine.RepositoryService;
  35. import org.activiti.engine.RuntimeService;
  36. import org.activiti.engine.TaskService;
  37. import org.activiti.engine.impl.RepositoryServiceImpl;
  38. import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
  39. import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
  40. import org.activiti.engine.impl.pvm.PvmTransition;
  41. import org.activiti.engine.impl.pvm.process.ActivityImpl;
  42. import org.activiti.engine.task.Task;
  43. import org.apache.commons.lang.CommonRandomUtil;
  44. import org.apache.commons.lang.xwork.StringUtils;
  45. import org.apache.log4j.Logger;
  46. import org.jeecgframework.core.beanvalidator.BeanValidators;
  47. import org.jeecgframework.core.common.dao.ICommonDao;
  48. import org.jeecgframework.core.common.exception.BusinessException;
  49. import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
  50. import org.jeecgframework.core.common.model.json.AjaxJson;
  51. import org.jeecgframework.core.common.model.json.DataGrid;
  52. import org.jeecgframework.core.constant.Globals;
  53. import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
  54. import org.jeecgframework.core.util.*;
  55. import org.jeecgframework.poi.excel.ExcelImportUtil;
  56. import org.jeecgframework.poi.excel.entity.ExportParams;
  57. import org.jeecgframework.poi.excel.entity.ImportParams;
  58. import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
  59. import org.jeecgframework.tag.core.easyui.TagUtil;
  60. import org.jeecgframework.tag.vo.datatable.SortDirection;
  61. import org.jeecgframework.web.system.dao.JeecgDictDao;
  62. import org.jeecgframework.web.system.pojo.base.DictEntity;
  63. import org.jeecgframework.web.system.pojo.base.TSBaseUser;
  64. import org.jeecgframework.web.system.pojo.base.TSDepart;
  65. import org.jeecgframework.web.system.pojo.base.TSUser;
  66. import org.jeecgframework.web.system.service.SystemService;
  67. import org.jeecgframework.web.system.service.UserService;
  68. import org.jeecgframework.workflow.common.WorkFlowGlobals;
  69. import org.jeecgframework.workflow.dto.DealOptionDto;
  70. import org.jeecgframework.workflow.model.activiti.ProcessHandle;
  71. import org.jeecgframework.workflow.model.activiti.Variable;
  72. import org.jeecgframework.workflow.pojo.activiti.ActRuTask;
  73. import org.jeecgframework.workflow.pojo.activiti.ActRuVariable;
  74. import org.jeecgframework.workflow.pojo.base.TPBpmLog;
  75. import org.jeecgframework.workflow.pojo.base.TSBaseBusQuery;
  76. import org.jeecgframework.workflow.service.ActivitiService;
  77. import org.jeecgframework.workflow.service.impl.TaskJeecgService;
  78. import org.jeecgframework.workflow.user.entity.TPTaskCcEntity;
  79. import org.springframework.beans.factory.annotation.Autowired;
  80. import org.springframework.http.HttpHeaders;
  81. import org.springframework.http.HttpStatus;
  82. import org.springframework.http.MediaType;
  83. import org.springframework.http.ResponseEntity;
  84. import org.springframework.stereotype.Controller;
  85. import org.springframework.ui.ModelMap;
  86. import org.springframework.web.bind.annotation.*;
  87. import org.springframework.web.multipart.MultipartFile;
  88. import org.springframework.web.multipart.MultipartHttpServletRequest;
  89. import org.springframework.web.servlet.ModelAndView;
  90. import org.springframework.web.util.UriComponentsBuilder;
  91. import javax.servlet.http.HttpServletRequest;
  92. import javax.servlet.http.HttpServletResponse;
  93. import javax.servlet.http.HttpSession;
  94. import javax.validation.ConstraintViolation;
  95. import javax.validation.Validator;
  96. import java.io.IOException;
  97. import java.math.BigDecimal;
  98. import java.net.URI;
  99. import java.text.DateFormat;
  100. import java.text.SimpleDateFormat;
  101. import java.util.*;
  102. //import cn.com.lzt.weixin.service.WXServiceI;
  103. /**
  104. * @Title: Controller
  105. * @Description: 订单表
  106. * @author onlineGenerator
  107. * @date 2017-06-07 17:15:24
  108. * @version V1.0
  109. *
  110. */
  111. @Controller
  112. @RequestMapping("/ordersFixAssetController")
  113. public class OrdersFixAssetController extends BaseLztController {
  114. /**
  115. * Logger for this class
  116. */
  117. private static final Logger logger = Logger.getLogger(OrdersFixAssetController.class);
  118. @Autowired
  119. private OrdersFixAssetServiceI ordersFixAssetService;
  120. @Autowired
  121. private SystemService systemService;
  122. @Autowired
  123. private Validator validator;
  124. @Autowired
  125. public ICommonDao commonDao = null;
  126. // @Autowired
  127. // private PaymentMiddleServiceI paymentMiddleService;
  128. @Autowired
  129. private RelatedUnitsServiceI relatedUnitsService;
  130. // @Autowired
  131. // private CollectMiddleServiceI collectMiddleService;
  132. @Autowired
  133. private OrdersFixAssetDao ordersFixAssetDao;
  134. @Autowired
  135. private JeecgDictDao jeecgDictDao;
  136. @Autowired
  137. private UserOrgMinidao userOrgdao;
  138. @Autowired
  139. private ActivitiService activitiService;
  140. @Autowired
  141. private TaskJeecgService taskJeecgService;
  142. @Autowired
  143. private TaskService taskService;
  144. @Autowired
  145. private RuntimeService runtimeService;
  146. @Autowired
  147. protected HistoryService historyService;
  148. @Autowired
  149. protected RepositoryService repositoryService;
  150. @Autowired
  151. protected WXServiceI wxservice;
  152. @Autowired
  153. protected UseractivitiDataDao useractivitiDataDao;
  154. @Autowired
  155. protected UserService userService;
  156. /**
  157. * 订单表列表 页面跳转
  158. *
  159. * @return
  160. */
  161. @RequestMapping(params = "list")
  162. public ModelAndView list(HttpServletRequest request) {
  163. return new ModelAndView("cn/com/lzt/orders/ordersList");
  164. }
  165. /**
  166. * 订单表列表 页面跳转
  167. *
  168. * @return
  169. */
  170. @RequestMapping(params = "listByWarehouse")
  171. public ModelAndView listByWarehouse(HttpServletRequest request) {
  172. // 当前登录用户ID
  173. TSUser tsuser = ResourceUtil.getSessionUser();
  174. String userid = tsuser.getId();
  175. String orderFor = request.getParameter("orderFor");
  176. boolean isProjectUser = UserUtil.isProjectUser(userid);
  177. request.setAttribute("isProjectUser", isProjectUser);
  178. if(isProjectUser) {
  179. String hql1 = "from WarehouseEntity where responsiblePerson=? and deleteFlag=0";
  180. List<WarehouseEntity> warehouseList = systemService.findHql(hql1, userid);
  181. request.setAttribute("userid", userid);
  182. if (warehouseList.size() > 1)
  183. request.setAttribute("isMultiWarehouse", "1");
  184. else if(warehouseList.size()==1){
  185. request.setAttribute("isMultiWarehouse", "0");
  186. request.setAttribute("warehouseid", warehouseList.get(0).getId());
  187. }else {
  188. request.setAttribute("isMultiWarehouse", "0");
  189. }
  190. }
  191. String role = userService.getUserRole(tsuser);
  192. request.setAttribute("fjl",StringUtils.contains(role, Globals.POSITION_TYPE_XZBFJL));
  193. request.setAttribute("createByUserName",tsuser.getUserName());
  194. ModelAndView mv = new ModelAndView("cn/com/lzt/ordersfixasset/ordersListByWarehouse");
  195. if(StringUtils.isNotEmpty(orderFor) && orderFor.equals("1")) {
  196. //自行申购签报
  197. mv = new ModelAndView("cn/com/lzt/ordersfixasset/ordersListByWarehouse-own");
  198. request.setAttribute("orderFor", orderFor);
  199. }else {
  200. //固定物料申购(办公室)
  201. request.setAttribute("orderFor", "0");
  202. }
  203. return mv;
  204. }
  205. /**
  206. * 请购单审批页面
  207. *
  208. * @return
  209. */
  210. @RequestMapping(params = "ordersList_task")
  211. public ModelAndView list_orderstask(HttpServletRequest request) {
  212. return new ModelAndView("cn/com/lzt/ordersfixasset/ordersList_task");
  213. }
  214. /**
  215. * 请购单审批页面加载
  216. *
  217. * @return
  218. */
  219. @RequestMapping(params = "datagrid_orderstask")
  220. public void datagrid_orderstask(OrdersFixAssetEntity orders,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
  221. CriteriaQuery cq = new CriteriaQuery(OrdersFixAssetEntity.class, dataGrid);
  222. String orderDateBegin = request.getParameter("orderDate_begin");
  223. String orderDateEnd = request.getParameter("orderDate_end");
  224. String orderOnumber = orders.getOrderOnumber();
  225. if(StringUtils.isNotBlank(orderOnumber)){
  226. orders.setOrderOnumber("*" +orderOnumber +"*");
  227. }
  228. cq.addOrder("createDate", SortDirection.desc);
  229. //查询条件组装器
  230. HqlGenerateUtil.installHql(cq, orders);
  231. try{
  232. //自定义追加查询条件
  233. if(StringUtils.isNotBlank(orderDateBegin) && StringUtils.isNotBlank(orderDateEnd)){
  234. cq.ge("createDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(orderDateBegin + " 00:00:00"));
  235. cq.le("createDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(orderDateEnd + " 23:59:59"));
  236. }
  237. }catch (Exception e) {
  238. throw new BusinessException(e.getMessage());
  239. }
  240. cq.notEq("bpmStatus", "1");
  241. cq.add();
  242. List<OrdersFixAssetEntity> list = ordersFixAssetService.getListByCriteriaQuery(cq, false);
  243. if(list == null || list.size()==0) {
  244. return;
  245. }
  246. List<OrdersFixAssetEntity> result = new ArrayList<OrdersFixAssetEntity>();
  247. HashMap<String, OrdersFixAssetEntity> hm_id2obj = new HashMap<>();
  248. for(OrdersFixAssetEntity oe : list) {
  249. hm_id2obj.put(oe.getId(), oe);
  250. }
  251. TSUser user = ResourceUtil.getSessionUser();
  252. List taskList = this.activitiService.findPriTodoTasks(user.getUserName(), request);
  253. for(int i=0 ; i<taskList.size() ; i++) {
  254. TSBaseBusQuery busobj = (TSBaseBusQuery)taskList.get(i);
  255. String id = activitiService.getBusinessKeyByTask(busobj.getProcess().getTask().getId());
  256. OrdersFixAssetEntity order = hm_id2obj.get(id);
  257. if(order != null) {
  258. result.add(order);
  259. order.setProcessObject(busobj);
  260. }
  261. }
  262. dataGrid.setResults(result);
  263. dataGrid.setFooter("totalMoney,baojieSum,gongchengSum,bangongSum");
  264. TagUtil.datagrid(response, dataGrid);
  265. }
  266. @RequestMapping(params = {"popDealOption"})
  267. public ModelAndView popDealOption(DealOptionDto dto, HttpServletRequest request) {
  268. request.setAttribute("dealParam", dto);
  269. return new ModelAndView("cn/com/lzt/ordersfixasset/dealOrderFlowWriteOption");
  270. }
  271. public Task getTask(String taskId) {
  272. return (Task)this.taskService.createTaskQuery().taskId(taskId).singleResult();
  273. }
  274. /**
  275. * 获取任务下一步节点的id
  276. * @param taskId
  277. * @param transName 通过或者驳回
  278. * @return
  279. */
  280. private String getTaskNextNodeId(String taskId, String transName) {
  281. List outTransitions = null;
  282. ArrayList trans = new ArrayList();
  283. Task task = this.getTask(taskId);
  284. ProcessDefinitionEntity def = (ProcessDefinitionEntity)((RepositoryServiceImpl)this.repositoryService).getDeployedProcessDefinition(task.getProcessDefinitionId());
  285. List activitiList = def.getActivities();
  286. String excId = task.getExecutionId();
  287. ExecutionEntity execution = (ExecutionEntity)this.runtimeService.createExecutionQuery().executionId(excId).singleResult();
  288. String activitiId = execution.getActivityId();
  289. Iterator arg10 = activitiList.iterator();
  290. while(arg10.hasNext()) {
  291. ActivityImpl activityImpl = (ActivityImpl)arg10.next();
  292. String id = activityImpl.getId();
  293. if(activitiId.equals(id)) {
  294. outTransitions = activityImpl.getOutgoingTransitions();
  295. Iterator arg13 = outTransitions.iterator();
  296. while(arg13.hasNext()) {
  297. PvmTransition tr = (PvmTransition)arg13.next();
  298. if(tr.getId() != null) {
  299. String name = (String)(oConvertUtils.isNotEmpty(tr.getProperty("name"))?tr.getProperty("name"):tr.getId());
  300. if(transName.equals(name)) {
  301. return tr.getDestination().getId();
  302. }
  303. }
  304. }
  305. return null;
  306. }
  307. }
  308. return null;
  309. }
  310. private List<OrdersFlowDto> getWorkflowParam(HttpServletRequest request){
  311. List<OrdersFlowDto> result = new ArrayList<>();
  312. String taskIdsInReq = oConvertUtils.getString(request.getParameter("taskId"));
  313. String dealOption = oConvertUtils.getString(request.getParameter("dealOption"));
  314. String transName = oConvertUtils.getString(request.getParameter("nextNodeName"));
  315. if("agree".equals(transName)) {
  316. transName = "通过";
  317. }else {
  318. transName = "驳回";
  319. }
  320. if(StringUtils.isEmpty(taskIdsInReq)) {
  321. return result;
  322. }
  323. String[] taskids = taskIdsInReq.split(",");
  324. for(int i=0 ; i<taskids.length ; i++) {
  325. String nextNode = getTaskNextNodeId(taskids[i],transName);
  326. OrdersFlowDto dto = new OrdersFlowDto();
  327. dto.setDealOption(dealOption);
  328. dto.setModel("1");
  329. dto.setNextnode(nextNode);
  330. dto.setTaskId(taskids[i]);
  331. dto.setOperateType(transName);
  332. result.add(dto);
  333. }
  334. return result;
  335. }
  336. /**
  337. * 批量审批
  338. * @param request
  339. * @param var
  340. * @return
  341. * @throws Exception
  342. */
  343. @RequestMapping(params = {"processComplete"})
  344. @ResponseBody
  345. public AjaxJson processComplete(HttpServletRequest request, Variable var) throws Exception {
  346. List<OrdersFlowDto> dtos = getWorkflowParam(request);
  347. AjaxJson j = new AjaxJson();
  348. String nextUser = oConvertUtils.getString(request.getParameter("id"));
  349. try {
  350. for(OrdersFlowDto dto : dtos) {
  351. ProcessHandle processHandle = this.activitiService.getProcessHandle(dto.getTaskId());
  352. if(oConvertUtils.isEmpty(processHandle)) {
  353. j.setSuccess(false);
  354. j.setMsg(MutiLangUtil.getMutiLangInstance().getLang("process.task.notexist"));
  355. return j;
  356. } else {
  357. Map map = var.getVariableMap(processHandle.getTpProcesspros());
  358. Task task = this.activitiService.getTask(dto.getTaskId());
  359. String processInstanceId = task.getProcessInstanceId();
  360. String ccUserNames="";
  361. if("1".equals(dto.getModel())) {
  362. if("end".equals(dto.getNextnode())) {
  363. this.taskJeecgService.goProcessTaskNode(dto.getTaskId(), dto.getNextnode(), map);
  364. } else {
  365. this.taskJeecgService.goProcessTaskNode(dto.getTaskId(), dto.getNextnode(), map);
  366. ccUserNames = this.taskJeecgService.getTaskIdByProins(processInstanceId, dto.getNextnode());
  367. }
  368. }
  369. //ccUserNames = oConvertUtils.getString(request.getParameter("ccUserNames"));
  370. this.taskCc(ccUserNames, task);
  371. TPBpmLog arg30 = new TPBpmLog();
  372. TSUser arg31 = ResourceUtil.getSessionUser();
  373. arg30.setBpm_id(task.getProcessInstanceId());
  374. arg30.setTask_name(processHandle.getTpProcess().getProcessname());
  375. arg30.setTask_node(processHandle.getTpProcessnode().getProcessnodename());
  376. arg30.setOp_code(arg31.getUserKey());
  377. arg30.setOp_name(arg31.getRealName());
  378. arg30.setOp_time(DataUtils.gettimestamp());
  379. // arg30.setLinename(nextNodeName);
  380. arg30.setTaskId(dto.getTaskId());
  381. arg30.setMemo(dto.getDealOption());
  382. String tableName = null;
  383. String busId = null;
  384. boolean hastep_name = false;
  385. String curttentstep = null;
  386. List actRuVariables = this.systemService.findByProperty(ActRuVariable.class, "actRuExecutionByProcInstId.id", processInstanceId);
  387. for(int list = 0; list < actRuVariables.size(); ++list) {
  388. ActRuVariable item = (ActRuVariable)actRuVariables.get(list);
  389. if(WorkFlowGlobals.BPM_FORM_KEY.equals(item.getName())) {
  390. tableName = item.getText();
  391. }
  392. if(WorkFlowGlobals.BPM_DATA_ID.equals(item.getName())) {
  393. busId = item.getText();
  394. }
  395. if("step_name".equals(item.getName())) {
  396. hastep_name = true;
  397. }
  398. }
  399. List arg32 = this.systemService.findByProperty(ActRuTask.class, "actRuExecutionByProcInstId.id", processInstanceId);
  400. if(oConvertUtils.isNotEmpty(arg32) && arg32.size() > 0) {
  401. curttentstep = ((ActRuTask)arg32.get(0)).getName();
  402. }
  403. if(hastep_name) {
  404. this.activitiService.updateBusStepname(tableName, busId, curttentstep);
  405. }
  406. if("end".equals(dto.getNextnode())) {
  407. this.activitiService.updateBusStepname(tableName, busId, MutiLangUtil.getMutiLangInstance().getLang("process.complete"));
  408. }
  409. this.systemService.save(arg30);
  410. }
  411. }
  412. j.setMsg("审批成功!");
  413. j.setObj(dtos);
  414. } catch (BusinessException arg28) {
  415. j.setSuccess(false);
  416. j.setMsg(MutiLangUtil.getMutiLangInstance().getLang("process.do.fail") + ":" + MutiLangUtil.getMutiLangInstance().getLang("process.nextnode.unknownerror"));
  417. arg28.printStackTrace();
  418. } catch (Exception arg29) {
  419. j.setSuccess(false);
  420. j.setMsg(MutiLangUtil.getMutiLangInstance().getLang("process.do.fail") + ":" + MutiLangUtil.getMutiLangInstance().getLang("nextnode.nopersion.error"));
  421. arg29.printStackTrace();
  422. }
  423. return j;
  424. }
  425. private void taskCc(String ccUserNames, Task task) {
  426. if(!CommonRandomUtil.isEmpty(ccUserNames)) {
  427. TSUser user = ResourceUtil.getSessionUser();
  428. String[] ccUserNameArr = ccUserNames.split(",");
  429. TPTaskCcEntity taskCcEntity = null;
  430. String[] arg8 = ccUserNameArr;
  431. int arg7 = ccUserNameArr.length;
  432. for(int arg6 = 0; arg6 < arg7; ++arg6) {
  433. String ccUserName = arg8[arg6];
  434. taskCcEntity = new TPTaskCcEntity();
  435. taskCcEntity.setProcDefId(task.getProcessDefinitionId());
  436. taskCcEntity.setProcInstId(task.getProcessInstanceId());
  437. taskCcEntity.setExecutionId(task.getExecutionId());
  438. taskCcEntity.setTaskDefKey(task.getTaskDefinitionKey());
  439. taskCcEntity.setTaskId(task.getId());
  440. taskCcEntity.setTaskName(task.getName());
  441. taskCcEntity.setFromUserName(user.getUserName());
  442. taskCcEntity.setCcUserName(ccUserName);
  443. this.systemService.save(taskCcEntity);
  444. }
  445. }
  446. }
  447. /**
  448. * easyui AJAX请求数据
  449. *
  450. * @param request
  451. * @param response
  452. * @param dataGrid
  453. */
  454. @RequestMapping(params = "datagrid")
  455. public void datagrid(OrdersFixAssetEntity orders,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
  456. CriteriaQuery cq = new CriteriaQuery(OrdersFixAssetEntity.class, dataGrid);
  457. String orderDateBegin = request.getParameter("orderDate_begin");
  458. String orderDateEnd = request.getParameter("orderDate_end");
  459. String orderOnumber = orders.getOrderOnumber();
  460. if(StringUtils.isNotBlank(orderOnumber)){
  461. orders.setOrderOnumber("*" +orderOnumber +"*");
  462. }
  463. String warehouseName = orders.getWarehouseName();
  464. if(StringUtils.isNotBlank(warehouseName)){
  465. orders.setWarehouseName("*" +warehouseName +"*");
  466. }
  467. cq.addOrder("createDate", SortDirection.desc);
  468. //查询条件组装器
  469. HqlGenerateUtil.installHql(cq, orders);
  470. try{
  471. //自定义追加查询条件
  472. if(StringUtils.isNotBlank(orderDateBegin) && StringUtils.isNotBlank(orderDateEnd)){
  473. cq.ge("createDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(orderDateBegin + " 00:00:00"));
  474. cq.le("createDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(orderDateEnd + " 23:59:59"));
  475. }
  476. }catch (Exception e) {
  477. throw new BusinessException(e.getMessage());
  478. }
  479. cq.notEq("bpmStatus", "1");
  480. cq.add();
  481. List<OrdersFixAssetEntity> list = ordersFixAssetService.getListByCriteriaQuery(cq, false);
  482. dataGrid.setResults(list);
  483. // this.ordersFixAssetService.getDataGridReturn(cq, false);
  484. dataGrid.setFooter("totalMoney,baojieSum,gongchengSum,bangongSum");
  485. TagUtil.datagrid(response, dataGrid);
  486. }
  487. /**
  488. * easyui AJAX请求数据
  489. *
  490. * @param request
  491. * @param response
  492. * @param dataGrid
  493. */
  494. @RequestMapping(params = "datagridByWarehouse")
  495. public void datagridByWarehouse(OrdersFixAssetEntity orders,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
  496. CriteriaQuery cq = new CriteriaQuery(OrdersFixAssetEntity.class, dataGrid);
  497. String orderDateBegin = request.getParameter("orderDate_begin");
  498. String orderDateEnd = request.getParameter("orderDate_end");
  499. String orderOnumber = orders.getOrderOnumber();
  500. if(StringUtils.isNotBlank(orderOnumber)){
  501. orders.setOrderOnumber("*" +orderOnumber +"*");
  502. }
  503. cq.addOrder("createDate", SortDirection.desc);
  504. TSUser user = ResourceUtil.getSessionUser();
  505. String role = userService.getUserRole(user);
  506. if(!StringUtils.contains(role, Globals.POSITION_TYPE_XZBFJL)){
  507. orders.setCreateBy(user.getUserName());
  508. }
  509. //查询条件组装器
  510. HqlGenerateUtil.installHql(cq, orders);
  511. try{
  512. //自定义追加查询条件
  513. if(StringUtils.isNotBlank(orderDateBegin) && StringUtils.isNotBlank(orderDateEnd)){
  514. cq.ge("createDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(orderDateBegin + " 00:00:00"));
  515. cq.le("createDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(orderDateEnd + " 23:59:59"));
  516. }
  517. }catch (Exception e) {
  518. throw new BusinessException(e.getMessage());
  519. }
  520. cq.add();
  521. ordersFixAssetService.getDataGridReturn(cq, true);
  522. TagUtil.datagrid(response, dataGrid);
  523. }
  524. protected List<String> getUserWarehouse(){
  525. TSUser tuser = ResourceUtil.getSessionUser();
  526. UserOrgDto userOrgDto = new UserOrgDto();
  527. userOrgDto.setUserId(tuser.getId());
  528. List<UserOrgDto> dtos = userOrgdao.getUserOrgDtoByUserId(userOrgDto , null);
  529. StringBuffer sb = new StringBuffer();
  530. String sql = "select id from t_b_warehouse where responsible_person = '"+tuser.getId()+"'";
  531. if(dtos != null && dtos.size()>0) {
  532. for(int i=0 ; i<dtos.size() ; i++) {
  533. if(i>0) {
  534. sb.append(",");
  535. }
  536. sb.append("'");
  537. sb.append(dtos.get(i).getOrgId());
  538. sb.append("'");
  539. }
  540. sql += " or project_id in("+sb.toString()+")";
  541. }
  542. List<String> tsDList = systemService.findListbySql(sql);
  543. boolean isProjectUser = UserUtil.isProjectUser(tuser.getId());
  544. if(!isProjectUser) {//职能部门能看见总仓
  545. tsDList.add("ff808081665bfece0166a8ebaa7f2738");
  546. }
  547. return tsDList;
  548. }
  549. /**
  550. * 删除订单表
  551. *
  552. * @return
  553. */
  554. @RequestMapping(params = "doDel")
  555. @ResponseBody
  556. public AjaxJson doDel(OrdersFixAssetEntity orders, HttpServletRequest request) {
  557. AjaxJson j = new AjaxJson();
  558. orders = systemService.getEntity(OrdersFixAssetEntity.class, orders.getId());
  559. String message = "订单表删除成功";
  560. try{
  561. ordersFixAssetService.delMain(orders);
  562. systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
  563. }catch(Exception e){
  564. e.printStackTrace();
  565. message = "订单表删除失败";
  566. throw new BusinessException(e.getMessage());
  567. }
  568. j.setMsg(message);
  569. return j;
  570. }
  571. /**
  572. * 批量删除订单表
  573. *
  574. * @return
  575. */
  576. @RequestMapping(params = "doBatchDel")
  577. @ResponseBody
  578. public AjaxJson doBatchDel(String ids,HttpServletRequest request){
  579. AjaxJson j = new AjaxJson();
  580. String message = "订单表删除成功";
  581. try{
  582. for(String id:ids.split(",")){
  583. OrdersFixAssetEntity orders = systemService.getEntity(OrdersFixAssetEntity.class,
  584. id
  585. );
  586. ordersFixAssetService.delMain(orders);
  587. systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
  588. }
  589. }catch(Exception e){
  590. e.printStackTrace();
  591. message = "订单表删除失败";
  592. throw new BusinessException(e.getMessage());
  593. }
  594. j.setMsg(message);
  595. return j;
  596. }
  597. /**
  598. * 添加订单表
  599. *
  600. * @return
  601. */
  602. @RequestMapping(params = "doAdd")
  603. @ResponseBody
  604. public AjaxJson doAdd(OrdersFixAssetEntity orders,OrdersFixAssetPage ordersPage, HttpServletRequest request) {
  605. if(StringUtils.isNotBlank(orders.getId())){
  606. return doUpdate(orders,ordersPage,request);
  607. }
  608. List<OrderFixAssetProductsEntity> orderProductsList = ordersPage.getOrderProductsList();
  609. AjaxJson j = new AjaxJson();
  610. String message = "添加成功";
  611. try{
  612. String warehouseid = orders.getWarehouseId();
  613. HttpSession session = ContextHolderUtils.getSession();
  614. TSUser tuser = (TSUser)session.getAttribute("LOCAL_CLINET_USER");
  615. WarehouseEntity wh = systemService.get(WarehouseEntity.class, warehouseid);
  616. orders.setWarehouseName(wh.getWarehouseName());
  617. orders.setHandlerPersonId(tuser.getId());
  618. orders.setHandlerPersonName(tuser.getRealName());
  619. orders.setOrderOnumber(OrderNumTools.generate18OrderNum());// 采购单好
  620. orders.setOrderStatus(Globals.UNAPPROVED);// 未审批状态
  621. ordersFixAssetService.addMain(orders, orderProductsList);
  622. systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
  623. }catch(Exception e){
  624. e.printStackTrace();
  625. message = "订单表添加失败";
  626. throw new BusinessException(e.getMessage());
  627. }
  628. j.setMsg(message);
  629. return j;
  630. }
  631. /**
  632. * 更新订单表
  633. *
  634. * @return
  635. */
  636. @RequestMapping(params = "doUpdate")
  637. @ResponseBody
  638. public AjaxJson doUpdate(OrdersFixAssetEntity orders, OrdersFixAssetPage ordersPage, HttpServletRequest request) {
  639. List<OrderFixAssetProductsEntity> orderProductsList = ordersPage.getOrderProductsList();
  640. AjaxJson j = new AjaxJson();
  641. String message = "更新成功";
  642. try{
  643. String warehouseid = orders.getWarehouseId();
  644. HttpSession session = ContextHolderUtils.getSession();
  645. TSUser tuser = (TSUser)session.getAttribute("LOCAL_CLINET_USER");
  646. WarehouseEntity wh = systemService.get(WarehouseEntity.class, warehouseid);
  647. orders.setWarehouseName(wh.getWarehouseName());
  648. orders.setHandlerPersonId(tuser.getId());
  649. orders.setHandlerPersonName(tuser.getRealName());
  650. ordersFixAssetService.updateMain(orders, orderProductsList);
  651. systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
  652. }catch(Exception e){
  653. e.printStackTrace();
  654. message = "更新订单表失败";
  655. throw new BusinessException(e.getMessage());
  656. }
  657. j.setMsg(message);
  658. return j;
  659. }
  660. /**
  661. * 订单表新增页面跳转
  662. *
  663. * @return
  664. */
  665. @RequestMapping(params = "goAdd")
  666. public ModelAndView goAdd(OrdersFixAssetEntity orders, HttpServletRequest req) {
  667. HttpSession session = ContextHolderUtils.getSession();
  668. TSUser tuser = (TSUser)session.getAttribute("LOCAL_CLINET_USER");
  669. req.setAttribute("userid", tuser.getId());
  670. if (StringUtil.isNotEmpty(orders.getId())) {
  671. orders = ordersFixAssetService.getEntity(OrdersFixAssetEntity.class, orders.getId());
  672. dealRoundHalfUpValue(orders);
  673. req.setAttribute("ordersPage", orders);
  674. }else{
  675. String wareHourseId = req.getParameter("warehouseid");
  676. String userId = tuser.getId();
  677. boolean isProjectUser = UserUtil.isProjectUser(userId);
  678. WarehouseEntity warehouseEntity =null;
  679. if(StringUtils.isNotBlank(wareHourseId)) {
  680. warehouseEntity = systemService.getEntity(WarehouseEntity.class, wareHourseId);
  681. }else {//如果没有warehouseid 判断是否职能部门
  682. if(!isProjectUser){//职能部门 默认公司本部
  683. wareHourseId = "ff808081665bfece0166a8ebaa7f2738";
  684. warehouseEntity = systemService.getEntity(WarehouseEntity.class, wareHourseId);
  685. }else{
  686. return null;
  687. }
  688. }
  689. orders.setWarehouseId(wareHourseId);
  690. orders.setWarehouseName(warehouseEntity.getWarehouseName());
  691. TSDepart userDepart ;
  692. if(isProjectUser) {
  693. String departId= warehouseEntity.getProjectId();
  694. userDepart = systemService.getEntity(TSDepart.class,departId );
  695. }else{
  696. userDepart = useractivitiDataDao.getUserDep(userId);
  697. }
  698. orders.setDepartId(userDepart.getId());
  699. orders.setDepName(userDepart.getGlcName());
  700. orders.setOrderFor(req.getParameter("orderFor"));
  701. }
  702. req.setAttribute("ordersPage", orders);
  703. ModelAndView mv = new ModelAndView("cn/com/lzt/ordersfixasset/orders-add");
  704. if(StringUtils.isNotEmpty(orders.getOrderFor()) && orders.getOrderFor().equals("1")) {
  705. mv = new ModelAndView("cn/com/lzt/ordersfixasset/orders-own-add");
  706. }
  707. return mv;
  708. }
  709. /**
  710. * 订单表编辑页面跳转
  711. *
  712. * @return
  713. */
  714. @RequestMapping(params = "goUpdateWithProcess")
  715. public ModelAndView goUpdateWithProcess(OrdersFixAssetEntity orders, HttpServletRequest req) {
  716. if(LztUtil.isApiRequest()) {
  717. return goUpdateWithProcessMobile(orders, req);
  718. }
  719. String isView = req.getParameter("viewFlag");
  720. req.setAttribute("viewFlag", isView);
  721. String taskId = oConvertUtils.getString(req.getParameter("taskId"));
  722. HttpSession session = ContextHolderUtils.getSession();
  723. TSUser tuser = (TSUser)session.getAttribute("LOCAL_CLINET_USER");
  724. req.setAttribute("userid", tuser.getId());
  725. if(oConvertUtils.isNotEmpty(taskId)){
  726. FormProcUtil.initWorkflowParam(req);
  727. req.setAttribute("taskId",taskId);
  728. }
  729. if (StringUtil.isNotEmpty(orders.getId())) {
  730. orders = ordersFixAssetService.getEntity(OrdersFixAssetEntity.class, orders.getId());
  731. dealRoundHalfUpValue(orders);
  732. req.setAttribute("ordersPage", orders);
  733. }else{
  734. List<String> tsDList = systemService.findListbySql("select id from t_b_warehouse where responsible_person = '"+tuser.getId()+"'");
  735. if(tsDList != null && tsDList.size()>0) {
  736. orders.setWarehouseId(tsDList.get(0));
  737. }
  738. req.setAttribute("ordersPage", orders);
  739. }
  740. // Date now = new Date();
  741. // Calendar begin = Calendar.getInstance();
  742. // begin.setTime(now);
  743. // begin.add(Calendar.MONTH, -2);
  744. //
  745. // Calendar end = Calendar.getInstance();
  746. // end.setTime(now);
  747. // end.add(Calendar.MONTH, 2);
  748. //
  749. // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  750. //
  751. // req.setAttribute("ref_date_begin", sdf.format(begin.getTime()));
  752. // req.setAttribute("ref_date_end", sdf.format(end.getTime()));
  753. //
  754. // Calendar defaultdate = Calendar.getInstance();
  755. // defaultdate.setTime(now);
  756. // int month = defaultdate.get(Calendar.MONTH);
  757. // if(month%2 == 0) {
  758. // //单月
  759. // month += 1;
  760. // }
  761. // defaultdate.set(Calendar.MONTH, month);
  762. // defaultdate.set(Calendar.DATE, 1);
  763. // List<String> ome = systemService.findListbySql("select id from t_b_ordermonths where ref_date='"+sdf.format(defaultdate.getTime())+"'");
  764. // if(ome != null && ome.size()>0) {
  765. // orders.setOrderMonths(ome.get(0));
  766. // }
  767. return new ModelAndView("cn/com/lzt/ordersfixasset/orders-proc-update");
  768. }
  769. @RequestMapping(params = "goUpdateWithProcessMobile")
  770. public ModelAndView goUpdateWithProcessMobile(OrdersFixAssetEntity orders, HttpServletRequest req) {
  771. String isView = req.getParameter("viewFlag");
  772. req.setAttribute("viewFlag", isView);
  773. String taskId = oConvertUtils.getString(req.getParameter("taskId"));
  774. HttpSession session = ContextHolderUtils.getSession();
  775. TSUser tuser = (TSUser)session.getAttribute("LOCAL_CLINET_USER");
  776. req.setAttribute("userid", tuser.getId());
  777. if(oConvertUtils.isNotEmpty(taskId)){
  778. FormProcUtil.initWorkflowParam(req);
  779. req.setAttribute("taskId",taskId);
  780. }
  781. if (StringUtil.isNotEmpty(orders.getId())) {
  782. orders = ordersFixAssetService.getEntity(OrdersFixAssetEntity.class, orders.getId());
  783. dealRoundHalfUpValue(orders);
  784. req.setAttribute("entity", orders);
  785. }else{
  786. List<String> tsDList = systemService.findListbySql("select id from t_b_warehouse where responsible_person = '"+tuser.getId()+"'");
  787. if(tsDList != null && tsDList.size()>0) {
  788. orders.setWarehouseId(tsDList.get(0));
  789. }
  790. req.setAttribute("entity", orders);
  791. }
  792. Map<String, Object> data = LztUtil.copyReqAttributes(new String[]{
  793. "entity","viewFlag","taskId","userid"});
  794. return new JsonDataModelAndView(WXAjaxJson.success(data));
  795. }
  796. /**
  797. * 订单表编辑页面跳转
  798. *
  799. * @return
  800. */
  801. @RequestMapping(params = "goUpdate")
  802. public ModelAndView goUpdate(OrdersFixAssetEntity orders, HttpServletRequest req) {
  803. req.setAttribute("goUpdate", true);
  804. return goAdd(orders,req);
  805. }
  806. @RequestMapping(params = "goView")
  807. public ModelAndView goView(OrdersFixAssetEntity orders, HttpServletRequest request) {
  808. if(LztUtil.isApiRequest())
  809. return goViewMobile(orders, request);
  810. String taskId = oConvertUtils.getString(request.getParameter("taskId"));
  811. if(oConvertUtils.isNotEmpty(taskId)){
  812. FormProcUtil.initWorkflowParam(request);
  813. request.setAttribute("taskId",taskId);
  814. }
  815. if (StringUtil.isNotEmpty(orders.getId())) {
  816. orders = ordersFixAssetService.getEntity(OrdersFixAssetEntity.class, orders.getId());
  817. // idandname(req, orders);
  818. dealRoundHalfUpValue(orders);
  819. request.setAttribute("ordersPage", orders);
  820. }
  821. request.setAttribute("in_process",true);
  822. // return new ModelAndView("cn/com/lzt/ordersfixasset/orders-View");
  823. ModelAndView mv = new ModelAndView("cn/com/lzt/ordersfixasset/orders-add");
  824. if(orders.getOrderFor().equals("1")) {
  825. mv = new ModelAndView("cn/com/lzt/ordersfixasset/orders-own-add");
  826. }
  827. return mv;
  828. }
  829. @RequestMapping(params = "goViewMobile")
  830. public ModelAndView goViewMobile(OrdersFixAssetEntity orders, HttpServletRequest request) {
  831. request.setAttribute("viewFlag", "1");
  832. String taskId = oConvertUtils.getString(request.getParameter("taskId"));
  833. if(oConvertUtils.isNotEmpty(taskId)){
  834. FormProcUtil.initWorkflowParam(request);
  835. request.setAttribute("taskId",taskId);
  836. }
  837. if (StringUtil.isNotEmpty(orders.getId())) {
  838. orders = ordersFixAssetService.getEntity(OrdersFixAssetEntity.class, orders.getId());
  839. dealRoundHalfUpValue(orders);
  840. request.setAttribute("entity", orders);
  841. }
  842. Map<String, Object> data = LztUtil.copyReqAttributes(new String[]{
  843. "entity","viewFlag","taskId","load"});
  844. data.put("flag", request.getParameter("flag"));
  845. return new JsonDataModelAndView(WXAjaxJson.success(data));
  846. }
  847. // public void idandname(HttpServletRequest req, OrdersFixAssetEntity orders) {
  848. // WarehouseEntity warehouseEntity = systemService.findUniqueByProperty(WarehouseEntity.class, "id", orders.getWarehouseId());
  849. // RelatedUnitsEntity relatedUnitsEntity = systemService.findUniqueByProperty(RelatedUnitsEntity.class, "id", orders.getSupplierName());
  850. // TSBaseUser user = systemService.findUniqueByProperty(TSBaseUser.class, "id", orders.getHandlerPerson());
  851. // // 经手人
  852. // String handlerPersonName="";
  853. // // 仓库
  854. // String wareHouseName = "";
  855. // // 供应商名
  856. // String unitName = "";
  857. // if (warehouseEntity != null) {
  858. // wareHouseName= warehouseEntity.getWarehouseName();
  859. // req.setAttribute("wareHouseIdName", wareHouseName);
  860. // }
  861. // if (relatedUnitsEntity != null) {
  862. // unitName= relatedUnitsEntity.getUnitName();
  863. // req.setAttribute("textUnitName", unitName);
  864. // }
  865. //
  866. // if (user != null) {
  867. // handlerPersonName= user.getRealName();
  868. // req.setAttribute("realName", handlerPersonName);
  869. // }
  870. // }
  871. /**
  872. * 加载明细列表[采购商品]
  873. *
  874. * @return
  875. */
  876. @RequestMapping(params = "orderProductsList")
  877. public ModelAndView orderProductsList(OrdersFixAssetEntity orders, HttpServletRequest req) {
  878. //===================================================================================
  879. //获取参数
  880. Object id0 = orders.getId();
  881. orders = ordersFixAssetService.get(OrdersFixAssetEntity.class, (String)id0);
  882. //===================================================================================
  883. //查询-采购商品
  884. String hql0 = "from OrderFixAssetProductsEntity where 1 = 1 AND fK_ID =? ";
  885. try{
  886. List<OrderFixAssetProductsEntity> OrderFixAssetProductsEntityList = systemService.findHql(hql0,id0);
  887. // addOnhandInfo2OrderProdunctsList(orders,OrderFixAssetProductsEntityList);
  888. req.setAttribute("orderProductsList", OrderFixAssetProductsEntityList);
  889. String load = (String)req.getAttribute("load");
  890. req.setAttribute("load", load);
  891. }catch(Exception e){
  892. logger.info(e.getMessage());
  893. }
  894. String orderFor = req.getParameter("orderFor");
  895. if(StringUtils.equals(orderFor, "1")){
  896. return new ModelAndView("cn/com/lzt/ordersfixasset/orderProductsList-own");
  897. }
  898. return new ModelAndView("cn/com/lzt/ordersfixasset/orderProductsList");
  899. }
  900. /**
  901. * 加载审批明细列表[采购商品]
  902. *
  903. * @return
  904. */
  905. @RequestMapping(params = "orderProductsViewList")
  906. public ModelAndView orderProductsViewList(OrdersFixAssetEntity orders, HttpServletRequest req) {
  907. //===================================================================================
  908. //获取参数
  909. Object id0 = orders.getId();
  910. orders = ordersFixAssetService.get(OrdersFixAssetEntity.class, (String)id0);
  911. //===================================================================================
  912. //查询-采购商品
  913. String hql0 = "from OrderFixAssetProductsEntity where 1 = 1 AND fK_ID =? ";
  914. try{
  915. List<OrderFixAssetProductsEntity> OrderFixAssetProductsEntityList = systemService.findHql(hql0,id0);
  916. addOnhandInfo2OrderProdunctsList(orders,OrderFixAssetProductsEntityList);
  917. req.setAttribute("orderProductsList", OrderFixAssetProductsEntityList);
  918. String load = (String)req.getAttribute("load");
  919. req.setAttribute("load", load);
  920. }catch(Exception e){
  921. logger.info(e.getMessage());
  922. }
  923. return new ModelAndView("cn/com/lzt/orderproducts/orderProductsViewList");
  924. }
  925. private void addOnhandInfo2OrderProdunctsList(OrdersFixAssetEntity orders, List<OrderFixAssetProductsEntity> list) {
  926. if(orders != null && list != null && list.size()>0) {
  927. String ordermonths = orders.getOrderMonths();
  928. OrderMonthsEntity ordermonthsEntity = systemService.get(OrderMonthsEntity.class, ordermonths);
  929. String warehouseid = orders.getWarehouseId();
  930. DateFormat format = new SimpleDateFormat("yyyy-MM");
  931. String busiDate = format.format(ordermonthsEntity.getRefDate());
  932. //暂时使用旧接口,带新功能启用后,再使用新接口
  933. HashMap<String,HashMap<String,Double>> onHandMap = ordersFixAssetService.queryGoodsOnhandDataForOrderAudit(busiDate,warehouseid, list);
  934. if(onHandMap != null) {
  935. for(OrderFixAssetProductsEntity entity : list) {
  936. String goodsid = entity.getGoodsId();
  937. String unit = entity.getMeasureUnit();
  938. HashMap<String,Double> result = onHandMap.get(goodsid+unit);
  939. if(result != null) {
  940. Double onhand = result.get(SCMConsole.ONHAND);
  941. Double last2MonthOutQuantity = result.get(SCMConsole.LAST2MONTHOUTQUANTITY);
  942. entity.setLastMonthUsedAmount(last2MonthOutQuantity);
  943. entity.setOnHandAmount(onhand);
  944. }
  945. }
  946. }
  947. }
  948. }
  949. /**
  950. * 加载审批明细可修改列表[采购商品]
  951. *
  952. * @return
  953. */
  954. @RequestMapping(params = "orderProductsProcUpdateList")
  955. public ModelAndView orderProductsProcUpdateList(OrdersFixAssetEntity orders, HttpServletRequest req) {
  956. //===================================================================================
  957. //获取参数
  958. Object id0 = orders.getId();
  959. orders = ordersFixAssetService.get(OrdersFixAssetEntity.class, (String)id0);
  960. //===================================================================================
  961. //查询-采购商品
  962. try{
  963. List<OrderFixAssetProductsEntity> OrderFixAssetProductsEntityList = ordersFixAssetDao.getOrderProductsOrderByCategory((String)id0);
  964. addOnhandInfo2OrderProdunctsList(orders,OrderFixAssetProductsEntityList);
  965. req.setAttribute("orderProductsList", OrderFixAssetProductsEntityList);
  966. String load = (String)req.getAttribute("load");
  967. req.setAttribute("load", load);
  968. }catch(Exception e){
  969. logger.info(e.getMessage());
  970. }
  971. return new ModelAndView("cn/com/lzt/orderproducts/orderProductsProcUpdateList");
  972. }
  973. /**
  974. * 导出excel
  975. *
  976. * @param request
  977. * @param response
  978. */
  979. @SuppressWarnings({ "rawtypes", "unchecked" })
  980. @RequestMapping(params = "exportXls")
  981. public String exportXls(OrdersFixAssetEntity orders,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) {
  982. CriteriaQuery cq = new CriteriaQuery(OrdersFixAssetEntity.class, dataGrid);
  983. String orderDateBegin = request.getParameter("orderDate_begin");
  984. String orderDateEnd = request.getParameter("orderDate_end");
  985. // 模糊查询
  986. String orderOnumber = orders.getOrderOnumber();
  987. if(StringUtils.isNotBlank(orderOnumber)){
  988. orders.setOrderOnumber("*" +orderOnumber +"*");
  989. }
  990. //查询条件组装器
  991. HqlGenerateUtil.installHql(cq, orders);
  992. try{
  993. //自定义追加查询条件
  994. if(StringUtils.isNotBlank(orderDateBegin) && StringUtils.isNotBlank(orderDateEnd)){
  995. cq.ge("orderDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(orderDateBegin + " 00:00:00"));
  996. cq.le("orderDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(orderDateEnd + " 23:59:59"));
  997. }
  998. }catch (Exception e) {
  999. throw new BusinessException(e.getMessage());
  1000. }
  1001. cq.add();
  1002. List<OrdersFixAssetEntity> list=this.ordersFixAssetService.getListByCriteriaQuery(cq, false);
  1003. List<OrdersFixAssetEntity> listResult = null;
  1004. List<OrdersFixAssetPage> pageList=new ArrayList<OrdersFixAssetPage>();
  1005. List<OrderFixAssetProductsEntity> OrderFixAssetProductsEntityListResult = null;
  1006. if(list!=null&&list.size()>0){
  1007. Class clsOrder = MyClassLoader.getClassByScn("cn.com.lzt.orders.entity.OrdersFixAssetEntity");
  1008. try {
  1009. listResult =systemService.dealResultShowText4Entities(list, clsOrder);
  1010. } catch (Exception e1) {
  1011. logger.info(e1.getMessage());
  1012. }
  1013. for(OrdersFixAssetEntity entity:listResult){
  1014. try{
  1015. OrdersFixAssetPage page=new OrdersFixAssetPage();
  1016. MyBeanUtils.copyBeanNotNull2Bean(entity,page);
  1017. Object id0 = entity.getId();
  1018. String hql0 = "from OrderFixAssetProductsEntity where 1 = 1 AND fK_ID =? ";
  1019. List<OrderFixAssetProductsEntity> OrderFixAssetProductsEntityList = systemService.findHql(hql0,id0);
  1020. Class cls = MyClassLoader.getClassByScn("cn.com.lzt.orderproducts.entity.OrderFixAssetProductsEntity");
  1021. OrderFixAssetProductsEntityListResult =systemService.dealResultShowText4Entities(OrderFixAssetProductsEntityList, cls);
  1022. page.setOrderProductsList(OrderFixAssetProductsEntityListResult);
  1023. pageList.add(page);
  1024. }catch(Exception e){
  1025. logger.info(e.getMessage());
  1026. }
  1027. }
  1028. }
  1029. map.put(NormalExcelConstants.FILE_NAME,"订单表");
  1030. map.put(NormalExcelConstants.CLASS,OrdersFixAssetPage.class);
  1031. map.put(NormalExcelConstants.PARAMS,new ExportParams("订单表列表", "导出人:Jeecg",
  1032. "导出信息"));
  1033. map.put(NormalExcelConstants.DATA_LIST,pageList);
  1034. return NormalExcelConstants.JEECG_EXCEL_VIEW;
  1035. }
  1036. /**
  1037. * 导出excel
  1038. *
  1039. * @param request
  1040. * @param response
  1041. */
  1042. @SuppressWarnings({ "rawtypes", "unchecked" })
  1043. @RequestMapping(params = "exportXlsOrder")
  1044. public String exportXlsOrder(String orderid,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) {
  1045. TSUser user = ResourceUtil.getSessionUser();
  1046. OrdersFixAssetEntity order = systemService.get(OrdersFixAssetEntity.class, orderid);
  1047. List<OrderFixAssetProductsEntity> details = systemService.findByProperty(OrderFixAssetProductsEntity.class, "fkId", orderid);
  1048. map.put(NormalExcelConstants.FILE_NAME,"申购单-"+order.getWarehouseName());
  1049. map.put(NormalExcelConstants.CLASS,OrderFixAssetProductsEntity.class);
  1050. ExportParams param = new ExportParams("申购单-"+order.getWarehouseName() ,"导出信息");
  1051. param.setAddIndex(true);
  1052. map.put(NormalExcelConstants.PARAMS,param);
  1053. map.put(NormalExcelConstants.DATA_LIST,details);
  1054. return NormalExcelConstants.JEECG_EXCEL_VIEW;
  1055. }
  1056. /**
  1057. * 通过excel导入数据
  1058. * @param request
  1059. * @param
  1060. * @return
  1061. */
  1062. @RequestMapping(params = "importExcel", method = RequestMethod.POST)
  1063. @ResponseBody
  1064. public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
  1065. AjaxJson j = new AjaxJson();
  1066. MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
  1067. Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
  1068. for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
  1069. MultipartFile file = entity.getValue();// 获取上传文件对象
  1070. ImportParams params = new ImportParams();
  1071. params.setTitleRows(2);
  1072. params.setHeadRows(2);
  1073. params.setNeedSave(true);
  1074. try {
  1075. List<OrdersFixAssetPage> list = ExcelImportUtil.importExcel(file.getInputStream(), OrdersFixAssetPage.class, params);
  1076. OrdersFixAssetEntity entity1=null;
  1077. for (OrdersFixAssetPage page : list) {
  1078. entity1=new OrdersFixAssetEntity();
  1079. MyBeanUtils.copyBeanNotNull2Bean(page,entity1);
  1080. ordersFixAssetService.addMain(entity1, page.getOrderProductsList());
  1081. }
  1082. j.setMsg("文件导入成功!");
  1083. } catch (Exception e) {
  1084. j.setMsg("文件导入失败!");
  1085. logger.error(ExceptionUtil.getExceptionMessage(e));
  1086. }finally{
  1087. try {
  1088. file.getInputStream().close();
  1089. } catch (IOException e) {
  1090. e.printStackTrace();
  1091. }
  1092. }
  1093. }
  1094. return j;
  1095. }
  1096. /**
  1097. * 导出excel 使模板
  1098. */
  1099. @RequestMapping(params = "exportXlsByT")
  1100. public String exportXlsByT(ModelMap map) {
  1101. map.put(NormalExcelConstants.FILE_NAME,"订单表");
  1102. map.put(NormalExcelConstants.CLASS,OrdersFixAssetPage.class);
  1103. map.put(NormalExcelConstants.PARAMS,new ExportParams("订单表列表", "导出人:"+ ResourceUtil.getSessionUserName().getRealName(),
  1104. "导出信息"));
  1105. map.put(NormalExcelConstants.DATA_LIST,new ArrayList());
  1106. return NormalExcelConstants.JEECG_EXCEL_VIEW;
  1107. }
  1108. /**
  1109. * 导入功能跳转
  1110. *
  1111. * @return
  1112. */
  1113. @RequestMapping(params = "upload")
  1114. public ModelAndView upload(HttpServletRequest req) {
  1115. req.setAttribute("controller_name", "ordersController");
  1116. return new ModelAndView("common/upload/pub_excel_upload");
  1117. }
  1118. @RequestMapping(method = RequestMethod.GET)
  1119. @ResponseBody
  1120. public List<OrdersFixAssetEntity> list() {
  1121. List<OrdersFixAssetEntity> listOrderss=ordersFixAssetService.getList(OrdersFixAssetEntity.class);
  1122. return listOrderss;
  1123. }
  1124. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  1125. @ResponseBody
  1126. public ResponseEntity<?> get(@PathVariable("id") String id) {
  1127. OrdersFixAssetEntity task = ordersFixAssetService.get(OrdersFixAssetEntity.class, id);
  1128. if (task == null) {
  1129. return new ResponseEntity(HttpStatus.NOT_FOUND);
  1130. }
  1131. return new ResponseEntity(task, HttpStatus.OK);
  1132. }
  1133. @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
  1134. @ResponseBody
  1135. public ResponseEntity<?> create(@RequestBody OrdersFixAssetPage ordersPage, UriComponentsBuilder uriBuilder) {
  1136. //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
  1137. Set<ConstraintViolation<OrdersFixAssetPage>> failures = validator.validate(ordersPage);
  1138. if (!failures.isEmpty()) {
  1139. return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
  1140. }
  1141. //保存
  1142. List<OrderFixAssetProductsEntity> orderProductsList = ordersPage.getOrderProductsList();
  1143. OrdersFixAssetEntity orders = new OrdersFixAssetEntity();
  1144. try{
  1145. MyBeanUtils.copyBeanNotNull2Bean(orders,ordersPage);
  1146. }catch(Exception e){
  1147. logger.info(e.getMessage());
  1148. }
  1149. ordersFixAssetService.addMain(orders, orderProductsList);
  1150. //按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
  1151. String id = ordersPage.getId();
  1152. URI uri = uriBuilder.path("/rest/ordersController/" + id).build().toUri();
  1153. HttpHeaders headers = new HttpHeaders();
  1154. headers.setLocation(uri);
  1155. return new ResponseEntity(headers, HttpStatus.CREATED);
  1156. }
  1157. @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
  1158. public ResponseEntity<?> update(@RequestBody OrdersFixAssetPage ordersPage) {
  1159. //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
  1160. Set<ConstraintViolation<OrdersFixAssetPage>> failures = validator.validate(ordersPage);
  1161. if (!failures.isEmpty()) {
  1162. return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
  1163. }
  1164. //保存
  1165. List<OrderFixAssetProductsEntity> orderProductsList = ordersPage.getOrderProductsList();
  1166. OrdersFixAssetEntity orders = new OrdersFixAssetEntity();
  1167. try{
  1168. MyBeanUtils.copyBeanNotNull2Bean(orders,ordersPage);
  1169. }catch(Exception e){
  1170. logger.info(e.getMessage());
  1171. }
  1172. ordersFixAssetService.updateMain(orders, orderProductsList);
  1173. //按Restful约定,返回204状态码, 无内容. 也可以返回200状态码.
  1174. return new ResponseEntity(HttpStatus.NO_CONTENT);
  1175. }
  1176. @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
  1177. @ResponseStatus(HttpStatus.NO_CONTENT)
  1178. public void delete(@PathVariable("id") String id) {
  1179. OrdersFixAssetEntity orders = ordersFixAssetService.get(OrdersFixAssetEntity.class, id);
  1180. ordersFixAssetService.delMain(orders);
  1181. }
  1182. /**
  1183. * 解析SQL,返回字段集 支持多数据源
  1184. * @return
  1185. */
  1186. @SuppressWarnings({ "unchecked", "rawtypes" })
  1187. @RequestMapping(params = "getProductInfo", method = RequestMethod.POST)
  1188. @ResponseBody
  1189. public Object getSqlFields(String goodsCode){
  1190. TBGoodsInfoEntity goodInfo = null;
  1191. TBPriceInfoEntity tBPriceInfoEntity = null;
  1192. TBPriceInfoEntity tBPriceInfoEntityResult = null;
  1193. Map reJson = new HashMap<String, Object>();
  1194. try{
  1195. //goodInfo = systemService.findUniqueByProperty(TBGoodsInfoEntity.class, "goodsCode",goodsCode);
  1196. String hql_Goods = "from TBGoodsInfoEntity where 1 = 1 AND GOODS_CODE =? AND STATUS = 0 AND DELETE_FLAG = 0";
  1197. List<TBGoodsInfoEntity> tBGoodsInfoEntityList = systemService.findHql(hql_Goods,goodsCode);
  1198. if(tBGoodsInfoEntityList != null && tBGoodsInfoEntityList.size() > 0){
  1199. goodInfo = tBGoodsInfoEntityList.get(0);
  1200. }else{
  1201. reJson.put("status", "false");
  1202. return reJson;
  1203. }
  1204. String categoryHql = " FROM TBGoodsCategoryEntity where categoryCode =? or categoryCode =? order by categoryCode";
  1205. List<TBGoodsCategoryEntity> categoryList = systemService.findHql(categoryHql,goodInfo.getBelongCategoryCode().substring(0,7),goodInfo.getBelongCategoryCode().substring(0,10));
  1206. if(categoryList != null && categoryList.size() == 2) {
  1207. goodInfo.setCategoryname(categoryList.get(0).getCategoryName()+"-"+categoryList.get(1).getCategoryName());
  1208. }else {
  1209. reJson.put("status", "false");
  1210. return reJson;
  1211. }
  1212. //获取参数
  1213. Object id0 = goodInfo.getId();
  1214. String hql0 = "from TBPriceInfoEntity where 1 = 1 AND GOODS_ID =? ";
  1215. List<TBPriceInfoEntity> tBPriceInfoEntityList = systemService.findHql(hql0,id0);
  1216. if(tBPriceInfoEntityList != null && tBPriceInfoEntityList.size() > 0){
  1217. for(int i = 0 ;i < tBPriceInfoEntityList.size();i++){
  1218. tBPriceInfoEntity = new TBPriceInfoEntity();
  1219. tBPriceInfoEntity = tBPriceInfoEntityList.get(i);
  1220. if(goodInfo.getPurchaseUnit() != null && tBPriceInfoEntity.getMeteringUnit() != null && goodInfo.getPurchaseUnit().equals(tBPriceInfoEntity.getMeteringUnit())){
  1221. tBPriceInfoEntityResult = tBPriceInfoEntity;
  1222. break;
  1223. }
  1224. }
  1225. }
  1226. }catch (Exception e) {
  1227. logger.info(e.getMessage());
  1228. }
  1229. reJson.put("status", "success");
  1230. reJson.put("datainfo", goodInfo);
  1231. reJson.put("pricinfo", tBPriceInfoEntityResult);
  1232. return reJson;
  1233. }
  1234. /**
  1235. * 解析SQL,返回字段集 支持多数据源
  1236. * @return
  1237. */
  1238. @SuppressWarnings({ "unchecked", "rawtypes" })
  1239. @RequestMapping(params = "getPurchasePriceInfo", method = RequestMethod.POST)
  1240. @ResponseBody
  1241. public Object getPurchasePriceInfo(String goodsCode,String purchaseUnit){
  1242. Map reJson = new HashMap<String, Object>();
  1243. TBGoodsInfoEntity goodInfo = null;
  1244. if(StringUtils.isNotBlank(goodsCode) && StringUtils.isNotBlank(purchaseUnit)){
  1245. TBPriceInfoEntity tBPriceInfoEntityResult = null;
  1246. List<String> unitlist = new ArrayList<String>();
  1247. try{
  1248. goodInfo = systemService.findUniqueByProperty(TBGoodsInfoEntity.class, "goodsCode",goodsCode);
  1249. String hql0 = "from TBPriceInfoEntity where 1 = 1 AND GOODS_ID = ?";
  1250. List<TBPriceInfoEntity> tBPriceInfoEntityList = systemService.findHql(hql0,goodInfo.getId());
  1251. if(tBPriceInfoEntityList != null && tBPriceInfoEntityList.size() > 0){
  1252. for(TBPriceInfoEntity price : tBPriceInfoEntityList) {
  1253. unitlist.add(price.getMeteringUnit());
  1254. if(purchaseUnit.equals(price.getMeteringUnit())) {
  1255. tBPriceInfoEntityResult = price;
  1256. }
  1257. }
  1258. }
  1259. if(tBPriceInfoEntityResult == null) {
  1260. List<DictEntity> dictList = jeecgDictDao.querySystemDict("metering_calcu_unit");
  1261. HashMap<String, String> map = new HashMap<>();
  1262. for(DictEntity dic : dictList) {
  1263. map.put(dic.getTypecode(), dic.getTypename());
  1264. }
  1265. StringBuffer sb = new StringBuffer();
  1266. sb.append("可选择的计量单位:【");
  1267. for(int i=0 ; i<unitlist.size() ; i++) {
  1268. if(i>0) {
  1269. sb.append("/");
  1270. }
  1271. sb.append(map.get(unitlist.get(i)));
  1272. }
  1273. sb.append("】");
  1274. reJson.put("msg", sb.toString());
  1275. }
  1276. }catch (Exception e) {
  1277. reJson.put("status", "fail");
  1278. logger.info(e.getMessage());
  1279. return reJson;
  1280. }
  1281. reJson.put("status", "success");
  1282. reJson.put("pricinfo", tBPriceInfoEntityResult);
  1283. }else{
  1284. reJson.put("status", "success");
  1285. reJson.put("pricinfo", null);
  1286. }
  1287. return reJson;
  1288. }
  1289. /**
  1290. * @param categoryName
  1291. * @param categoryName
  1292. * @return
  1293. */
  1294. private String dealCateName(String categoryCode, String categoryName) {
  1295. if(categoryCode.contains("rootA04")) {
  1296. categoryName = "固定资产类-" + categoryName;
  1297. }else if(categoryCode.contains("rootA05")) {
  1298. categoryName = "应急采购类-" + categoryName;
  1299. }else if(categoryCode.contains("rootA06")) {
  1300. categoryName = "其他类-" + categoryName;
  1301. }
  1302. return categoryName;
  1303. }
  1304. /**
  1305. * 经手人弹出框
  1306. * @param request
  1307. * @param response
  1308. * @param dataGrid
  1309. * @throws ClassNotFoundException
  1310. */
  1311. @SuppressWarnings({"rawtypes" })
  1312. @RequestMapping(params = "selRefDatagridHandlerPerson")
  1313. public void selRefDatagridHandlerPerson(String classname,TSBaseUser tSBaseUser,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) throws Exception {
  1314. // Class cls = MyClassLoader.getClassByScn(classname);
  1315. // CriteriaQuery cq = new CriteriaQuery(cls, dataGrid);
  1316. // //自定义追加查询条件
  1317. // Short[] status = new Short[]{Globals.ONLINE,Globals.OFFLINE};
  1318. // cq.in("status", status);
  1319. // cq.eq("deleteFlag", Globals.Delete_Normal);
  1320. // // 检索用仓库编码
  1321. // if(StringUtils.isNotBlank(tSBaseUser.getUserName())){
  1322. // cq.eq("userName", tSBaseUser.getUserName());
  1323. // }
  1324. // // 检索用仓库名称
  1325. // if(StringUtils.isNotBlank(tSBaseUser.getRealName())){
  1326. // cq.eq("realName", tSBaseUser.getRealName());
  1327. // }
  1328. // org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, cls.newInstance());
  1329. // commonDao.getDataGridReturn(cq, true);
  1330. // List result = dataGrid.getResults();
  1331. // try {
  1332. // //result =systemService.dealResultShowText4Entities(dataGrid.getResults(), cls);
  1333. // } catch (Exception e) {
  1334. // throw new BusinessException(e);
  1335. // }
  1336. // dataGrid.setResults(result);
  1337. // TagUtil.datagrid(response, dataGrid);
  1338. }
  1339. /**
  1340. * 经手人弹出框
  1341. * @return
  1342. */
  1343. @RequestMapping(params = "selectReferHandlerPerson")
  1344. public ModelAndView selectReferHandlerPerson(HttpServletRequest request) {
  1345. ModelAndView mv = new ModelAndView("cn/com/lzt/ordersfixasset/selectHandlerPersonInfo");
  1346. String ids = oConvertUtils.getString(request.getParameter("ids"));
  1347. mv.addObject("ids", ids);
  1348. // 需要将前端的类路径传递到refer页面
  1349. String clsname = oConvertUtils.getString(request.getParameter("classname"));
  1350. mv.addObject("classname", clsname);
  1351. mv.addObject("codefield", oConvertUtils.getString(request.getParameter("codefield")));
  1352. mv.addObject("namefield", oConvertUtils.getString(request.getParameter("namefield")));
  1353. return mv;
  1354. }
  1355. /**
  1356. * 物流弹出框
  1357. * @param request
  1358. * @param response
  1359. * @param dataGrid
  1360. * @throws ClassNotFoundException
  1361. */
  1362. @SuppressWarnings({"rawtypes" })
  1363. @RequestMapping(params = "selRefDatagridLogistics")
  1364. public void selRefDatagridLogistics(String classname,TBLogisticsEntity tBLogisticsEntity,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) throws Exception {
  1365. Class cls = MyClassLoader.getClassByScn(classname);
  1366. CriteriaQuery cq = new CriteriaQuery(cls, dataGrid);
  1367. //自定义追加查询条件
  1368. String[] unitstate = new String[]{Globals.Enable_Normal};
  1369. cq.in("status", unitstate);
  1370. cq.eq("deleteFlag", Globals.Delete_Normal.toString());
  1371. // 检索用仓库编码
  1372. if(StringUtils.isNotBlank(tBLogisticsEntity.getCompanyCode())){
  1373. cq.eq("companyCode", tBLogisticsEntity.getCompanyCode());
  1374. }
  1375. // 检索用仓库名称
  1376. if(StringUtils.isNotBlank(tBLogisticsEntity.getCompanyName())){
  1377. cq.eq("companyName", tBLogisticsEntity.getCompanyName());
  1378. }
  1379. HqlGenerateUtil.installHql(cq, cls.newInstance());
  1380. commonDao.getDataGridReturn(cq, true);
  1381. List result = dataGrid.getResults();
  1382. try {
  1383. //result =systemService.dealResultShowText4Entities(dataGrid.getResults(), cls);
  1384. } catch (Exception e) {
  1385. throw new BusinessException(e);
  1386. }
  1387. dataGrid.setResults(result);
  1388. TagUtil.datagrid(response, dataGrid);
  1389. }
  1390. /**
  1391. * 物流弹出框
  1392. * @return
  1393. */
  1394. @RequestMapping(params = "selectReferLogistics")
  1395. public ModelAndView selectReferLogistics(HttpServletRequest request) {
  1396. ModelAndView mv = new ModelAndView("cn/com/lzt/ordersfixasset/selectLogisticsInfo");
  1397. String ids = oConvertUtils.getString(request.getParameter("ids"));
  1398. mv.addObject("ids", ids);
  1399. // 需要将前端的类路径传递到refer页面
  1400. String clsname = oConvertUtils.getString(request.getParameter("classname"));
  1401. mv.addObject("classname", clsname);
  1402. mv.addObject("codefield", oConvertUtils.getString(request.getParameter("codefield")));
  1403. mv.addObject("namefield", oConvertUtils.getString(request.getParameter("namefield")));
  1404. return mv;
  1405. }
  1406. /**
  1407. * 取消采购单
  1408. *
  1409. * @author guoqing.yan
  1410. */
  1411. @RequestMapping(params = "doCancel")
  1412. @ResponseBody
  1413. public AjaxJson doCancel(String id, HttpServletRequest req) {
  1414. AjaxJson j = new AjaxJson();
  1415. String message = null;
  1416. OrdersFixAssetEntity orders = ordersFixAssetService.getEntity(OrdersFixAssetEntity.class, id);
  1417. try{
  1418. // 未审批和已经审批的可以取消
  1419. if(orders.getOrderStatus() != null &&(orders.getOrderStatus().equals(Globals.UNAPPROVED) || orders.getOrderStatus().equals(Globals.APPROVED))){
  1420. orders.setOrderStatus(Globals.CANCELED);//订单状态: 取消
  1421. ordersFixAssetService.updateEntitie(orders);
  1422. message = "单号:" + orders.getOrderOnumber() + "取消成功!";
  1423. systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
  1424. }else{
  1425. message = "该单不能取消,请确认!";
  1426. }
  1427. }catch(Exception e){
  1428. message = "操作失败!";
  1429. }
  1430. j.setMsg(message);
  1431. return j;
  1432. }
  1433. private void dealRoundHalfUpValue(OrdersFixAssetEntity entity) {
  1434. BigDecimal guding = entity.getGudingSum() == null ? BigDecimal.ZERO : new BigDecimal(entity.getGudingSum());
  1435. entity.setGudingSum(guding.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
  1436. BigDecimal yingji = entity.getYingjiSum() == null ? BigDecimal.ZERO : new BigDecimal(entity.getYingjiSum());
  1437. entity.setYingjiSum(yingji.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
  1438. BigDecimal qita = entity.getQitaSum() == null ? BigDecimal.ZERO : new BigDecimal(entity.getQitaSum());
  1439. entity.setQitaSum(qita.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
  1440. }
  1441. /**
  1442. * 取消采购单
  1443. *
  1444. * @author guoqing.yan
  1445. */
  1446. @RequestMapping(params = "doCancelAuditOrder")
  1447. @ResponseBody
  1448. public AjaxJson doCancelAuditOrder(String id,String refundvalue, HttpServletRequest req) {
  1449. AjaxJson j = new AjaxJson();
  1450. String message = null;
  1451. OrdersFixAssetEntity orders = ordersFixAssetService.getEntity(OrdersFixAssetEntity.class, id);
  1452. // try{
  1453. // // 首先判断该订单是否入库,如果入库则不能取消
  1454. // Long godownOrderCount = systemService.getCountForJdbc("select count(1) from t_b_godown_entry where purchase_order_no='" + orders.getOrderOnumber() + "'");
  1455. // // 未入库时候
  1456. // if(godownOrderCount <=0){
  1457. // if(StringUtils.isNotBlank(refundvalue)){
  1458. // // 退的预付定金额
  1459. // Double refundMoney = Double.parseDouble(refundvalue);
  1460. // CollectMiddleEntity collectMiddleEntity = new CollectMiddleEntity();
  1461. // collectMiddleEntity.setUnitId(orders.getSupplierId());// 供应商ID
  1462. // collectMiddleEntity.setCollectionOrderOnumber(orders.getOrderOnumber());//订单号
  1463. // collectMiddleEntity.setCollectionType(Globals.DEPOSIT_REFUND);// 预付定金退款
  1464. // collectMiddleEntity.setAmountReceivable(refundMoney);
  1465. // collectMiddleService.saveOrUpdate(collectMiddleEntity);
  1466. // // 更新 往来单位表中的 应收余额
  1467. // RelatedUnitsEntity relatedUnitsEntity = relatedUnitsService.get(RelatedUnitsEntity.class, orders.getSupplierId());
  1468. // if(relatedUnitsEntity.getAmountReceivable() != null){
  1469. // relatedUnitsEntity.setPrepaidBalance(refundMoney + relatedUnitsEntity.getAmountReceivable());// 预付余额
  1470. // }else{
  1471. // relatedUnitsEntity.setPrepaidBalance(refundMoney);// 预付余额
  1472. // }
  1473. // relatedUnitsService.updateEntitie(relatedUnitsEntity);
  1474. // }
  1475. // // 未审批和已经审批的可以取消
  1476. // if(orders.getOrderStatus() != null && !orders.getOrderStatus().equals(Globals.CANCELED)){
  1477. // orders.setOrderStatus(Globals.CANCELED);//订单状态: 取消
  1478. // ordersFixAssetService.updateEntitie(orders);
  1479. // message = "单号:" + orders.getOrderOnumber() + "取消成功!";
  1480. // systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
  1481. // }else{
  1482. // message = "该单已经取消,请确认!";
  1483. // }
  1484. // // 已经入库的时候
  1485. // }else{
  1486. // message = "该订单已经入库,不能取消,请确认!";
  1487. // }
  1488. //
  1489. // }catch(Exception e){
  1490. // message = "操作失败!";
  1491. // }
  1492. j.setMsg(message);
  1493. return j;
  1494. }
  1495. /**
  1496. * 审核通过 采购单
  1497. *
  1498. * @author guoqing.yan
  1499. */
  1500. @RequestMapping(params = "doAudit")
  1501. @ResponseBody
  1502. public AjaxJson doAudit(String id, HttpServletRequest req) {
  1503. AjaxJson j = new AjaxJson();
  1504. String message = null;
  1505. OrdersFixAssetEntity orders = ordersFixAssetService.getEntity(OrdersFixAssetEntity.class, id);
  1506. try{
  1507. // 未审批和已经审批的可以取消
  1508. if(orders.getOrderStatus() != null &&orders.getOrderStatus().equals(Globals.UNAPPROVED)){
  1509. // 预付定金 不为空的时候
  1510. if(orders.getPrepaidMoney() != null && orders.getPrepaidMoney() >0){
  1511. // 更新 付款明细中间表
  1512. // PaymentMiddleEntity paymentMiddleEntity = new PaymentMiddleEntity();
  1513. // paymentMiddleEntity.setUnitId(orders.getSupplierId());// 供应商ID
  1514. // paymentMiddleEntity.setPaymentDate(new Date());// 应付款发生日期
  1515. // paymentMiddleEntity.setPaymentOrderOnumber(orders.getOrderOnumber());// 应付款单据编号
  1516. // paymentMiddleEntity.setPaymentType(Globals.PURCHASE_ADVANCE_PAYMENT);// 应付款类型 采购预付款
  1517. // paymentMiddleEntity.setHandlerPerson(orders.getHandlerPersonId());// 经手人
  1518. // paymentMiddleEntity.setAmountPayable(orders.getPrepaidMoney());// 应付定金
  1519. // paymentMiddleService.save(paymentMiddleEntity);
  1520. // 更新 往来单位表中的 预付余额
  1521. RelatedUnitsEntity relatedUnitsEntity = relatedUnitsService.get(RelatedUnitsEntity.class, orders.getSupplierId());
  1522. if(relatedUnitsEntity.getPrepaidBalance() != null){
  1523. relatedUnitsEntity.setPrepaidBalance(orders.getPrepaidMoney() + relatedUnitsEntity.getPrepaidBalance());// 预付余额
  1524. }else{
  1525. relatedUnitsEntity.setPrepaidBalance(orders.getPrepaidMoney());// 预付余额
  1526. }
  1527. relatedUnitsService.updateEntitie(relatedUnitsEntity);
  1528. }
  1529. // 采购单审核状态更新
  1530. ordersFixAssetService.updateEntitie(orders);
  1531. HttpSession session = ContextHolderUtils.getSession();
  1532. TSUser tuser = (TSUser)session.getAttribute("LOCAL_CLINET_USER");
  1533. orders.setAuditDate(new Date());
  1534. orders.setOrderAuditor(tuser.getRealName());
  1535. orders.setOrderStatus(Globals.APPROVED);//订单状态: 已审批
  1536. message = "单号:" + orders.getOrderOnumber() + "已生效!";
  1537. systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
  1538. }else{
  1539. message = "该单已经取消或者已生效,不能提交生效,请确认!";
  1540. }
  1541. }catch(Exception e){
  1542. message = "操作失败!";
  1543. }
  1544. j.setMsg(message);
  1545. return j;
  1546. }
  1547. @RequestMapping(params = "doCheckNotSubnitWarehouse")
  1548. @ResponseBody
  1549. public AjaxJson doCheckNotSubnitWarehouse(String id,String refundvalue, HttpServletRequest req) {
  1550. AjaxJson j = new AjaxJson();
  1551. String message = null;
  1552. try {
  1553. String monthSql = "select id from t_b_ordermonths where ref_date = ?";
  1554. String monthFirstDay = DateUtils.date_sdf.format(new Date()).substring(0, 7)+"-01";
  1555. if (monthFirstDay.substring(5, 7).equals("01") || monthFirstDay.substring(5, 7).equals("03") ||monthFirstDay.substring(5, 7).equals("05") ||
  1556. monthFirstDay.substring(5, 7).equals("07") ||monthFirstDay.substring(5, 7).equals("09") ||monthFirstDay.substring(5, 7).equals("11")) {
  1557. Calendar cal = Calendar.getInstance();
  1558. cal.setTime(new Date());
  1559. cal.add(Calendar.MONTH, -1);
  1560. Date lastMonthDate = cal.getTime();
  1561. monthFirstDay = DateUtils.date_sdf.format(lastMonthDate).substring(0, 7)+"-01";
  1562. }
  1563. List<Map<String,Object>> res = systemService.findForJdbc(monthSql, monthFirstDay);
  1564. if(res.size() == 0)
  1565. return j;
  1566. wxservice.sendMsgToWXForOrdersNotSubmit(res.get(0).get("id").toString());
  1567. message = "消息发送成功,请行政经理查看美都环卫微管理";
  1568. }catch (Exception e) {
  1569. logger.error(e.getMessage());
  1570. message = "操作失败,请联系系统管理员查看失败原因。";
  1571. }
  1572. j.setMsg(message);
  1573. return j;
  1574. }
  1575. @RequestMapping(params = "checkGoAdd")
  1576. @ResponseBody
  1577. public AjaxJson checkGoAdd(String warehouseid, HttpServletRequest request) {
  1578. AjaxJson j = new AjaxJson();
  1579. //暂时取消校验,待物料二期正式使用时,在启用此校验
  1580. // if(true)
  1581. // return j;
  1582. TSUser tuser = ResourceUtil.getSessionUser();
  1583. if(StringUtils.isEmpty(warehouseid)){
  1584. List<String> tsDList = systemService.findListbySql("select id from t_b_warehouse where responsible_person = '"+tuser.getId()+"'");
  1585. if(tsDList != null && tsDList.size()>0) {
  1586. warehouseid = tsDList.get(0);
  1587. }
  1588. }
  1589. String message = "";
  1590. String lastMonth = XcglDateUtils.addDateMonth(new Date(), -1, DateUtils.date_sdf).substring(0,7);
  1591. //查询上个月出库单
  1592. String noStorageOutSql = "select * from t_b_storage_out where warehouseid =? and left(outdate,7) =? ";
  1593. String onhandSql = "select * from t_b_onhandreport where warehouse_id =? and order_date =? ";
  1594. String hasPorderSql = "select id from t_b_porders where warehouse_id = '"+warehouseid+"' and left(order_date,4) > '2019' order by order_date desc LIMIT 1";
  1595. String orderstotalSql = "select count(*) as totalrows from t_b_orders where warehouse_id =? ";
  1596. //新建领料点,可以直接申请物料
  1597. List<Map<String,Object>> ordersCount = systemService.findForJdbc(orderstotalSql, warehouseid);
  1598. if(Integer.parseInt(ordersCount.get(0).get("totalrows").toString()) == 0)
  1599. return j;
  1600. List<String> idList = systemService.findListbySql(hasPorderSql);
  1601. //查询上一个采购单的核对单
  1602. String noStorageInSql = "select * from t_b_storage_in where porderid in ( select id from ( " +
  1603. "select id from t_b_porders where warehouse_id =? order by order_date desc LIMIT 1 )as t)" ;
  1604. List<Map<String,Object>> retout = systemService.findForJdbc(noStorageOutSql, warehouseid,lastMonth);
  1605. List<Map<String,Object>> retOnhand = systemService.findForJdbc(onhandSql, warehouseid,lastMonth);
  1606. List<Map<String,Object>> retin = systemService.findForJdbc(noStorageInSql, warehouseid);
  1607. //如果上个月库存上报单及领料出库单都没有,则提示,保障系统初始运行时无错误逻辑
  1608. if(retOnhand.size() == 0 && retout.size() == 0 ){
  1609. message = lastMonth+"未进行领料出库,请填写领料出库后再进行物料申购";
  1610. }
  1611. //如果有采购单,并且采购单没有进行核对,则提示
  1612. if(idList.size() > 0 && retin.size() == 0){
  1613. message = "此领料点上次采购单未进行采购核对,请填写采购单核对后再进行物料申购";
  1614. }
  1615. if(StringUtils.isNotEmpty(message)) {
  1616. j.setSuccess(false);
  1617. j.setMsg(message);
  1618. }
  1619. return j;
  1620. }
  1621. @RequestMapping(params="exportDetailPdf4Mobile")
  1622. public void exportDetailPdf4Mobile(
  1623. @RequestParam("procInstId") String procInstId
  1624. ,@RequestParam(value = "flag",required = false,defaultValue = "2") Integer flag
  1625. ,HttpServletRequest request, HttpServletResponse response){
  1626. ActivitiTools tools = ActivitiTools.getInstance(procInstId,true);
  1627. tools.setProcInstId(null);
  1628. ActivitiPdfExport pdfExport = tools.getPdfExport();
  1629. String id = tools.getBusId();
  1630. OrdersFixAssetEntity orders = ordersFixAssetService.getEntity(OrdersFixAssetEntity.class, id);
  1631. String orderFor= orders.getOrderFor();
  1632. String orderForTxt;
  1633. if(orderFor.equals("0")){
  1634. orderForTxt="公司采购";
  1635. }else{
  1636. orderForTxt="自行采购";
  1637. }
  1638. boolean showMoney = (flag>=3 || orderFor.equals("1"));
  1639. pdfExport.table()
  1640. .cell("领料点",orders.getWarehouseName()).cell("采购方式",orderForTxt).cell("组织机构",orders.getDepName());
  1641. if(showMoney) {
  1642. pdfExport.cell("总金额", orders.getTotalMoney() == null ? "0" : orders.getTotalMoney().toString());
  1643. /*.cell("固定资产类金额", orders.getGudingSum() == null ? "0" : orders.getGudingSum().toString())
  1644. .cell("应急采购类金额", orders.getYingjiSum() == null ? "0" : orders.getYingjiSum().toString())
  1645. .cell("其他类金额", orders.getQitaSum() == null ? "0" : orders.getQitaSum().toString());*/
  1646. }
  1647. pdfExport.cell("备注说明",orders.getDescription());
  1648. String hql0 = "from OrderFixAssetProductsEntity where 1 = 1 AND fK_ID =? ";
  1649. try{
  1650. List<OrderFixAssetProductsEntity> OrderFixAssetProductsEntityList = systemService.findHql(hql0,id);
  1651. pdfExport.cell("");
  1652. int detailColumnNum =showMoney?7:5;
  1653. PdfPTable detailTableHeader = pdfExport.createTable(detailColumnNum);
  1654. detailTableHeader.setWidthPercentage(100);
  1655. pdfExport.cell(detailTableHeader, "货品名称", true);
  1656. pdfExport.cell(detailTableHeader, "货品分类", true);
  1657. pdfExport.cell(detailTableHeader, "计量单位", true);
  1658. pdfExport.cell(detailTableHeader, "数量", true);
  1659. if(showMoney) {
  1660. pdfExport.cell(detailTableHeader, "采购单价(元)", true);
  1661. pdfExport.cell(detailTableHeader, "金额(元)", true);
  1662. }
  1663. pdfExport.cell(detailTableHeader, "备注", true);
  1664. pdfExport.cell(detailTableHeader);
  1665. int i = 0;
  1666. for(OrderFixAssetProductsEntity detailEntity:OrderFixAssetProductsEntityList){
  1667. i++;
  1668. PdfPTable detailTable = pdfExport.createTable(detailColumnNum);
  1669. pdfExport.cell(detailTable,detailEntity.getPname(),false);
  1670. pdfExport.cell(detailTable, detailEntity.getBelongCategoryName(), false);
  1671. pdfExport.cell(detailTable, DictUtil.formatToTypeName(detailEntity.getMeasureUnit(),"metering_calcu_unit") , false);
  1672. pdfExport.cell(detailTable, detailEntity.getQuantity().toString(), false);
  1673. if(showMoney) {
  1674. pdfExport.cell(detailTable, detailEntity.getPurchasePrice().toString(), false);
  1675. pdfExport.cell(detailTable, detailEntity.getMoney().toString(), false);
  1676. }
  1677. pdfExport.cell(detailTable,detailEntity.getRemark(), false);
  1678. pdfExport.cell("明细"+i,true);
  1679. pdfExport.cell(detailTable);
  1680. }
  1681. }catch(Exception e){
  1682. e.printStackTrace();
  1683. logger.info(e.getMessage());
  1684. }
  1685. tools.exportToResponse(response);
  1686. }
  1687. /**
  1688. * 选择物料签报单 员工报销
  1689. * @return
  1690. */
  1691. @RequestMapping(params = "ordersFixAssetSelect4CostPay")
  1692. public String ordersFixAssetSelect4CostPay(){
  1693. return "cn/com/lzt/ordersfixasset/select_orders_fix_asset_cost_pay";
  1694. }
  1695. @RequestMapping(params = "ordersFixAssetSelect4CostPayDatagrid")
  1696. public void ordersFixAssetSelect4CostPayDatagrid(OrdersFixAssetEntity entity, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid){
  1697. TSUser user = ResourceUtil.getSessionUser();
  1698. boolean projectUser = UserUtil.isProjectUser(user.getId());
  1699. // List<String> warehouseIdList = getUserWarehouse();
  1700. String role = userService.getUserRole(user);
  1701. if(!StringUtils.contains(role, Globals.POSITION_TYPE_XZBFJL)){
  1702. entity.setCreateBy(user.getUserName());
  1703. entity.setOrderFor("1");
  1704. }
  1705. List<OrdersFixAssetEntity> ordersList =ordersFixAssetDao.getOrders4CostPay(entity,user.getId(),projectUser,null);
  1706. dataGrid.setResults(ordersList);
  1707. dataGrid.setTotal(ordersList.size());
  1708. TagUtil.datagrid(response, dataGrid);
  1709. }
  1710. /**
  1711. * 选择物料签报详情单 对外付款
  1712. * @return
  1713. */
  1714. @RequestMapping(params = "ordersFixAssetDetailSelect4CostPay")
  1715. public String ordersFixAssetDetailSelect4CostPay(){
  1716. return "cn/com/lzt/ordersfixasset/select_orders_fix_asset_detail_cost_pay";
  1717. }
  1718. @RequestMapping(params = "ordersFixAssetDetailSelect4CostPayDatagrid")
  1719. public void ordersFixAssetDetailSelect4CostPayDatagrid(OrderFixAssetProductsEntity entity, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid){
  1720. TSUser user = ResourceUtil.getSessionUser();
  1721. boolean projectUser = UserUtil.isProjectUser(user.getId());
  1722. // List<String> warehouseIdList = getUserWarehouse();
  1723. entity.setId(request.getParameter("updateId"));
  1724. String role = userService.getUserRole(user);
  1725. if(!StringUtils.contains(role, Globals.POSITION_TYPE_XZBFJL)){
  1726. entity.setCreateBy(user.getUserName());
  1727. entity.setOrderFor("1");
  1728. }
  1729. List<OrderFixAssetProductsEntity> ordersList =ordersFixAssetDao.getOrderProducts4CostPay(entity,user.getId(),projectUser,null);
  1730. dataGrid.setResults(ordersList);
  1731. dataGrid.setTotal(ordersList.size());
  1732. TagUtil.datagrid(response, dataGrid);
  1733. }
  1734. }