Commit 6cbef9ad by 宋祥

1.生成二维码

parent 84e67b8b
package com.baosight.hpjx.core.tools;
/**
* @author:songx
* @date:2024/4/16,16:29
*/
public class EuTools {
/**
* @author:songx
* @date:2024/4/16,16:29
*/
public static class EuDm01 {
/**
* @param realPath
* @param docId
* @return
*/
public static void intoDb(String realPath, String docId) {
}
}
}
......@@ -47,10 +47,14 @@ public class QrCodeUtils {
/**
* 生成本地文件
* {
* "file": "D:\\home\\appuser\\qrCode\\20240416162700_mizw6izh.png",
* "docId": "90f1a41a48e644d1a56682be03a231db",
* "filePath": "D:\\home\\appuser\\qrCode\\20240416162700_mizw6izh.png",
* "fileLocation": "local"
* }
*
* @param content
* @throws WriterException
* @throws IOException
*/
public static Map<String, Object> create(String content) throws Exception {
String fileLocation = PlatApplicationContext.getProperty("iplat4j.admin.upload.fileLocation");
......
......@@ -316,6 +316,8 @@ public class HPSqlConstant {
// 修改状态
public static final String UPDATE_STATUS = "HPSC003.updateStatus";
// 修改状态
public static final String UPDATE_QRCODE = "HPSC003.updateQrcode";
// 修改时间
public static final String UPDATE_DATE = "HPSC003.updateDate";
......
......@@ -42,9 +42,8 @@ public class HPSC003 extends DaoEPBase {
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_SCHEDULE = "schedule";
public static final String FIELD_DELIVERY_DATE = "deliveryDate";
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId";
public static final String FIELD_QRCODE_DOC_ID = "qrcodeDocId";
public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
......@@ -65,6 +64,7 @@ public class HPSC003 extends DaoEPBase {
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID";
public static final String COL_DELIVERY_DATE = "DELIVERY_DATE";
public static final String COL_QRCODE_DOC_ID = "QRCODE_DOC_ID";
public static final String QUERY = "HPSC003.query";
public static final String COUNT = "HPSC003.count";
......@@ -90,17 +90,14 @@ public class HPSC003 extends DaoEPBase {
private String depCode = " "; /* 部门编码*/
private String remark = " "; /* 备注*/
private Long matId = null; /* 物料ID*/
private String schedule = "";
private String deliveryDate = " ";
private Long inventRecordId = new Long(0);
private String spec = " "; /* 规格*/
private BigDecimal length = new BigDecimal(0.00); /* 长*/
private BigDecimal width = new BigDecimal(0.00); /* 宽*/
private BigDecimal thick = new BigDecimal(0.00); /* 厚*/
private String qrcodeDocId = " "; /* 二维码文件ID */
/**
......@@ -219,6 +216,9 @@ public class HPSC003 extends DaoEPBase {
eiColumn.setDescName("交货日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_QRCODE_DOC_ID);
eiColumn.setDescName("二维码文件ID");
eiMetadata.addMeta(eiColumn);
}
......@@ -590,6 +590,14 @@ public class HPSC003 extends DaoEPBase {
this.deliveryDate = deliveryDate;
}
public String getQrcodeDocId() {
return qrcodeDocId;
}
public void setQrcodeDocId(String qrcodeDocId) {
this.qrcodeDocId = qrcodeDocId;
}
/**
* get the value from Map.
*
......@@ -623,6 +631,7 @@ public class HPSC003 extends DaoEPBase {
setThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get("thick")), thick));
setMatId(NumberUtils.toLong(StringUtils.toString(map.get("matId")), matId));
setDeliveryDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DELIVERY_DATE)), deliveryDate));
setQrcodeDocId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_QRCODE_DOC_ID)), qrcodeDocId));
}
......@@ -658,6 +667,7 @@ public class HPSC003 extends DaoEPBase {
map.put("thick", StringUtils.toString(thick, eiMetadata.getMeta("thick")));
map.put("matId", StringUtils.toString(matId, eiMetadata.getMeta("matId")));
map.put(FIELD_DELIVERY_DATE, StringUtils.toString(deliveryDate, eiMetadata.getMeta(FIELD_DELIVERY_DATE)));
map.put(FIELD_QRCODE_DOC_ID, StringUtils.toString(qrcodeDocId, eiMetadata.getMeta(FIELD_QRCODE_DOC_ID)));
return map;
}
......
......@@ -10,12 +10,16 @@ import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.sc.domain.HPSC003;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -23,12 +27,9 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -36,7 +37,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
*
......@@ -215,6 +215,10 @@ public class ServiceHPSC003 extends ServiceBase {
}
// 修改计划状态
HPSCTools.HpSc003.updateStatus(id, HPConstant.planStatus.S_1);
// 生成二维码
if (StringUtils.isBlank(dbSc003.getQrcodeDocId())) {
HPSCTools.HpSc003.createQrCode(id);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("提交成功");
} catch (Exception e) {
......@@ -266,7 +270,7 @@ public class ServiceHPSC003 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产计划",operType = "查询",operDesc = "部件下拉框")
@OperationLogAnnotation(operModul = "生产计划", operType = "查询", operDesc = "部件下拉框")
public EiInfo queryInventComboBox(EiInfo inInfo) {
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.INVENT_RECORD_BLOCK_ID);
......@@ -274,4 +278,32 @@ public class ServiceHPSC003 extends ServiceBase {
return inInfo;
}
/**
* 扫码显示计划明细
*
* @param inInfo
* @return
*/
public EiInfo qrcodePlanDetail(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String planInfoNo = MapUtils.getString(queryRow, HPSC003.FIELD_PLAN_INFO_NO);
AssertUtils.isNull(planInfoNo, "计划号不能为空");
// 查询计划主信息
HPSC003 dbSc003 = HPSCTools.HpSc003.getByNo(planInfoNo);
EiInfoUtils.addBlock(inInfo, "planMain", dbSc003, HPSC003.class);
// 查询计划明细信息
List<HPSC004> dbSc004s = HPSCTools.HpSc004.queryByParent(dbSc003.getPlanInfoNo());
EiInfoUtils.addBlock(inInfo, "planDetail", dbSc004s, HPSC004.class);
// 订单号
List<String> prodOrderNos = ObjectUtils.listEpKey(dbSc004s, HPSC004.FIELD_PROD_ORDER_NO);
// 查询派工信息
List<HPSC005B> dbSc005bs = HPSCTools.HpSc005b.listByOrder(prodOrderNos);
EiInfoUtils.addBlock(inInfo, "prodOrder", dbSc005bs, HPSC005B.class);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询计划详情失败");
}
return inInfo;
}
}
......@@ -105,6 +105,7 @@
THICK as "thick", <!-- 厚 -->
MAT_ID AS "matId",
DELIVERY_DATE as "deliveryDate",
QRCODE_DOC_ID as "qrcodeDocId",
CONCAT((
SELECT
format((ifnull( SUM( ACTUAL_COMPLETION_NUM ), 0 ) / ifnull( SUM( NUM ), 0 ) * 100),2)
......@@ -234,4 +235,13 @@
WHERE ID = #id#
</update>
<!-- 修改二维码地址 -->
<update id="updateQrcode">
UPDATE hpjx.T_HPSC003
SET
QRCODE_DOC_ID = #qrcodeDocId#,
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
......@@ -108,6 +108,9 @@
<isNotEmpty prepend=" AND " property="ids">
A.ID IN <iterate close=")" open="(" conjunction="," property="statuses">#statuses[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodOrderNos">
A.PROD_ORDER_NO IN <iterate close=")" open="(" conjunction="," property="prodOrderNos">#prodOrderNos[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodTaskNos">
B.PROD_TASK_NO IN <iterate close=")" open="(" conjunction="," property="prodTaskNos">#prodTaskNos[]#</iterate>
</isNotEmpty>
......@@ -128,7 +131,7 @@
$order$
</isNotEmpty>
<isEmpty property="order">
A.CREATED_TIME desc
A.PROD_ORDER_NO DESC, B.PROD_TASK_NO ASC
</isEmpty>
</dynamic>
</sql>
......
package com.baosight.hpjx.hp.sc.tools;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.core.utils.QrCodeUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
......@@ -21,7 +23,6 @@ import com.baosight.iplat4j.core.util.NumberUtils;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -406,6 +407,7 @@ public class HPSCTools {
queryMap.put("matId", matId);
DaoBase.getInstance().update(HPSqlConstant.HPSC003.DELETE_BY_MAT, queryMap);
}
/**
* 修改状态
*
......@@ -421,6 +423,24 @@ public class HPSCTools {
}
/**
* 生成二维码
*
* @param id
*/
public static void createQrCode(Long id) throws Exception {
AssertUtils.isNull(id, "节点ID不能为空");
// 生成二维码
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", id);
jsonObject.put("remark", "计划ID");
Map<String, Object> resultMap = QrCodeUtils.create(jsonObject.toJSONString());
Map map = new HashMap();
map.put("id", id);
map.put("qrcodeDocId", resultMap.get("docId"));
DaoUtils.update(HPSqlConstant.HPSC003.UPDATE_QRCODE, map);
}
/**
* 修改计划完成时间
*
* @param planInfoNo
......@@ -440,12 +460,12 @@ public class HPSCTools {
* @param planInfoNo
* @return
*/
public static HPSC003 getEntityByPlanInfoNo(String planInfoNo) {
AssertUtils.isNull(planInfoNo, "生产订单号不能为空");
public static HPSC003 getByNo(String planInfoNo) {
AssertUtils.isNull(planInfoNo, "计划号不能为空");
Map queryMap = new HashMap();
queryMap.put("planInfoNo", planInfoNo);
List<HPSC003> results = DaoBase.getInstance().query(HPSC003.QUERY, queryMap);
AssertUtils.isNull(results, String.format("生产订单号[%s]信息不存在", planInfoNo));
AssertUtils.isNull(results, String.format("计划号[%s]信息不存在", planInfoNo));
return results.get(0);
}
}
......@@ -872,6 +892,21 @@ public class HPSCTools {
}
/**
* 查询盘点单信息
*
* @param prodOrderNos
* @return
*/
public static List<HPSC005B> listByOrder(List<String> prodOrderNos) {
if (CollectionUtils.isEmpty(prodOrderNos)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("prodOrderNos", prodOrderNos);
return DaoBase.getInstance().query(HPSC005B.QUERY, queryMap);
}
/**
* 查询信息
*
* @param factoryCode
......
package com.baosight.hpjx.util;
import com.baosight.iplat4j.core.BaseObject;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import org.apache.commons.collections.MapUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -107,4 +110,42 @@ public class EiInfoUtils {
rowMap.put(key, value);
}
/**
* eiinfo中新增block
*
* @param inInfo
* @param blockId
* @param row
* @param clazz
* @param <T>
* @throws InstantiationException
* @throws IllegalAccessException
*/
public static <T extends DaoEPBase> void addBlock(EiInfo inInfo, String blockId, T row, Class<T> clazz)
throws InstantiationException, IllegalAccessException {
EiBlock block = new EiBlock(blockId);
block.addBlockMeta(clazz.newInstance().eiMetadata);
block.addRow(row);
inInfo.setBlock(block);
}
/**
* eiinfo中新增block
*
* @param inInfo
* @param blockId
* @param rows
* @param clazz
* @param <T>
* @throws InstantiationException
* @throws IllegalAccessException
*/
public static <T extends DaoEPBase> void addBlock(EiInfo inInfo, String blockId, List<T> rows, Class<T> clazz)
throws InstantiationException, IllegalAccessException {
EiBlock block = new EiBlock(blockId);
block.addBlockMeta(clazz.newInstance().eiMetadata);
block.addRows(rows);
inInfo.setBlock(block);
}
}
package com.baosight.hpjx.util;
import com.baosight.iplat4j.core.data.DaoEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -119,4 +121,19 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
.collect(Collectors.toList());
}
/**
* 从DaoEPBase中取KEY
*
* @param items
* @param keyName
* @return
*/
public static <T> List<T> listEpKey(Collection<? extends DaoEPBase> items, String keyName) {
if (CollectionUtils.isEmpty(items)) {
return null;
}
return items.stream().map(item -> item.toMap()).map(item -> (T) item.get(keyName))
.filter(ObjectUtils::isNotBlank).distinct().collect(Collectors.toList());
}
}
......@@ -19,7 +19,7 @@ spring.servlet.multipart.file-size-threshold =0
componentEname=hpjx
projectName=hpjx
moduleName=ep
projectEnv=run
projectEnv=dev
platSchema=iplat
eplatSchema=EPLAT
lowcodedbSchema=lowcodedb
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment