jiazx0107@163.com
2023-05-29 0efbf246a22f7331cf2e16bd659caea22a494102
调整模块货位和库存2
已修改7个文件
已添加1个文件
244 ■■■■■ 文件已修改
igds-core/src/main/java/com/ld/igds/common/impl/CommonDataServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/constant/DepotStatus.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/constant/RedisConst.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/data/SimpleDepot.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/view/DepotPR.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/view/DepotStore.view.xml 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/view/DepotStorePR.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/view/service/HDepotService.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/common/impl/CommonDataServiceImpl.java
@@ -19,6 +19,7 @@
import com.ld.igds.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.CDATA;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -51,7 +52,6 @@
    @Override
    public List<Depot> getCacheDepotList(String companyId) {
        String patten = RedisConst.buildKey(companyId, RedisConst.KEY_DEPOT);
        Set<String> keys = redisUtil.keys(patten);
igds-core/src/main/java/com/ld/igds/constant/DepotStatus.java
@@ -7,12 +7,12 @@
    STATUS_1("1", "空仓"),
    STATUS_2("2", "入库中"),
    STATUS_3("3", "满仓"),
    STATUS_3("3", "封仓"),
    STATUS_4("4", "出库中"),
    STATUS_31("31", "满仓-气调中"),
    STATUS_32("32", "满仓-熏蒸中"),
    STATUS_33("33", "满仓-通风中"),
    STATUS_34("34", "满仓-温控中"),
    STATUS_31("31", "封仓-气调中"),
    STATUS_32("32", "封仓-熏蒸中"),
    STATUS_33("33", "封仓-通风中"),
    STATUS_34("34", "封仓-温控中"),
    STATUS_9("9", "其他");
    private String code;
igds-core/src/main/java/com/ld/igds/constant/RedisConst.java
@@ -72,7 +72,7 @@
    /**
     * ä»“库列表KEY
     */
    public static final String KEY_DEPOT = "KEY_DEPOT_DATA";
    public static final String KEY_DEPOT = "KEY_DEPOT";
    /**
     * ä»“库参数列表KEY
igds-core/src/main/java/com/ld/igds/data/SimpleDepot.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
package com.ld.igds.data;
import com.bstek.dorado.annotation.PropertyDef;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
/**
 * @Desc: ç”¨äºŽä½œä¸ºä¸‹æ‹‰æ¡†çš„æ•°æ®å°è£…,只包含基础信息
 * @author: andy.jia
 * @update-time: 2023/5/29 11:58
 */
@Data
public class SimpleDepot {
    @PropertyDef(label = "货位编号")
    private String id;
    @PropertyDef(label = "组织编码")
    private String companyId;
    @PropertyDef(label = "所属分库")
    private String deptId;
    @PropertyDef(label = "货位名称")
    private String name;
    @PropertyDef(label = "所属仓房")
    private String buildingId;
    @PropertyDef(label = "所属廒间")
    private String granaryId;
    @PropertyDef(label = "仓库类型", description = "根据国标配置类型,平房仓、立筒仓、浅圆仓、储油罐")
    private String depotType;
    @PropertyDef(label = "仓库状态", description = "与库存表关联,通过库存变更")
    private String depotStatus;
}
igds-core/src/main/java/com/ld/igds/view/DepotPR.java
@@ -50,8 +50,8 @@
    private RemoteManager remoteManager;
    @Autowired
    private ExeOrderService exeOrderService;
    /**
     * ä»“房类型-非国标定义
     * ${dorado.getDataProvider("depotPR#triggerDepotType").getResult()}
@@ -68,7 +68,7 @@
        list.add(new DicTrigger(DepotType.TYPE_99.getCode(), DepotType.TYPE_99.getMsg()));
        return list;
    }
    /**
     * ä»“房状态
     * ${dorado.getDataProvider("depotPR#triggerDepotStatus").getResult()}
@@ -89,7 +89,7 @@
        list.add(new DicTrigger(DepotStatus.STATUS_9.getCode(), DepotStatus.STATUS_9.getMsg()));
        return list;
    }
    /**
     * ç²®é£Ÿç­‰çº§
     * ${dorado.getDataProvider("depotPR#triggerFoodLevel").getResult()}
@@ -123,7 +123,7 @@
        list.add(new DicTrigger("9", "其他"));
        return list;
    }
    /**
     * ç®¡ç†æ–¹å¼
     * ${dorado.getDataProvider("depotPR#triggerManagerType").getResult()}
@@ -211,8 +211,9 @@
    // ${dorado.getDataProvider("depotPR#getAllCache").getResult()}
    @DataProvider
    public List<Depot> getAllCache(String name) {
        return depotService.getAllCache(name, null);
        return depotService.getAllCache(name, ContextUtil.getCompanyId());
    }
    // depotPR#ajaxGetAllCache
    @Expose
@@ -223,7 +224,7 @@
    // depotPR#flushCache
    @Expose
    public void flushCache() {
        depotService.flushCache(null);
        depotService.flushCache(ContextUtil.getCompanyId());
    }
    // depotPR#saveOrUpdate
@@ -241,14 +242,7 @@
        if (null == depot.getCompanyId()) {
            depotService.saveDepot(depot);
        } else {
            depotService.updataDepot(depot);
// TODO
//            if (StringUtils.isNotEmpty(depot.getEditTag())) {
//                // è¡¨ç¤ºä¿®æ”¹äº†ä»“库状态
//                if (depot.getEditTag().indexOf("depotStatus") >= 0) {
//                    this.pullDepotStatus(depot.getCompanyId(), depot.getId(), depot.getDepotStatus());
//                }
//            }
            depotService.updateDepot(depot);
        }
        flushCache();
@@ -323,38 +317,26 @@
        depotService.updateFreq(freq);
    }
    public void updateByStore(DepotStore data) {
        depotService.updateByStore(data);
    }
    public void updateByStore(DepotStore data) throws Exception {
    /**
     * æ ¹æ®ä»“库初始化一条出入库的流水记录
     * public void initDepotInoutRecord(Depot depot) {
     * InoutRecord data = new InoutRecord();
     * if (StringUtils.isEmpty(depot.getCompanyId())) {
     * depot.setCompanyId(ContextUtil.getCompanyId());
     * }
     * data.setId(depot.getCompanyId() + "-" + depot.getId() + "-"
     * + DateFormatUtils.format(new Date(), "yyyyMMdd"));
     * data.setCheckStatus("PASS");
     * data.setCompanyId(depot.getCompanyId());
     * data.setCompleteTime(new Date());
     * data.setCompleteUser(ContextUtil.getLoginUserCName());
     * data.setDepotId(depot.getId());
     * data.setDeptId(depot.getDeptId());
     * data.setFoodVariety(depot.getFoodVariety());
     * data.setFoodYear(DateFormatUtils.format(new Date(), "yyyy"));
     * data.setProgress("RECORD");
     * data.setRecordStatus("ADD");
     * data.setType("NONE");
     * if (depot.getStorageReal() == null) {
     * data.setCurStorage(0);
     * } else {
     * data.setCurStorage(depot.getStorageReal());
     * }
     * depotService.initInoutRecord(data);
     * }
     */
        Depot depot = depotService.getDepotById(data.getCompanyId(), data.getDepotId());
        if (null == depot) return;
        depot.setStorageReal(data.getStorageReal());
        depot.setDepotStatus(data.getDepotStatus());
        depot.setFoodLevel(data.getFoodLevel());
        depot.setFoodLocation(data.getFoodLocation());
        depot.setFoodVariety(data.getFoodVariety());
        depot.setFoodType(data.getFoodType());
        depot.setFoodYear(data.getFoodYear());
        if (null != data.getStoreDate()) {
            depot.setStoreDate(data.getStoreDate());
        }
        depotService.updateDepot(depot);
    }
    public String pullDepotStatus(String companyId, String depotId, String status) {
        // æ‰§è¡ŒæŽ¨é€
igds-core/src/main/java/com/ld/igds/view/DepotStore.view.xml
@@ -125,7 +125,7 @@
      <Buttons>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsMain.data:#&quot;);&#xD;
view.get(&quot;#uaAction&quot;).set(&quot;parameter&quot;,data).execute(function(result){&#xD;
view.get(&quot;#uaAction&quot;).execute(function(result){&#xD;
    if(result){&#xD;
        $alert(result);&#xD;
    }else{&#xD;
@@ -204,7 +204,7 @@
            <Editor/>
          </AutoFormElement>
          <Label>
            <Property name="text">货位状态=空仓/入库中/出库中,必填</Property>
            <Property name="text">货位状态=封仓/入库中/出库中,必填</Property>
            <Property name="style">
              <Property name="color">red</Property>
              <Property name="font-size">12px</Property>
@@ -216,9 +216,10 @@
            <Editor/>
          </AutoFormElement>
          <Label>
            <Property name="text">货位状态=空仓/入库中/出库中,必填</Property>
            <Property name="text">货位状态=封仓/入库中/出库中,必填</Property>
            <Property name="style">
              <Property name="color">blue</Property>
              <Property name="color">red</Property>
              <Property name="font-size">12px</Property>
            </Property>
          </Label>
          <AutoFormElement>
@@ -228,9 +229,10 @@
            <Editor/>
          </AutoFormElement>
          <Label>
            <Property name="text">货位状态=空仓/入库中/出库中,必填</Property>
            <Property name="text">货位状态=封仓/入库中/出库中,必填</Property>
            <Property name="style">
              <Property name="color">blue</Property>
              <Property name="color">red</Property>
              <Property name="font-size">12px</Property>
            </Property>
          </Label>
          <AutoFormElement>
@@ -241,7 +243,8 @@
          <Label>
            <Property name="text">必填,空仓=0,入库/出库数量之和</Property>
            <Property name="style">
              <Property name="color">blue</Property>
              <Property name="color">red</Property>
              <Property name="font-size">12px</Property>
            </Property>
          </Label>
          <AutoFormElement>
@@ -252,7 +255,8 @@
          <Label>
            <Property name="text">必填,空仓=0,入库/出库结算数量之和</Property>
            <Property name="style">
              <Property name="color">blue</Property>
              <Property name="color">red</Property>
              <Property name="font-size">12px</Property>
            </Property>
          </Label>
          <AutoFormElement>
@@ -261,9 +265,10 @@
            <Editor/>
          </AutoFormElement>
          <Label>
            <Property name="text">货位状态=空仓/出库中,必填</Property>
            <Property name="text">货位状态=封仓/出库中,必填</Property>
            <Property name="style">
              <Property name="color">blue</Property>
              <Property name="color">red</Property>
              <Property name="font-size">12px</Property>
            </Property>
          </Label>
          <AutoFormElement>
@@ -272,9 +277,10 @@
            <Editor/>
          </AutoFormElement>
          <Label>
            <Property name="text">货位状态=空仓/入库中/出库中,必填。第一车入仓时间</Property>
            <Property name="text">货位状态=封仓/入库中/出库中,必填。第一车入仓时间</Property>
            <Property name="style">
              <Property name="color">blue</Property>
              <Property name="color">red</Property>
              <Property name="font-size">12px</Property>
            </Property>
          </Label>
          <AutoFormElement>
@@ -285,7 +291,8 @@
          <Label>
            <Property name="text">货位状态=空仓,必填。最后一车粮食出仓时间</Property>
            <Property name="style">
              <Property name="color">blue</Property>
              <Property name="color">red</Property>
              <Property name="font-size">12px</Property>
            </Property>
          </Label>
          <AutoFormElement>
@@ -294,9 +301,10 @@
            <Editor/>
          </AutoFormElement>
          <Label>
            <Property name="text">货位状态=满仓,可填</Property>
            <Property name="text">货位状态=封仓,可填</Property>
            <Property name="style">
              <Property name="color">blue</Property>
              <Property name="font-size">12px</Property>
            </Property>
          </Label>
          <AutoFormElement>
@@ -305,9 +313,10 @@
            <Editor/>
          </AutoFormElement>
          <Label>
            <Property name="text">货位状态=满仓,可填</Property>
            <Property name="text">货位状态=封仓,可填</Property>
            <Property name="style">
              <Property name="color">blue</Property>
              <Property name="font-size">12px</Property>
            </Property>
          </Label>
          <AutoFormElement layoutConstraint="colSpan:2">
igds-core/src/main/java/com/ld/igds/view/DepotStorePR.java
@@ -4,6 +4,7 @@
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;
import com.bstek.dorado.data.provider.Page;
import com.ld.igds.constant.DepotStatus;
import com.ld.igds.models.DepotStore;
import com.ld.igds.view.service.HDepotStoreService;
import org.springframework.stereotype.Component;
@@ -49,9 +50,43 @@
     * @param data
     */
    @DataResolver
    public void saveDepotStore(DepotStore data) {
        //TODO æ ¹æ®é¡µé¢è¯´æ˜Žå¢žåŠ ä¿å­˜å‰éªŒè¯ 2023å¹´5月27日 18:53:56
    public String saveDepotStore(DepotStore data) throws Exception {
        //如果仓库状态=封仓/入库中/出库中
        if (DepotStatus.STATUS_2.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_3.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_4.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_31.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_32.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_33.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_34.getCode().equals(data.getDepotStatus())) {
            if (null == data.getFoodYear()) return "货位状态=封仓/入库中/出库中,收货年度不能为空";
            if (null == data.getCountry()) return "货位状态=封仓/入库中/出库中,国别不能为空";
            if (null == data.getFoodLocation()) return "货位状态=封仓/入库中/出库中,粮食产地不能为空";
            if (null == data.getFoodLocation()) return "货位状态=封仓/入库中/出库中,粮食产地不能为空";
            if (null == data.getStoreDate()) return "货位状态=封仓/入库中/出库中,入库时间不可为空";
        }
        //货位状态=封仓/出库中,必填
        if (DepotStatus.STATUS_3.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_4.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_31.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_32.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_33.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_34.getCode().equals(data.getDepotStatus())) {
            if (null == data.getFullDate()) return "货位状态=封仓/出库中,封仓时间不可为空";
        }
        //货位状态=空仓,必填。最后一车粮食出仓时间
        if (DepotStatus.STATUS_1.getCode().equals(data.getDepotStatus())) {
            if (null == data.getOutDate()) return "货位状态=空仓,出仓完成时间不可为空";
        }
        depotStoreService.saveDepotStore(data);
@@ -60,6 +95,8 @@
        //远程同步状态
        depotPR.pullDepotStatus(data.getCompanyId(), data.getDepotId(), data.getDepotStatus());
        return null;
    }
    /**
igds-core/src/main/java/com/ld/igds/view/service/HDepotService.java
@@ -97,6 +97,8 @@
            Map<String, Object> args = new HashMap<>();
            args.put("companyId", companyId);
            list = this.getData(args);
            coreCommonService.setCacheDepot(list, companyId);
        } catch (Exception e) {
            e.printStackTrace();
@@ -147,7 +149,7 @@
     *
     * @throws Exception
     */
    public void updataDepot(Depot depot) throws Exception {
    public void updateDepot(Depot depot) throws Exception {
        Session session = this.getSessionFactory().openSession();
        try {
            flushCache(depot.getCompanyId());
@@ -253,15 +255,6 @@
        coreCommonService.setCacheDepotConf(list, companyId);
    }
//    public void initInoutRecord(InoutRecord inoutRecord) {
//        Session session = this.getSessionFactory().openSession();
//        try {
//            session.saveOrUpdate(inoutRecord);
//        } finally {
//            session.flush();
//            session.close();
//        }
//    }
    public void updateFreq(String freq) {
        String sql = "UPDATE D_DEPOT_CONF SET GRAIN_FREQ_ =:freq WHERE COMPANY_ID_ =:companyId";
@@ -306,27 +299,6 @@
        if (null == list || list.isEmpty()) return;
        for (Depot depot : list) {
            ContextUtil.updateSubDept(depot.getId(), depot.getDeptId());
        }
    }
    public void updateByStore(DepotStore depotStore) {
        String sql = "UPDATE D_DEPOT SET STORAGE_REAL_ =:storageReal,DEPOT_STATUS_=:depotStatus ";
        Session session = this.getSessionFactory().openSession();
        String companyId = depotStore.getCompanyId();
        if (null == companyId) {
            companyId = ContextUtil.getCompanyId();
        }
        try {
            sql += " WHERE COMPANY_ID_ =:companyId AND ID_=:id";
            SQLQuery query = session.createSQLQuery(sql);
            query.setDouble("storageReal", depotStore.getStorageReal());
            query.setString("depotStatus", depotStore.getDepotStatus());
            query.setString("companyId", companyId);
            query.setString("id", depotStore.getDepotId());
            query.executeUpdate();
        } finally {
            session.flush();
            session.close();
        }
    }
}