Commit ef6a2782 by 宋祥

1.其他入库生成存货错乱问题修复

parent cb467e88
package com.baosight.hpjx.hp.kc.domain; package com.baosight.hpjx.hp.kc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/** /**
* Project: <br> * Project: <br>
...@@ -90,9 +91,9 @@ public class HPKC006 extends DaoEPBase { ...@@ -90,9 +91,9 @@ public class HPKC006 extends DaoEPBase {
private String receiptDate = " "; /* 单据日期*/ private String receiptDate = " "; /* 单据日期*/
private String otherEnterNo = " "; /* 其他入库单号*/ private String otherEnterNo = " "; /* 其他入库单号*/
private String whCode = " "; /* 仓库编码*/ private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/ private String whName = " "; /* 仓库名称*/
private String inventType = " "; /* 存货类型*/ private Integer inventType; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
private Long inventRecordId = null; /* 规格*/ private Long inventRecordId = null; /* 规格*/
private BigDecimal amount = new BigDecimal(0.00); /* 数量*/ private BigDecimal amount = new BigDecimal(0.00); /* 数量*/
...@@ -385,11 +386,13 @@ public class HPKC006 extends DaoEPBase { ...@@ -385,11 +386,13 @@ public class HPKC006 extends DaoEPBase {
public void setWhName(String whName) { public void setWhName(String whName) {
this.whName = whName; this.whName = whName;
} }
/** /**
* get the inventType - 物料类型. * get the inventType - 物料类型.
*
* @return the inventType * @return the inventType
*/ */
public String getInventType() { public Integer getInventType() {
return this.inventType; return this.inventType;
} }
...@@ -398,11 +401,13 @@ public class HPKC006 extends DaoEPBase { ...@@ -398,11 +401,13 @@ public class HPKC006 extends DaoEPBase {
* *
* @param inventType - 物料类型 * @param inventType - 物料类型
*/ */
public void setInventType(String inventType) { public void setInventType(Integer inventType) {
this.inventType = inventType; this.inventType = inventType;
} }
/** /**
* get the inventCode - 物料编码. * get the inventCode - 物料编码.
*
* @return the inventCode * @return the inventCode
*/ */
public String getInventCode() { public String getInventCode() {
...@@ -768,7 +773,7 @@ public class HPKC006 extends DaoEPBase { ...@@ -768,7 +773,7 @@ public class HPKC006 extends DaoEPBase {
setOtherEnterNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OTHER_ENTER_NO)), otherEnterNo)); setOtherEnterNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OTHER_ENTER_NO)), otherEnterNo));
setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode)); setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode));
setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName)); setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType)); setInventType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode)); setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName)); setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId)); setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
......
...@@ -22,7 +22,6 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -22,7 +22,6 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
...@@ -91,57 +90,64 @@ public class ServiceHPKC006 extends ServiceBase { ...@@ -91,57 +90,64 @@ public class ServiceHPKC006 extends ServiceBase {
} }
/** /**
* 新增操作 * 保存操作.
* *
* @param inInfo * @param inInfo
* @return * @return
*/ */
@Override @OperationLogAnnotation(operModul = "其他入库单", operType = "插入", operDesc = "保存")
@OperationLogAnnotation(operModul = "其他入库单", operType = "新增", operDesc = "新增") public EiInfo save(EiInfo inInfo) {
public EiInfo insert(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验 // 数据校验
this.checkSaveData(resultRows); this.checkSaveData(resultRows);
// 数据写入 // 写入数据
for (int i = 0; i < resultRows.size(); i++) { for (Map resultRow : resultRows) {
HPKC006 fKc006 = new HPKC006(); HPKC006 fKc006 = new HPKC006();
fKc006.fromMap(resultRows.get(i)); fKc006.fromMap(resultRow);
// 设置基础信息 if (fKc006.getId() == null || fKc006.getId() == 0) {
this.setBaseInfo(fKc006); this.add(fKc006);
// 生成入库单号 } else {
fKc006.setOtherEnterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_ENTER_NO)); // TODO 库存不支持修改
HPPZ006 hppz006 = HPPZTools.checkAndSavePZ06( }
Integer.parseInt(resultRows.get(i).get("inventType").toString()),
resultRows.get(i).get("inventName").toString(),
NumberUtils.toBigDecimal(resultRows.get(i).get("length")),
NumberUtils.toBigDecimal(resultRows.get(i).get("width")),
NumberUtils.toBigDecimal(resultRows.get(i).get("thick")),
NumberUtils.toBigDecimal(resultRows.get(i).get("coefficient")),
resultRows.get(i).get("material").toString(),
resultRows.get(i).get("unit").toString()
);
// 根据规格计算单重
fKc006.setUnitWeight(HPPZTools.HpPz006.calcUnitWeight(hppz006.getId()));
// 计算总重
fKc006.setWeight(fKc006.getAmount().multiply(fKc006.getUnitWeight()));
fKc006.setInventRecordId(hppz006.getId());
fKc006.setInventCode(hppz006.getInventCode());
DaoUtils.insert(HPKC006.INSERT, fKc006);
// 修改库存
HPKCTools.updateStock(fKc006.getWhCode(), fKc006.getInventRecordId(), fKc006.getAmount(),
fKc006.getWeight());
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败"); LogUtils.setDetailMsg(inInfo, e, "保存失败");
} }
return inInfo; return inInfo;
} }
/** /**
* 新增操作
*
* @param fKc006
* @return
*/
private void add(HPKC006 fKc006) {
// 设置基础信息
this.setBaseInfo(fKc006);
// 生成入库单号
fKc006.setOtherEnterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_ENTER_NO));
HPPZ006 hppz006 = HPPZTools.checkAndSavePZ06(fKc006.getInventType(), fKc006.getInventName(), fKc006.getLength(),
fKc006.getWidth(), fKc006.getThick(), fKc006.getCoefficient(), fKc006.getMaterial(), fKc006.getUnit()
);
// 根据规格计算单重
fKc006.setUnitWeight(HPPZTools.HpPz006.calcUnitWeight(hppz006.getId()));
// 计算总重
fKc006.setWeight(fKc006.getAmount().multiply(fKc006.getUnitWeight()));
fKc006.setInventRecordId(hppz006.getId());
fKc006.setInventCode(hppz006.getInventCode());
fKc006.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC006.INSERT, fKc006);
// 修改库存
HPKCTools.updateStock(fKc006.getWhCode(), fKc006.getInventRecordId(), fKc006.getAmount(),
fKc006.getWeight());
}
/**
* 校验保存的数据 * 校验保存的数据
* *
* @param resultRows * @param resultRows
......
...@@ -42,16 +42,16 @@ ...@@ -42,16 +42,16 @@
WH_CODE = #whCode# WH_CODE = #whCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="whName"> <isNotEmpty prepend=" AND " property="whName">
WH_NAME LIKE '%' || #whName# || '%' WH_NAME LIKE CONCAT('%', #whName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="prodNo"> <isNotEmpty prepend=" AND " property="prodNo">
PROD_NO = #prodNo# PROD_NO = #prodNo#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode"> <isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode# PROJ_CODE LIKE CONCAT('%', #projCode#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projName"> <isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE '%' || #projName# || '%' PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode"> <isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode# INVENT_CODE = #inventCode#
......
...@@ -215,8 +215,8 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -215,8 +215,8 @@ public class ServiceHPPZ006 extends ServiceBase {
}else{ }else{
// 生成编码 // 生成编码
hppz006.setInventType(Integer.parseInt(inInfo.getString("inventType"))); hppz006.setInventType(Integer.parseInt(inInfo.getString("inventType")));
hppz006.setInventCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.INVENT_CODE)); hppz006.setInventCode(inInfo.getString("inventCode"));
hppz006.setInventName(inInfo.getString("inventCode")); hppz006.setInventName(inInfo.getString("inventName"));
hppz006.setLength(new BigDecimal(inInfo.getString("length"))); hppz006.setLength(new BigDecimal(inInfo.getString("length")));
hppz006.setWidth(new BigDecimal(inInfo.getString("width"))); hppz006.setWidth(new BigDecimal(inInfo.getString("width")));
hppz006.setThick(new BigDecimal(inInfo.getString("thick"))); hppz006.setThick(new BigDecimal(inInfo.getString("thick")));
......
...@@ -354,7 +354,7 @@ public class HPPZTools { ...@@ -354,7 +354,7 @@ public class HPPZTools {
} }
EiInfo inInfo = new EiInfo(); EiInfo inInfo = new EiInfo();
inInfo.set("inventType", inventType); inInfo.set("inventType", inventType);
inInfo.set("inventCode", checkAndSavePZ04(inventType,inventName)); inInfo.set("inventCode", checkAndSavePZ04(inventType, inventName));
inInfo.set("inventName", inventName); inInfo.set("inventName", inventName);
inInfo.set("length", length); inInfo.set("length", length);
inInfo.set("width", width); inInfo.set("width", width);
......
...@@ -145,8 +145,10 @@ $(function() { ...@@ -145,8 +145,10 @@ $(function() {
loadComplete: function (grid) { loadComplete: function (grid) {
}, },
//beforeAdd:function(){firstLoad = 1}, //beforeAdd:function(){firstLoad = 1},
onSave:function () { onSave: function (e) {
//firstLoad = 1; // 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
}, },
afterEdit: function (e) { afterEdit: function (e) {
if (e.field === "inventRecordId") { if (e.field === "inventRecordId") {
......
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