Commit 309a9e9b by 宋祥

1.其他出库单逻辑开发

parent 1fab9987
......@@ -16,7 +16,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-24 11:37:39 create
* @history 2024-01-24 15:34:45 create
*/
public class HPKC007 extends DaoEPBase {
......@@ -32,18 +32,20 @@ public class HPKC007 extends DaoEPBase {
public static final String FIELD_INVENT_TYPE = "inventType"; /* 物料类型*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 物料编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 物料名称*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 规格*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 规格ID*/
public static final String FIELD_AMOUNT = "amount"; /* 数量*/
public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_STATUS = "status"; /* 状态 0审核 1保存*/
public static final String FIELD_KC_ID = "kcId"; /* 库存ID*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_OLD_OUTER_NO = "oldOuterNo"; /* 原出库单号*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 更新人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0.否1.是*/
public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
......@@ -55,18 +57,20 @@ public class HPKC007 extends DaoEPBase {
public static final String COL_INVENT_TYPE = "INVENT_TYPE"; /* 物料类型*/
public static final String COL_INVENT_CODE = "INVENT_CODE"; /* 物料编码*/
public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 物料名称*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 规格*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 规格ID*/
public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_STATUS = "STATUS"; /* 状态 0审核 1保存*/
public static final String COL_KC_ID = "KC_ID"; /* 库存ID*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_OLD_OUTER_NO = "OLD_OUTER_NO"; /* 原出库单号*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 更新人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除0.否1.是*/
public static final String QUERY = "HPKC007.query";
public static final String COUNT = "HPKC007.count";
......@@ -84,18 +88,20 @@ public class HPKC007 extends DaoEPBase {
private String inventType = " "; /* 物料类型*/
private String inventCode = " "; /* 物料编码*/
private String inventName = " "; /* 物料名称*/
private Long inventRecordId = null; /* 规格*/
private Long inventRecordId = null; /* 规格ID*/
private BigDecimal amount = new BigDecimal(0.00); /* 数量*/
private BigDecimal weight = new BigDecimal(0.00); /* 重量*/
private Integer status; /* 状态 0审核 1保存*/
private Long kcId = new Long(0); /* 库存ID*/
private Integer status = 0; /* 状态 0审核 1保存*/
private Long kcId = null; /* 库存ID*/
private String remark = " "; /* 备注*/
private String oldOuterNo = " "; /* 原出库单号*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag = 0; /* 是否删除0.否1.是*/
/**
* initialize the metadata.
......@@ -144,6 +150,10 @@ public class HPKC007 extends DaoEPBase {
eiColumn.setDescName("物料名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_RECORD_ID);
eiColumn.setDescName("规格ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(2);
......@@ -170,6 +180,10 @@ public class HPKC007 extends DaoEPBase {
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OLD_OUTER_NO);
eiColumn.setDescName("原出库单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
......@@ -194,6 +208,10 @@ public class HPKC007 extends DaoEPBase {
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除0.否1.是");
eiMetadata.addMeta(eiColumn);
}
......@@ -365,17 +383,17 @@ public class HPKC007 extends DaoEPBase {
this.inventName = inventName;
}
/**
* get the inventRecordId - 规格.
* get the inventRecordId - 规格ID.
* @return the inventRecordId
*/
public Long getInventRecordId() {
return this.inventRecordId;
}
/**
* set the inventRecordId - 规格.
* set the inventRecordId - 规格ID.
*
* @param inventRecordId - 规格
* @param inventRecordId - 规格ID
*/
public void setInventRecordId(Long inventRecordId) {
this.inventRecordId = inventRecordId;
......@@ -461,6 +479,22 @@ public class HPKC007 extends DaoEPBase {
this.remark = remark;
}
/**
* get the oldOuterNo - 原出库单号.
* @return the oldOuterNo
*/
public String getOldOuterNo() {
return this.oldOuterNo;
}
/**
* set the oldOuterNo - 原出库单号.
*
* @param oldOuterNo - 原出库单号
*/
public void setOldOuterNo(String oldOuterNo) {
this.oldOuterNo = oldOuterNo;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
......@@ -557,6 +591,22 @@ public class HPKC007 extends DaoEPBase {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 是否删除0.否1.是.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 是否删除0.否1.是.
*
* @param deleteFlag - 是否删除0.否1.是
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the value from Map.
*
* @param map - source data map
......@@ -580,12 +630,14 @@ public class HPKC007 extends DaoEPBase {
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setKcId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_KC_ID)), kcId));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setOldOuterNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OLD_OUTER_NO)), oldOuterNo));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
}
/**
......@@ -611,12 +663,14 @@ public class HPKC007 extends DaoEPBase {
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
map.put(FIELD_KC_ID, StringUtils.toString(kcId, eiMetadata.getMeta(FIELD_KC_ID)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_OLD_OUTER_NO, StringUtils.toString(oldOuterNo, eiMetadata.getMeta(FIELD_OLD_OUTER_NO)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
return map;
}
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
......@@ -9,6 +10,7 @@ import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
......@@ -69,8 +71,8 @@ public class ServiceHPKC007 extends ServiceBase {
String receiptDate = MapUtils.getString(queryRow, "receiptDate");
queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
inInfo = super.query(inInfo, HPKC007.QUERY, new HPKC006());
List sum = dao.query(HPSqlConstant.HPKC006.QUERY_SUM, queryRow);
inInfo = super.query(inInfo, HPKC007.QUERY, new HPKC007());
List sum = dao.query(HPSqlConstant.HPKC007.QUERY_SUM, queryRow);
inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -191,7 +193,7 @@ public class ServiceHPKC007 extends ServiceBase {
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 库单号
// 库单号
List<String> otherOuterNos = ObjectUtils.listKey(resultRows, "otherOuterNo");
// 锁记录
HPKCTools.lockKc007(otherOuterNos);
......@@ -201,8 +203,16 @@ public class ServiceHPKC007 extends ServiceBase {
HPKC007 fKc007 = new HPKC007();
fKc007.fromMap(resultRows.get(i));
DaoUtils.update(HPKC007.DELETE, fKc007);
// 修改库存
// 生成红冲记录
HPKC007 dbKc007 = mapKc007.get(fKc007.getOtherOuterNo());
HPKC007 newKc007 = BeanUtils.copy(dbKc007, HPKC007.class);
newKc007.setOtherOuterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_OUTER_NO));
newKc007.setAmount(newKc007.getAmount().negate());
newKc007.setWeight(newKc007.getWeight().negate());
newKc007.setOldOuterNo(dbKc007.getOtherOuterNo());
newKc007.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC007.INSERT, newKc007);
// 修改库存
HPKCTools.updateStock(dbKc007.getWhCode(), dbKc007.getInventRecordId(), dbKc007.getAmount(),
dbKc007.getWeight());
}
......
......@@ -2,6 +2,7 @@ package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
......@@ -18,6 +19,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.Arrays;
......@@ -102,13 +104,16 @@ public class ServiceHPKC007A extends ServiceEPBase {
for (Map row : resultRows) {
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
BigDecimal applyWeight = MapUtils.getBigDecimal(row, "applyWeight");
String applyRemark = MapUtils.getString(row, "applyRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
HPKC007 kc007 = BeanUtils.copy(dbKc010, HPKC007.class);
kc007.setOtherOuterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_OUTER_NO));
kc007.setReceiptDate(DateUtils.shortDate());
kc007.setAmount(applyAmount);
kc007.setWeight(applyWeight);
kc007.setRemark("");
kc007.setKcId(kcId);
kc007.setRemark(applyRemark);
DaoUtils.insert(HPKC007.INSERT, kc007);
// 修改库存数量
HPKCTools.updateStock(kc007.getWhCode(), kc007.getInventRecordId(), kc007.getAmount().negate(),
......
......@@ -13,11 +13,13 @@
INVENT_TYPE as "inventType", <!-- 物料类型 -->
INVENT_CODE as "inventCode", <!-- 物料编码 -->
INVENT_NAME as "inventName", <!-- 物料名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格 -->
AMOUNT as "amount", <!-- 数量 -->
WEIGHT as "weight", <!-- 重量 -->
STATUS as "status", <!-- 状态 0审核 1保存 -->
KC_ID as "kcId", <!-- 库存ID -->
REMARK as "remark", <!-- 备注 -->
OLD_OUTER_NO as "oldOuterNo", <!-- 原出库单号 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
......@@ -27,6 +29,7 @@
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -57,6 +60,9 @@
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="oldOuterNo">
OLD_OUTER_NO = #oldOuterNo#
</isNotEmpty>
</sql>
<sql id="customCondition">
......@@ -123,22 +129,26 @@
INVENT_TYPE, <!-- 物料类型 -->
INVENT_CODE, <!-- 物料编码 -->
INVENT_NAME, <!-- 物料名称 -->
INVENT_RECORD_ID, <!-- 规格 -->
AMOUNT, <!-- 数量 -->
WEIGHT, <!-- 重量 -->
KC_ID, <!-- 库存ID -->
REMARK, <!-- 备注 -->
OLD_OUTER_NO, <!-- 原出库单号 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #otherOuterNo#, #whCode#, #whName#,
#inventType#, #inventCode#, #inventName#, #amount#, #weight#,
#kcId#, #remark#, #createdBy#, #createdName#, #createdTime#
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#,
#kcId#, #remark#, #oldOuterNo#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
)
</insert>
<!-- 逻辑删除 -->
<delete id="delete">
DELETE FROM hpjx.t_hpkc007 WHERE ID = #id#
UPDATE hpjx.t_hpkc007 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<update id="update">
......@@ -154,6 +164,19 @@
WHERE ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPKC007
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<isNotEmpty prepend=" AND " property="otherOuterNo">
OTHER_OUTER_NO = #otherOuterNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherOuterNos">
OTHER_OUTER_NO IN <iterate close=")" open="(" conjunction="," property="otherOuterNos">#otherOuterNos[]#</iterate>
</isNotEmpty>
</update>
<!-- 统计库存 -->
<select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC007">
SELECT
......
......@@ -16,7 +16,7 @@
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains"
template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#">
template="#=textField#" valueTemplate="#=textField#">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFSelect>
......@@ -37,7 +37,7 @@
<EF:EFGrid blockId="result" autoDraw="no">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="otherOuterNo" cname="出库单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" editType="date" dateFormat="yyyy-MM-dd"
parseFormats="['yyyyMMdd']" width="90" align="center" required="true"/>
<EF:EFComboColumn ename="whCode" cname="仓库编码" enable="false" width="120"
columnTemplate="#=textField#" itemTemplate="#=textField#"
......@@ -51,11 +51,11 @@
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true"/>
<EF:EFColumn ename="weight" cname="重量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150"/>
<EF:EFColumn ename="amount" cname="数量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="right" sumType="all" required="true"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="right" sumType="all" required="true"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
......@@ -57,6 +57,7 @@
</EF:EFComboColumn>
<EF:EFColumn ename="applyAmount" cname="申请数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="applyWeight" cname="申请重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="applyRemark" cname="说明" enable="false" width="150" editType="textarea" copy="true"/>
<EF:EFColumn ename="amount" cname="库存数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="weight" cname="库存重量" enable="false" width="120" align="right" format="{0:N3}"
......
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