Commit 66ba0a18 by zhanglt

Merge branch 'master' of http://gitlab.yqdchina.com/huyi/warehouse into zlt

parents a0af70bd 26ec05d5
......@@ -30,6 +30,7 @@ public class GoodsInfo extends DataEntity<GoodsInfo> {
private BigDecimal amount; // 单价
private List<QrCode> qrCodeList; // 二维码集合(xml中无关联查询)
private List<String> modelList; // 查询时使用的属性
public GoodsInfo() {
super();
......@@ -111,4 +112,11 @@ public class GoodsInfo extends DataEntity<GoodsInfo> {
this.qrCodeList = qrCodeList;
}
public List<String> getModelList() {
return modelList;
}
public void setModelList(List<String> modelList) {
this.modelList = modelList;
}
}
\ No newline at end of file
......@@ -26,7 +26,7 @@
<sql id="goodsInfoJoins">
LEFT JOIN t_wh_material_type type ON type.id = a.type_id
LEFT JOIN t_wh_goods b ON b.id = a.goods_id
LEFT JOIN t_wh_goods b ON b.id = a.goods_id
</sql>
......
......@@ -208,4 +208,13 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
goods.setGoodsInfoList(goodsInfoList);
return goods;
}
public QrCode getGIAndQCByTwoId(String goodsInfoId, String qrCodeId) {
GoodsInfo goodsInfo = goodsInfoMapper.get(new GoodsInfo(goodsInfoId));
QrCode qrCode = qrCodeMapper.get(new QrCode(qrCodeId));
if (null != qrCode) {
qrCode.setGoodsInfo(goodsInfo);
}
return qrCode;
}
}
\ No newline at end of file
......@@ -296,4 +296,22 @@ public class GoodsController extends BaseController {
return j;
}
/**
* 根据货品明细id和二维码id查询货品信息和二维码信息
* @param goodsInfoId
* @param qrCodeId
* @return
*/
@ResponseBody
@RequestMapping(value = "getGIAndQCByTwoId")
public AjaxJson getGIAndQCByTwoId(String goodsInfoId, String qrCodeId) {
AjaxJson j = new AjaxJson();
//新增或编辑表单保存
QrCode qrCode = goodsService.getGIAndQCByTwoId(goodsInfoId, qrCodeId);
j.put("qrCode", qrCode);
j.setSuccess(true);
j.setMsg("查询成功成功");
return j;
}
}
\ No newline at end of file
package com.jeeplus.modules.warehouse.ikanalyzer;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import org.wltea.analyzer.cfg.DefaultConfig;
import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;
import org.wltea.analyzer.cfg.Configuration;
public class IKSegmenterTest {
public class IKSegmenter {
private static Configuration m_wordCut_cfg;
......@@ -16,7 +17,7 @@ public class IKSegmenterTest {
// 参数2为是否使用智能分词
// true:使用智能分词
// false:使用最细粒度分词
IKSegmenter ikSegmenter = new IKSegmenter(sr, useSmart);
org.wltea.analyzer.core.IKSegmenter ikSegmenter = new org.wltea.analyzer.core.IKSegmenter(sr, useSmart);
Lexeme word = null;
String w = null;
StringBuffer sb = new StringBuffer();
......@@ -38,16 +39,21 @@ public class IKSegmenterTest {
* @param b ture为智能拆分,false为最细粒度拆分
* @return
*/
public static String splitStr(String text, boolean b) {
public static List<String> splitStr(String text, boolean b) {
String strs = text;
m_wordCut_cfg = DefaultConfig.getInstance();
try {
IKSegmenterTest ikSegmenterTest = new IKSegmenterTest();
IKSegmenter ikSegmenterTest = new IKSegmenter();
strs = ikSegmenterTest.parse(text,b);
} catch (Exception e) {
e.printStackTrace();
}
return strs;
List<String> list = new ArrayList<>();
String [] strArr = strs.split("|");
for (String str : strArr) {
list.add(str);
}
return list;
}
public static void main(String[] args) {
String text = "185的绿军鞋15双";
......
......@@ -7,6 +7,8 @@ import java.math.BigDecimal;
import java.util.*;
import com.jeeplus.modules.warehouse.ledger.dto.CountLedgerInfo;
import com.jeeplus.modules.warehouse.qrcode.entity.QrCode;
import com.jeeplus.modules.warehouse.qrcode.mapper.QrCodeMapper;
import com.jeeplus.modules.warehouse.shelves.utils.ShelvesUtil;
import com.jeeplus.modules.warehouse.storage.dto.CountStorageInfo;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -32,6 +34,8 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
@Autowired
private LedgerInfoMapper ledgerInfoMapper;
@Autowired
private QrCodeMapper qrCodeMapper;
public Ledger get(String id) {
Ledger ledger = super.get(id);
......@@ -139,6 +143,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
oldLeger.setSum(oldLeger.getSum().add(sum));
oldLeger.preUpdate();
mapper.update(oldLeger);
ledger = oldLeger;
}
for (LedgerInfo ledgerInfo : ledger.getLedgerInfoList()){
if (ledgerInfo.getId() == null){
......@@ -146,6 +151,10 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
}
if (LedgerInfo.DEL_FLAG_NORMAL.equals(ledgerInfo.getDelFlag())){
if (StringUtils.isBlank(ledgerInfo.getId())){
QrCode qrCode = ledgerInfo.getQr();
QrCode qc = qrCodeMapper.get(qrCode);
qc.setState("2");
qrCodeMapper.update(qc);
ledgerInfo.setLedger(ledger);
ledgerInfo.preInsert();
ledgerInfoMapper.insert(ledgerInfo);
......
......@@ -8,6 +8,8 @@ import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
import com.jeeplus.modules.warehouse.goods.entity.GoodsInfo;
import java.util.List;
/**
* 二维码Entity
* @author 胡懿
......@@ -20,7 +22,7 @@ public class QrCode extends DataEntity<QrCode> {
private String code; // 物资编码
private String url; // 二维码存储路径
private String state; // 物资状态码 (0:未入库,1:已入库未入账,2:已入账未下账,3:下账)
public QrCode() {
super();
}
......@@ -63,4 +65,5 @@ public class QrCode extends DataEntity<QrCode> {
public void setState(String state) {
this.state = state;
}
}
\ No newline at end of file
......@@ -175,6 +175,7 @@
FROM t_wh_qr a
LEFT JOIN t_wh_goods_info gi ON a.goods_info_id = gi.id
LEFT JOIN t_wh_material_type type ON type.id = gi.type_id
LEFT JOIN t_wh_goods g ON g.id = gi.goods_id
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if test="goodsInfo.goods.batchNum != null and goodsInfo.goods.batchNum != ''">
......@@ -183,8 +184,14 @@
<if test="goodsInfo.type.id != null and goodsInfo.type.id != ''">
AND gi.type_id = #{goodsInfo.type.id}
</if>
<if test="goodsInfo.model != null and goodsInfo.model != ''">
AND gi.type_id = #{goodsInfo.model}
<if test="state != null and state != ''">
AND a.state = #{state}
</if>
<if test="goodsInfo.modelList != null and goodsInfo.modelList.size() != 0">
AND
<foreach collection="goodsInfo.modelList" item="model" index="index" separator=" AND" open="(" close=")">
gi.model like concat('%',#{model},'%')
</foreach>
</if>
</where>
<choose>
......
......@@ -238,8 +238,8 @@ public class DrawQrcodeUtil {
public static BufferedImage createAssetImageNew(File qrcodeFile,QrCode qrCode) throws IOException {
GoodsInfo goodsInfo = qrCode.getGoodsInfo();
QRcodeSize qRcodeSize = null;
qRcodeSize = new QRcodeSize(8,50,330,78,50,50,300,300,new Color(34,25,21));
BufferedImage bgImage = new BufferedImage(400, 600, BufferedImage.TYPE_4BYTE_ABGR);
qRcodeSize = new QRcodeSize(8,200,1400,78,200,200,1200,1200,new Color(34,25,21));
BufferedImage bgImage = new BufferedImage(1600, 2400, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g2 = bgImage.createGraphics();
BufferedImage qrcodeImage = ImageIO.read(qrcodeFile);
......@@ -251,12 +251,12 @@ public class DrawQrcodeUtil {
, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2.setRenderingHints(rh);
Font font = new Font("黑体",Font.BOLD,3 * qRcodeSize.getInitfontSize());
Font font = new Font("黑体",Font.BOLD,16 * qRcodeSize.getInitfontSize());
g2.setFont(font); //设置字体:字体、字号、大小
g2.setColor(qRcodeSize.color);//设置背景颜色
// g2.setBackground(c);
int contentX = qRcodeSize.getInitContentX();
int contentY = qRcodeSize.getInitContentY() + 70;
int contentY = qRcodeSize.getInitContentY() + 200;
//写二维码
g2.drawImage(qrcodeImage,qRcodeSize.getQrcodeX(),qRcodeSize.getQrcodeY(),qRcodeSize.getQrcodeWidth(),qRcodeSize.getQrcodeHeight(),null,null);
......@@ -272,21 +272,32 @@ public class DrawQrcodeUtil {
//写入货品类型
String contentTitle2 = "货品类型:";
int contentTitle2Width = g2.getFontMetrics().stringWidth(contentTitle2);
g2.drawString(contentTitle2,contentX,contentY+50);
g2.drawString(contentTitle2,contentX,contentY+200);
String typeName = formatContent(goodsInfo.getType().getName(),10);
as = new AttributedString(typeName);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, typeName.length());
g2.drawString(as.getIterator(),contentX+contentTitle2Width,contentY+50);
g2.drawString(as.getIterator(),contentX+contentTitle2Width,contentY+200);
//写入物资编码
String contentTitle4 = "物资编码:";
int contentTitle4Width = g2.getFontMetrics().stringWidth(contentTitle4);
g2.drawString(contentTitle4,contentX,contentY+100);
String code = formatContent(qrCode.getCode(),10);
as = new AttributedString(code);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, code.length());
g2.drawString(as.getIterator(),contentX+contentTitle4Width,contentY+100);
g2.drawString(contentTitle4,contentX,contentY+400);
String code = qrCode.getCode();
if (code.length() > 10) {
String str1 = code.substring(0, 9);
str1 = formatContent(str1,10);
as = new AttributedString(str1);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, str1.length());
g2.drawString(as.getIterator(),contentX+contentTitle4Width,contentY+400);
String str2 = code.substring(9, code.length());
str2 = formatContent(str2,10);
as = new AttributedString(str2);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, str2.length());
g2.drawString(as.getIterator(),contentX+contentTitle4Width,contentY+600);
}
return bgImage;
}
......
......@@ -24,6 +24,7 @@ public class CountStorageInfo extends DataEntity<StorageInfo> {
private Warehouse warehouse; // 仓库外键
private BigDecimal sum; // 单价
private int num; // 数量
private String state; // 入库状态
private String shelvesNames; // 多个货架信息,前端展示使用
private String warehouseNames; // 多个仓库信息,前端展示使用
......@@ -123,4 +124,12 @@ public class CountStorageInfo extends DataEntity<StorageInfo> {
public void setWarehouseNames(String warehouseNames) {
this.warehouseNames = warehouseNames;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
......@@ -23,14 +23,17 @@
type.name AS "type.name",
type.code AS "type.code",
warehouse.name AS "warehouse.name"
s.name AS "shelves.name",
warehouse.name AS "warehouse.name",
qr.code AS "qrCode.code"
</sql>
<sql id="storageInfoJoins">
LEFT JOIN t_wh_material_type type ON type.id = a.type_id
LEFT JOIN t_wh_warehouse warehouse ON warehouse.id = a.warehouse_id
LEFT JOIN t_wh_shelves s on s.id = a.shelves_id
LEFT JOIN t_wh_qr qr on qr.id = a.qr_id
</sql>
......@@ -65,6 +68,9 @@
<if test="shelves != null and shelves.id != null and shelves.id != ''">
AND a.shelves_id = #{shelves.id}
</if>
<if test="goodsInfo != null and goodsInfo.id != null and goodsInfo.id != ''">
AND a.goods_info_id = #{goodsInfo.id}
</if>
<if test="model != null and model != ''">
AND a.model LIKE
<if test="dbName == 'oracle'">'%'||#{model}||'%'</if>
......@@ -201,19 +207,21 @@
s.name AS "shelves.name",
w.id AS "warehouse.id",
w.name AS "warehouse.name",
qr.state AS "state",
COUNT( a.id ) AS "num"
FROM
t_wh_storage_info a
LEFT JOIN t_wh_material_type type on a.type_id = type.id
LEFT JOIN t_wh_shelves s on s.id = a.shelves_id
LEFT JOIN t_wh_warehouse w on w.id = s.warehouse_id
LEFT JOIN t_wh_qr qr ON qr.id = a.qr_id
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if test="storage != null and storage.id != null and storage.id != ''">
AND a.storage_id = #{storage.id}
</if>
</where>
GROUP BY a.goods_info_id,a.shelves_id
GROUP BY a.goods_info_id,a.shelves_id,qr.state
</select>
</mapper>
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.jeeplus.modules.warehouse.goods.entity.Goods;
import com.jeeplus.modules.warehouse.goods.entity.GoodsInfo;
import com.jeeplus.modules.warehouse.goods.mapper.GoodsInfoMapper;
import com.jeeplus.modules.warehouse.goods.mapper.GoodsMapper;
import com.jeeplus.modules.warehouse.ikanalyzer.IKSegmenter;
import com.jeeplus.modules.warehouse.ledger.dto.CountLedgerInfo;
import com.jeeplus.modules.warehouse.qrcode.entity.QrCode;
import com.jeeplus.modules.warehouse.qrcode.mapper.QrCodeMapper;
......@@ -88,6 +89,7 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
csi.setModel(c.getModel());
csi.setName(c.getName());
csi.setType(c.getType());
csi.setState(c.getState());
}
if (i != list.size() - 1) {
shelvesNames = shelvesNames + c.getShelves().getName() + ",";
......@@ -215,13 +217,23 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
/**
* 根据批次号,货品类型,货品型号查询二维码
* @param goodsInfo
* @param si
* @return
*/
@Transactional(readOnly = false)
public Page<StorageInfo> findByPcTypeModel(Page<StorageInfo> page, GoodsInfo goodsInfo) {
public Page<StorageInfo> findByPcTypeModel(Page<StorageInfo> page, StorageInfo si) {
GoodsInfo goodsInfo = si.getGoodsInfo();
QrCode temQr = new QrCode();
String model = goodsInfo.getModel();
if (StringUtils.isNotBlank(model)) {
goodsInfo.setModelList(IKSegmenter.splitStr(model, false));
}
temQr.setGoodsInfo(goodsInfo);
QrCode qr = si.getQrCode();
if (null != qr && StringUtils.isNotBlank(qr.getState())) {
temQr.setState(qr.getState());
}
List<QrCode> qrCodeList = qrCodeMapper.findByPcTypeModel(temQr);
List<StorageInfo> storageInfoList = new ArrayList<>();
......
......@@ -270,7 +270,7 @@ public class StorageController extends BaseController {
public Map<String, Object> findByPcTypeModel(HttpServletRequest request, HttpServletResponse response, StorageInfo storageInfo) {
GoodsInfo goodsInfo = storageInfo.getGoodsInfo();
if (null != goodsInfo && null != goodsInfo.getGoods() && null != goodsInfo.getType() && StringUtils.isNotBlank(goodsInfo.getGoods().getBatchNum()) && StringUtils.isNotBlank(goodsInfo.getType().getId())) {
Page<StorageInfo> page = storageService.findByPcTypeModel(new Page<StorageInfo>(request, response), goodsInfo);
Page<StorageInfo> page = storageService.findByPcTypeModel(new Page<StorageInfo>(request, response), storageInfo);
return getBootstrapData(page);
} else {
return null;
......
/*
* big.js v6.1.1
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
* Copyright (c) 2021 Michael Mclaughlin
* https://github.com/MikeMcl/big.js/LICENCE.md
*/
;(function (GLOBAL) {
'use strict';
var Big,
/************************************** EDITABLE DEFAULTS *****************************************/
// The default values below must be integers within the stated ranges.
/*
* The maximum number of decimal places (DP) of the results of operations involving division:
* div and sqrt, and pow with negative exponents.
*/
DP = 20, // 0 to MAX_DP
/*
* The rounding mode (RM) used when rounding to the above decimal places.
*
* 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
* 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
* 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
* 3 Away from zero. (ROUND_UP)
*/
RM = 1, // 0, 1, 2 or 3
// The maximum value of DP and Big.DP.
MAX_DP = 1E6, // 0 to 1000000
// The maximum magnitude of the exponent argument to the pow method.
MAX_POWER = 1E6, // 1 to 1000000
/*
* The negative exponent (NE) at and beneath which toString returns exponential notation.
* (JavaScript numbers: -7)
* -1000000 is the minimum recommended exponent value of a Big.
*/
NE = -7, // 0 to -1000000
/*
* The positive exponent (PE) at and above which toString returns exponential notation.
* (JavaScript numbers: 21)
* 1000000 is the maximum recommended exponent value of a Big, but this limit is not enforced.
*/
PE = 21, // 0 to 1000000
/*
* When true, an error will be thrown if a primitive number is passed to the Big constructor,
* or if valueOf is called, or if toNumber is called on a Big which cannot be converted to a
* primitive number without a loss of precision.
*/
STRICT = false, // true or false
/**************************************************************************************************/
// Error messages.
NAME = '[big.js] ',
INVALID = NAME + 'Invalid ',
INVALID_DP = INVALID + 'decimal places',
INVALID_RM = INVALID + 'rounding mode',
DIV_BY_ZERO = NAME + 'Division by zero',
// The shared prototype object.
P = {},
UNDEFINED = void 0,
NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
/*
* Create and return a Big constructor.
*/
function _Big_() {
/*
* The Big constructor and exported function.
* Create and return a new instance of a Big number object.
*
* n {number|string|Big} A numeric value.
*/
function Big(n) {
var x = this;
// Enable constructor usage without new.
if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);
// Duplicate.
if (n instanceof Big) {
x.s = n.s;
x.e = n.e;
x.c = n.c.slice();
} else {
if (typeof n !== 'string') {
if (Big.strict === true) {
throw TypeError(INVALID + 'number');
}
// Minus zero?
n = n === 0 && 1 / n < 0 ? '-0' : String(n);
}
parse(x, n);
}
// Retain a reference to this Big constructor.
// Shadow Big.prototype.constructor which points to Object.
x.constructor = Big;
}
Big.prototype = P;
Big.DP = DP;
Big.RM = RM;
Big.NE = NE;
Big.PE = PE;
Big.strict = STRICT;
Big.roundDown = 0;
Big.roundHalfUp = 1;
Big.roundHalfEven = 2;
Big.roundUp = 3;
return Big;
}
/*
* Parse the number or string value passed to a Big constructor.
*
* x {Big} A Big number instance.
* n {number|string} A numeric value.
*/
function parse(x, n) {
var e, i, nl;
if (!NUMERIC.test(n)) {
throw Error(INVALID + 'number');
}
// Determine sign.
x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
// Decimal point?
if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
// Exponential form?
if ((i = n.search(/e/i)) > 0) {
// Determine exponent.
if (e < 0) e = i;
e += +n.slice(i + 1);
n = n.substring(0, i);
} else if (e < 0) {
// Integer.
e = n.length;
}
nl = n.length;
// Determine leading zeros.
for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
if (i == nl) {
// Zero.
x.c = [x.e = 0];
} else {
// Determine trailing zeros.
for (; nl > 0 && n.charAt(--nl) == '0';);
x.e = e - i - 1;
x.c = [];
// Convert string to array of digits without leading/trailing zeros.
for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
}
return x;
}
/*
* Round Big x to a maximum of sd significant digits using rounding mode rm.
*
* x {Big} The Big to round.
* sd {number} Significant digits: integer, 0 to MAX_DP inclusive.
* rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
* [more] {boolean} Whether the result of division was truncated.
*/
function round(x, sd, rm, more) {
var xc = x.c;
if (rm === UNDEFINED) rm = x.constructor.RM;
if (rm !== 0 && rm !== 1 && rm !== 2 && rm !== 3) {
throw Error(INVALID_RM);
}
if (sd < 1) {
more =
rm === 3 && (more || !!xc[0]) || sd === 0 && (
rm === 1 && xc[0] >= 5 ||
rm === 2 && (xc[0] > 5 || xc[0] === 5 && (more || xc[1] !== UNDEFINED))
);
xc.length = 1;
if (more) {
// 1, 0.1, 0.01, 0.001, 0.0001 etc.
x.e = x.e - sd + 1;
xc[0] = 1;
} else {
// Zero.
xc[0] = x.e = 0;
}
} else if (sd < xc.length) {
// xc[sd] is the digit after the digit that may be rounded up.
more =
rm === 1 && xc[sd] >= 5 ||
rm === 2 && (xc[sd] > 5 || xc[sd] === 5 &&
(more || xc[sd + 1] !== UNDEFINED || xc[sd - 1] & 1)) ||
rm === 3 && (more || !!xc[0]);
// Remove any digits after the required precision.
xc.length = sd--;
// Round up?
if (more) {
// Rounding up may mean the previous digit has to be rounded up.
for (; ++xc[sd] > 9;) {
xc[sd] = 0;
if (!sd--) {
++x.e;
xc.unshift(1);
}
}
}
// Remove trailing zeros.
for (sd = xc.length; !xc[--sd];) xc.pop();
}
return x;
}
/*
* Return a string representing the value of Big x in normal or exponential notation.
* Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
*/
function stringify(x, doExponential, isNonzero) {
var e = x.e,
s = x.c.join(''),
n = s.length;
// Exponential notation?
if (doExponential) {
s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
// Normal notation.
} else if (e < 0) {
for (; ++e;) s = '0' + s;
s = '0.' + s;
} else if (e > 0) {
if (++e > n) {
for (e -= n; e--;) s += '0';
} else if (e < n) {
s = s.slice(0, e) + '.' + s.slice(e);
}
} else if (n > 1) {
s = s.charAt(0) + '.' + s.slice(1);
}
return x.s < 0 && isNonzero ? '-' + s : s;
}
// Prototype/instance methods
/*
* Return a new Big whose value is the absolute value of this Big.
*/
P.abs = function () {
var x = new this.constructor(this);
x.s = 1;
return x;
};
/*
* Return 1 if the value of this Big is greater than the value of Big y,
* -1 if the value of this Big is less than the value of Big y, or
* 0 if they have the same value.
*/
P.cmp = function (y) {
var isneg,
x = this,
xc = x.c,
yc = (y = new x.constructor(y)).c,
i = x.s,
j = y.s,
k = x.e,
l = y.e;
// Either zero?
if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
// Signs differ?
if (i != j) return i;
isneg = i < 0;
// Compare exponents.
if (k != l) return k > l ^ isneg ? 1 : -1;
j = (k = xc.length) < (l = yc.length) ? k : l;
// Compare digit by digit.
for (i = -1; ++i < j;) {
if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
}
// Compare lengths.
return k == l ? 0 : k > l ^ isneg ? 1 : -1;
};
/*
* Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
* if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
*/
P.div = function (y) {
var x = this,
Big = x.constructor,
a = x.c, // dividend
b = (y = new Big(y)).c, // divisor
k = x.s == y.s ? 1 : -1,
dp = Big.DP;
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
throw Error(INVALID_DP);
}
// Divisor is zero?
if (!b[0]) {
throw Error(DIV_BY_ZERO);
}
// Dividend is 0? Return +-0.
if (!a[0]) {
y.s = k;
y.c = [y.e = 0];
return y;
}
var bl, bt, n, cmp, ri,
bz = b.slice(),
ai = bl = b.length,
al = a.length,
r = a.slice(0, bl), // remainder
rl = r.length,
q = y, // quotient
qc = q.c = [],
qi = 0,
p = dp + (q.e = x.e - y.e) + 1; // precision of the result
q.s = k;
k = p < 0 ? 0 : p;
// Create version of divisor with leading zero.
bz.unshift(0);
// Add zeros to make remainder as long as divisor.
for (; rl++ < bl;) r.push(0);
do {
// n is how many times the divisor goes into current remainder.
for (n = 0; n < 10; n++) {
// Compare divisor and remainder.
if (bl != (rl = r.length)) {
cmp = bl > rl ? 1 : -1;
} else {
for (ri = -1, cmp = 0; ++ri < bl;) {
if (b[ri] != r[ri]) {
cmp = b[ri] > r[ri] ? 1 : -1;
break;
}
}
}
// If divisor < remainder, subtract divisor from remainder.
if (cmp < 0) {
// Remainder can't be more than 1 digit longer than divisor.
// Equalise lengths using divisor with extra leading zero?
for (bt = rl == bl ? b : bz; rl;) {
if (r[--rl] < bt[rl]) {
ri = rl;
for (; ri && !r[--ri];) r[ri] = 9;
--r[ri];
r[rl] += 10;
}
r[rl] -= bt[rl];
}
for (; !r[0];) r.shift();
} else {
break;
}
}
// Add the digit n to the result array.
qc[qi++] = cmp ? n : ++n;
// Update the remainder.
if (r[0] && cmp) r[rl] = a[ai] || 0;
else r = [a[ai]];
} while ((ai++ < al || r[0] !== UNDEFINED) && k--);
// Leading zero? Do not remove if result is simply zero (qi == 1).
if (!qc[0] && qi != 1) {
// There can't be more than one zero.
qc.shift();
q.e--;
p--;
}
// Round?
if (qi > p) round(q, p, Big.RM, r[0] !== UNDEFINED);
return q;
};
/*
* Return true if the value of this Big is equal to the value of Big y, otherwise return false.
*/
P.eq = function (y) {
return this.cmp(y) === 0;
};
/*
* Return true if the value of this Big is greater than the value of Big y, otherwise return
* false.
*/
P.gt = function (y) {
return this.cmp(y) > 0;
};
/*
* Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
* return false.
*/
P.gte = function (y) {
return this.cmp(y) > -1;
};
/*
* Return true if the value of this Big is less than the value of Big y, otherwise return false.
*/
P.lt = function (y) {
return this.cmp(y) < 0;
};
/*
* Return true if the value of this Big is less than or equal to the value of Big y, otherwise
* return false.
*/
P.lte = function (y) {
return this.cmp(y) < 1;
};
/*
* Return a new Big whose value is the value of this Big minus the value of Big y.
*/
P.minus = P.sub = function (y) {
var i, j, t, xlty,
x = this,
Big = x.constructor,
a = x.s,
b = (y = new Big(y)).s;
// Signs differ?
if (a != b) {
y.s = -b;
return x.plus(y);
}
var xc = x.c.slice(),
xe = x.e,
yc = y.c,
ye = y.e;
// Either zero?
if (!xc[0] || !yc[0]) {
if (yc[0]) {
y.s = -b;
} else if (xc[0]) {
y = new Big(x);
} else {
y.s = 1;
}
return y;
}
// Determine which is the bigger number. Prepend zeros to equalise exponents.
if (a = xe - ye) {
if (xlty = a < 0) {
a = -a;
t = xc;
} else {
ye = xe;
t = yc;
}
t.reverse();
for (b = a; b--;) t.push(0);
t.reverse();
} else {
// Exponents equal. Check digit by digit.
j = ((xlty = xc.length < yc.length) ? xc : yc).length;
for (a = b = 0; b < j; b++) {
if (xc[b] != yc[b]) {
xlty = xc[b] < yc[b];
break;
}
}
}
// x < y? Point xc to the array of the bigger number.
if (xlty) {
t = xc;
xc = yc;
yc = t;
y.s = -y.s;
}
/*
* Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
* needs to start at yc.length.
*/
if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
// Subtract yc from xc.
for (b = i; j > a;) {
if (xc[--j] < yc[j]) {
for (i = j; i && !xc[--i];) xc[i] = 9;
--xc[i];
xc[j] += 10;
}
xc[j] -= yc[j];
}
// Remove trailing zeros.
for (; xc[--b] === 0;) xc.pop();
// Remove leading zeros and adjust exponent accordingly.
for (; xc[0] === 0;) {
xc.shift();
--ye;
}
if (!xc[0]) {
// n - n = +0
y.s = 1;
// Result must be zero.
xc = [ye = 0];
}
y.c = xc;
y.e = ye;
return y;
};
/*
* Return a new Big whose value is the value of this Big modulo the value of Big y.
*/
P.mod = function (y) {
var ygtx,
x = this,
Big = x.constructor,
a = x.s,
b = (y = new Big(y)).s;
if (!y.c[0]) {
throw Error(DIV_BY_ZERO);
}
x.s = y.s = 1;
ygtx = y.cmp(x) == 1;
x.s = a;
y.s = b;
if (ygtx) return new Big(x);
a = Big.DP;
b = Big.RM;
Big.DP = Big.RM = 0;
x = x.div(y);
Big.DP = a;
Big.RM = b;
return this.minus(x.times(y));
};
/*
* Return a new Big whose value is the value of this Big plus the value of Big y.
*/
P.plus = P.add = function (y) {
var e, k, t,
x = this,
Big = x.constructor;
y = new Big(y);
// Signs differ?
if (x.s != y.s) {
y.s = -y.s;
return x.minus(y);
}
var xe = x.e,
xc = x.c,
ye = y.e,
yc = y.c;
// Either zero?
if (!xc[0] || !yc[0]) {
if (!yc[0]) {
if (xc[0]) {
y = new Big(x);
} else {
y.s = x.s;
}
}
return y;
}
xc = xc.slice();
// Prepend zeros to equalise exponents.
// Note: reverse faster than unshifts.
if (e = xe - ye) {
if (e > 0) {
ye = xe;
t = yc;
} else {
e = -e;
t = xc;
}
t.reverse();
for (; e--;) t.push(0);
t.reverse();
}
// Point xc to the longer array.
if (xc.length - yc.length < 0) {
t = yc;
yc = xc;
xc = t;
}
e = yc.length;
// Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
for (k = 0; e; xc[e] %= 10) k = (xc[--e] = xc[e] + yc[e] + k) / 10 | 0;
// No need to check for zero, as +x + +y != 0 && -x + -y != 0
if (k) {
xc.unshift(k);
++ye;
}
// Remove trailing zeros.
for (e = xc.length; xc[--e] === 0;) xc.pop();
y.c = xc;
y.e = ye;
return y;
};
/*
* Return a Big whose value is the value of this Big raised to the power n.
* If n is negative, round to a maximum of Big.DP decimal places using rounding
* mode Big.RM.
*
* n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
*/
P.pow = function (n) {
var x = this,
one = new x.constructor('1'),
y = one,
isneg = n < 0;
if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) {
throw Error(INVALID + 'exponent');
}
if (isneg) n = -n;
for (;;) {
if (n & 1) y = y.times(x);
n >>= 1;
if (!n) break;
x = x.times(x);
}
return isneg ? one.div(y) : y;
};
/*
* Return a new Big whose value is the value of this Big rounded to a maximum precision of sd
* significant digits using rounding mode rm, or Big.RM if rm is not specified.
*
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
*/
P.prec = function (sd, rm) {
if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
throw Error(INVALID + 'precision');
}
return round(new this.constructor(this), sd, rm);
};
/*
* Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
* using rounding mode rm, or Big.RM if rm is not specified.
* If dp is negative, round to an integer which is a multiple of 10**-dp.
* If dp is not specified, round to 0 decimal places.
*
* dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
*/
P.round = function (dp, rm) {
if (dp === UNDEFINED) dp = 0;
else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
throw Error(INVALID_DP);
}
return round(new this.constructor(this), dp + this.e + 1, rm);
};
/*
* Return a new Big whose value is the square root of the value of this Big, rounded, if
* necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
*/
P.sqrt = function () {
var r, c, t,
x = this,
Big = x.constructor,
s = x.s,
e = x.e,
half = new Big('0.5');
// Zero?
if (!x.c[0]) return new Big(x);
// Negative?
if (s < 0) {
throw Error(NAME + 'No square root');
}
// Estimate.
s = Math.sqrt(x + '');
// Math.sqrt underflow/overflow?
// Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
if (s === 0 || s === 1 / 0) {
c = x.c.join('');
if (!(c.length + e & 1)) c += '0';
s = Math.sqrt(c);
e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
r = new Big((s == 1 / 0 ? '5e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
} else {
r = new Big(s + '');
}
e = r.e + (Big.DP += 4);
// Newton-Raphson iteration.
do {
t = r;
r = half.times(t.plus(x.div(t)));
} while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
return round(r, (Big.DP -= 4) + r.e + 1, Big.RM);
};
/*
* Return a new Big whose value is the value of this Big times the value of Big y.
*/
P.times = P.mul = function (y) {
var c,
x = this,
Big = x.constructor,
xc = x.c,
yc = (y = new Big(y)).c,
a = xc.length,
b = yc.length,
i = x.e,
j = y.e;
// Determine sign of result.
y.s = x.s == y.s ? 1 : -1;
// Return signed 0 if either 0.
if (!xc[0] || !yc[0]) {
y.c = [y.e = 0];
return y;
}
// Initialise exponent of result as x.e + y.e.
y.e = i + j;
// If array xc has fewer digits than yc, swap xc and yc, and lengths.
if (a < b) {
c = xc;
xc = yc;
yc = c;
j = a;
a = b;
b = j;
}
// Initialise coefficient array of result with zeros.
for (c = new Array(j = a + b); j--;) c[j] = 0;
// Multiply.
// i is initially xc.length.
for (i = b; i--;) {
b = 0;
// a is yc.length.
for (j = a + i; j > i;) {
// Current sum of products at this digit position, plus carry.
b = c[j] + yc[i] * xc[j - i - 1] + b;
c[j--] = b % 10;
// carry
b = b / 10 | 0;
}
c[j] = b;
}
// Increment result exponent if there is a final carry, otherwise remove leading zero.
if (b) ++y.e;
else c.shift();
// Remove trailing zeros.
for (i = c.length; !c[--i];) c.pop();
y.c = c;
return y;
};
/*
* Return a string representing the value of this Big in exponential notation rounded to dp fixed
* decimal places using rounding mode rm, or Big.RM if rm is not specified.
*
* dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
*/
P.toExponential = function (dp, rm) {
var x = this,
n = x.c[0];
if (dp !== UNDEFINED) {
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
throw Error(INVALID_DP);
}
x = round(new x.constructor(x), ++dp, rm);
for (; x.c.length < dp;) x.c.push(0);
}
return stringify(x, true, !!n);
};
/*
* Return a string representing the value of this Big in normal notation rounded to dp fixed
* decimal places using rounding mode rm, or Big.RM if rm is not specified.
*
* dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
*
* (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
* (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
*/
P.toFixed = function (dp, rm) {
var x = this,
n = x.c[0];
if (dp !== UNDEFINED) {
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
throw Error(INVALID_DP);
}
x = round(new x.constructor(x), dp + x.e + 1, rm);
// x.e may have changed if the value is rounded up.
for (dp = dp + x.e + 1; x.c.length < dp;) x.c.push(0);
}
return stringify(x, false, !!n);
};
/*
* Return a string representing the value of this Big.
* Return exponential notation if this Big has a positive exponent equal to or greater than
* Big.PE, or a negative exponent equal to or less than Big.NE.
* Omit the sign for negative zero.
*/
P.toJSON = P.toString = function () {
var x = this,
Big = x.constructor;
return stringify(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
};
/*
* Return the value of this Big as a primitve number.
*/
P.toNumber = function () {
var n = Number(stringify(this, true, true));
if (this.constructor.strict === true && !this.eq(n.toString())) {
throw Error(NAME + 'Imprecise conversion');
}
return n;
};
/*
* Return a string representing the value of this Big rounded to sd significant digits using
* rounding mode rm, or Big.RM if rm is not specified.
* Use exponential notation if sd is less than the number of digits necessary to represent
* the integer part of the value in normal notation.
*
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
*/
P.toPrecision = function (sd, rm) {
var x = this,
Big = x.constructor,
n = x.c[0];
if (sd !== UNDEFINED) {
if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
throw Error(INVALID + 'precision');
}
x = round(new Big(x), sd, rm);
for (; x.c.length < sd;) x.c.push(0);
}
return stringify(x, sd <= x.e || x.e <= Big.NE || x.e >= Big.PE, !!n);
};
/*
* Return a string representing the value of this Big.
* Return exponential notation if this Big has a positive exponent equal to or greater than
* Big.PE, or a negative exponent equal to or less than Big.NE.
* Include the sign for negative zero.
*/
P.valueOf = function () {
var x = this,
Big = x.constructor;
if (Big.strict === true) {
throw Error(NAME + 'valueOf disallowed');
}
return stringify(x, x.e <= Big.NE || x.e >= Big.PE, true);
};
// Export
Big = _Big_();
Big['default'] = Big.Big = Big;
//AMD.
if (typeof define === 'function' && define.amd) {
define(function () { return Big; });
// Node and other CommonJS-like environments that support module.exports.
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = Big;
//Browser.
} else {
GLOBAL.Big = Big;
}
})(this);
......@@ -176,6 +176,7 @@ function delRow(obj, prefix){
// if(width.indexOf("%")>=0 || height.indexOf("%")>=0 ){
// auto =false;
// }
// }
// top.layer.open({
// type: 2,
// area: [width, height],
......@@ -272,15 +273,13 @@ function delRow(obj, prefix){
content: ctx+"/warehouse/shelves/shelves/shelvesSelect",
btn: ['确定', '关闭'],
yes: function(index, layero){
var ids = layero.find("iframe")[0].contentWindow.getIdSelections();
var names = layero.find("iframe")[0].contentWindow.getNameSelections();
if(ids.length ==0){
var items = layero.find("iframe")[0].contentWindow.getSelections();
if(Array.isArray(items)&&items.length ==0){
jp.warning("请选择至少一个货架!");
return;
}
// 执行保存
yesFuc(ids.join(","), names.join(","));
yesFuc(items);
top.layer.close(index);
},
cancel: function(index){
......@@ -323,19 +322,19 @@ function delRow(obj, prefix){
}
});
},
openStorageSelectDialog:function(isMultiSelect, batchNum, yesFuc){
var url = ctx+"/warehouse/storage/storage/findByPcTypeModel?goodsInfo.goods.batchNum="+batchNum;
var fieldLabels = "名称|类型";
var fieldKeys = "name|type.name";
var searchLabels = "型号|类型";
var searchKeys = "goodsInfo.model|goodsInfo.type";
openStorageSelectDialog:function(params, yesFuc){
var url = ctx+"/warehouse/storage/storage/findByPcTypeModel?goodsInfo.goods.batchNum="+params.batchNum+"&qrCode.state="+params.state;
var fieldLabels = "物资编码|名称|类型|型号";
var fieldKeys = "qrCode.code|name|type.name|model";
var searchLabels = "类型|型号";
var searchKeys = "goodsInfo.type|goodsInfo.model";
top.layer.open({
type: 2,
area: ['800px', '500px'],
title:"选择入库明细",
auto:true,
name:'friend',
content: ctx+"/tag/gridselect?url="+encodeURIComponent(url)+"&fieldLabels="+encodeURIComponent(fieldLabels)+"&fieldKeys="+encodeURIComponent(fieldKeys)+"&searchLabels="+encodeURIComponent(searchLabels)+"&searchKeys="+encodeURIComponent(searchKeys)+"&isMultiSelected="+isMultiSelect,
content: ctx+"/tag/gridselect?url="+encodeURIComponent(url)+"&fieldLabels="+encodeURIComponent(fieldLabels)+"&fieldKeys="+encodeURIComponent(fieldKeys)+"&searchLabels="+encodeURIComponent(searchLabels)+"&searchKeys="+encodeURIComponent(searchKeys)+"&isMultiSelected="+params.isMultiSelect,
btn: ['确定', '关闭'],
yes: function(index, layero){
var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
......@@ -344,14 +343,7 @@ function delRow(obj, prefix){
jp.warning("必须选择一条数据!");
return;
}
var ids = [];
var names = [];
for(var i=0; i<items.length; i++){
var item = items[i];
ids.push(item.id);
names.push(item.enname)
}
yesFuc(ids.join(","), names.join(","));
yesFuc(items);
top.layer.close(index);//关闭对话框。
},
cancel: function(index){
......
......@@ -28,7 +28,7 @@ $(document).ready(function() {
//可供选择的每页的行数(*)
pageList: [10, 25, 50, 'ALL'],
//这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
url: "${url}",
url: jp.unescapeHTML("${url}"),
//默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
//queryParamsType:'',
////查询参数,每次调用是会带上这个参数,可自定义
......
......@@ -159,9 +159,7 @@
});
}
function getSelections() {
return $.map($("#table").bootstrapTable('getSelections'), function (row) {
return row
});
return $("#table").bootstrapTable('getSelections')
}
</script>
......
......@@ -74,6 +74,16 @@
}
},
{
field: 'amount',
title: '单价',
formatter: function (value,row,index){
return Mustache.render($("#amountTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: 'remarks',
title: '备注',
formatter: function (value,row,index){
......@@ -105,7 +115,8 @@
name: ''
},
model: '',
num: '',
num: null,
amount: null,
remarks: ''
}
......@@ -134,12 +145,50 @@
}
function onInputChange(rowIndex, elem , field){
var obj = {};
obj[field] = $(elem).val()
var timer = null;
clearTimeout(timer);
timer = setTimeout(function (){
updateRow(rowIndex, obj)
}, 0)
obj[field] = $(elem).val();
updateRow(rowIndex, obj);
// 校验数量与单价
if(field === 'num' && obj[field]){
// 正则表达式验证可以带小数点的数字
var reg = new RegExp("^[0-9]+(.[0-9]{1,2})?$");
// 不是数字
if(!reg.test(obj[field])){
jp.warning("必须是数字");
$(elem).val('')
return
}
if (Number(obj[field]) <= 0) {
jp.warning("数量不能小于等于0");
$(elem).val('');
return;
}
setSumPrice();
}
if(field === 'amount' && obj[field]) {
// 正则表达式验证可以带小数点的数字
// 不是数字
if(!/^(?:[1-9]\d*|0)(?:\.\d{1,2})?$/.test(obj[field])) {
jp.warning("输入正确的金额");
$(elem).val('')
return
}
setSumPrice();
}
}
function setSumPrice(){
var data = $(selector).bootstrapTable('getData');
var sum = data.reduce(function (sum, current){
if(current.delFlag != 1 && current.amount && current.num){
var total = new Big(current.amount).times(current.num).toNumber();
return new Big(sum).plus(total);
}
return new Big(sum);
},0)
$("#sum").val(sum);
}
function onSelectType(nodes, rowIndex){
......@@ -178,6 +227,10 @@
<input id="goodsInfoList{{idx}}_num" name="goodsInfoList[{{idx}}].num" type="text" value="{{row.num}}" onchange="onInputChange('{{idx}}', this, 'num')" class="form-control "/>
</script>
<script id="amountTpl" type="text/html">
<input id="goodsInfoList{{idx}}_amount" name="goodsInfoList[{{idx}}].amount" type="text" value="{{row.amount}}" onchange="onInputChange('{{idx}}', this, 'amount')" class="form-control "/>
</script>
<script id="remarksTpl" type="text/html">
<textarea id="goodsInfoList{{idx}}_remarks" name="goodsInfoList[{{idx}}].remarks" rows="4" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea>
</script>
\ No newline at end of file
......@@ -8,6 +8,7 @@
<link rel="stylesheet" href="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.css">
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table-zh-CN.js"></script>
<script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script>
</head>
<body>
<div class="wrapper wrapper-content">
......@@ -52,8 +53,14 @@
labelName="operator.name" labelValue="${goods.operator.name}"
cssClass="form-control required" disabled="disabled"/>
</td>
<td>备注</td>
<td>总价</td>
<td>
<form:input path="sum" htmlEscape="false" readonly="true" class="form-control "/>
</td>
</tr>
<tr>
<td>备注</td>
<td colspan="3">
<form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/>
</td>
</tr>
......
......@@ -249,14 +249,14 @@ $(document).ready(function() {
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/goods/goods/form/edit?id=" + id);
jp.openSaveDialog("编辑货品","${ctx}/warehouse/goods/goods/form/edit?id=" + id, '1200', '800');
}
function view(id){//没有权限时,不显示确定按钮
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/goods/goods/form/view?id=" + id);
jp.openViewDialog("查看货品","${ctx}/warehouse/goods/goods/form/view?id=" + id, '1200', '800');
}
......@@ -296,17 +296,22 @@ $(document).ready(function() {
function printQr(id) {
jp.loading('loading...');
initLodop();
jp.get("${ctx}/warehouse/goods/goods/printQr?goodsInfoId="+id, function (res) {
var list = res.body.goodsInfo.qrCodeList;
LODOP.PRINT_INIT("打印货品");
LODOP.SET_PRINT_PAGESIZE(1,400,600,0)
LODOP.SET_PRINT_MODE("FULL_HEIGHT_FOR_OVERFLOW",true);
LODOP.SET_PRINT_MODE("FULL_HEIGHT_FOR_OVERFLOW",true);
createAllPage(list);
LODOP.PREVIEW();
jp.close();
})
try{
initLodop();
jp.get("${ctx}/warehouse/goods/goods/printQr?goodsInfoId="+id, function (res) {
var list = res.body.goodsInfo.qrCodeList;
LODOP.PRINT_INIT("打印货品");
LODOP.SET_PRINT_PAGESIZE(1,400,600,0)
createAllPage(list);
LODOP.PREVIEW();
jp.close();
})
}catch (e){
jp.get("${ctx}/warehouse/goods/goods/printQr?goodsInfoId="+id, function (res) {
var list = res.body.goodsInfo.qrCodeList;
jp.close();
})
}
}
function createAllPage(list){
......@@ -317,7 +322,7 @@ $(document).ready(function() {
list.forEach(function(item){
LODOP.NewPage();
var imgUrl = "${ctxPath}/" + item.url;
LODOP.ADD_PRINT_IMAGE('0%',"0%","100%","100%","<img border='0' src='"+imgUrl+"' />");
LODOP.ADD_PRINT_IMAGE('0%',"0%","100%","100%","<img width='150' border='0' src='"+imgUrl+"' />");
})
}
......@@ -345,6 +350,7 @@ $(document).ready(function() {
<th>类型编码</th>
<th>型号</th>
<th>数量</th>
<th>单价</th>
<th>备注信息</th>
<th>操作</th>
</tr>
......@@ -373,6 +379,9 @@ $(document).ready(function() {
{{row.num}}
</td>
<td>
{{row.amount}}
</td>
<td>
{{row.remarks}}
</td>
<td>
......
<%--
Created by IntelliJ IDEA.
User: yangzi
Date: 2023/2/21
Time: 10:29
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<table id="detail_table"></table>
<script>
var selector = "#detail_table";
function initTable(){
var data = ${fns:toJson(ledger.ledgerInfoList)};
$(selector).bootstrapTable({
data: data,
columns:[{checkbox: true},
{
field: 'no',
title: '序号',
align: 'center',
width: 60,
formatter: function (value, row, index){
var tpl = $("#hideTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
var html = Mustache.render(tpl, {
idx: index,
row: row
})
return html + '<span>'+(index+1)+'</span>'
}
},
{
field: 'name',
title: '名称',
formatter: function (value,row,index){
return Mustache.render($("#nameTpl").html(),{
row: row,
idx: index
})
}
},
{
field: 'type.name',
title: '类型',
formatter: function (value,row,index){
return Mustache.render($("#typeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: 'model',
title: '型号',
formatter: function (value,row,index){
return Mustache.render($("#modelTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: 'batchNum',
title: '批次号',
formatter: function (value,row,index){
return Mustache.render($("#batchNumTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: 'shelves.name',
title: '货架',
formatter: function (value,row,index){
return Mustache.render($("#shelvesTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: 'code',
title: '物资编码',
formatter: function (value,row,index){
return Mustache.render($("#codeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: '',
title: '操作',
formatter: function (value,row,index){
var text = row.delFlag == 1 ? '撤销删除' : '删除';
var result = ["<a href='javascript:void(0);' onclick=\"removeRow(" + index + ", '" + row.id + "', '" + row.delFlag + "')\">"+text+"</a>" ]
return result.join('');
}
}
]
});
}
function getSelections(){
return $(selector).bootstrapTable('getSelections');
}
function removeRow(index, rowId, rowDelFlag){
if(rowId){
var delFlag = rowDelFlag === 1 ? 0 : 1
updateRow(index, {
delFlag: delFlag
})
}else{
$(selector).bootstrapTable("remove", {
field: '$index',
values: [index]
})
}
}
function updateRow(index, row){
$(selector).bootstrapTable('updateRow', {
index: index,
row: row
})
}
function onInputChange(rowIndex, elem , field){
var obj = {};
obj[field] = $(elem).val()
var timer = null;
clearTimeout(timer);
timer = setTimeout(function (){
updateRow(rowIndex, obj)
}, 0)
}
function onSelectType(nodes, rowIndex){
if(Array.isArray(nodes) && nodes.length === 1){
var node = nodes[0];
var obj = {
type: {
id: node.id,
name: node.text
}
};
updateRow(rowIndex, obj)
}
}
/**
* 获取所有明细数据
* @returns {*|jQuery}
*/
function getTableData(){
return $(selector).bootstrapTable('getData');
}
</script>
<script id="hideTpl" type="text/html">
<input id="ledgerInfoList{{idx}}_id" name="ledgerInfoList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
<input id="ledgerInfoList{{idx}}_delFlag" name="ledgerInfoList[{{idx}}].delFlag" type="hidden" value="{{row.delFlag}}"/>
<input id="ledgerInfoList{{idx}}_goodsInfoId" name="ledgerInfoList[{{idx}}].goodsInfo.id" type="hidden" value="{{row.goodsInfo.id}}"/>
<input id="ledgerInfoList{{idx}}_shelvesId" name="ledgerInfoList[{{idx}}].shelves.id" type="hidden" value="{{row.shelves.id}}" readonly class="form-control" />
<input id="ledgerInfoList{{idx}}_qrCodeId" name="ledgerInfoList[{{idx}}].qr.id" type="hidden" value="{{row.qr.id}}" readonly class="form-control" />
</script>
<script id="nameTpl" type="text/html">
<input id="ledgerInfoList{{idx}}_name" name="ledgerInfoList[{{idx}}].name" type="text" readonly value="{{row.name}}" onchange="onInputChange('{{idx}}', this, 'name')" class="form-control "/>
</script>
<script id="typeTpl" type="text/html">//<!--
<sys:treeselect id="ledgerInfoList{{idx}}_type" name="ledgerInfoList[{{idx}}].type.id" value="{{row.type.id}}" labelName="storageInfoList{{idx}}.type.name" labelValue="{{row.type.name}}"
title="类型" url="/warehouse/materialtype/materialType/treeData" cssClass="form-control " disabled="disabled" allowClear="true" allowSearch="true" callback="onSelectType" />//-->
</script>
<script id="modelTpl" type="text/html">
<input id="ledgerInfoList{{idx}}_model" name="ledgerInfoList[{{idx}}].model" type="text" value="{{row.model}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/>
</script>
<script id="batchNumTpl" type="text/html">
<input id="ledgerInfoList{{idx}}_batchNum" name="ledgerInfoList[{{idx}}].batchNum" type="text" value="{{row.batchNum}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/>
</script>
<script id="codeTpl" type="text/html">
<input id="ledgerInfoList{{idx}}_code" name="ledgerInfoList[{{idx}}].code" type="text" value="{{row.code}}" readonly class="form-control" />
</script>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ include file="/webpage/include/taglib.jsp" %>
<html>
<head>
<title>台账信息管理</title>
<meta name="decorator" content="ani"/>
<script type="text/javascript">
$(document).ready(function() {
jp.ajaxForm("#inputForm",function(data){
if(data.success){
jp.success(data.msg);
jp.go("${ctx}/warehouse/ledger/ledger");
}else{
jp.error(data.msg);
$("#inputForm").find("button:submit").button("reset");
}
});
});
function addRow(list, idx, tpl, row){
$(list).append(Mustache.render(tpl, {
idx: idx, delBtn: true, row: row
}));
$(list+idx).find("select").each(function(){
$(this).val($(this).attr("data-value"));
});
$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
var ss = $(this).attr("data-value").split(',');
for (var i=0; i<ss.length; i++){
if($(this).val() == ss[i]){
$(this).attr("checked","checked");
}
}
});
$(list+idx).find(".form_datetime").each(function(){
$(this).datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
});
}
function delRow(obj, prefix){
var id = $(prefix+"_id");
var delFlag = $(prefix+"_delFlag");
if (id.val() == ""){
$(obj).parent().parent().remove();
}else if(delFlag.val() == "0"){
delFlag.val("1");
$(obj).html("&divide;").attr("title", "撤销删除");
$(obj).parent().parent().addClass("error");
}else if(delFlag.val() == "1"){
delFlag.val("0");
$(obj).html("&times;").attr("title", "删除");
$(obj).parent().parent().removeClass("error");
}
}
</script>
<title>台账信息管理</title>
<meta name="decorator" content="ani"/>
<link rel="stylesheet" href="${ctxStatic}/common/css/form.css">
<link rel="stylesheet" href="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.css">
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table-zh-CN.js"></script>
</head>
<body>
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
<a class="panelButton" href="${ctx}/warehouse/ledger/ledger"><i class="ti-angle-left"></i> 返回</a>
</h3>
</div>
<div class="panel-body">
<form:form id="inputForm" modelAttribute="ledger" action="${ctx}/warehouse/ledger/ledger/save" method="post" class="form-horizontal">
<form:hidden path="id"/>
<div class="form-group">
<label class="col-sm-2 control-label">物资名称:</label>
<div class="col-sm-10">
<form:input path="name" htmlEscape="false" class="form-control "/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">类型:</label>
<div class="col-sm-10">
<sys:treeselect id="type" name="type.id" value="${ledger.type.id}" labelName="type.name" labelValue="${ledger.type.name}"
title="类型" url="/warehouse/materialtype/materialType/treeData" extId="${ledger.id}" cssClass="form-control " allowClear="true"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">型号:</label>
<div class="col-sm-10">
<form:input path="model" htmlEscape="false" class="form-control "/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">货架id集合:</label>
<div class="col-sm-10">
<form:input path="shelvesIds" htmlEscape="false" class="form-control "/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">数量:</label>
<div class="col-sm-10">
<form:input path="num" htmlEscape="false" class="form-control "/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">备注信息:</label>
<div class="col-sm-10">
<form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/>
</div>
</div>
<div class="tabs-container">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">台账明细:</a>
</li>
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
<a class="btn btn-white btn-sm" onclick="addRow('#ledgerInfoList', ledgerInfoRowIdx, ledgerInfoTpl);ledgerInfoRowIdx = ledgerInfoRowIdx + 1;" title="新增"><i class="fa fa-plus"></i> 新增</a>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th class="hide"></th>
<th>物资名称</th>
<th>类型</th>
<th>型号</th>
<th>批次号</th>
<th>货品明细id</th>
<th>二维码id</th>
<th>货架id</th>
<th>物资编码</th>
<th>备注信息</th>
<th width="10">&nbsp;</th>
</tr>
</thead>
<tbody id="ledgerInfoList">
</tbody>
</table>
<script type="text/template" id="ledgerInfoTpl">//<!--
<tr id="ledgerInfoList{{idx}}">
<td class="hide">
<input id="ledgerInfoList{{idx}}_id" name="ledgerInfoList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
<input id="ledgerInfoList{{idx}}_delFlag" name="ledgerInfoList[{{idx}}].delFlag" type="hidden" value="0"/>
</td>
<td>
<input id="ledgerInfoList{{idx}}_name" name="ledgerInfoList[{{idx}}].name" type="text" value="{{row.name}}" class="form-control "/>
</td>
<td>
<sys:treeselect id="ledgerInfoList{{idx}}_type" name="ledgerInfoList[{{idx}}].type.id" value="{{row.type.id}}" labelName="ledgerInfoList{{idx}}.type.code" labelValue="{{row.type.code}}"
title="类型" url="/warehouse/materialtype/materialType/treeData" cssClass="form-control " allowClear="true" />
</td>
<td>
<input id="ledgerInfoList{{idx}}_model" name="ledgerInfoList[{{idx}}].model" type="text" value="{{row.model}}" class="form-control "/>
</td>
<td>
<input id="ledgerInfoList{{idx}}_batchNum" name="ledgerInfoList[{{idx}}].batchNum" type="text" value="{{row.batchNum}}" class="form-control "/>
</td>
<td>
<input id="ledgerInfoList{{idx}}_goodsInfo" name="ledgerInfoList[{{idx}}].goodsInfo.id" type="text" value="{{row.goodsInfo.id}}" class="form-control "/>
</td>
<td>
<input id="ledgerInfoList{{idx}}_qr" name="ledgerInfoList[{{idx}}].qr.id" type="text" value="{{row.qr.id}}" class="form-control "/>
</td>
<td>
<sys:treeselect id="ledgerInfoList{{idx}}_shelves" name="ledgerInfoList[{{idx}}].shelves.id" value="{{row.shelves.id}}" labelName="ledgerInfoList{{idx}}.shelves.name" labelValue="{{row.shelves.name}}"
title="货架id" url="/warehouse/shelves/shelves/data" cssClass="form-control " allowClear="true" />
</td>
<td>
<input id="ledgerInfoList{{idx}}_code" name="ledgerInfoList[{{idx}}].code" type="text" value="{{row.code}}" class="form-control "/>
</td>
<td>
<textarea id="ledgerInfoList{{idx}}_remarks" name="ledgerInfoList[{{idx}}].remarks" rows="4" class="form-control ">{{row.remarks}}</textarea>
</td>
<td class="text-center" width="10">
{{#delBtn}}<span class="close" onclick="delRow(this, '#ledgerInfoList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
</td>
</tr>//-->
</script>
<script type="text/javascript">
var ledgerInfoRowIdx = 0, ledgerInfoTpl = $("#ledgerInfoTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
$(document).ready(function() {
var data = ${fns:toJson(ledger.ledgerInfoList)};
for (var i=0; i<data.length; i++){
addRow('#ledgerInfoList', ledgerInfoRowIdx, ledgerInfoTpl, data[i]);
ledgerInfoRowIdx = ledgerInfoRowIdx + 1;
}
});
</script>
</div>
</div>
</div>
<c:if test="${mode == 'add' || mode=='edit'}">
<div class="col-lg-3"></div>
<div class="col-lg-6">
<div class="form-group text-center">
<div>
<button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
</div>
</div>
</div>
</c:if>
</form:form>
</div>
</div>
</div>
</div>
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-body">
<form:form id="inputForm" modelAttribute="ledger" action="${ctx}/warehouse/ledger/ledger/save"
method="post" class="form-horizontal">
<form:hidden path="id"/>
<h3 class="text-center">台账表</h3>
<table class="table table-bordered main-table">
<tr>
<td>物资名称</td>
<td>
<form:input path="name" htmlEscape="false" class="form-control "/>
</td>
<td>类型</td>
<td>
<sys:treeselect id="type" name="type.id" value="${ledger.type.id}" labelName="type.name"
labelValue="${ledger.type.name}"
title="类型" url="/warehouse/materialtype/materialType/treeData"
extId="${ledger.id}" cssClass="form-control " allowClear="true"/>
</td>
</tr>
<tr>
<td>型号</td>
<td>
<form:input path="model" htmlEscape="false" class="form-control "/>
</td>
<td>数量</td>
<td>
<form:input path="num" htmlEscape="false" class="form-control "/>
</td>
</tr>
<tr>
<td>总价</td>
<td>
<form:input path="sum" htmlEscape="false" class="form-control "/>
</td>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="4">
<%@include file="ledgerDetail.jsp" %>
</td>
</tr>
</table>
</form:form>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
initTable();
});
function save() {
var isValidate = jp.validateForm('#inputForm');//校验表单
if(!isValidate){
return false;
}else{
jp.loading();
jp.post($("#inputForm").attr('action'),$('#inputForm').serialize(),function(data){
if(data.success){
jp.getParent().refresh();
var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(dialogIndex);
jp.success(data.msg)
}else{
jp.error(data.msg);
}
})
}
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -249,21 +249,21 @@ $(document).ready(function() {
$('#ledgerTable').bootstrapTable('refresh');
}
function add(){
jp.go("${ctx}/warehouse/ledger/ledger/form/add");
jp.openSaveDialog("新增台账","${ctx}/warehouse/ledger/ledger/form/add", '1200', '800');
}
function edit(id){
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/ledger/ledger/form/edit?id=" + id);
jp.openSaveDialog("编辑台账","${ctx}/warehouse/ledger/ledger/form/edit?id=" + id, '1200', '800');
}
function view(id){//没有权限时,不显示确定按钮
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/ledger/ledger/form/view?id=" + id);
jp.openViewDialog("查看台账","${ctx}/warehouse/ledger/ledger/form/view?id=" + id,'1200', '800');
}
......@@ -311,12 +311,8 @@ $(document).ready(function() {
<th>类型</th>
<th>型号</th>
<th>批次号</th>
<th>主表外键</th>
<th>货品明细id</th>
<th>二维码id</th>
<th>货架id</th>
<th>货架</th>
<th>物资编码</th>
<th>备注信息</th>
</tr>
</thead>
<tbody id="ledgerChild-{{idx}}-1-List">
......
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ include file="/webpage/include/taglib.jsp" %>
<html>
<head>
<title>物资类型管理</title>
<meta name="decorator" content="ani"/>
<script type="text/javascript">
$(document).ready(function() {
jp.ajaxForm("#inputForm",function(data){
if(data.success){
jp.success(data.msg);
jp.go("${ctx}/warehouse/materialtype/materialType?parentIds="+data.body.parentIds);
}else{
jp.error(data.msg);
$("#inputForm").find("button:submit").button("reset");
}
});
});
</script>
<title>物资类型管理</title>
<meta name="decorator" content="ani"/>
<link rel="stylesheet" href="${ctxStatic}/common/css/form.css">
</head>
<body>
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
<a class="panelButton" href="${ctx}/warehouse/materialtype/materialType"><i class="ti-angle-left"></i> 返回</a>
</h3>
</div>
<div class="panel-body">
<form:form id="inputForm" modelAttribute="materialType" action="${ctx}/warehouse/materialtype/materialType/save" method="post" class="form-horizontal">
<form:hidden path="id"/>
<div class="form-group">
<label class="col-sm-2 control-label"><font color="red">*</font>名称:</label>
<div class="col-sm-10">
<form:input path="name" htmlEscape="false" class="form-control required"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"><font color="red">*</font>排序:</label>
<div class="col-sm-10">
<form:input path="sort" htmlEscape="false" class="form-control required"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">物资类型编码:</label>
<div class="col-sm-10">
<form:input path="code" htmlEscape="false" class="form-control "/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">备注信息:</label>
<div class="col-sm-10">
<form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">上级父级编号:</label>
<div class="col-sm-10">
<sys:treeselect id="parent" name="parent.id" value="${materialType.parent.id}" labelName="parent.name" labelValue="${materialType.parent.name}"
title="父级编号" url="/warehouse/materialtype/materialType/treeData" extId="${materialType.id}" cssClass="form-control " allowClear="true"/>
</div>
</div>
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-body">
<form:form id="inputForm" modelAttribute="materialType"
action="${ctx}/warehouse/materialtype/materialType/save" method="post"
class="form-horizontal">
<form:hidden path="id"/>
<h3 class="text-center">物资类型表</h3>
<table class="table table-bordered main-table">
<tr>
<td><font color="red">*</font>名称</td>
<td>
<form:input path="name" htmlEscape="false"
class="form-control required"/>
</td>
<td><font color="red">*</font>排序</td>
<td>
<form:input path="sort" htmlEscape="false" class="form-control required"/>
</td>
</tr>
<c:if test="${mode == 'add' || mode=='edit'}">
<div class="col-lg-3"></div>
<div class="col-lg-6">
<div class="form-group text-center">
<div>
<button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
</div>
</div>
</div>
</c:if>
</form:form>
</div>
</div>
</div>
</div>
<tr>
<td><font color="red">*</font>物资类型编码</td>
<td>
<form:input path="code" htmlEscape="false"
class="form-control required"/>
</td>
<td><font color="red">*</font>父级编号</td>
<td>
<sys:treeselect id="parent" name="parent.id" value="${materialType.parent.id}"
labelName="parent.name" labelValue="${materialType.parent.name}"
title="父级编号" url="/warehouse/materialtype/materialType/treeData"
extId="${materialType.id}" cssClass="form-control required"
allowClear="true"/>
</td>
</tr>
<tr>
<td>备注</td>
<td colspan="3">
<form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/>
</td>
</tr>
</table>
</form:form>
</div>
</div>
</div>
</div>
</div>
<script>
function save() {
var isValidate = jp.validateForm('#inputForm');//校验表单
if(!isValidate){
return false;
}else{
jp.loading();
jp.post($("#inputForm").attr('action'),$('#inputForm').serialize(),function(data){
if(data.success){
jp.getParent().refresh();
var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(dialogIndex);
jp.success(data.msg)
}else{
jp.error(data.msg);
}
})
}
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -50,16 +50,16 @@
}
function add(){//新增
jp.go('${ctx}/warehouse/materialtype/materialType/form/add');
jp.openSaveDialog("新增物资类型",'${ctx}/warehouse/materialtype/materialType/form/add', '800','600');
}
function edit(id){//编辑
jp.go('${ctx}/warehouse/materialtype/materialType/form/edit?id='+id);
jp.openSaveDialog("编辑物资类型",'${ctx}/warehouse/materialtype/materialType/form/edit?id='+id, '800','600');
}
function view(id){//查看
jp.go('${ctx}/warehouse/materialtype/materialType/form/view?id='+id);
jp.openViewDialog("查看物资类型",'${ctx}/warehouse/materialtype/materialType/form/view?id='+id, '800','600');
}
function addChild(id){//添加下级机构
jp.go('${ctx}/warehouse/materialtype/materialType/form/add?parent.id='+id);
jp.openSaveDialog("添加下级物资类型",'${ctx}/warehouse/materialtype/materialType/form/add?parent.id='+id, '800','600');
}
function refresh(){//刷新
var index = jp.loading("正在加载,请稍等...");
......@@ -71,13 +71,13 @@
<td>
<c:choose>
<c:when test="${fns:hasPermission('warehouse:materialtype:materialType:edit')}">
<a href="${ctx}/warehouse/materialtype/materialType/form/edit?id={{d.row.id}}">
<a onclick="edit('{{d.row.id}}')">
{{d.row.name === undefined ? "": d.row.name}}
</a>
</c:when>
<c:when test="${fns:hasPermission('warehouse:materialtype:materialType:view')}">
<a href="${ctx}/warehouse/materialtype/materialType/form/view?id={{d.row.id}}">
<a onclick="view('{{d.row.id}}')">
{{d.row.name === undefined ? "": d.row.name}}
</a>
......@@ -102,16 +102,16 @@
</button>
<ul class="dropdown-menu" role="menu">
<shiro:hasPermission name="warehouse:materialtype:materialType:view">
<li><a href="${ctx}/warehouse/materialtype/materialType/form/view?id={{d.row.id}}"><i class="fa fa-search-plus"></i> 查看</a></li>
<li><a onclick="view('{{d.row.id}}')"><i class="fa fa-search-plus"></i> 查看</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialtype:materialType:edit">
<li><a href="${ctx}/warehouse/materialtype/materialType/form/edit?id={{d.row.id}}"><i class="fa fa-edit"></i> 修改</a></li>
<li><a onclick="edit('{{d.row.id}}')"><i class="fa fa-edit"></i> 修改</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialtype:materialType:del">
<li><a onclick="return del(this, '{{d.row.id}}')"><i class="fa fa-trash"></i> 删除</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialtype:materialType:add">
<li><a href="${ctx}/warehouse/materialtype/materialType/form/add?parent.id={{d.row.id}}"><i class="fa fa-plus"></i> 添加下级物资类型</a></li>
<li><a onclick="addChild('{{d.row.id}}')"><i class="fa fa-plus"></i> 添加下级物资类型</a></li>
</shiro:hasPermission>
</ul>
</div>
......
......@@ -85,32 +85,10 @@ $(document).ready(function() {
}
,{
field: 'goodsInfo.id',
title: '货品明细外键',
sortable: true,
sortName: 'goodsInfo.id'
,formatter:function(value, row , index){
value = jp.unescapeHTML(value);
<c:choose>
<c:when test="${fns:hasPermission('warehouse:qrcode:qrCode:edit')}">
return "<a href='javascript:edit(\""+row.id+"\")'>"+value+"</a>";
</c:when>
<c:when test="${fns:hasPermission('warehouse:qrcode:qrCode:view')}">
return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
</c:when>
<c:otherwise>
return value;
</c:otherwise>
</c:choose>
}
}
,{
field: 'code',
title: '物资编码',
sortable: true,
sortName: 'code'
}
,{
field: 'url',
......
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ include file="/webpage/include/taglib.jsp" %>
<html>
<head>
<title>货架信息管理</title>
<meta name="decorator" content="ani"/>
<script type="text/javascript">
$(document).ready(function() {
jp.ajaxForm("#inputForm",function(data){
if(data.success){
jp.success(data.msg);
jp.go("${ctx}/warehouse/shelves/shelves");
}else{
jp.error(data.msg);
$("#inputForm").find("button:submit").button("reset");
}
});
});
</script>
<title>货架信息管理</title>
<meta name="decorator" content="ani"/>
<link rel="stylesheet" href="${ctxStatic}/common/css/form.css">
</head>
<body>
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
<a class="panelButton" href="${ctx}/warehouse/shelves/shelves"><i class="ti-angle-left"></i> 返回</a>
</h3>
</div>
<div class="panel-body">
<form:form id="inputForm" modelAttribute="shelves" action="${ctx}/warehouse/shelves/shelves/save" method="post" class="form-horizontal">
<form:hidden path="id"/>
<div class="form-group">
<label class="col-sm-2 control-label"><font color="red">*</font>货架名称:</label>
<div class="col-sm-10">
<form:input path="name" htmlEscape="false" class="form-control required"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"><font color="red">*</font>货架编号:</label>
<div class="col-sm-10">
<form:input path="number" htmlEscape="false" class="form-control required"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">仓库id:</label>
<div class="col-sm-10">
<form:input path="warehouse.id" htmlEscape="false" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">备注信息:</label>
<div class="col-sm-10">
<form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/>
</div>
</div>
<c:if test="${mode == 'add' || mode=='edit'}">
<div class="col-lg-3"></div>
<div class="col-lg-6">
<div class="form-group text-center">
<div>
<button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
</div>
</div>
</div>
</c:if>
</form:form>
</div>
</div>
</div>
</div>
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-body">
<form:form id="inputForm" modelAttribute="shelves" action="${ctx}/warehouse/shelves/shelves/save"
method="post" class="form-horizontal">
<form:hidden path="id"/>
<h3 class="text-center">货架表</h3>
<table class="table table-bordered main-table">
<tr>
<td><font color="red">*</font>货架名称</td>
<td>
<form:input path="name" htmlEscape="false" class="form-control required"/>
</td>
<td><font color="red">*</font>货架编号</td>
<td>
<form:input path="number" htmlEscape="false" class="form-control required"/>
</td>
</tr>
<tr>
<td><font color="red">*</font>仓库</td>
<td>
<sys:gridselect url="${ctx}/warehouse/warehouse/warehouse/data" id="warehouse" name="warehouse.id" value="${testCountry.warehouse.id}" labelName="warehouse.name" labelValue="${testCountry.warehouse.name}"
title="选择仓库" cssClass="form-control " fieldLabels="仓库名称|仓库编号" fieldKeys="name|code" searchLabels="仓库名称|仓库编号" searchKeys="name|code" ></sys:gridselect>
</td>
<td>备注</td>
<td>
<form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/>
</td>
</tr>
</table>
</form:form>
</div>
</div>
</div>
</div>
</div>
<script>
function save() {
var isValidate = jp.validateForm('#inputForm');//校验表单
if(!isValidate){
return false;
}else{
jp.loading();
jp.post($("#inputForm").attr('action'),$('#inputForm').serialize(),function(data){
if(data.success){
jp.getParent().refresh();
var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(dialogIndex);
jp.success(data.msg)
}else{
jp.error(data.msg);
}
})
}
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -231,14 +231,14 @@ $(document).ready(function() {
$('#shelvesTable').bootstrapTable('refresh');
}
function add(){
jp.go("${ctx}/warehouse/shelves/shelves/form/add");
jp.openSaveDialog("新增货架","${ctx}/warehouse/shelves/shelves/form/add", '800', '600');
}
function edit(id){
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/shelves/shelves/form/edit?id=" + id);
jp.openSaveDialog("编辑货架","${ctx}/warehouse/shelves/shelves/form/edit?id=" + id, '800', '600');
}
function view(id) {
......
......@@ -8,8 +8,11 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<div id="toolbar" class="text-left">
<a class="btn btn-primary btn-sm" onclick="addDetail('#detail_table')" title="新增"><i class="fa fa-plus"></i> 新增</a>
<a class="btn btn-primary btn-sm" disabled="true" onclick="addShelve('#detail_table')" title="新增"><i class="fa fa-plus"></i> 批量编辑货架</a>
<c:if test="${mode == 'add' || mode == 'edit'}">
<a class="btn btn-primary btn-sm" onclick="addDetail('#detail_table')" title="新增"><i class="fa fa-plus"></i> 手动添加</a>
<a class="btn btn-primary btn-sm" onclick="addScan('#detail_table')" title="新增"><i class="fa fa-plus"></i> 扫码添加</a>
<a id="editAll" class="btn btn-primary btn-sm" onclick="addShelve('#detail_table')" title="新增"><i class="fa fa-plus"></i> 批量编辑货架</a>
</c:if>
</div>
<table id="detail_table" data-toolbar="#toolbar"></table>
<script>
......@@ -94,40 +97,46 @@
}
}
]
})
});
$(selector).on('check.bs.table uncheck.bs.table load-success.bs.table ' +
'check-all.bs.table uncheck-all.bs.table', function () {
$('#editAll').prop('disabled', !getSelections().length);
});
}
function getSelections(){
return $(selector).bootstrapTable('getSelections');
}
/**
* 手动添加明细
* @param selector
*/
function addDetail(selector){
// 选择该批次号下的货品明细
if(!$("#batchNum").val()){
jp.warning('请选择批次号!');
return;
}
jp.openStorageSelectDialog(true,$("#batchNum").val(),function (){
jp.openStorageSelectDialog({batchNum:$("#batchNum").val(),state: 0, isMultiSelect: true },function (items){
if(Array.isArray(items)){
var data = items.map(function (item){
if(item.goodsInfo && !item.goodsInfo.amount){
item.goodsInfo.amount = 0;
}
return {
id: '',
delFlag: 0,
remarks: '',
...item
}
})
$(selector).bootstrapTable('append', data)
}
})
// var row = {
// id: '',
// delFlag: 0,
// name: '',
// type: {
// id: '',
// name: ''
// },
// model: '',
// num: '',
// remarks: ''
// }
//
// $(selector).bootstrapTable('append', [
// row
// ])
}
function removeRow(index, rowId, rowDelFlag){
if(rowId){
......@@ -171,11 +180,83 @@
}
}
/**
* 获取所有明细数据
* @returns {*|jQuery}
*/
function getTableData(){
return $(selector).bootstrapTable('getData');
}
function addShelve(){
jp.openShelvesSelectDialog(function (){
jp.openShelvesSelectDialog(function (items){
var Shelve = items[0];
// TODO: 获取选中的明细下标
getSelections().forEach(function (item){
var index = getTableData().findIndex(function (current){
return current.qrCode.id === item.qrCode.id;
})
updateRow(index,{
shelves: {
id: Shelve.id,
name: Shelve.name
},
warehouse: Shelve.warehouse
})
})
})
}
/**
* 点击扫码显示扫码窗口
*/
function addScan(){
layer.open({
type: 1,
title: '扫码',
auto: true,
area: ['500','300'],
content: $("#scanResultTpl").html(),
success: function (){
$("#scanResult").focus();
},
btn:['关闭']
})
}
/**
* 扫码
* 一、获取扫码结果
* 二、请求后台接口获取结果
* 三、增一条明细数据
* 四、清空扫码结果
* @param elem
*/
function onScanChange(elem){
try{
var json = JSON.parse($(elem).val());
var qrCodeId = json.code;
var goodsInfoId = json.infoId;
jp.get('${ctx}/warehouse/goods/goods/getGIAndQCByTwoId?goodsInfoId='+goodsInfoId+"&qrCodeId="+qrCodeId, function (res){
var qrCode = res.body.qrCode;
$(selector).bootstrapTable('append',[
{
qrCode: qrCode,
goodsInfo: qrCode.goodsInfo,
...qrCode.goodsInfo,
id: '',
delFlag: 0,
remarks: ''
}
]);
$(elem).val('').focus();
})
}catch (e){
console.log(e);
}
}
</script>
<script id="hideTpl" type="text/html">
......@@ -183,25 +264,45 @@
<input id="storageInfoList{{idx}}_delFlag" name="storageInfoList[{{idx}}].delFlag" type="hidden" value="{{row.delFlag}}"/>
<input id="storageInfoList{{idx}}_goodsInfoId" name="storageInfoList[{{idx}}].goodsInfo.id" type="hidden" value="{{row.goodsInfo.id}}"/>
<input id="storageInfoList{{idx}}_goodsInfoName" name="storageInfoList[{{idx}}].goodsInfo.name" type="hidden" value="{{row.goodsInfo.name}}"/>
<input id="storageInfoList{{idx}}_goodsInfoAmount" name="storageInfoList[{{idx}}].goodsInfo.amount" type="hidden" value="{{row.goodsInfo.amount}}"/>
<input id="storageInfoList{{idx}}_shelvesId" name="storageInfoList[{{idx}}].shelves.id" type="hidden" value="{{row.shelves.id}}" readonly class="form-control" />
<input id="storageInfoList{{idx}}_warehouseId" name="storageInfoList[{{idx}}].warehouse.id" type="hidden" value="{{row.warehouse.id}}" readonly class="form-control" />
<input id="storageInfoList{{idx}}_amount" name="storageInfoList[{{idx}}].amount" type="hidden" value="{{row.amount}}" readonly class="form-control" />
<input id="storageInfoList{{idx}}_qrCodeId" name="storageInfoList[{{idx}}].qrCode.id" type="hidden" value="{{row.qrCode.id}}" readonly class="form-control" />
</script>
<script id="nameTpl" type="text/html">
<input id="storageInfoList{{idx}}_name" name="storageInfoList[{{idx}}].name" type="text" value="{{row.name}}" onchange="onInputChange('{{idx}}', this, 'name')" class="form-control "/>
<input id="storageInfoList{{idx}}_name" name="storageInfoList[{{idx}}].name" type="text" readonly value="{{row.name}}" onchange="onInputChange('{{idx}}', this, 'name')" class="form-control "/>
</script>
<script id="typeTpl" type="text/html">//<!--
<sys:treeselect id="storageInfoList{{idx}}_type" name="storageInfoList[{{idx}}].type.id" value="{{row.type.id}}" labelName="storageInfoList{{idx}}.type.name" labelValue="{{row.type.name}}"
title="类型" url="/warehouse/materialtype/materialType/treeData" cssClass="form-control " allowClear="true" allowSearch="true" callback="onSelectType" />//-->
title="类型" url="/warehouse/materialtype/materialType/treeData" cssClass="form-control " disabled="disabled" allowClear="true" allowSearch="true" callback="onSelectType" />//-->
</script>
<script id="modelTpl" type="text/html">
<input id="storageInfoList{{idx}}_model" name="storageInfoList[{{idx}}].model" type="text" value="{{row.model}}" onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/>
<input id="storageInfoList{{idx}}_model" name="storageInfoList[{{idx}}].model" type="text" value="{{row.model}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/>
</script>
<script id="shelvesTpl" type="text/html">
<input id="storageInfoList{{idx}}_shelvesName" name="storageInfoList[{{idx}}].shelves.name" type="text" value="{{row.shelves.name}}" readonly class="form-control" />
<input id="storageInfoList{{idx}}_shelvesName" name="storageInfoList[{{idx}}].shelves.name" type="text" value="{{row.shelves.name}}" readonly class="form-control" />
</script>
<script id="remarksTpl" type="text/html">
<textarea id="storageInfoList{{idx}}_remarks" name="storageInfoList[{{idx}}].remarks" rows="4" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea>
<textarea id="storageInfoList{{idx}}_remarks" name="storageInfoList[{{idx}}].remarks" rows="2" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea>
</script>
<script id="scanResultTpl" type="text/html">
<br>
<div class="container-fluid">
<div class="row">
<div class="col-xs-2 text-right">
<label>扫码结果:</label>
</div>
<div class="col-xs-10">
<input type="text" id="scanResult" class="form-control" onchange="onScanChange(this)">
<span class="text-danger">请切换英文输入法</span>
</div>
</div>
</div>
<br>
</script>
\ No newline at end of file
......@@ -6,6 +6,33 @@
<meta name="decorator" content="ani"/>
<link rel="stylesheet" href="${ctxStatic}/common/css/form.css">
<link rel="stylesheet" href="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.css">
<style>
.statistic-container{
position: relative;
padding: 45px 15px 15px;
margin: 0 -15px 15px;
border-style: solid;
margin-right: 0;
margin-left: 0;
background-color: #fff;
border-color: #ddd;
border-width: 1px;
border-radius: 4px 4px 0 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.statistic-container:after {
position: absolute;
top: 15px;
left: 15px;
font-size: 12px;
font-weight: 700;
color: #959595;
text-transform: uppercase;
letter-spacing: 1px;
content: "统计信息";
}
</style>
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table-zh-CN.js"></script>
</head>
......@@ -63,6 +90,13 @@
<%@include file="storageDetail.jsp" %>
</td>
</tr>
<c:if test="${mode == 'view'}">
<tr>
<td colspan="4">
<%@include file="storageStatistic.jsp" %>
</td>
</tr>
</c:if>
</table>
</form:form>
</div>
......@@ -74,6 +108,12 @@
$(document).ready(function () {
initTable();
if('${mode}' == 'view'){
getDetail();
initStatisticTable();
}
jp.ajaxForm("#inputForm", function (data) {
if (data.success) {
jp.success(data.msg);
......
......@@ -255,14 +255,14 @@ $(document).ready(function() {
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/storage/storage/form/edit?id=" + id);
jp.openSaveDialog("编辑入库单","${ctx}/warehouse/storage/storage/form/edit?id=" + id, '1200', '800');
}
function view(id){//没有权限时,不显示确定按钮
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/storage/storage/form/view?id=" + id);
jp.openViewDialog("查看入库单","${ctx}/warehouse/storage/storage/form/view?id=" + id, '1200', '800');
}
......@@ -274,11 +274,16 @@ $(document).ready(function() {
var html = Mustache.render(htmltpl, {
idx:row.id
});
$.get("${ctx}/warehouse/storage/storage/detail?id="+row.id, function(storage){
$.get("${ctx}/warehouse/storage/storage/countStorage?id="+row.id, function(storage){
var storageChild1RowIdx = 0, storageChild1Tpl = $("#storageChild1Tpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var data1 = storage.storageInfoList;
var data1 = storage.countStorageInfoList;
for (var i=0; i<data1.length; i++){
data1[i].dict = {};
data1[i].storageId = row.id;
data1[i].batchNum = row.batchNum;
data1[i].jsonStr = JSON.stringify(data1[i]);
data1[i].isNotStorage = data1[i].state === '1';
data1[i].isStorage = data1[i].state === '2';
addRow('#storageChild-'+row.id+'-1-List', storageChild1RowIdx, storageChild1Tpl, data1[i]);
storageChild1RowIdx = storageChild1RowIdx + 1;
}
......@@ -294,6 +299,50 @@ $(document).ready(function() {
idx: idx, delBtn: true, row: row
}));
}
function onStorage(countStorage, goodsInfoId){
var main = JSON.parse(countStorage);
jp.get("${ctx}/warehouse/storage/storage/findInfoBycountStorage?goodsInfo.id="+goodsInfoId+"&storage="+main.storageId, function (res){
var data = res.body.storageInfoList;
if(Array.isArray(data)){
var shelvesIds = data.map(function (item){
return item.shelves.id
}).join(',');
// 构建台账主表
var name$ = $("<input type='hidden' name='name' value='"+main.name+"' />");
var typeId$ = $("<input type='hidden' name='type.id' value='"+main.type.id+"' />");
var typeName$ = $("<input type='hidden' name='type.name' value='"+main.type.name+"' />");
var model$ = $("<input type='hidden' name='model' value='"+main.model+"' />");
var shelvesIds$ = $("<input type='hidden' name='shelvesIds' value='"+shelvesIds+"' />");
var num$ = $("<input type='hidden' name='num' value="+main.num+" />");
var sum$ = $("<input type='hidden' name='sum' value="+main.sum+" />");
$("#ledgerForm").empty();
$("#ledgerForm").append(name$).append(typeId$).append(typeName$).append(model$).append(shelvesIds$).append(num$).append(sum$);
data.forEach(function (item,index){
// 构建台账附表
var id$ = $("<input type='hidden' name='ledgerInfoList["+index+"].id' value='' />");
var delFlag$ = $("<input type='hidden' name='ledgerInfoList["+index+"].delFlag' value='0' />");
var name$ = $("<input type='hidden' name='ledgerInfoList["+index+"].name' value='"+item.name+"' />");
var typeId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].type.id' value='"+item.type.id+"' />");
var batchNum$ = $("<input type='hidden' name='ledgerInfoList["+index+"].batchNum' value='"+main.batchNum+"' />");
var model$ = $("<input type='hidden' name='ledgerInfoList["+index+"].model' value='"+item.model+"' />");
var goodsInfoId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].goodsInfo.id' value='"+item.goodsInfo.id+"' />");
var qrId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].qr.id' value='"+item.qrCode.id+"' />");
var shelvesId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].shelves.id' value='"+item.shelves.id+"' />");
var code$ = $("<input type='hidden' name='ledgerInfoList["+index+"].code' value='"+item.qrCode.code+"' />");
$("#ledgerForm").append(delFlag$).append(name$).append(typeId$).append(batchNum$).append(model$).append(goodsInfoId$).append(qrId$).append(shelvesId$).append(code$);
})
jp.loading('入库中...');
jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){
if(res.success){
jp.success('入库成功!');
}else {
jp.error('入库失败!');
}
})
}
})
}
</script>
<script type="text/template" id="storageChildrenTpl">//<!--
......@@ -309,8 +358,11 @@ $(document).ready(function() {
<th>名称</th>
<th>类型</th>
<th>型号</th>
<th>仓库</th>
<th>货架</th>
<th>备注信息</th>
<th>总价</th>
<th>数量</th>
<th>操作</th>
</tr>
</thead>
<tbody id="storageChild-{{idx}}-1-List">
......@@ -331,10 +383,26 @@ $(document).ready(function() {
{{row.model}}
</td>
<td>
{{row.shelves.name}}
{{row.warehouseNames}}
</td>
<td>
{{row.shelvesNames}}
</td>
<td>
{{row.sum}}
</td>
<td>
{{row.num}}
</td>
{{#row.isNotStorage}}
<td>
<a href="javascript:void(0);" onclick="onStorage('{{row.jsonStr}}','{{row.goodsInfo.id}}')">入库</a>
</td>
{{/row.isNotStorage}}
{{#row.isStorage}}
<td>
{{row.remarks}}
已入库
</td>
{{/row.isStorage}}
</tr>//-->
</script>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ include file="/webpage/include/taglib.jsp" %>
<html>
<head>
<title>入库信息管理</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="decorator" content="ani"/>
<%@ include file="/webpage/include/bootstraptable.jsp"%>
<%@include file="/webpage/include/treeview.jsp" %>
<%@include file="storageList.js" %>
<title>入库信息管理</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="decorator" content="ani"/>
<%@ include file="/webpage/include/bootstraptable.jsp" %>
<%@include file="/webpage/include/treeview.jsp" %>
<%@include file="storageList.js" %>
</head>
<body>
<div class="wrapper wrapper-content">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">入库信息列表</h3>
</div>
<div class="panel-body">
<!-- 搜索 -->
<div id="search-collapse" class="collapse">
<div class="accordion-inner">
<form:form id="searchForm" modelAttribute="storage" class="form form-horizontal well clearfix">
<div class="col-xs-12 col-sm-6 col-md-4">
<label class="label-item single-overflow pull-left" title="入库单:">入库单:</label>
<form:input path="code" htmlEscape="false" maxlength="64" class=" form-control"/>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<label class="label-item single-overflow pull-left" title="操作人:">操作人:</label>
<sys:userselect id="operator" name="operator.id" value="${storage.operator.id}" labelName="operator.name" labelValue="${storage.operator.name}"
cssClass="form-control "/>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="form-group">
<label class="label-item single-overflow pull-left" title="时间:">&nbsp;时间:</label>
<div class="col-xs-12">
<div class="col-xs-12 col-sm-5">
<div class='input-group date' id='beginTime' style="left: -10px;" >
<input type='text' name="beginTime" class="form-control" />
<span class="input-group-addon">
<div class="wrapper wrapper-content">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">入库信息列表</h3>
</div>
<div class="panel-body">
<!-- 搜索 -->
<div id="search-collapse" class="collapse">
<div class="accordion-inner">
<form:form id="searchForm" modelAttribute="storage" class="form form-horizontal well clearfix">
<div class="col-xs-12 col-sm-6 col-md-4">
<label class="label-item single-overflow pull-left" title="入库单:">入库单:</label>
<form:input path="code" htmlEscape="false" maxlength="64" class=" form-control"/>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<label class="label-item single-overflow pull-left" title="操作人:">操作人:</label>
<sys:userselect id="operator" name="operator.id" value="${storage.operator.id}"
labelName="operator.name" labelValue="${storage.operator.name}"
cssClass="form-control "/>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="form-group">
<label class="label-item single-overflow pull-left" title="时间:">&nbsp;时间:</label>
<div class="col-xs-12">
<div class="col-xs-12 col-sm-5">
<div class='input-group date' id='beginTime' style="left: -10px;">
<input type='text' name="beginTime" class="form-control"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="col-xs-12 col-sm-1">
~
</div>
<div class="col-xs-12 col-sm-5">
<div class='input-group date' id='endTime' style="left: -10px;" >
<input type='text' name="endTime" class="form-control" />
<span class="input-group-addon">
</div>
</div>
<div class="col-xs-12 col-sm-1">
~
</div>
<div class="col-xs-12 col-sm-5">
<div class='input-group date' id='endTime' style="left: -10px;">
<input type='text' name="endTime" class="form-control"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<label class="label-item single-overflow pull-left" title="批次号:">批次号:</label>
<form:input path="batchNum" htmlEscape="false" maxlength="64" class=" form-control"/>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div style="margin-top:26px">
<a id="search" class="btn btn-primary btn-rounded btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
<a id="reset" class="btn btn-primary btn-rounded btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>
</div>
</div>
</form:form>
</div>
</div>
<!-- 工具栏 -->
<div id="toolbar">
<shiro:hasPermission name="warehouse:storage:storage:add">
<button id="add" class="btn btn-primary" onclick="add()">
<i class="glyphicon glyphicon-plus"></i> 新建
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:edit">
<button id="edit" class="btn btn-success" disabled onclick="edit()">
<i class="glyphicon glyphicon-edit"></i> 修改
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:del">
<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
<i class="glyphicon glyphicon-remove"></i> 删除
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:import">
<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:export">
<button id="export" class="btn btn-warning">
<i class="fa fa-file-excel-o"></i> 导出
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:view">
<button id="view" class="btn btn-default" disabled onclick="view()">
<i class="fa fa-search-plus"></i> 查看
</button>
</shiro:hasPermission>
</div>
<!-- 表格 -->
<table id="storageTable" data-toolbar="#toolbar"></table>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<label class="label-item single-overflow pull-left" title="批次号:">批次号:</label>
<form:input path="batchNum" htmlEscape="false" maxlength="64" class=" form-control"/>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div style="margin-top:26px">
<a id="search" class="btn btn-primary btn-rounded btn-bordered btn-sm"><i
class="fa fa-search"></i> 查询</a>
<a id="reset" class="btn btn-primary btn-rounded btn-bordered btn-sm"><i
class="fa fa-refresh"></i> 重置</a>
</div>
</div>
</form:form>
</div>
</div>
<!-- 工具栏 -->
<div id="toolbar">
<shiro:hasPermission name="warehouse:storage:storage:add">
<button id="add" class="btn btn-primary" onclick="add()">
<i class="glyphicon glyphicon-plus"></i> 新建
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:edit">
<button id="edit" class="btn btn-success" disabled onclick="edit()">
<i class="glyphicon glyphicon-edit"></i> 修改
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:del">
<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
<i class="glyphicon glyphicon-remove"></i> 删除
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:import">
<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:export">
<button id="export" class="btn btn-warning">
<i class="fa fa-file-excel-o"></i> 导出
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:view">
<button id="view" class="btn btn-default" disabled onclick="view()">
<i class="fa fa-search-plus"></i> 查看
</button>
</shiro:hasPermission>
</div>
<!-- 表格 -->
<table id="storageTable" data-toolbar="#toolbar"></table>
<!-- context menu -->
<ul id="context-menu" class="dropdown-menu">
<shiro:hasPermission name="warehouse:storage:storage:view">
<li data-item="view"><a>查看</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:edit">
<li data-item="edit"><a>编辑</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:del">
<li data-item="delete"><a>删除</a></li>
</shiro:hasPermission>
<li data-item="action1"><a>取消</a></li>
</ul>
</div>
</div>
</div>
<!-- context menu -->
<ul id="context-menu" class="dropdown-menu">
<shiro:hasPermission name="warehouse:storage:storage:view">
<li data-item="view"><a>查看</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:edit">
<li data-item="edit"><a>编辑</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:storage:storage:del">
<li data-item="delete"><a>删除</a></li>
</shiro:hasPermission>
<li data-item="action1"><a>取消</a></li>
</ul>
</div>
</div>
</div>
<div class="hide">
<form id="ledgerForm"></form>
</div>
</body>
</html>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: dell
Date: 2023/2/22
Time: 15:27
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<div class="statistic-container">
<table id="statisticTable" class="detail-table"></table>
</div>
<script>
function initStatisticTable(){
$("#statisticTable").bootstrapTable({
data: [],
columns:[
{field: 'name', title: '名称', align: 'center'},
{field: 'type.name', title: '类型',align: 'center'},
{field: 'model', title: '型号',align: 'center'},
{field: 'warehouseNames', title: '仓库',align: 'center'},
{field: 'shelvesNames', title: '货架',align: 'center'},
{field: 'sum', title: '总价',align: 'center'},
{field: 'num', title: '数量',align: 'center'}
]
})
}
function getDetail(){
$.get("${ctx}/warehouse/storage/storage/countStorage?id=${storage.id}", function(storage){
var data = storage.countStorageInfoList;
$("#statisticTable").bootstrapTable('append', data);
})
}
</script>
\ No newline at end of file
......@@ -233,14 +233,14 @@ $(document).ready(function() {
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/warehouse/warehouse/form/edit?id=" + id);
jp.openSaveDialog("编辑仓库","${ctx}/warehouse/warehouse/warehouse/form/edit?id=" + id, '800', '600');
}
function view(id) {
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/warehouse/warehouse/form/view?id=" + id);
jp.openViewDialog("查看仓库","${ctx}/warehouse/warehouse/warehouse/form/view?id=" + id, '800', '600');
}
</script>
\ No newline at end of file
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