Commit f7796178 by 宋祥

1.销售出库逻辑关联生产任务

parent c4e7d5a0
...@@ -58,6 +58,8 @@ public class HPSqlConstant { ...@@ -58,6 +58,8 @@ public class HPSqlConstant {
public static final String STAT_DATE = "HPKC004.statDate"; public static final String STAT_DATE = "HPKC004.statDate";
// 锁 // 锁
public static final String LOCK = "HPKC004.lock"; public static final String LOCK = "HPKC004.lock";
// 修改打印状态
public static final String UPDATE_PRINT = "HPKC004.updatePrint";
} }
/** /**
......
...@@ -91,9 +91,9 @@ public class ServiceHPKC002A extends ServiceEPBase { ...@@ -91,9 +91,9 @@ public class ServiceHPKC002A extends ServiceEPBase {
// 库存ID // 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id"); List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁 // 行锁
HPKCTools.lockKc010(ids); HPKCTools.HpKc010.lock(ids);
// 获取库存信息 // 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.mapKc010(ids); Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验 // 状态校验
for (Map row : resultRows) { for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id"); Long id = MapUtils.getLong(row, "id");
......
...@@ -89,9 +89,9 @@ public class ServiceHPKC004 extends ServiceBase { ...@@ -89,9 +89,9 @@ public class ServiceHPKC004 extends ServiceBase {
// 销售单号 // 销售单号
List<String> saleNos = ObjectUtils.listKey(resultRows, "saleNo"); List<String> saleNos = ObjectUtils.listKey(resultRows, "saleNo");
// 锁记录 // 锁记录
HPKCTools.lockKc004(saleNos); HPKCTools.HpKc004.lock(saleNos);
// 查询数据库记录 // 查询数据库记录
Map<String, HPKC004> mapKc004 = HPKCTools.mapKc004(saleNos); Map<String, HPKC004> mapKc004 = HPKCTools.HpKc004.map(saleNos);
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HPKC004 fKc004 = new HPKC004(); HPKC004 fKc004 = new HPKC004();
fKc004.fromMap(resultRows.get(i)); fKc004.fromMap(resultRows.get(i));
...@@ -101,13 +101,13 @@ public class ServiceHPKC004 extends ServiceBase { ...@@ -101,13 +101,13 @@ public class ServiceHPKC004 extends ServiceBase {
HPKC004 newKc004 = BeanUtils.copy(dbKc004, HPKC004.class); HPKC004 newKc004 = BeanUtils.copy(dbKc004, HPKC004.class);
newKc004.setSaleNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC004_SALE_NO)); newKc004.setSaleNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC004_SALE_NO));
newKc004.setAmount(dbKc004.getAmount().negate()); newKc004.setAmount(dbKc004.getAmount().negate());
newKc004.setWeight(dbKc004.getWeight().negate()); newKc004.setUnitWeight(dbKc004.getUnitWeight().negate());
newKc004.setOldSaleNo(dbKc004.getSaleNo()); newKc004.setOldSaleNo(dbKc004.getSaleNo());
newKc004.setDeleteFlag(CommonConstant.YesNo.YES_1); newKc004.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC004.INSERT, newKc004); DaoUtils.insert(HPKC004.INSERT, newKc004);
// 修改库存 // 修改库存
HPKCTools.updateStock(dbKc004.getWhCode(), dbKc004.getInventRecordId(), // HPKCTools.updateStock(dbKc004.getWhCode(), dbKc004.getInventRecordId(),
dbKc004.getAmount(), dbKc004.getWeight()); // dbKc004.getAmount(), dbKc004.getWeight());
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
...@@ -92,9 +92,9 @@ public class ServiceHPKC004A extends ServiceEPBase { ...@@ -92,9 +92,9 @@ public class ServiceHPKC004A extends ServiceEPBase {
// 库存ID // 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id"); List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁 // 行锁
HPKCTools.lockKc010(ids); HPKCTools.HpKc010.lock(ids);
// 获取库存信息 // 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.mapKc010(ids); Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验 // 状态校验
for (Map row : resultRows) { for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id"); Long id = MapUtils.getLong(row, "id");
...@@ -125,8 +125,8 @@ public class ServiceHPKC004A extends ServiceEPBase { ...@@ -125,8 +125,8 @@ public class ServiceHPKC004A extends ServiceEPBase {
newKc004.setDeleteFlag(CommonConstant.YesNo.NO_0); newKc004.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC004.INSERT, newKc004); DaoUtils.insert(HPKC004.INSERT, newKc004);
// 修改库存数量 // 修改库存数量
HPKCTools.updateStock(newKc004.getWhCode(), newKc004.getInventRecordId(), // HPKCTools.updateStock(newKc004.getWhCode(), newKc004.getInventRecordId(),
newKc004.getAmount().negate(), newKc004.getWeight().negate()); // newKc004.getAmount().negate(), newKc004.getWeight().negate());
} }
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成出库单失败"); LogUtils.setDetailMsg(inInfo, e, "生成出库单失败");
......
...@@ -81,9 +81,9 @@ public class ServiceHPKC005A extends ServiceEPBase { ...@@ -81,9 +81,9 @@ public class ServiceHPKC005A extends ServiceEPBase {
// 库存ID // 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id"); List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁 // 行锁
HPKCTools.lockKc010(ids); HPKCTools.HpKc010.lock(ids);
// 获取库存信息 // 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.mapKc010(ids); Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验 // 状态校验
for (Map row : resultRows) { for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id"); Long id = MapUtils.getLong(row, "id");
......
...@@ -90,9 +90,9 @@ public class ServiceHPKC007A extends ServiceEPBase { ...@@ -90,9 +90,9 @@ public class ServiceHPKC007A extends ServiceEPBase {
// 库存ID // 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id"); List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁 // 行锁
HPKCTools.lockKc010(ids); HPKCTools.HpKc010.lock(ids);
// 获取库存信息 // 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.mapKc010(ids); Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验 // 状态校验
for (Map row : resultRows) { for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id"); Long id = MapUtils.getLong(row, "id");
......
...@@ -10,16 +10,23 @@ ...@@ -10,16 +10,23 @@
SALE_NO as "saleNo", <!-- 销售单号 --> SALE_NO as "saleNo", <!-- 销售单号 -->
WH_CODE as "whCode", <!-- 仓库编码 --> WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 --> WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 --> PROD_NO as "prodNo", <!-- 生产订单号 -->
INVENT_CODE as "inventCode", <!-- 存货编码 --> PROJ_CODE as "projCode", <!-- 项目号 -->
INVENT_NAME as "inventName", <!-- 存货名称 --> PROJ_NAME as "projName", <!-- 项目名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格 --> INVENT_CODE as "inventCode", <!-- 部件编码 -->
INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零部件编码 -->
SUB_INVENT_NAME as "subInventName", <!-- 零部件名称 -->
LENGTH as "length", <!-- 长 -->
WIDTH as "width", <!-- 宽 -->
THICK as "thick", <!-- 厚 -->
AMOUNT as "amount", <!-- 数量 --> AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 --> WEIGHT as "weight", <!-- 重量 -->
STATUS as "status", <!-- 状态 -->
REMARK as "remark", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
KC_ID as "kcId", <!-- 库存ID --> KC_ID as "kcId", <!-- 库存ID -->
OLD_SALE_NO as "oldSaleNo", <!-- 原销售单号 --> OLD_SALE_NO as "oldSaleNo", <!-- 原销售单号 -->
IS_PRINT as "isPrint", <!-- 是否打印:0.否1.是 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 --> CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 --> CREATED_TIME as "createdTime", <!-- 创建时间 -->
...@@ -51,38 +58,51 @@ ...@@ -51,38 +58,51 @@
<isNotEmpty prepend=" AND " property="whName"> <isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName# WH_NAME = #whName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType"> <isNotEmpty prepend=" AND " property="prodNo">
INVENT_TYPE = #inventType# PROD_NO = #prodNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode"> <isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode# INVENT_CODE = #inventCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName"> <isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName# INVENT_NAME LIKE CONCAT('%', #inventName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventCode">
SUB_INVENT_CODE = #subInventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventName">
SUB_INVENT_NAME LIKE CONCAT('%', #subInventName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId"> <isNotEmpty prepend=" AND " property="remark">
INVENT_RECORD_ID = #inventRecordId# REMARK = #remark#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="kcId"> <isNotEmpty prepend=" AND " property="kcId">
KC_ID = #kcId# KC_ID = #kcId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="oldSaleNo">
OLD_SALE_NO = #oldSaleNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="isPrint">
IS_PRINT = #isPrint#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag"> <isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag# DELETE_FLAG = #deleteFlag#
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="saleNos"> <isNotEmpty prepend=" AND " property="saleNos">
SALE_NO IN <iterate close=")" open="(" conjunction="," property="saleNos">#saleNos[]#</iterate> SALE_NO IN <iterate close=")" open="(" conjunction="," property="saleNos">#saleNos[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
<isEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = '')
</isEqual>
<isNotEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = #spec#)
</isNotEqual>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom"> <isNotEmpty prepend=" AND " property="createdDateFrom">
CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000') CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty> </isNotEmpty>
...@@ -91,6 +111,13 @@ ...@@ -91,6 +111,13 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime# <!-- 修改时间 -->
</sql>
<sql id="order"> <sql id="order">
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
...@@ -125,27 +152,34 @@ ...@@ -125,27 +152,34 @@
SALE_NO, <!-- 销售单号 --> SALE_NO, <!-- 销售单号 -->
WH_CODE, <!-- 仓库编码 --> WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 --> WH_NAME, <!-- 仓库名称 -->
INVENT_TYPE, <!-- 存货类型 --> PROD_NO, <!-- 生产订单号 -->
INVENT_CODE, <!-- 存货编码 --> PROJ_CODE, <!-- 项目号 -->
INVENT_NAME, <!-- 存货名称 --> PROJ_NAME, <!-- 项目名称 -->
INVENT_RECORD_ID, <!-- 规格 --> INVENT_CODE, <!-- 部件编码 -->
INVENT_NAME, <!-- 部件名称 -->
SUB_INVENT_CODE, <!-- 零部件编码 -->
SUB_INVENT_NAME, <!-- 零部件名称 -->
LENGTH, <!-- 长 -->
WIDTH, <!-- 宽 -->
THICK, <!-- 厚 -->
AMOUNT, <!-- 数量 --> AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 --> WEIGHT, <!-- 重量 -->
STATUS, <!-- 状态 -->
REMARK, <!-- 备注 --> REMARK, <!-- 备注 -->
KC_ID, <!-- 库存ID --> KC_ID, <!-- 库存ID -->
OLD_SALE_NO, <!-- 原销售单号 --> OLD_SALE_NO, <!-- 原销售单号 -->
IS_PRINT, <!-- 是否打印:0.否1.是 -->
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 --> CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 --> CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG <!-- 是否删除 --> DELETE_FLAG <!-- 是否删除 -->
) VALUES ( ) VALUES (
#companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#, #companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#, #prodNo#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#, #status#, #projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#,
#remark#, #kcId#, #oldSaleNo#, #createdBy#, #createdName#, #createdTime#, #deleteFlag# #length#, #width#, #thick#, #amount#, #unitWeight#, #weight#, #remark#, #kcId#,
#oldSaleNo#, #isPrint#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
) )
</insert> </insert>
<!-- 逻辑删除 --> <!-- 逻辑删除 -->
<delete id="delete"> <delete id="delete">
UPDATE ${hpjxSchema}.T_HPKC004 SET DELETE_FLAG = 1 WHERE ID = #id# UPDATE ${hpjxSchema}.T_HPKC004 SET DELETE_FLAG = 1 WHERE ID = #id#
...@@ -157,16 +191,26 @@ ...@@ -157,16 +191,26 @@
RECEIPT_DATE = #receiptDate#, <!-- 票据日期 --> RECEIPT_DATE = #receiptDate#, <!-- 票据日期 -->
WH_CODE = #whCode#, <!-- 仓库编码 --> WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 --> WH_NAME = #whName#, <!-- 仓库名称 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 --> PROD_NO = #prodNo#, <!-- 生产订单号 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 --> PROJ_CODE = #projCode#, <!-- 项目号 -->
INVENT_NAME = #inventName#, <!-- 存货名称 --> PROJ_NAME = #projName#, <!-- 项目名称 -->
INVENT_CODE = #inventCode#, <!-- 部件编码 -->
INVENT_NAME = #inventName#, <!-- 部件名称 -->
SUB_INVENT_CODE = #subInventCode#, <!-- 零部件编码 -->
SUB_INVENT_NAME = #subInventName#, <!-- 零部件名称 -->
LENGTH = #length#, <!-- 长 -->
WIDTH = #width#, <!-- 宽 -->
THICK = #thick#, <!-- 厚 -->
AMOUNT = #amount#, <!-- 数量 --> AMOUNT = #amount#, <!-- 数量 -->
UNIT_WEIGHT = #unitWeight#, <!-- 单重 -->
WEIGHT = #weight#, <!-- 重量 --> WEIGHT = #weight#, <!-- 重量 -->
STATUS = #status#, <!-- 状态 -->
REMARK = #remark#, <!-- 备注 --> REMARK = #remark#, <!-- 备注 -->
KC_ID = #kcId#, <!-- 库存ID -->
OLD_SALE_NO = #oldSaleNo#, <!-- 原销售单号 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 --> UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 --> UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime# <!-- 修改时间 --> UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除 -->
WHERE ID = #id# WHERE ID = #id#
</update> </update>
...@@ -183,6 +227,14 @@ ...@@ -183,6 +227,14 @@
</isNotEmpty> </isNotEmpty>
</update> </update>
<!-- 修改状态 -->
<update id="updatePrint">
UPDATE ${hpjxSchema}.T_HPKC004
SET IS_PRINT = 1,
<include refid="updateRevise"/>
WHERE ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</update>
<!-- 统计库存 --> <!-- 统计库存 -->
<select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC004"> <select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC004">
SELECT SELECT
......
package com.baosight.hpjx.hp.kc.tools; package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.*; import com.baosight.hpjx.hp.kc.domain.*;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -110,47 +111,85 @@ public class HPKCTools { ...@@ -110,47 +111,85 @@ public class HPKCTools {
} }
/** /**
* * HPKC004 公共方法定义
* *
* @param saleNos * @author:songx
* @return * @date:2024/1/31,16:36
*/ */
public static void lockKc004(List<String> saleNos) { public static class HpKc004 {
if (CollectionUtils.isEmpty(saleNos)) {
return; /**
* 锁
*
* @param saleNos
* @return
*/
public static void lock(List<String> saleNos) {
if (CollectionUtils.isEmpty(saleNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("saleNos", saleNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC004.LOCK, queryMap);
} }
Map queryMap = new HashMap();
queryMap.put("saleNos", saleNos); /**
DaoBase.getInstance().update(HPSqlConstant.HPKC004.LOCK, queryMap); * 查询销售出库信息
} *
* @param ids
/** * @return
* 查询销售出库信息 */
* public static List<HPKC004> listById(List<Long> ids) {
* @param saleNos if (CollectionUtils.isEmpty(ids)) {
* @return return null;
*/ }
public static List<HPKC004> listKc004(List<String> saleNos) { Map queryMap = new HashMap();
if (CollectionUtils.isEmpty(saleNos)) { queryMap.put("ids", ids);
return null; return DaoBase.getInstance().query(HPKC004.QUERY, queryMap);
} }
Map queryMap = new HashMap();
queryMap.put("saleNos", saleNos); /**
return DaoBase.getInstance().query(HPKC004.QUERY, queryMap); * 查询销售出库信息
} *
* @param saleNos
/** * @return
* 查询销售出库信息 */
* public static List<HPKC004> list(List<String> saleNos) {
* @param saleNos if (CollectionUtils.isEmpty(saleNos)) {
* @return return null;
*/ }
public static Map<String, HPKC004> mapKc004(List<String> saleNos) { Map queryMap = new HashMap();
List<HPKC004> results = listKc004(saleNos); queryMap.put("saleNos", saleNos);
if (CollectionUtils.isEmpty(results)) { return DaoBase.getInstance().query(HPKC004.QUERY, queryMap);
return null; }
/**
* 查询销售出库信息
*
* @param saleNos
* @return
*/
public static Map<String, HPKC004> map(List<String> saleNos) {
List<HPKC004> results = list(saleNos);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC004::getSaleNo, item -> item));
}
/**
* 修改打印状态
*
* @param ids
*/
public static void updatePrint(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoUtils.update(HPSqlConstant.HPKC004.UPDATE_PRINT, queryMap);
} }
return results.stream().collect(Collectors.toMap(HPKC004::getSaleNo, item -> item));
} }
/** /**
...@@ -286,47 +325,57 @@ public class HPKCTools { ...@@ -286,47 +325,57 @@ public class HPKCTools {
} }
/** /**
* 查询库存信息 * HPKC004公共DAO方法定义
* *
* @param ids * @author:songx
* @return * @date:2024/1/31,16:42
*/ */
public static List<HPKC010> listKc010(List<Long> ids) { public static class HpKc010 {
if (CollectionUtils.isEmpty(ids)) {
return null; /**
* 查询库存信息
*
* @param ids
* @return
*/
public static List<HPKC010> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap);
} }
Map queryMap = new HashMap();
queryMap.put("ids", ids); /**
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap); * 查询库存信息
} *
* @param ids
/** * @return
* 查询库存信息 */
* public static Map<Long, HPKC010> map(List<Long> ids) {
* @param ids List<HPKC010> results = list(ids);
* @return if (CollectionUtils.isEmpty(results)) {
*/ return null;
public static Map<Long, HPKC010> mapKc010(List<Long> ids) { }
List<HPKC010> results = listKc010(ids); return results.stream().collect(Collectors.toMap(HPKC010::getId, item -> item));
if (CollectionUtils.isEmpty(results)) {
return null;
} }
return results.stream().collect(Collectors.toMap(HPKC010::getId, item -> item));
} /**
* 锁
/** *
* 锁 * @param ids
* * @return
* @param ids */
* @return public static void lock(List<Long> ids) {
*/ if (CollectionUtils.isEmpty(ids)) {
public static void lockKc010(List<Long> ids) { return;
if (CollectionUtils.isEmpty(ids)) { }
return; Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoBase.getInstance().update(HPSqlConstant.HPKC010.LOCK, queryMap);
} }
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoBase.getInstance().update(HPSqlConstant.HPKC010.LOCK, queryMap);
} }
/** /**
......
package com.baosight.hpjx.util; package com.baosight.hpjx.util;
import com.alibaba.fastjson.JSONObject;
import com.baosight.iplat4j.core.exception.PlatException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
/** /**
...@@ -109,4 +115,17 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { ...@@ -109,4 +115,17 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
return str.length() > endIndex ? str.substring(0, endIndex) : str; return str.length() > endIndex ? str.substring(0, endIndex) : str;
} }
/**
* 解码参数
*
* @param parameter
* @return
*/
public static Map<String, Object> encodeParam(String parameter) throws UnsupportedEncodingException {
// 帆软传递进来的参数进行了两次编码,因此需要进行两次解码
String paramsText = URLDecoder.decode(parameter, "UTF-8");
paramsText = URLDecoder.decode(paramsText, "UTF-8");
return JSONObject.parseObject(paramsText).getInnerMap();
}
} }
...@@ -8,8 +8,8 @@ $(function () { ...@@ -8,8 +8,8 @@ $(function () {
return showUserName(options.createdBy, options.createdName); return showUserName(options.createdBy, options.createdName);
} }
}], }],
loadComplete: function (grid) { loadComplete: function (grid) {
} }
} }
} }
...@@ -18,6 +18,9 @@ $(function () { ...@@ -18,6 +18,9 @@ $(function () {
// 挑选库存 // 挑选库存
$("#SELECT_STOCK").on("click", selectStock); $("#SELECT_STOCK").on("click", selectStock);
// 导出打印
$("#PRINT").on("click", exportPrint);
}); });
...@@ -59,3 +62,31 @@ let selectStockCallback = function () { ...@@ -59,3 +62,31 @@ let selectStockCallback = function () {
// 关闭弹窗 // 关闭弹窗
JSColorbox.close(); JSColorbox.close();
} }
/**
* 导出打印
*/
let exportPrint = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择同一个项目的数据")
return;
}
let saleIds = [];
let projCodeTemp;
for (let i = 0; i < rows.length; i++) {
let projCode = rows[i]['projCode'];
if (projCodeTemp == null) {
projCodeTemp = projCode;
} else if (projCodeTemp != projCode) {
message("第" + (i + 1) + "行项目号不一致,请选择同一个项目的数据");
return;
}
saleIds.push(rows[i]['id']);
}
let parameter = {
"saleIds": saleIds
};
window.location = IPLATUI.CONTEXT_PATH + "/HP/KC/HPKC90.jsp?route=1&parameter="
+ encodeURI(encodeURI(JSON.stringify(parameter)));
}
...@@ -8,66 +8,63 @@ ...@@ -8,66 +8,63 @@
<EF:EFPage title="销售出库单"> <EF:EFPage title="销售出库单">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFDatePicker cname="单据日期" ename="inqu_status-0-receiptDate" colWidth="3" format="yyyy-MM-dd" <EF:EFDatePicker cname="单据日期" ename="receiptDate" blockId="inqu_status" row="0" colWidth="3"
readonly="true"/> format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="销售单号" ename="inqu_status-0-saleNo" colWidth="3"/> <EF:EFInput cname="销售单号" ename="saleNo" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains"> <EF:EFInput cname="项目号" ename="projCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFOption label="全部" value=""/> <EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2', '3', '4')"/>
</EF:EFSelect>
<EF:EFSelect cname="仓库名称" ename="inqu_status-0-whCode" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div> </div>
<div class="row"> <div class="row">
<EF:EFSelect cname="存货名称" ename="inqu_status-0-inventCode" colWidth="3" filter="contains"> <EF:EFInput cname="部件编码" ename="inventCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFOption label="全部" value=""/> <EF:EFInput cname="部件名称" ename="inventName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/> <EF:EFInput cname="零部件编码" ename="subInventCode" blockId="inqu_status" row="0" colWidth="3"/>
</EF:EFSelect> <EF:EFInput cname="零部件名称" ename="subInventName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div> </div>
<div class="row"> <div class="row">
<EF:EFSelect cname="是否删除" ename="inqu_status-0-deleteFlag" colWidth="3" defaultValue="0"> <EF:EFSelect cname="是否打印" ename="isPrint" blockId="inqu_status" row="0" colWidth="3" defaultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.isPrint"/>
</EF:EFSelect>
<EF:EFSelect cname="是否删除" ename="deleteFlag" blockId="inqu_status" row="0" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/> <EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" startName="createdDateFrom" endName="createdDateTo"
blockId="inqu_status" row="0" role="date" format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8"
endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="saleNo" cname="销售单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" width="90" align="center" <EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" width="90" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/> editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center"> <EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/> <EF:EFColumn ename="inventName" cname="部件名称" enable="false" width="120" align="center"/>
</EF:EFComboColumn> <EF:EFColumn ename="subInventName" cname="零部件名称" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="whCode" cname="仓库编码" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="false" width="120" align="center"
blockName="invent_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="120" align="center"
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="数量" enable="false" format="{0:N3}" maxLength="20" width="100" <EF:EFColumn ename="amount" cname="数量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/> align="center"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" format="{0:N3}" maxLength="20" width="100" <EF:EFColumn ename="length" cname="长" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFColumn ename="width" cname="宽" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/> align="center"/>
<EF:EFColumn ename="thick" cname="厚" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFColumn ename="weight" cname="总重" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFComboColumn ename="isPrint" cname="是否打印" width="80" align="center">
<EF:EFCodeOption codeName="hpjx.hpjx.isPrint"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="100" align="center"/> <EF:EFColumn ename="remark" cname="备注" enable="false" width="100" align="center"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="inventCode" cname="部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="subInventCode" cname="零部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="prodNo" cname="生产订单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="saleNo" cname="销售单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="oldSaleNo" cname="原销售单号" enable="false" width="140" align="center"/> <EF:EFColumn ename="oldSaleNo" cname="原销售单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="120" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
......
<!DOCTYPE html> <!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" %> <%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.baosight.hpjx.hp.kc.tools.CKExcelTools" %> <%@ page import="com.baosight.hpjx.hp.kc.tools.CKExcelTools" %>
<%@ page import="com.baosight.iplat4j.core.exception.PlatException" %>
<% <%
try { try {
CKExcelTools.downloadFile(pageContext); // 1.出库单
out.clear(); if ("1".equals(request.getParameter("route"))) {
out = pageContext.pushBody(); CKExcelTools.downloadFile(pageContext);
} catch (Exception e) { } else {
request.setAttribute("iplat_msgKey", "ES001"); throw new PlatException("非法的路由信息");
request.setAttribute("iplat_msg", "出库单下载失败"); }
request.setAttribute("iplat_msgDetail", e.toString()); out.clear();
request.getRequestDispatcher("/EU/DM/EUDM30.jsp").forward(request, response); out = pageContext.pushBody();
} catch (Throwable e) {
} request.setAttribute("iplat_msgKey", "ES001");
request.setAttribute("iplat_msg", "文件下载失败");
request.setAttribute("iplat_msgDetail", e.toString());
request.getRequestDispatcher("/EU/DM/EUDM30.jsp").forward(request, response);
}
%> %>
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