Commit 0f1d4c10 by 宋祥

1.采购入库支持录入规格等信息

parent 2bf6133c
......@@ -56,7 +56,7 @@ public enum DdynamicEnum {
* 编写:wwl
*/
INVENT_ALL_BLOCK_ID("invent_all_block_id", "id", "spec", "material", "unit", "length", "width", "thick",
"HPPZ006.queryComboBoxAll"),
"coefficient", "HPPZ006.queryComboBoxAll"),
/**
* 模块:存货档案部件名称
......@@ -220,6 +220,8 @@ public enum DdynamicEnum {
private String param4;
private String param5;
private String param6;
/** 数据源 */
private final String dbSource;
......@@ -273,6 +275,20 @@ public enum DdynamicEnum {
this.dbSource = dbSource;
}
DdynamicEnum(String blockId, String value, String text, String param1, String param2, String param3, String param4,
String param5, String param6,String dbSource) {
this.blockId = blockId;
this.value = value;
this.text = text;
this.param1 = param1;
this.param2 = param2;
this.param3 = param3;
this.param4 = param4;
this.param5 = param5;
this.param6 = param6;
this.dbSource = dbSource;
}
DdynamicEnum(String blockId, String value, String text, String dbSource){
this.blockId = blockId;
this.value = value;
......@@ -337,4 +353,12 @@ public enum DdynamicEnum {
public void setParam5(String param5) {
this.param5 = param5;
}
public String getParam6() {
return param6;
}
public void setParam6(String param6) {
this.param6 = param6;
}
}
......@@ -52,6 +52,8 @@ public class HPConstants {
public static final String PARAM5_FIELD = "param5Field";
/** 前后台交互下拉框字段 字段名 dzg */
public static final String PARAM6_FIELD = "param6Field";
/** 前后台交互下拉框字段 字段名 dzg */
public static final String VALUE_FIELD = "valueField";
public static final String PARAM_FILENAME = "fileName";
......
......@@ -8,6 +8,7 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
......@@ -80,6 +81,8 @@ public class ServiceHPKC001 extends ServiceBase {
inInfo = super.query(inInfo, HPKC001.QUERY, new HPKC001());
// List sum = dao.query(HPSqlConstant.HPKC001.QUERY_SUM, queryRow);
// inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
// 设置规格信息
HPPZTools.HpPz006.setSpecInfo(inInfo, HPKC001.FIELD_INVENT_RECORD_ID);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......@@ -118,8 +121,10 @@ public class ServiceHPKC001 extends ServiceBase {
for (Map resultRow : resultRows) {
HPKC001 fKc001 = new HPKC001();
fKc001.fromMap(resultRow);
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRow);
if (fKc001.getId() == null || fKc001.getId() == 0) {
this.addData(fKc001);
this.addData(fKc001, fPz006);
} else {
// TODO 采购入库不支持修改
}
......@@ -130,12 +135,19 @@ public class ServiceHPKC001 extends ServiceBase {
* 写入数据
*
* @param fKc001
* @param fPz006
*/
private void addData(HPKC001 fKc001) {
private void addData(HPKC001 fKc001, HPPZ006 fPz006) {
// 设置基础信息
this.setBaseInfo(fKc001);
// 检查规格是否已存在,不存在就新增
HPPZ006 dbPz006 = HPPZTools.HpPz006.checkAndSave(fPz006);
fKc001.setInventRecordId(dbPz006.getId());
// 计算重量
this.calcWeight(fKc001);
// 生成入库单号
fKc001.setPurchaseNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC001_NUMBER));
fKc001.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC001.INSERT, fKc001);
// 修改库存
HPKCTools.updateStock(fKc001.getWhCode(), fKc001.getInventRecordId(), fKc001.getAmount(),
......@@ -153,7 +165,6 @@ public class ServiceHPKC001 extends ServiceBase {
fKc001.fromMap(resultRow);
AssertUtils.isEmpty(fKc001.getWhCode(), "仓库名称不能为空");
AssertUtils.isEmpty(fKc001.getInventCode(), "存货名称不能为空");
// AssertUtils.isNull(fKc001.getInventRecordId(), "规格不能为空");
AssertUtils.isGt(BigDecimal.ZERO, fKc001.getAmount(), "数量必须大于0");
AssertUtils.isGt(BigDecimal.ZERO, fKc001.getWeight(), "重量必须大于0");
}
......@@ -171,6 +182,14 @@ public class ServiceHPKC001 extends ServiceBase {
fKc001.setWhName(HPPZTools.HpPz007.getByCode(fKc001.getWhCode()).getWhName());
// 存货名称
fKc001.setInventName(HPPZTools.HpPz004.getByCode(fKc001.getInventCode()).getInventName());
}
/**
* 计算重量
*
* @param fKc001
*/
private void calcWeight(HPKC001 fKc001) {
// 根据规格计算单重
fKc001.setUnitWeight(HPPZTools.HpPz006.calcUnitWeight(fKc001.getInventRecordId()));
// 计算总重
......
......@@ -266,6 +266,7 @@
LENGTH AS "length" , <!-- 长 -->
WIDTH AS "width" , <!-- 宽 -->
THICK AS "thick" , <!-- 厚 -->
COEFFICIENT AS "coefficient" , <!-- 系数 -->
MATERIAL AS "material" , <!-- 材质 -->
UNIT AS "unit" <!-- 单位 -->
FROM hpjx.t_hppz006
......
......@@ -287,13 +287,33 @@ public class HPPZTools {
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HPPZ006> results = DaoBase.getInstance().query(HPPZ006.QUERY, queryMap);
AssertUtils.isNull(results, String.format("规格[%s]不存在", id));
AssertUtils.isEmpty(results, String.format("规格[%s]不存在", id));
return results.get(0);
}
/**
* 查询
*
* @param inventCode
* @param spec
* @return
*/
public static HPPZ006 getBySpec(String inventCode, String spec) {
AssertUtils.isEmpty(inventCode, "存货编码不能为空");
Map queryMap = new HashMap();
queryMap.put("inventCode", inventCode);
if (StringUtils.isBlank(spec)) {
queryMap.put("notSpec", CommonConstant.YesNo.YES);
} else {
queryMap.put("spec", spec);
}
List<HPPZ006> results = DaoBase.getInstance().query(HPPZ006.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param ids
* @return
*/
......@@ -360,6 +380,19 @@ public class HPPZTools {
/**
* 拼接规格
*
* @param pz006
*/
public static void jointSpec(HPPZ006 pz006) {
if (StringUtils.isNotBlank(pz006.getSpec())) {
return;
}
pz006.setSpec(jointSpec(pz006.getLength(), pz006.getWidth(), pz006.getThick()));
}
/**
* 拼接规格
*
* @param length
* @param width
* @param thick
......@@ -389,6 +422,26 @@ public class HPPZTools {
}
/**
* 检查不存在就新增
*
* @param newPz006
* @return
*/
public static HPPZ006 checkAndSave(HPPZ006 newPz006) {
// 检查存货名称是否存在
jointSpec(newPz006);
HPPZ006 specPz006 = getBySpec(newPz006.getInventCode(), newPz006.getSpec());
if (specPz006 != null) {
return specPz006;
} else {
// 生成编码
newPz006.setStatus(CommonConstant.YesNo.YES_1.intValue());
DaoUtils.insert(HPPZ006.INSERT, newPz006);
return newPz006;
}
}
/**
* 判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案
*
* @param inventType 存货类型
......@@ -450,10 +503,16 @@ public class HPPZTools {
for (Map resultRow : resultRows) {
Long id = MapUtils.getLong(resultRow, idName);
HPPZ006 dbPz006 = resultMap.get(id);
resultRow.put(HPPZ006.FIELD_SPEC, dbPz006 == null ? "" : dbPz006.getSpec());
if (dbPz006 == null) {
resultRow.put(HPPZ006.FIELD_SPEC, "");
} else {
resultRow.put(HPPZ006.FIELD_SPEC, "".equals(StringUtils.trim(dbPz006.getSpec()))
? "无规格" : dbPz006.getSpec());
}
resultRow.put(HPPZ006.FIELD_LENGTH, dbPz006 == null ? "" : dbPz006.getLength());
resultRow.put(HPPZ006.FIELD_WIDTH, dbPz006 == null ? "" : dbPz006.getWidth());
resultRow.put(HPPZ006.FIELD_THICK, dbPz006 == null ? "" : dbPz006.getThick());
resultRow.put(HPPZ006.FIELD_COEFFICIENT, dbPz006 == null ? "" : dbPz006.getCoefficient());
}
}
......
......@@ -84,7 +84,7 @@ public class CommonMethod {
row.put(HPConstants.PARAM3_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam3())));
row.put(HPConstants.PARAM4_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam4())));
row.put(HPConstants.PARAM5_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam5())));
row.put(HPConstants.PARAM6_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam6())));
} else {
row.put(HPConstants.TEXT_FIELD, String.valueOf(tryValue.get(tableParam.getText())));
row.put(HPConstants.PARAM1_FIELD, String.valueOf(tryValue.get(tableParam.getParam1())));
......@@ -92,6 +92,7 @@ public class CommonMethod {
row.put(HPConstants.PARAM3_FIELD, String.valueOf(tryValue.get(tableParam.getParam3())));
row.put(HPConstants.PARAM4_FIELD, String.valueOf(tryValue.get(tableParam.getParam4())));
row.put(HPConstants.PARAM5_FIELD, String.valueOf(tryValue.get(tableParam.getParam5())));
row.put(HPConstants.PARAM6_FIELD, String.valueOf(tryValue.get(tableParam.getParam6())));
}
resultRows.add(row);
}
......
......@@ -83,7 +83,7 @@ $(function() {
inInfo.set("methodName", "queryComboBoxSpec");
inInfo.set("blockId", "invent_spec_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
refreshInputSelect(container, inInfo);
}
}, {
field: "length",
......@@ -93,7 +93,7 @@ $(function() {
return inventAllGlobalData[i]['param3Field'];
}
}
return "";
return dataItem['length'];
}
}, {
field: "width",
......@@ -103,7 +103,7 @@ $(function() {
return inventAllGlobalData[i]['param4Field'];
}
}
return "";
return dataItem['width'];
}
}, {
field: "thick",
......@@ -113,7 +113,7 @@ $(function() {
return inventAllGlobalData[i]['param5Field'];
}
}
return "";
return dataItem['thick'];
}
}, {
field: "material",
......@@ -123,7 +123,7 @@ $(function() {
return inventAllGlobalData[i]['param1Field'];
}
}
return "";
return dataItem['material'];
}
}, {
field: "unit",
......@@ -133,23 +133,25 @@ $(function() {
return inventAllGlobalData[i]['param2Field'];
}
}
return "";
return dataItem['unit'];
}
}],
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function(e) {
if (e.field == "inventRecordId") {
if (e.field == "spec") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === item.inventRecordId) {
resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field'])
resultGrid.setCellValue(item, 'unit', inventAllGlobalData[i]['param2Field'])
resultGrid.setCellValue(item, 'length', inventAllGlobalData[i]['param3Field'])
resultGrid.setCellValue(item, 'width', inventAllGlobalData[i]['param4Field'])
resultGrid.setCellValue(item, 'thick', inventAllGlobalData[i]['param5Field'])
if (inventAllGlobalData[i]['textField'] === item.spec) {
resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field']);
resultGrid.setCellValue(item, 'unit', inventAllGlobalData[i]['param2Field']);
resultGrid.setCellValue(item, 'length', inventAllGlobalData[i]['param3Field']);
resultGrid.setCellValue(item, 'width', inventAllGlobalData[i]['param4Field']);
resultGrid.setCellValue(item, 'thick', inventAllGlobalData[i]['param5Field']);
resultGrid.setCellValue(item, 'coefficient', inventAllGlobalData[i]['param6Field']);
resultGrid.refresh();
}
}
}
......@@ -269,10 +271,6 @@ let save = function () {
message("勾选的第" + (i + 1) + "行存货名称不能为空");
return;
}
if (isBlank(rows[i]['inventRecordId'])) {
message("勾选的第" + (i + 1) + "行规格不能为空");
return;
}
if (!isPositiveInteger(rows[i]['amount'])) {
message("勾选的第" + (i + 1) + "行数量必须是大于0的整数");
return;
......
......@@ -44,28 +44,29 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" isFloat="true" checkMode="row">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="purchaseNo" cname="采购单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="purchaseNo" cname="采购单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="90" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" readonly="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
<EF:EFComboColumn ename="inventType" cname="存货类型" width="80" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" width="120" align="center" readonly="true" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" enable="false"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N0}" maxLength="20" width="100" align="right"
required="true" readonly="true"/>
<EF:EFColumn ename="unitWeight" cname="单重(KG)" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="重量(KG)" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="unitWeight" cname="单重(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="重量(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="material" cname="材质" width="80" align="center" readonly="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center" readonly="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150" readonly="true"/>
<EF:EFColumn ename="oldPurchaseNo" cname="原采购单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" 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