From 52d437b89025b47713b4079881f2890ee2c939c7 Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期六, 27 五月 2023 14:37:41 +0800 Subject: [PATCH] 调整模块-取消错误代码,添加TODO标记后期处理 --- igds-inout/src/main/java/com/ld/igds/m/view/VarietyChangePR.java | 64 ++++++ igds-inout/src/main/java/com/ld/igds/m/view/VarietyChange.view.xml | 393 +++++++++++++++++++++++++++++++++++++++ igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java | 95 +++++++++ igds-web/src/main/java/com/ld/igds/TestAction.java | 4 4 files changed, 552 insertions(+), 4 deletions(-) diff --git a/igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java b/igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java new file mode 100644 index 0000000..cbc2d81 --- /dev/null +++ b/igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java @@ -0,0 +1,95 @@ +package com.ld.igds.m.service; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.hibernate.Session; +import org.springframework.stereotype.Component; + +import com.bstek.bdf2.core.orm.hibernate.HibernateDao; +import com.bstek.dorado.data.provider.Page; +import com.ld.igds.models.InoutVarietyChange; +import com.ld.igds.util.ContextUtil; + +@Component +public class HVarietyChangeService extends HibernateDao { + + public void pageData(Page<InoutVarietyChange> page, Map<String, Object> param) + throws Exception { + String hql = " from " + InoutVarietyChange.class.getName() + + " where companyId=:companyId"; + + Map<String, Object> args = new HashMap<String, Object>(); + args.put("companyId", ContextUtil.getCompanyId()); + + if (null != param) { + + String str = (String) param.get("depotId"); + if (StringUtils.isNotEmpty(str)) { + hql += " and depotId =:depotId"; + args.put("depotId", str); + } + + str = (String) param.get("foodVariety"); + if (StringUtils.isNotEmpty(str)) { + hql += " and foodVariety =:foodVariety"; + args.put("foodVariety", str); + } + + str = (String) param.get("type"); + if (StringUtils.isNotEmpty(str)) { + hql += " and type =:type"; + args.put("type", str); + } + } + + String count = "select count(*) " + hql; + + hql += " order by changeTime desc"; + + this.pagingQuery(page, hql, count, args); + + } + + public void saveData(InoutVarietyChange data) { + if (null == data.getCompanyId()) { + data.setCompanyId(ContextUtil.getCompanyId()); + } + if (null == data.getDeptId()) { + data.setDeptId(ContextUtil.subDeptId(null)); + } + Session session = this.getSessionFactory().openSession(); + data.setUpdateTime(new Date()); + try { + if (null == data.getId()) { + data.setId(ContextUtil.getUUID()); + session.save(data); + } else { + session.update(data); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + session.flush(); + session.close(); + } + } + + public String delData(InoutVarietyChange data) { + Session session = this.getSessionFactory().openSession(); + try { + if (null != data.getId()) { + session.delete(data); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + session.flush(); + session.close(); + } + return null; + } + +} diff --git a/igds-inout/src/main/java/com/ld/igds/m/view/VarietyChange.view.xml b/igds-inout/src/main/java/com/ld/igds/m/view/VarietyChange.view.xml new file mode 100644 index 0000000..38d7c30 --- /dev/null +++ b/igds-inout/src/main/java/com/ld/igds/m/view/VarietyChange.view.xml @@ -0,0 +1,393 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ViewConfig> + <Arguments/> + <Context/> + <Model> + <DataType name="dtMain"> + <Property name="creationType">com.ld.igds.models.InoutVarietyChange</Property> + <PropertyDef name="id"> + <Property></Property> + <Property name="label">ID</Property> + </PropertyDef> + <PropertyDef name="companyId"> + <Property></Property> + <Property name="label">缁勭粐缂栫爜</Property> + </PropertyDef> + <PropertyDef name="approvalId"> + <Property></Property> + <Property name="label">鎵瑰噯鏂囧彿</Property> + <Property name="required">false</Property> + </PropertyDef> + <PropertyDef name="deptId"> + <Property></Property> + <Property name="label">鎵�灞炲垎搴�</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("deptPR#loadParents").getResult()}</Property> + <Property name="keyProperty">id</Property> + <Property name="valueProperty">name</Property> + </Property> + </PropertyDef> + <PropertyDef name="depotId"> + <Property></Property> + <Property name="label">鎵�灞炰粨搴�</Property> + <Property name="required">true</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("depotPR#getAllCache").getResult()}</Property> + <Property name="keyProperty">id</Property> + <Property name="valueProperty">name</Property> + </Property> + </PropertyDef> + <PropertyDef name="foodVariety"> + <Property></Property> + <Property name="label">鍙樻洿鍓嶅搧绉�</Property> + <Property name="required">false</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("dicTriggerPR#dicTrigger").getResult("FOOD_VARIETY_")}</Property> + <Property name="keyProperty">code</Property> + <Property name="valueProperty">name</Property> + </Property> + </PropertyDef> + <PropertyDef name="newFoodVariety"> + <Property></Property> + <Property name="label">鍙樻洿鍚庡搧绉�</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("dicTriggerPR#dicTrigger").getResult("FOOD_VARIETY_")}</Property> + <Property name="keyProperty">code</Property> + <Property name="valueProperty">name</Property> + </Property> + <Property name="required">false</Property> + </PropertyDef> + <PropertyDef name="foodType"> + <Property></Property> + <Property name="label">鍙樻洿鍓嶆�ц川</Property> + <Property name="required">false</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("dicTriggerPR#dicTrigger").getResult("FOOD_TYPE_")}</Property> + <Property name="keyProperty">code</Property> + <Property name="valueProperty">name</Property> + </Property> + </PropertyDef> + <PropertyDef name="newFoodType"> + <Property></Property> + <Property name="label">鍙樻洿鍚庢�ц川</Property> + <Property name="required">false</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("dicTriggerPR#dicTrigger").getResult("FOOD_TYPE_")}</Property> + <Property name="keyProperty">code</Property> + <Property name="valueProperty">name</Property> + </Property> + </PropertyDef> + <PropertyDef name="number"> + <Property></Property> + <Property name="label">绮鏁伴噺</Property> + <Property name="dataType">Double</Property> + <Property name="displayFormat">#,##0.00 kG</Property> + </PropertyDef> + <PropertyDef name="changeNumber"> + <Property></Property> + <Property name="label">鍒掕浆鏁伴噺</Property> + <Property name="dataType">Double</Property> + <Property name="displayFormat">#,##0.00 kG</Property> + </PropertyDef> + <PropertyDef name="changeTime"> + <Property name="dataType">Date</Property> + <Property name="label">鍙樻洿鏃堕棿</Property> + <Property name="required">true</Property> + </PropertyDef> + <PropertyDef name="updateTime"> + <Property name="dataType">DateTime</Property> + <Property name="label">鏇存柊鏃堕棿</Property> + </PropertyDef> + <PropertyDef name="updateUser"> + <Property></Property> + <Property name="label">鏇存柊浜�</Property> + </PropertyDef> + <PropertyDef name="remark"> + <Property></Property> + <Property name="label">澶囨敞</Property> + </PropertyDef> + </DataType> + <DataType name="dtParam"> + <PropertyDef name="deptId"> + <Property></Property> + <Property name="label">鎵�灞炲垎搴�</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("deptPR#loadParents").getResult()}</Property> + <Property name="keyProperty">id</Property> + <Property name="valueProperty">name</Property> + </Property> + </PropertyDef> + <PropertyDef name="depotId"> + <Property></Property> + <Property name="label">鎵�灞炰粨搴�</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("depotPR#getAllCache").getResult()}</Property> + <Property name="keyProperty">id</Property> + <Property name="valueProperty">name</Property> + </Property> + </PropertyDef> + <PropertyDef name="foodVariety"> + <Property></Property> + <Property name="label">绮鍝佺</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("dicTriggerPR#dicTrigger").getResult("FOOD_VARIETY_")}</Property> + <Property name="keyProperty">code</Property> + <Property name="valueProperty">name</Property> + </Property> + </PropertyDef> + </DataType> + </Model> + <View layout="padding:5;regionPadding:5"> + <ClientEvent name="onReady">
 +view.get("#dsParam").insert({});
 +
 +
 +addMain = function(){
 + view.get("#dsMain").insert({
 + });
 + view.get("#dialogMain").show();
 +}</ClientEvent> + <Property name="packages">font-awesome,css-common</Property> + <DataSet id="dsMain"> + <Property name="loadMode">lazy</Property> + <Property name="dataProvider">varietyChangePR#pageData</Property> + <Property name="dataType">[dtMain]</Property> + <Property name="pageSize">15</Property> + <Property name="parameter"></Property> + </DataSet> + <DataSet id="dsParam"> + <Property name="dataType">dtParam</Property> + </DataSet> + <Container layout="regionPadding:10" layoutConstraint="top"> + <Property name="exClassName">bg-color</Property> + <Property name="contentOverflow">hidden</Property> + <Property name="height">55</Property> + <Label layoutConstraint="left"> + <Property name="text">鑿滃崟鏍忥細</Property> + </Label> + <Button layoutConstraint="left"> + <ClientEvent name="onClick">addMain();
 +</ClientEvent> + <Property name="caption">鏂板</Property> + <Property name="exClassName">btn-default</Property> + <Property name="iconClass">fa fa-plus</Property> + </Button> + <Button layoutConstraint="left"> + <ClientEvent name="onClick">var data = view.get("#dsMain.data:#");
 +if(data){
 + view.get("#dialogMain").show();
 +}</ClientEvent> + <Property name="caption">璋冩暣</Property> + <Property name="exClassName">btn-warm</Property> + <Property name="iconClass">fa fa-pencil</Property> + </Button> + <Button layoutConstraint="left"> + <ClientEvent name="onClick">var data = view.get("#dsMain.data:#");
 +if(!data){
 + return;
 +}
 +view.get("#ajaxDel").set("parameter",data).execute(function(result){
 + if(result){
 + $alert(result);
 + return;
 + }else{
 + data.remove();
 + }
 +});</ClientEvent> + <Property name="caption">鍒犻櫎</Property> + <Property name="exClassName">btn-warn</Property> + <Property name="iconClass">fa fa-minus</Property> + </Button> + <Button layoutConstraint="left"> + <ClientEvent name="onClick">view.get("#dsMain").flushAsync();
 +</ClientEvent> + <Property name="caption">鍒锋柊</Property> + <Property name="exClassName">btn-default</Property> + <Property name="iconClass">fa fa-refresh</Property> + </Button> + </Container> + <Container layout="regionPadding:10" layoutConstraint="center"> + <Property name="exClassName">bg-color</Property> + <AutoForm> + <Property name="cols">*,*,*,*</Property> + <Property name="dataSet">dsParam</Property> + <Property name="labelAlign">right</Property> + <Property name="labelSeparator">锛�</Property> + <Property name="labelWidth">100</Property> + <AutoFormElement> + <Property name="name">depotId</Property> + <Property name="property">depotId</Property> + <Property name="trigger">autoMappingDropDown2</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">foodVariety</Property> + <Property name="property">foodVariety</Property> + <Property name="trigger">autoMappingDropDown2</Property> + <Editor/> + </AutoFormElement> + <Button layoutConstraint="left"> + <ClientEvent name="onClick">var param = view.get("#dsParam.data");
 +view.get("#dsMain").set("parameter",param.toJSON()).flushAsync();</ClientEvent> + <Property name="caption">鏌ヨ</Property> + <Property name="exClassName">btn-default</Property> + <Property name="iconClass">fa fa-refresh</Property> + </Button> + </AutoForm> + <DataGrid layoutConstraint="center padding:5px"> + <ClientEvent name="onDataRowDoubleClick">var data = view.get("#dsMain.data:#");
 +if(data){
 + view.get("#dialogMain").show();
 +}</ClientEvent> + <Property name="dataSet">dsMain</Property> + <Property name="readOnly">true</Property> + <RowNumColumn/> + <DataColumn name="depotId"> + <Property name="property">depotId</Property> + <Property name="align">center</Property> + </DataColumn> + <DataColumn name="foodVariety"> + <Property name="property">foodVariety</Property> + <Property name="align">center</Property> + </DataColumn> + <DataColumn name="newFoodVariety"> + <Property name="property">newFoodVariety</Property> + <Property name="align">center</Property> + </DataColumn> + <DataColumn name="changeTime"> + <Property name="property">changeTime</Property> + <Property name="align">center</Property> + </DataColumn> + <DataColumn name="updateTime"> + <Property name="property">updateTime</Property> + <Property name="align">center</Property> + </DataColumn> + <DataColumn name="updateUser"> + <Property name="property">updateUser</Property> + <Property name="align">center</Property> + </DataColumn> + <DataColumn name="remark"> + <Property name="property">remark</Property> + </DataColumn> + </DataGrid> + </Container> + <Container layout="regionPadding:10" layoutConstraint="bottom"> + <Property name="exClassName">bg-color</Property> + <DataPilot layoutConstraint="right"> + <Property name="itemCodes">pageSize,pages</Property> + <Property name="dataSet">dsMain</Property> + </DataPilot> + </Container> + <Dialog id="dialogMain" layout="padding:5;regionPadding:10"> + <Property name="width">800</Property> + <Property name="caption">绮鍝佺鍙樻洿淇℃伅</Property> + <Property name="iconClass">fa fa-flag-o</Property> + <Property name="closeable">false</Property> + <Buttons> + <Button> + <ClientEvent name="onClick">var data = view.get("#dsMain.data:#");
 +if(data.validate() != 'ok'){
 + $notify("鏁版嵁鏍¢獙澶辫触锛侊紒");
 + return;
 +}
 +view.get("#uaAction").set("parameter",data).execute(function(){
 + self.get("parent").hide();
 +});</ClientEvent> + <Property name="caption">纭</Property> + <Property name="iconClass">fa fa-check-circle</Property> + <Property name="width">90</Property> + </Button> + <Button> + <ClientEvent name="onClick">view.get("#dsMain.data:#").cancel();
 +self.get("parent").hide();</ClientEvent> + <Property name="caption">鍙栨秷</Property> + <Property name="iconClass">fa fa-times-circle</Property> + <Property name="width">90</Property> + </Button> + </Buttons> + <Children> + <AutoForm> + <Property name="dataSet">dsMain</Property> + <Property name="cols">*,*</Property> + <Property name="labelWidth">120</Property> + <Property name="labelAlign">right</Property> + <Property name="labelSeparator">锛�</Property> + <AutoFormElement> + <Property name="name">depotId</Property> + <Property name="property">depotId</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">approvalId</Property> + <Property name="property">approvalId</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">foodVariety</Property> + <Property name="property">foodVariety</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">newFoodVariety</Property> + <Property name="property">newFoodVariety</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">foodType</Property> + <Property name="property">foodType</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">newFoodType</Property> + <Property name="property">newFoodType</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">number</Property> + <Property name="property">number</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">changeNumber</Property> + <Property name="property">changeNumber</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">changeTime</Property> + <Property name="property">changeTime</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">updateUser</Property> + <Property name="property">updateUser</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement layoutConstraint="colSpan:2"> + <Property name="name">remark</Property> + <Property name="property">remark</Property> + <Property name="editorType">TextArea</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">updateTime</Property> + <Property name="property">updateTime</Property> + <Property name="readOnly">true</Property> + <Editor/> + </AutoFormElement> + </AutoForm> + </Children> + <Tools/> + </Dialog> + <UpdateAction id="uaAction"> + <Property name="dataResolver">varietyChangePR#saveData</Property> + <UpdateItem> + <Property name="dataSet">dsMain</Property> + <Property name="dataPath">[#current]</Property> + </UpdateItem> + </UpdateAction> + <AjaxAction id="ajaxDel"> + <Property name="confirmMessage">纭畾瑕佸垹闄ゅ悧锛�</Property> + <Property name="service">varietyChangePR#delData</Property> + </AjaxAction> + </View> +</ViewConfig> diff --git a/igds-inout/src/main/java/com/ld/igds/m/view/VarietyChangePR.java b/igds-inout/src/main/java/com/ld/igds/m/view/VarietyChangePR.java new file mode 100644 index 0000000..c490af8 --- /dev/null +++ b/igds-inout/src/main/java/com/ld/igds/m/view/VarietyChangePR.java @@ -0,0 +1,64 @@ +package com.ld.igds.m.view; + +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.bstek.dorado.annotation.DataProvider; +import com.bstek.dorado.annotation.DataResolver; +import com.bstek.dorado.annotation.Expose; +import com.bstek.dorado.data.provider.Page; +import com.ld.igds.m.service.HVarietyChangeService; +import com.ld.igds.models.InoutVarietyChange; + +/** + * 缁煎悎涓氬姟-绮鍝佺鍙樻洿璁板綍 + * + * @author: andy.jia + * @description: + * @version: + * @data:2020骞�5鏈�28鏃� + * + */ +@Component +public class VarietyChangePR { + + @Autowired + private HVarietyChangeService service; + + /** + * varietyChangePR#pageData + * + * @param page + * @param param + * @throws Exception + */ + @DataProvider + public void pageData(Page<InoutVarietyChange> page, Map<String, Object> param) + throws Exception { + service.pageData(page, param); + } + + /** + * varietyChangePR#saveData + * + * @param data + */ + @DataResolver + public void saveData(InoutVarietyChange data) { + service.saveData(data); + } + + /** + * varietyChangePR#delData + * + * @param data + * @return + */ + @Expose + public String delData(InoutVarietyChange data) { + return service.delData(data); + } + +} diff --git a/igds-web/src/main/java/com/ld/igds/TestAction.java b/igds-web/src/main/java/com/ld/igds/TestAction.java index c86783b..5fb216b 100644 --- a/igds-web/src/main/java/com/ld/igds/TestAction.java +++ b/igds-web/src/main/java/com/ld/igds/TestAction.java @@ -38,8 +38,6 @@ private RedisUtil redisUtil; @Autowired private WeatherScheduled weatherScheduled; - @Autowired - private TestService testService; @Override public String getUrl() { @@ -127,7 +125,6 @@ return; } log.info("------initRecordCurStorageOUT--------"); - testService.initRecordCurStorageOUT(p1, p2); } if (t.equals("reset-in-storage")) { @@ -137,7 +134,6 @@ if (null == p2) {// 寮�濮嬫椂闂� return; } - testService.initRecordCurStorageIN(p1, p2); } if (t.equals("weather11")) { -- Gitblit v1.9.3