jiazx0107@163.com
2023-05-27 52d437b89025b47713b4079881f2890ee2c939c7
调整模块-取消错误代码,添加TODO标记后期处理
已添加3个文件
已修改1个文件
556 ■■■■■ 文件已修改
igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/m/view/VarietyChange.view.xml 393 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/m/view/VarietyChangePR.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-web/src/main/java/com/ld/igds/TestAction.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
    }
}
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(&quot;deptPR#loadParents&quot;).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(&quot;depotPR#getAllCache&quot;).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(&quot;dicTriggerPR#dicTrigger&quot;).getResult(&quot;FOOD_VARIETY_&quot;)}</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(&quot;dicTriggerPR#dicTrigger&quot;).getResult(&quot;FOOD_VARIETY_&quot;)}</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(&quot;dicTriggerPR#dicTrigger&quot;).getResult(&quot;FOOD_TYPE_&quot;)}</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(&quot;dicTriggerPR#dicTrigger&quot;).getResult(&quot;FOOD_TYPE_&quot;)}</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(&quot;deptPR#loadParents&quot;).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(&quot;depotPR#getAllCache&quot;).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(&quot;dicTriggerPR#dicTrigger&quot;).getResult(&quot;FOOD_VARIETY_&quot;)}</Property>
          <Property name="keyProperty">code</Property>
          <Property name="valueProperty">name</Property>
        </Property>
      </PropertyDef>
    </DataType>
  </Model>
  <View layout="padding:5;regionPadding:5">
    <ClientEvent name="onReady">&#xD;
view.get(&quot;#dsParam&quot;).insert({});&#xD;
&#xD;
&#xD;
addMain = function(){&#xD;
    view.get(&quot;#dsMain&quot;).insert({&#xD;
    });&#xD;
    view.get(&quot;#dialogMain&quot;).show();&#xD;
}</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();&#xD;
</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(&quot;#dsMain.data:#&quot;);&#xD;
if(data){&#xD;
    view.get(&quot;#dialogMain&quot;).show();&#xD;
}</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(&quot;#dsMain.data:#&quot;);&#xD;
if(!data){&#xD;
    return;&#xD;
}&#xD;
view.get(&quot;#ajaxDel&quot;).set(&quot;parameter&quot;,data).execute(function(result){&#xD;
    if(result){&#xD;
        $alert(result);&#xD;
        return;&#xD;
    }else{&#xD;
        data.remove();&#xD;
    }&#xD;
});</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(&quot;#dsMain&quot;).flushAsync();&#xD;
</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(&quot;#dsParam.data&quot;);&#xD;
view.get(&quot;#dsMain&quot;).set(&quot;parameter&quot;,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(&quot;#dsMain.data:#&quot;);&#xD;
if(data){&#xD;
    view.get(&quot;#dialogMain&quot;).show();&#xD;
}</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(&quot;#dsMain.data:#&quot;);&#xD;
if(data.validate() != 'ok'){&#xD;
    $notify(&quot;数据校验失败!!&quot;);&#xD;
    return;&#xD;
}&#xD;
view.get(&quot;#uaAction&quot;).set(&quot;parameter&quot;,data).execute(function(){&#xD;
    self.get(&quot;parent&quot;).hide();&#xD;
});</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(&quot;#dsMain.data:#&quot;).cancel();&#xD;
self.get(&quot;parent&quot;).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>
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);
    }
}
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")) {