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;
......
......@@ -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>
......@@ -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>
<%--
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