YYC
2023-07-13 43a14ad6fbb68a9c0ce787acce28ce446aac13b0
添加扦样信息
已修改9个文件
271 ■■■■ 文件已修改
igds-core/src/main/java/com/ld/igds/inout/InoutConstant.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/view/InoutDataPR.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/view/InoutHand.view.xml 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/view/InoutList.view.xml 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/m/InoutManageUtil.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/m/service/HLossOverService.java 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/models/InoutLossOver.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/models/inout.model.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/inout/InoutConstant.java
@@ -192,7 +192,18 @@
     * 计划明细类型 -轮入计划
     **/
    public static final String PLAN_DETAIL_TYPE_2 = "2";
    /**
     * 检测结果 -合格
     */
    public static final String RESULT_1 = "1";
    /**
     * 检测结果 -不合格
     */
    public static final String RESULT_0 = "0";
    public static final String SAMPLE_TYPE_MANUAL = "0";
    public static final String SAMPLE_TYPE_AUTOMATIC = "1";
    public static final String SAMPLE_TYPE_RANDOM = "2";
    /**
     * 根据业务类型和 当前状态返回当前状态的流程名称
igds-inout/src/main/java/com/ld/igds/inout/view/InoutDataPR.java
@@ -42,9 +42,8 @@
    private InoutReportManager inoutReportManager;
    @Resource
    private InoutManager inoutManager;
    // ${dorado.getDataProvider("inoutDataPR#triggerRecordStatus1").getResult()}
    @DataProvider
    public List<DicTrigger> triggerRecordStatus1() {
@@ -54,6 +53,25 @@
        return list;
    }
    // ${dorado.getDataProvider("inoutDataPR#triggerResult").getResult()}
    @DataProvider
    public List<DicTrigger> triggerResult() {
        List<DicTrigger> list = new ArrayList<DicTrigger>();
        list.add(new DicTrigger(InoutConstant.RESULT_1, "合格"));
        list.add(new DicTrigger(InoutConstant.RESULT_0, "不合格"));
        return list;
    }
    // ${dorado.getDataProvider("inoutDataPR#triggerSampleType").getResult()}
    @DataProvider
    public List<DicTrigger> triggerSampleType() {
        List<DicTrigger> list = new ArrayList<DicTrigger>();
        list.add(new DicTrigger(InoutConstant.SAMPLE_TYPE_MANUAL, "人工"));
        list.add(new DicTrigger(InoutConstant.SAMPLE_TYPE_AUTOMATIC, "自动"));
        list.add(new DicTrigger(InoutConstant.SAMPLE_TYPE_RANDOM, "智能随机"));
        return list;
    }
    /**
     * inoutDataPR#pageInoutData
     *
igds-inout/src/main/java/com/ld/igds/inout/view/InoutHand.view.xml
@@ -108,6 +108,34 @@
        <Property></Property>
        <Property name="label">运算符号</Property>
      </PropertyDef>
      <PropertyDef name="operaSymbolValue">
        <Property/>
      </PropertyDef>
      <PropertyDef name="addNum">
        <Property name="dataType">Double</Property>
        <Property name="label">增重</Property>
      </PropertyDef>
      <PropertyDef name="deNum">
        <Property name="dataType">Double</Property>
        <Property name="label">扣重</Property>
      </PropertyDef>
      <PropertyDef name="addPrice">
        <Property name="dataType">Double</Property>
        <Property name="label">增价</Property>
      </PropertyDef>
      <PropertyDef name="dePrice">
        <Property name="dataType">Double</Property>
        <Property name="label">扣价</Property>
      </PropertyDef>
      <PropertyDef name="result">
        <Property/>
        <Property name="label">检验结果</Property>
        <Property name="mapping">
          <Property name="keyProperty">code</Property>
          <Property name="valueProperty">name</Property>
          <Property name="mapValues">${dorado.getDataProvider(&quot;inoutDataPR#triggerResult&quot;).getResult()}</Property>
        </Property>
      </PropertyDef>
    </DataType>
  </Model>
  <View layout="padding:5;regionPadding:5">
@@ -556,8 +584,29 @@
              <Property name="label">质检时间</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">sampleUser</Property>
              <Property name="property">sampleUser</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">sampleTime</Property>
              <Property name="property">sampleTime</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">sampleType</Property>
              <Property name="property">sampleType</Property>
              <Property name="editorType">RadioGroup</Property>
              <Editor/>
            </AutoFormElement>
          </AutoForm>
          <DataGrid id="dataGridCheckItem" layoutConstraint="padding:10">
            <ClientEvent name="onCellValueEdit">var data = view.get(&quot;#dsMain.data:#&quot;);&#xD;
if(data){&#xD;
    console.log(data,&quot;inoutHand&quot;);&#xD;
}&#xD;
</ClientEvent>
            <Property name="dataSet">dsMain</Property>
            <Property name="dataPath">#.checkItems</Property>
            <Property name="highlightCurrentRow">false</Property>
@@ -579,14 +628,38 @@
              <Property name="property">unit</Property>
              <Property name="width">80</Property>
              <Property name="readOnly">true</Property>
            </DataColumn>
            <DataColumn name="standardValue">
              <Property name="property">standardValue</Property>
              <Property name="readOnly">true</Property>
              <Property name="align">center</Property>
            </DataColumn>
            <DataColumn name="operaSymbolValue">
              <Property name="property">operaSymbolValue</Property>
              <Property name="align">center</Property>
              <Property name="caption">标准值</Property>
              <Property name="readOnly">true</Property>
            </DataColumn>
            <DataColumn name="deNum">
              <Property name="property">deNum</Property>
              <Property name="align">center</Property>
            </DataColumn>
            <DataColumn name="addNum">
              <Property name="property">addNum</Property>
              <Property name="align">center</Property>
            </DataColumn>
            <DataColumn name="dePrice">
              <Property name="property">dePrice</Property>
              <Property name="align">center</Property>
            </DataColumn>
            <DataColumn name="addPrice">
              <Property name="property">addPrice</Property>
              <Property name="align">center</Property>
            </DataColumn>
            <DataColumn name="result">
              <Property name="property">result</Property>
              <Property name="align">center</Property>
              <Property name="readOnly">true</Property>
            </DataColumn>
            <DataColumn name="remarks">
              <Property name="property">remarks</Property>
              <Property name="align">center</Property>
            </DataColumn>
          </DataGrid>
        </Container>
igds-inout/src/main/java/com/ld/igds/inout/view/InoutList.view.xml
@@ -978,6 +978,22 @@
                  <Property name="label">质检时间</Property>
                  <Editor/>
                </AutoFormElement>
                <AutoFormElement>
                  <Property name="name">sampleUser</Property>
                  <Property name="property">sampleUser</Property>
                  <Editor/>
                </AutoFormElement>
                <AutoFormElement>
                  <Property name="name">sampleTime</Property>
                  <Property name="property">sampleTime</Property>
                  <Editor/>
                </AutoFormElement>
                <AutoFormElement>
                  <Property name="name">sampleType</Property>
                  <Property name="property">sampleType</Property>
                  <Property name="editorType">RadioGroup</Property>
                  <Editor/>
                </AutoFormElement>
              </AutoForm>
              <DataGrid id="dataGridCheckItem" layoutConstraint="padding:10">
                <Property name="dataSet">dsMain</Property>
@@ -1001,14 +1017,38 @@
                  <Property name="property">unit</Property>
                  <Property name="width">80</Property>
                  <Property name="readOnly">true</Property>
                </DataColumn>
                <DataColumn name="standardValue">
                  <Property name="property">standardValue</Property>
                  <Property name="readOnly">true</Property>
                  <Property name="align">center</Property>
                </DataColumn>
                <DataColumn name="operaSymbolValue">
                  <Property name="property">operaSymbolValue</Property>
                  <Property name="align">center</Property>
                  <Property name="caption">标准值</Property>
                  <Property name="readOnly">true</Property>
                </DataColumn>
                <DataColumn name="deNum">
                  <Property name="property">deNum</Property>
                  <Property name="align">center</Property>
                </DataColumn>
                <DataColumn name="addNum">
                  <Property name="property">addNum</Property>
                  <Property name="align">center</Property>
                </DataColumn>
                <DataColumn name="dePrice">
                  <Property name="property">dePrice</Property>
                  <Property name="align">center</Property>
                </DataColumn>
                <DataColumn name="addPrice">
                  <Property name="property">addPrice</Property>
                  <Property name="align">center</Property>
                </DataColumn>
                <DataColumn name="result">
                  <Property name="property">result</Property>
                  <Property name="align">center</Property>
                  <Property name="readOnly">true</Property>
                </DataColumn>
                <DataColumn name="remarks">
                  <Property name="property">remarks</Property>
                  <Property name="align">center</Property>
                </DataColumn>
              </DataGrid>
            </Container>
igds-inout/src/main/java/com/ld/igds/m/InoutManageUtil.java
@@ -82,6 +82,8 @@
     */
    public static final String CACHE_VARIETY_ID = "VARIETY_ID";
    public static final String CACHE_LOSS_OVER_ID = "LOSS_OVER_ID";
    /**
     * 根据类型创建计划ID
     *
igds-inout/src/main/java/com/ld/igds/m/service/HLossOverService.java
@@ -2,15 +2,21 @@
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import com.ld.igds.constant.RedisConst;
import com.ld.igds.inout.InoutConstant;
import com.ld.igds.inout.dto.InoutData;
import com.ld.igds.inout.dto.InoutParam;
import com.ld.igds.inout.service.InoutService;
import com.ld.igds.m.InoutManageUtil;
import com.ld.igds.models.InoutLossOver;
import com.ld.igds.models.InoutVarietyChange;
import com.ld.igds.util.DateUtil;
import com.ld.igds.util.RedisUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
@@ -25,6 +31,8 @@
@Component
public class HLossOverService extends HibernateDao {
    @Resource
    private RedisUtil redisUtil;
    @Autowired
    private InoutService inoutService;
@@ -78,18 +86,6 @@
        data.setUpdateUser(ContextUtil.getLoginUserCName());
        InoutParam param = new InoutParam();
        param.setCompanyId(ContextUtil.getCompanyId());
        param.setDepotId(data.getDepotId());
        param.setProgress(InoutConstant.PROGRESS_RECORD);
        InoutData inoutData = inoutService.getLastRecord(param);
        if (null != inoutData && null != inoutData.getCompleteTime() &&
                data.getSubmitTime().before(inoutData.getCompleteTime())) {
            throw new Exception("登记时间不能早于最后一辆车完成时间:" + DateFormatUtils.format(inoutData.getCompleteTime(), "yyyy-MM-dd HH:mm"));
        }
        try {
            if (null == data.getId()) {
                IUser user = ContextUtil.getLoginUser();
@@ -106,8 +102,8 @@
                if (data.getSubmitTime().before(curDate)) {
                    data.setSubmitTime(curDate);
                }
                String id = addInoutDataByLossOver(data);
                String id = createId(data.getSubmitTime(), data.getCompanyId(), data.getHwdm());
//                String id = addInoutDataByLossOver(data);
                data.setId(id);
@@ -188,4 +184,56 @@
        inoutService.delInoutDataByLossOver(param);
    }
    public List<InoutLossOver> getMaxId(Map<String, Object> param) {
        String hql = "from " + InoutLossOver.class.getName() + " where 1 = 1 ";
        Map<String, Object> args = new HashMap<String, Object>();
        if (null != param) {
            String str = (String) param.get("timeKey");
            if (StringUtils.isNotEmpty(str)) {
                hql += " and id like :timeKey";
                args.put("timeKey", str);
            }
        }
        hql += " order by  id desc ";
        return this.query(hql, args);
    }
    public String createId(Date date, String companyId, String freightId) {
        // 时间戳标签
        String timeKey = DateFormatUtils.format(date, "yyyyMMdd");
        // 从缓存中获取已有的组织编码
        String cacheKey = RedisConst.buildKey(companyId,
                InoutManageUtil.CACHE_LOSS_OVER_ID);
        String cacheId = (String) redisUtil.get(cacheKey);
        if (null != cacheId && cacheId.indexOf(freightId + timeKey) >= 0) {
            String temp = cacheId.substring(cacheId.length() - 3);
            Integer i = Integer.valueOf(temp);
            cacheId = freightId + timeKey + String.format("%03d", ++i);
        } else {
            Map<String, Object> args = new HashMap<>();
            args.put("timeKey", freightId + timeKey + "%");
            List<InoutLossOver> result = getMaxId(args);
            if (null == result || result.size() == 0) {
                cacheId = freightId + timeKey + "001";
            } else {
                int max = 0;
                int num;
                for (InoutLossOver inoutLossOver : result) {
                    num = Integer.parseInt(inoutLossOver.getId().substring(inoutLossOver.getId().length() - 3));
                    max = Math.max(max, num);
                }
                cacheId = freightId + timeKey + String.format("%03d", ++max);
            }
        }
        // 更新缓存
        redisUtil.set(cacheKey, cacheId);
        return cacheId;
    }
}
igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java
@@ -158,7 +158,7 @@
            cacheId = freightId + timeKey + String.format("%03d", i);
        } else {
            Map<String, Object> args = new HashMap<>();
            args.put("timeKey", "%" + freightId + timeKey + "%");
            args.put("timeKey", freightId + timeKey + "%");
            List<InoutVarietyChange> result = getMaxId(args);
            if (null == result || result.size() == 0) {
igds-inout/src/main/java/com/ld/igds/models/InoutLossOver.java
@@ -27,7 +27,7 @@
    @Id
    @Column(name = "ID_", length = 40)
    @PropertyDef(label = "主键")
    @PropertyDef(label = "损益单号", description = "由货位代码+业务日期(yyyyMMdd)+3位顺序号组成")
    private String id;
    @Column(name = "COMPANY_ID_", length = 10)
@@ -41,6 +41,10 @@
    @Column(name = "DEPOT_ID_", length = 50)
    @PropertyDef(label = "所属仓库")
    private String depotId;
    @Column(name = "hwdm", length = 50)
    @PropertyDef(label = "货位代码")
    private String hwdm;
    @Column(name = "TYPE_", length = 10)
    @PropertyDef(label = "类型", description = "损耗/溢出")
@@ -85,7 +89,7 @@
    private double ckzz;
    @Column(name = "AMOUNT_")
    @PropertyDef(label = "重量", description = "损溢数量KG")
    @PropertyDef(label = "重量", description = "损溢数量KG;损耗为正数,溢余为负数")
    private Double amount;
//    @PropertyDef(label = "其中:成货位前损耗(公斤)" )
@@ -184,4 +188,8 @@
    @PropertyDef(label = "更新人")
    private String updateUser;
    @PropertyDef(label = "操作标志", description = "i:新增数据(默认)u:更新数据d:删除数据")
    @Column(name = "czbz", length = 1)
    private String czbz;
}
igds-inout/src/main/java/models/inout.model.xml
@@ -75,7 +75,7 @@
      </Property>
    </PropertyDef>
    <PropertyDef name="khlx">
      <Property/>
      <Property></Property>
      <Property name="label">客户类型</Property>
      <Property name="mapping">
        <Property name="mapValues">${dorado.getDataProvider(&quot;contractManagePR#triggerCustomerType&quot;).getResult()}</Property>
@@ -84,19 +84,19 @@
      </Property>
    </PropertyDef>
    <PropertyDef name="khbh">
      <Property/>
      <Property></Property>
      <Property name="label">客户编码</Property>
    </PropertyDef>
    <PropertyDef name="fddbr">
      <Property/>
      <Property></Property>
      <Property name="label">法定代表人</Property>
    </PropertyDef>
    <PropertyDef name="yzbm">
      <Property/>
      <Property></Property>
      <Property name="label">邮政编码</Property>
    </PropertyDef>
    <PropertyDef name="dzyx">
      <Property/>
      <Property></Property>
      <Property name="label">电子信箱</Property>
    </PropertyDef>
    <PropertyDef name="updateTime">
@@ -387,6 +387,11 @@
    <PropertyDef name="sampleType">
      <Property></Property>
      <Property name="label">扦样方式</Property>
      <Property name="mapping">
        <Property name="mapValues">${dorado.getDataProvider(&quot;inoutDataPR#triggerSampleType&quot;).getResult()}</Property>
        <Property name="keyProperty">code</Property>
        <Property name="valueProperty">name</Property>
      </Property>
    </PropertyDef>
    <PropertyDef name="deCheck">
      <Property name="dataType">double</Property>