Commit 57af0b79 by wuwenlong

生产入库bugfix

parent 1979e892
......@@ -35,6 +35,7 @@ public class HPKC003 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"; /* 存货档案ID*/
public static final String FIELD_AMOUNT = "amount"; /* 数量*/
public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
......@@ -60,6 +61,7 @@ public class HPKC003 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"; /* 存货档案ID*/
public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
......@@ -83,6 +85,7 @@ public class HPKC003 extends DaoEPBase {
private Integer inventType; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long inventRecordId = new Long(0); /* 存货档案ID*/
private BigDecimal amount = new BigDecimal(0.00); /* 数量*/
private BigDecimal weight = new BigDecimal(0.00); /* 重量*/
private String remark = " "; /* 备注*/
......@@ -137,6 +140,10 @@ public class HPKC003 extends DaoEPBase {
eiColumn.setDescName("仓库名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_RECORD_ID);
eiColumn.setDescName("存货档案ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_TYPE);
eiColumn.setDescName("存货类型");
eiMetadata.addMeta(eiColumn);
......@@ -397,6 +404,22 @@ public class HPKC003 extends DaoEPBase {
this.inventName = inventName;
}
/**
* get the inventRecordId - 存货档案ID.
* @return the inventRecordId
*/
public Long getInventRecordId() {
return this.inventRecordId;
}
/**
* set the inventRecordId - 存货档案ID.
*
* @param inventRecordId - 存货档案ID
*/
public void setInventRecordId(Long inventRecordId) {
this.inventRecordId = inventRecordId;
}
/**
* get the amount - 数量.
* @return the amount
*/
......@@ -577,6 +600,7 @@ public class HPKC003 extends DaoEPBase {
setInventType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
......@@ -609,6 +633,7 @@ public class HPKC003 extends DaoEPBase {
map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
......
......@@ -4,6 +4,7 @@ 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.HPKC003;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
......@@ -15,6 +16,7 @@ import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
......@@ -75,7 +77,6 @@ public class ServiceHPKC003 extends ServiceBase {
*/
@Override
public EiInfo insert(EiInfo inInfo) {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据写入
......@@ -92,7 +93,10 @@ public class ServiceHPKC003 extends ServiceBase {
DaoUtils.insert("HPKC003.insert", fKc003);
//同步生产计划
this.synchronousPlan(fKc003);
DaoUtils.update("HPSC004.update",this.synchronousPlan(fKc003));
// 修改库存
HPKCTools.updateStock(fKc003.getWhCode(), fKc003.getInventRecordId(), fKc003.getAmount().negate(),
fKc003.getWeight().negate());
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -155,7 +159,10 @@ public class ServiceHPKC003 extends ServiceBase {
hpkc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO));
DaoUtils.insert("HPKC003.insert", hpkc003);
//同步生产计划
this.synchronousPlan(hpkc003);
DaoUtils.update("HPSC004.update",this.synchronousPlan(hpkc003));
// 修改库存
HPKCTools.updateStock(hpkc003.getWhCode(), hpkc003.getInventRecordId(), hpkc003.getAmount().negate(),
hpkc003.getWeight().negate());
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
......@@ -170,25 +177,23 @@ public class ServiceHPKC003 extends ServiceBase {
* 新增入库及删除入库单做同步计划订单
* @param hpkc003
*/
public void synchronousPlan(HPKC003 hpkc003) {
HPSC004 HPSC004 = (HPSC004) this.dao.get("HPSC004.queryDetail","productionOrderNo",hpkc003.getProductionOrderNo());
if (HPSC004 != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
BigDecimal actualCompletionNum = hpkc003.getAmount().add(HPSC004.getNum());
BigDecimal actualCompletionUnitWt = hpkc003.getWeight().add(HPSC004.getActualCompletionUnitWt());
HPSC004.setActualCompletionNum(actualCompletionNum);
HPSC004.setActualCompletionUnitWt(actualCompletionUnitWt);
HPSC004.setUpdatedBy(UserSession.getUserId());
HPSC004.setUpdatedTime(sdf.format(new Date()));
public HPSC004 synchronousPlan(HPKC003 hpkc003) {
HPSC004 hpsc004 = (HPSC004) this.dao.get("HPSC004.queryDetail","productionOrderNo",hpkc003.getProductionOrderNo());
if (hpsc004 != null) {
BigDecimal actualCompletionNum = hpkc003.getAmount().add(hpsc004.getNum());
BigDecimal actualCompletionUnitWt = hpkc003.getWeight().add(hpsc004.getActualCompletionUnitWt());
hpsc004.setActualCompletionNum(actualCompletionNum);
hpsc004.setActualCompletionUnitWt(actualCompletionUnitWt);
//计算是否生产完成
if (HPSC004.getNum().compareTo(actualCompletionNum) < 0
&& HPSC004.getUnitWt().compareTo(actualCompletionUnitWt) < 0) {
HPSC004.setActualCompletionDate(sdf.format(new Date()));
if (hpsc004.getNum().compareTo(actualCompletionNum) < 0
&& hpsc004.getUnitWt().compareTo(actualCompletionUnitWt) < 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
hpsc004.setActualCompletionDate(DateUtils.toDateStr(new Date(),DateUtils.DEFAULT_DATETIME_PATTERN));
} else {
HPSC004.setActualCompletionDate("");
hpsc004.setActualCompletionDate("");
}
this.dao.update("HPSC004.update", HPSC004.toMap());
}
return hpsc004;
}
}
......@@ -14,6 +14,7 @@
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
WEIGHT as "weight", <!-- 重量 -->
REMARK as "remark", <!-- 备注 -->
......@@ -54,6 +55,9 @@
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -63,6 +67,14 @@
</sql>
<sql id="customCondition">
<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">
CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
......@@ -109,6 +121,7 @@
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
AMOUNT, <!-- 数量 -->
WEIGHT, <!-- 重量 -->
REMARK, <!-- 备注 -->
......@@ -118,7 +131,7 @@
DELETE_FLAG
) VALUES (
#companyCode#, #depCode#, #documentDate#, #prodNo#, #prodNoOld#, #productionOrderNo#, #whCode#, #whName#,
#inventType#, #inventCode#, #inventName#, #amount#, #weight#, #remark#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#, #remark#,
#createdBy#, #createdName#, #createdTime#, 0
)
</insert>
......@@ -140,6 +153,7 @@
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 存货档案ID -->
AMOUNT = #amount#, <!-- 数量 -->
WEIGHT = #weight#, <!-- 重量 -->
REMARK = #remark#, <!-- 备注 -->
......@@ -157,6 +171,7 @@
WH_CODE AS "whCode",
INVENT_TYPE AS "inventType",
INVENT_CODE AS "inventCode",
INVENT_RECORD_ID AS "inventRecordId",
COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hpjxSchema}.T_HPKC003
......@@ -164,7 +179,7 @@
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, INVENT_TYPE, INVENT_CODE
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, INVENT_TYPE, INVENT_CODE, INVENT_RECORD_ID
</select>
</sqlMap>
......@@ -53,6 +53,7 @@
</EF:EFComboColumn>
<EF:EFColumn cname="存货代码" ename="inventCode" width="120" align="center" enable="false"/>
<EF:EFColumn cname="存货名称" ename="inventName" width="120" align="center" enable="false"/>
<EF:EFColumn ename="inventRecordId" cname="存货档案ID" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150" editType="textarea" readonly="true"/>
<EF:EFColumn cname="原生产单号" ename="ProdNoOld" enable="false" width="140" align="center"/>
<EF:EFColumn cname="创建人名称" ename="createdName" enable="false" width="120" align="center"/>
......
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