Commit 7bd23633 by 胡懿

Merge branches 'hy' and 'zlt' of gitlab.yqdchina.com:huyi/warehouse into hy

parents af1234a6 bf01d28c
...@@ -14,6 +14,18 @@ public class StaticNumSeq { ...@@ -14,6 +14,18 @@ public class StaticNumSeq {
* 购置备案 * 购置备案
* */ * */
public final static String GZBA = "GZBA"; public final static String GZBA = "GZBA";
/**
* 领用单号
* */
public final static String LYDH = "LYDH";
/**
* 出库单号
* */
public final static String CKDH = "CKDH";
/**
* 出库单号
* */
public final static String PKDH = "PKDH";
/** /**
* 批次号 * 批次号
......
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.materialloss.entity;
import java.util.List;
import com.google.common.collect.Lists;
import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
import java.util.Date;
/**
* 物资盘亏记录Entity
* @author zhanglt
* @version 2023-02-14
*/
public class MaterialLoss extends DataEntity<MaterialLoss> {
private static final long serialVersionUID = 1L;
private String number; // 盘亏单号
private String operator; // 操作人
private Date time; // 盘亏时间
private String beginTime; // 开始 盘亏时间
private String endTime; // 结束 盘亏时间
private List<MaterialLossInfo> materialLossInfoList = Lists.newArrayList(); // 子表列表
public MaterialLoss() {
super();
}
public MaterialLoss(String id){
super(id);
}
@ExcelField(title="盘亏单号", align=2, sort=1)
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
@ExcelField(title="操作人", align=2, sort=2)
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
@ExcelField(title="盘亏时间", align=2, sort=3)
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public List<MaterialLossInfo> getMaterialLossInfoList() {
return materialLossInfoList;
}
public void setMaterialLossInfoList(List<MaterialLossInfo> materialLossInfoList) {
this.materialLossInfoList = materialLossInfoList;
}
}
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.materialloss.entity;
import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
import com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo;
/**
* 盘亏明细表Entity
* @author zhanglt
* @version 2023-02-14
*/
public class MaterialLossInfo extends DataEntity<MaterialLossInfo> {
private static final long serialVersionUID = 1L;
private MaterialLoss materialLoss; // 盘亏表主表ID
private LedgerInfo ledgerInfo; // 物资台账明细ID
public MaterialLossInfo() {
super();
}
public MaterialLossInfo(String id){
super(id);
}
public MaterialLossInfo(MaterialLoss materialLoss) {
this.materialLoss = materialLoss;
}
public MaterialLossInfo(String id, LedgerInfo ledgerInfo) {
super(id);
this.ledgerInfo = ledgerInfo;
}
public MaterialLossInfo(LedgerInfo ledgerInfo) {
this.ledgerInfo = ledgerInfo;
}
@ExcelField(title="盘亏表主表ID", align=2, sort=1)
public MaterialLoss getMaterialLoss() {
return materialLoss;
}
public void setMaterialLoss(MaterialLoss materialLoss) {
this.materialLoss = materialLoss;
}
@ExcelField(title="物资台账明细ID", align=2, sort=2)
public LedgerInfo getLedgerInfo() {
return ledgerInfo;
}
public void setLedgerInfo(LedgerInfo ledgerInfo) {
this.ledgerInfo = ledgerInfo;
}
}
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.materialloss.mapper;
import com.jeeplus.core.persistence.BaseMapper;
import com.jeeplus.core.persistence.annotation.MyBatisMapper;
import com.jeeplus.modules.warehouse.materialloss.entity.MaterialLossInfo;
/**
* 盘亏明细表MAPPER接口
* @author zhanglt
* @version 2023-02-14
*/
@MyBatisMapper
public interface MaterialLossInfoMapper extends BaseMapper<MaterialLossInfo> {
}
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.materialloss.mapper;
import com.jeeplus.core.persistence.BaseMapper;
import com.jeeplus.core.persistence.annotation.MyBatisMapper;
import com.jeeplus.modules.warehouse.materialloss.entity.MaterialLoss;
/**
* 物资盘亏记录MAPPER接口
* @author zhanglt
* @version 2023-02-14
*/
@MyBatisMapper
public interface MaterialLossMapper extends BaseMapper<MaterialLoss> {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeeplus.modules.warehouse.materialloss.mapper.MaterialLossInfoMapper">
<sql id="materialLossInfoColumns">
a.id AS "id",
a.material_loss_id AS "materialLoss.id",
a.ledger_info_id AS "ledgerInfo.id",
a.remarks AS "remarks",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag"
</sql>
<sql id="materialLossInfoJoins">
</sql>
<select id="get" resultType="MaterialLossInfo" >
SELECT
<include refid="materialLossInfoColumns"/>
FROM t_wh_material_loss_info a
<include refid="materialLossInfoJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="MaterialLossInfo" >
SELECT
<include refid="materialLossInfoColumns"/>
FROM t_wh_material_loss_info a
<include refid="materialLossInfoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
<if test="materialLoss != null and materialLoss.id != null and materialLoss.id != ''">
AND a.material_loss_id = #{materialLoss.id}
</if>
<if test="ledgerInfo != null and ledgerInfo.id != null and ledgerInfo.id != ''">
AND a.ledger_info_id = #{ledgerInfo.id}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="MaterialLossInfo" >
SELECT
<include refid="materialLossInfoColumns"/>
FROM t_wh_material_loss_info a
<include refid="materialLossInfoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO t_wh_material_loss_info(
id,
material_loss_id,
ledger_info_id,
remarks,
create_by,
create_date,
update_by,
update_date,
del_flag
) VALUES (
#{id},
#{materialLoss.id},
#{ledgerInfo.id},
#{remarks},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{delFlag}
)
</insert>
<update id="update">
UPDATE t_wh_material_loss_info SET
material_loss_id = #{materialLoss.id},
ledger_info_id = #{ledgerInfo.id},
remarks = #{remarks},
update_by = #{updateBy.id},
update_date = #{updateDate}
WHERE id = #{id}
</update>
<!--物理删除-->
<update id="delete">
DELETE FROM t_wh_material_loss_info
WHERE id = #{id}
</update>
<!--逻辑删除-->
<update id="deleteByLogic">
UPDATE t_wh_material_loss_info SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
<select id="findUniqueByProperty" resultType="MaterialLossInfo" statementType="STATEMENT">
select * FROM t_wh_material_loss_info where ${propertyName} = '${value}'
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeeplus.modules.warehouse.materialloss.mapper.MaterialLossMapper">
<sql id="materialLossColumns">
a.id AS "id",
a.number AS "number",
a.operator AS "operator",
a.time AS "time",
a.remarks AS "remarks",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag"
</sql>
<sql id="materialLossJoins">
</sql>
<select id="get" resultType="MaterialLoss" >
SELECT
<include refid="materialLossColumns"/>
FROM t_wh_material_loss a
<include refid="materialLossJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="MaterialLoss" >
SELECT
<include refid="materialLossColumns"/>
FROM t_wh_material_loss a
<include refid="materialLossJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
<if test="number != null and number != ''">
AND a.number = #{number}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="MaterialLoss" >
SELECT
<include refid="materialLossColumns"/>
FROM t_wh_material_loss a
<include refid="materialLossJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO t_wh_material_loss(
id,
number,
operator,
time,
remarks,
create_by,
create_date,
update_by,
update_date,
del_flag
) VALUES (
#{id},
#{number},
#{operator},
#{time},
#{remarks},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{delFlag}
)
</insert>
<update id="update">
UPDATE t_wh_material_loss SET
number = #{number},
operator = #{operator},
time = #{time},
remarks = #{remarks},
update_by = #{updateBy.id},
update_date = #{updateDate}
WHERE id = #{id}
</update>
<!--物理删除-->
<update id="delete">
DELETE FROM t_wh_material_loss
WHERE id = #{id}
</update>
<!--逻辑删除-->
<update id="deleteByLogic">
UPDATE t_wh_material_loss SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
<select id="findUniqueByProperty" resultType="MaterialLoss" statementType="STATEMENT">
select * FROM t_wh_material_loss where ${propertyName} = '${value}'
</select>
</mapper>
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.materialloss.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import com.jeeplus.modules.warehouse.code.util.CodeUtil;
import com.jeeplus.modules.warehouse.code.util.StaticNumSeq;
import com.jeeplus.modules.warehouse.materialrequisition.entity.MaterialRequisition;
import com.jeeplus.modules.warehouse.materialrequisition.entity.MaterialRequisitionInfo;
import com.jeeplus.modules.warehouse.outbound.entity.Outbound;
import com.jeeplus.modules.warehouse.outbound.entity.OutboundInfo;
import com.jeeplus.modules.warehouse.outbound.service.OutboundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.modules.warehouse.materialloss.entity.MaterialLoss;
import com.jeeplus.modules.warehouse.materialloss.mapper.MaterialLossMapper;
import com.jeeplus.modules.warehouse.materialloss.entity.MaterialLossInfo;
import com.jeeplus.modules.warehouse.materialloss.mapper.MaterialLossInfoMapper;
/**
* 物资盘亏记录Service
* @author zhanglt
* @version 2023-02-14
*/
@Service
@Transactional(readOnly = true)
public class MaterialLossService extends CrudService<MaterialLossMapper, MaterialLoss> {
@Autowired
private MaterialLossInfoMapper materialLossInfoMapper;
@Autowired
private OutboundService outboundService;
public MaterialLoss get(String id) {
MaterialLoss materialLoss = super.get(id);
materialLoss.setMaterialLossInfoList(materialLossInfoMapper.findList(new MaterialLossInfo(materialLoss)));
return materialLoss;
}
public List<MaterialLoss> findList(MaterialLoss materialLoss) {
return super.findList(materialLoss);
}
public Page<MaterialLoss> findPage(Page<MaterialLoss> page, MaterialLoss materialLoss) {
return super.findPage(page, materialLoss);
}
@Transactional(readOnly = false)
public void save(MaterialLoss materialLoss) {
super.save(materialLoss);
for (MaterialLossInfo materialLossInfo : materialLoss.getMaterialLossInfoList()){
if (materialLossInfo.getId() == null){
continue;
}
if (MaterialLossInfo.DEL_FLAG_NORMAL.equals(materialLossInfo.getDelFlag())){
if (StringUtils.isBlank(materialLossInfo.getId())){
materialLossInfo.setMaterialLoss(materialLoss);
materialLossInfo.preInsert();
materialLossInfoMapper.insert(materialLossInfo);
}else{
materialLossInfo.setMaterialLoss(materialLoss);
materialLossInfo.preUpdate();
materialLossInfoMapper.update(materialLossInfo);
}
}else{
materialLossInfoMapper.delete(materialLossInfo);
}
}
}
@Transactional(readOnly = false)
public void delete(MaterialLoss materialLoss) {
super.delete(materialLoss);
materialLossInfoMapper.delete(new MaterialLossInfo(materialLoss));
}
@Transactional(readOnly = false)
public String createLYDH() {
String pkdh = CodeUtil.code("PKDH", StaticNumSeq.PKDH);
return pkdh;
}
//物资盘亏后生成 对应的 出库记录
@Transactional(readOnly = false)
public void delivery(MaterialLoss materialLoss) {
if(materialLoss.getNumber() == null || Objects.equals(materialLoss.getNumber(), "")){
materialLoss.setNumber(this.createLYDH());
}
this.save(materialLoss);
Outbound outbound = new Outbound();
//设置相关表单id为物资盘亏主表的ID
outbound.setRelationId(materialLoss.getId());
//查询当前记录是否已经出库
List<Outbound> list = outboundService.findList(outbound);
if(list != null && list.size()>0){
return;
}
//设置当 前的操作人 与 发放物资的操作人相同
outbound.setOperator(materialLoss.getOperator());
//当前出库时间
outbound.setOutboundTime(new Date());
//出库类型为 领用出库
outbound.setType("2");
List<OutboundInfo> outboundInfoList = new ArrayList<>();
List<MaterialLossInfo> materialLossInfoList = materialLoss.getMaterialLossInfoList();
for (MaterialLossInfo one:materialLossInfoList) {
OutboundInfo outboundInfo = new OutboundInfo();
String ledgerInfoId = one.getLedgerInfo().getId();
String sql = "UPDATE t_wh_ledger_info SET del_flag = 1 WHERE id = " + ledgerInfoId ;
outboundInfo.setId("");
outboundInfo.setOutbound(outbound);
outboundInfo.setLedgerInfo(one.getLedgerInfo());
outboundInfoList.add(outboundInfo);
this.executeUpdateSql(sql);
}
outbound.setOutboundInfoList(outboundInfoList);
outboundService.save(outbound);
}
}
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.materialloss.web;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.multipart.MultipartFile;
import com.google.common.collect.Lists;
import com.jeeplus.common.utils.DateUtils;
import com.jeeplus.common.config.Global;
import com.jeeplus.common.json.AjaxJson;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.web.BaseController;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.common.utils.excel.ExportExcel;
import com.jeeplus.common.utils.excel.ImportExcel;
import com.jeeplus.modules.warehouse.materialloss.entity.MaterialLoss;
import com.jeeplus.modules.warehouse.materialloss.service.MaterialLossService;
/**
* 物资盘亏记录Controller
* @author zhanglt
* @version 2023-02-14
*/
@Controller
@RequestMapping(value = "${adminPath}/warehouse/materialloss/materialLoss")
public class MaterialLossController extends BaseController {
@Autowired
private MaterialLossService materialLossService;
@ModelAttribute
public MaterialLoss get(@RequestParam(required=false) String id) {
MaterialLoss entity = null;
if (StringUtils.isNotBlank(id)){
entity = materialLossService.get(id);
}
if (entity == null){
entity = new MaterialLoss();
}
return entity;
}
/**
* 物资盘亏记录列表页面
*/
@RequiresPermissions("warehouse:materialloss:materialLoss:list")
@RequestMapping(value = {"list", ""})
public String list(MaterialLoss materialLoss, Model model) {
model.addAttribute("materialLoss", materialLoss);
return "modules/warehouse/materialloss/materialLossList";
}
/**
* 物资盘亏记录列表数据
*/
@ResponseBody
@RequiresPermissions("warehouse:materialloss:materialLoss:list")
@RequestMapping(value = "data")
public Map<String, Object> data(MaterialLoss materialLoss, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<MaterialLoss> page = materialLossService.findPage(new Page<MaterialLoss>(request, response), materialLoss);
return getBootstrapData(page);
}
/**
* 查看,增加,编辑物资盘亏记录表单页面
*/
@RequiresPermissions(value={"warehouse:materialloss:materialLoss:view","warehouse:materialloss:materialLoss:add","warehouse:materialloss:materialLoss:edit"},logical=Logical.OR)
@RequestMapping(value = "form/{mode}")
public String form(@PathVariable String mode, MaterialLoss materialLoss, Model model) {
model.addAttribute("materialLoss", materialLoss);
model.addAttribute("mode", mode);
return "modules/warehouse/materialloss/materialLossForm";
}
/**
* 保存物资盘亏记录
*/
@ResponseBody
@RequiresPermissions(value={"warehouse:materialloss:materialLoss:add","warehouse:materialloss:materialLoss:edit"},logical=Logical.OR)
@RequestMapping(value = "save")
public AjaxJson save(MaterialLoss materialLoss, Model model) throws Exception{
AjaxJson j = new AjaxJson();
/**
* 后台hibernate-validation插件校验
*/
String errMsg = beanValidator(materialLoss);
if (StringUtils.isNotBlank(errMsg)){
j.setSuccess(false);
j.setMsg(errMsg);
return j;
}
//新增或编辑表单保存
// materialLossService.save(materialLoss);//保存
materialLossService.delivery(materialLoss);//保存
j.setSuccess(true);
j.setMsg("保存物资盘亏记录成功");
return j;
}
/**
* 删除物资盘亏记录
*/
@ResponseBody
@RequiresPermissions("warehouse:materialloss:materialLoss:del")
@RequestMapping(value = "delete")
public AjaxJson delete(MaterialLoss materialLoss) {
AjaxJson j = new AjaxJson();
materialLossService.delete(materialLoss);
j.setMsg("删除物资盘亏记录成功");
return j;
}
/**
* 批量删除物资盘亏记录
*/
@ResponseBody
@RequiresPermissions("warehouse:materialloss:materialLoss:del")
@RequestMapping(value = "deleteAll")
public AjaxJson deleteAll(String ids) {
AjaxJson j = new AjaxJson();
String idArray[] =ids.split(",");
for(String id : idArray){
materialLossService.delete(materialLossService.get(id));
}
j.setMsg("删除物资盘亏记录成功");
return j;
}
/**
* 导出excel文件
*/
@ResponseBody
@RequiresPermissions("warehouse:materialloss:materialLoss:export")
@RequestMapping(value = "export")
public AjaxJson exportFile(MaterialLoss materialLoss, HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
try {
String fileName = "物资盘亏记录"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
Page<MaterialLoss> page = materialLossService.findPage(new Page<MaterialLoss>(request, response, -1), materialLoss);
new ExportExcel("物资盘亏记录", MaterialLoss.class).setDataList(page.getList()).write(response, fileName).dispose();
j.setSuccess(true);
j.setMsg("导出成功!");
return j;
} catch (Exception e) {
j.setSuccess(false);
j.setMsg("导出物资盘亏记录记录失败!失败信息:"+e.getMessage());
}
return j;
}
@ResponseBody
@RequestMapping(value = "detail")
public MaterialLoss detail(String id) {
return materialLossService.get(id);
}
/**
* 导入Excel数据
*/
@ResponseBody
@RequiresPermissions("warehouse:materialloss:materialLoss:import")
@RequestMapping(value = "import")
public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
try {
int successNum = 0;
int failureNum = 0;
StringBuilder failureMsg = new StringBuilder();
ImportExcel ei = new ImportExcel(file, 1, 0);
List<MaterialLoss> list = ei.getDataList(MaterialLoss.class);
for (MaterialLoss materialLoss : list){
try{
materialLossService.save(materialLoss);
successNum++;
}catch(ConstraintViolationException ex){
failureNum++;
}catch (Exception ex) {
failureNum++;
}
}
if (failureNum>0){
failureMsg.insert(0, ",失败 "+failureNum+" 条物资盘亏记录记录。");
}
j.setMsg( "已成功导入 "+successNum+" 条物资盘亏记录记录"+failureMsg);
} catch (Exception e) {
j.setSuccess(false);
j.setMsg("导入物资盘亏记录失败!失败信息:"+e.getMessage());
}
return j;
}
/**
* 下载导入物资盘亏记录数据模板
*/
@ResponseBody
@RequiresPermissions("warehouse:materialloss:materialLoss:import")
@RequestMapping(value = "import/template")
public AjaxJson importFileTemplate(HttpServletResponse response) {
AjaxJson j = new AjaxJson();
try {
String fileName = "物资盘亏记录数据导入模板.xlsx";
List<MaterialLoss> list = Lists.newArrayList();
new ExportExcel("物资盘亏记录数据", MaterialLoss.class, 1).setDataList(list).write(response, fileName).dispose();
return null;
} catch (Exception e) {
j.setSuccess(false);
j.setMsg( "导入模板下载失败!失败信息:"+e.getMessage());
}
return j;
}
/**
* 保存物资盘亏记录
*/
@ResponseBody
@RequiresPermissions(value={"warehouse:materialloss:materialLoss:add","warehouse:materialloss:materialLoss:edit"},logical=Logical.OR)
@RequestMapping(value = "delivery")
public AjaxJson delivery(MaterialLoss materialLoss, Model model) throws Exception{
AjaxJson j = new AjaxJson();
/**
* 后台hibernate-validation插件校验
*/
String errMsg = beanValidator(materialLoss);
if (StringUtils.isNotBlank(errMsg)){
j.setSuccess(false);
j.setMsg(errMsg);
return j;
}
//新增或编辑表单保存
// materialLossService.save(materialLoss);//保存
materialLossService.delivery(materialLoss);//保存
j.setSuccess(true);
j.setMsg("保存物资盘亏记录成功");
return j;
}
}
\ No newline at end of file
...@@ -22,7 +22,7 @@ public class MaterialRequisition extends DataEntity<MaterialRequisition> { ...@@ -22,7 +22,7 @@ public class MaterialRequisition extends DataEntity<MaterialRequisition> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String number; // 领用单号 private String number; // 领用单号
private String operator; // 操作人 private String operator; // 操作人
private String receiver; // 领用人 // private String receiver; // 领用人
private Office office; // 领用机构 private Office office; // 领用机构
private Date time; // 领用时间 private Date time; // 领用时间
private List<MaterialRequisitionInfo> materialRequisitionInfoList = Lists.newArrayList(); // 子表列表 private List<MaterialRequisitionInfo> materialRequisitionInfoList = Lists.newArrayList(); // 子表列表
...@@ -53,14 +53,6 @@ public class MaterialRequisition extends DataEntity<MaterialRequisition> { ...@@ -53,14 +53,6 @@ public class MaterialRequisition extends DataEntity<MaterialRequisition> {
this.operator = operator; this.operator = operator;
} }
@ExcelField(title="领用人", align=2, sort=3)
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
@ExcelField(title="领用机构", fieldType=Office.class, value="", align=2, sort=4) @ExcelField(title="领用机构", fieldType=Office.class, value="", align=2, sort=4)
public Office getOffice() { public Office getOffice() {
......
...@@ -17,6 +17,7 @@ public class MaterialRequisitionInfo extends DataEntity<MaterialRequisitionInfo> ...@@ -17,6 +17,7 @@ public class MaterialRequisitionInfo extends DataEntity<MaterialRequisitionInfo>
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private MaterialRequisition materialRequisition; // 物资领用主表ID private MaterialRequisition materialRequisition; // 物资领用主表ID
private String receiver; // 领用人
private LedgerInfo ledgerInfo; // 物资台账明细ID private LedgerInfo ledgerInfo; // 物资台账明细ID
public MaterialRequisitionInfo() { public MaterialRequisitionInfo() {
...@@ -44,6 +45,14 @@ public class MaterialRequisitionInfo extends DataEntity<MaterialRequisitionInfo> ...@@ -44,6 +45,14 @@ public class MaterialRequisitionInfo extends DataEntity<MaterialRequisitionInfo>
public LedgerInfo getLedgerInfo() { public LedgerInfo getLedgerInfo() {
return ledgerInfo; return ledgerInfo;
} }
@ExcelField(title="领用人", align=2, sort=3)
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public void setLedgerInfo(LedgerInfo ledgerInfo) { public void setLedgerInfo(LedgerInfo ledgerInfo) {
this.ledgerInfo = ledgerInfo; this.ledgerInfo = ledgerInfo;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
a.id AS "id", a.id AS "id",
a.material_requisition_id AS "materialRequisition.id", a.material_requisition_id AS "materialRequisition.id",
a.ledger_info_id AS "ledgerInfo.id", a.ledger_info_id AS "ledgerInfo.id",
a.receiver AS "receiver",
a.create_by AS "createBy.id", a.create_by AS "createBy.id",
a.create_date AS "createDate", a.create_date AS "createDate",
a.update_by AS "updateBy.id", a.update_by AS "updateBy.id",
...@@ -76,6 +77,7 @@ ...@@ -76,6 +77,7 @@
INSERT INTO t_wh_material_requisition_info( INSERT INTO t_wh_material_requisition_info(
id, id,
material_requisition_id, material_requisition_id,
receiver,
ledger_info_id, ledger_info_id,
create_by, create_by,
create_date, create_date,
...@@ -86,6 +88,7 @@ ...@@ -86,6 +88,7 @@
) VALUES ( ) VALUES (
#{id}, #{id},
#{materialRequisition.id}, #{materialRequisition.id},
#{receiver},
#{ledgerInfo.id}, #{ledgerInfo.id},
#{createBy.id}, #{createBy.id},
#{createDate}, #{createDate},
...@@ -100,6 +103,7 @@ ...@@ -100,6 +103,7 @@
UPDATE t_wh_material_requisition_info SET UPDATE t_wh_material_requisition_info SET
material_requisition_id = #{materialRequisition.id}, material_requisition_id = #{materialRequisition.id},
ledger_info_id = #{ledgerInfo.id}, ledger_info_id = #{ledgerInfo.id},
receiver = #{receiver},
update_by = #{updateBy.id}, update_by = #{updateBy.id},
update_date = #{updateDate}, update_date = #{updateDate},
remarks = #{remarks} remarks = #{remarks}
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
a.id AS "id", a.id AS "id",
a.number AS "number", a.number AS "number",
a.operator AS "operator", a.operator AS "operator",
a.receiver AS "receiver",
a.collecting_office_id AS "office.id", a.collecting_office_id AS "office.id",
a.time AS "time", a.time AS "time",
a.create_by AS "createBy.id", a.create_by AS "createBy.id",
...@@ -14,7 +13,8 @@ ...@@ -14,7 +13,8 @@
a.update_by AS "updateBy.id", a.update_by AS "updateBy.id",
a.update_date AS "updateDate", a.update_date AS "updateDate",
a.del_flag AS "delFlag", a.del_flag AS "delFlag",
a.remarks AS "remarks" a.remarks AS "remarks",
office.name AS "office.name"
</sql> </sql>
<sql id="materialRequisitionJoins"> <sql id="materialRequisitionJoins">
...@@ -45,9 +45,6 @@ ...@@ -45,9 +45,6 @@
<if test="operator != null and operator != ''"> <if test="operator != null and operator != ''">
AND a.operator = #{operator} AND a.operator = #{operator}
</if> </if>
<if test="receiver != null and receiver != ''">
AND a.receiver = #{receiver}
</if>
</where> </where>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when test="page !=null and page.orderBy != null and page.orderBy != ''">
...@@ -83,7 +80,6 @@ ...@@ -83,7 +80,6 @@
id, id,
number, number,
operator, operator,
receiver,
collecting_office_id, collecting_office_id,
time, time,
create_by, create_by,
...@@ -96,7 +92,6 @@ ...@@ -96,7 +92,6 @@
#{id}, #{id},
#{number}, #{number},
#{operator}, #{operator},
#{receiver},
#{office.id}, #{office.id},
#{time}, #{time},
#{createBy.id}, #{createBy.id},
...@@ -112,7 +107,6 @@ ...@@ -112,7 +107,6 @@
UPDATE t_wh_material_requisition SET UPDATE t_wh_material_requisition SET
number = #{number}, number = #{number},
operator = #{operator}, operator = #{operator},
receiver = #{receiver},
collecting_office_id = #{office.id}, collecting_office_id = #{office.id},
time = #{time}, time = #{time},
update_by = #{updateBy.id}, update_by = #{updateBy.id},
......
...@@ -3,8 +3,16 @@ ...@@ -3,8 +3,16 @@
*/ */
package com.jeeplus.modules.warehouse.materialrequisition.service; package com.jeeplus.modules.warehouse.materialrequisition.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
import com.jeeplus.modules.warehouse.code.util.CodeUtil;
import com.jeeplus.modules.warehouse.code.util.StaticNumSeq;
import com.jeeplus.modules.warehouse.outbound.entity.Outbound;
import com.jeeplus.modules.warehouse.outbound.entity.OutboundInfo;
import com.jeeplus.modules.warehouse.outbound.service.OutboundService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -28,6 +36,9 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM ...@@ -28,6 +36,9 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM
@Autowired @Autowired
private MaterialRequisitionInfoMapper materialRequisitionInfoMapper; private MaterialRequisitionInfoMapper materialRequisitionInfoMapper;
@Autowired
private OutboundService outboundService;
public MaterialRequisition get(String id) { public MaterialRequisition get(String id) {
MaterialRequisition materialRequisition = super.get(id); MaterialRequisition materialRequisition = super.get(id);
...@@ -70,5 +81,49 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM ...@@ -70,5 +81,49 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM
super.delete(materialRequisition); super.delete(materialRequisition);
materialRequisitionInfoMapper.delete(new MaterialRequisitionInfo(materialRequisition)); materialRequisitionInfoMapper.delete(new MaterialRequisitionInfo(materialRequisition));
} }
@Transactional(readOnly = false)
public String createLYDH() {
String lydh = CodeUtil.code("LYDH", StaticNumSeq.LYDH);
return lydh;
}
//物资领用后生成 对应的 出库记录
@Transactional(readOnly = false)
public void delivery(MaterialRequisition materialRequisition) {
if(materialRequisition.getNumber() == null &&Objects.equals(materialRequisition.getNumber(), "")){
materialRequisition.setNumber(this.createLYDH());
}
this.save(materialRequisition);
Outbound outbound = new Outbound();
//设置相关表单id为领用主表的ID
outbound.setRelationId(materialRequisition.getId());
//查询当前记录是否已经出库
List<Outbound> list = outboundService.findList(outbound);
if(list != null && list.size()>0){
return;
}
//设置当 前的操作人 与 发放物资的操作人相同
outbound.setOperator(materialRequisition.getOperator());
//当前出库时间
outbound.setOutboundTime(new Date());
//出库类型为 领用出库
outbound.setType("1");
List<OutboundInfo> outboundInfoList = new ArrayList<>();
List<MaterialRequisitionInfo> materialRequisitionInfoList = materialRequisition.getMaterialRequisitionInfoList();
if(materialRequisitionInfoList != null ){
for (MaterialRequisitionInfo one:materialRequisitionInfoList) {
OutboundInfo outboundInfo = new OutboundInfo();
String ledgerInfoId = one.getLedgerInfo().getId();
String sql = "UPDATE t_wh_ledger_info SET del_flag = 1 WHERE id = " + ledgerInfoId ;
outboundInfo.setId("");
outboundInfo.setOutbound(outbound);
outboundInfo.setLedgerInfo(one.getLedgerInfo());
outboundInfoList.add(outboundInfo);
this.executeUpdateSql(sql);
}
outbound.setOutboundInfoList(outboundInfoList);
outboundService.save(outbound);
}
}
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
package com.jeeplus.modules.warehouse.materialrequisition.web; package com.jeeplus.modules.warehouse.materialrequisition.web;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -10,6 +11,8 @@ import javax.servlet.http.HttpServletRequest; ...@@ -10,6 +11,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import com.jeeplus.modules.sys.entity.User;
import com.jeeplus.modules.sys.service.SystemService;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -46,6 +49,9 @@ public class MaterialRequisitionController extends BaseController { ...@@ -46,6 +49,9 @@ public class MaterialRequisitionController extends BaseController {
@Autowired @Autowired
private MaterialRequisitionService materialRequisitionService; private MaterialRequisitionService materialRequisitionService;
@Autowired
private SystemService systemService;
@ModelAttribute @ModelAttribute
public MaterialRequisition get(@RequestParam(required=false) String id) { public MaterialRequisition get(@RequestParam(required=false) String id) {
...@@ -109,7 +115,9 @@ public class MaterialRequisitionController extends BaseController { ...@@ -109,7 +115,9 @@ public class MaterialRequisitionController extends BaseController {
return j; return j;
} }
//新增或编辑表单保存 //新增或编辑表单保存
materialRequisitionService.save(materialRequisition);//保存 // materialRequisitionService.save(materialRequisition);//保存
materialRequisitionService.delivery(materialRequisition);
j.setSuccess(true); j.setSuccess(true);
j.setMsg("保存物资领用成功"); j.setMsg("保存物资领用成功");
return j; return j;
...@@ -228,6 +236,46 @@ public class MaterialRequisitionController extends BaseController { ...@@ -228,6 +236,46 @@ public class MaterialRequisitionController extends BaseController {
} }
return j; return j;
} }
/**
* 生成对应的 出库记录 领用后出库
*/
@ResponseBody
@RequiresPermissions(value={"warehouse:materialrequisition:materialRequisition:add","warehouse:materialrequisition:materialRequisition:edit"},logical=Logical.OR)
@RequestMapping(value = "delivery")
public AjaxJson delivery(MaterialRequisition materialRequisition, Model model) throws Exception{
AjaxJson j = new AjaxJson();
/**
* 后台hibernate-validation插件校验
*/
String errMsg = beanValidator(materialRequisition);
if (StringUtils.isNotBlank(errMsg)){
j.setSuccess(false);
j.setMsg(errMsg);
return j;
}
//新增或编辑表单保存
// materialRequisitionService.save(materialRequisition);//保存
materialRequisitionService.delivery(materialRequisition);
j.setSuccess(true);
j.setMsg("保存物资领用成功");
return j;
}
/**
* 获取 领用机构下的 所有用户
*/
@ResponseBody
@RequestMapping(value = "getUserListByOfficeId")
public List<User> getUserListByOfficeId(String officeId) throws Exception{
/**
* 后台hibernate-validation插件校验
*/
List<User> list = new ArrayList<>();
if (StringUtils.isBlank(officeId)){
return list;
}
list = systemService.findUserByOfficeId(officeId);
return list;
}
} }
\ No newline at end of file
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
package com.jeeplus.modules.warehouse.outbound.service; package com.jeeplus.modules.warehouse.outbound.service;
import java.util.List; import java.util.List;
import java.util.Objects;
import com.jeeplus.modules.warehouse.code.util.CodeUtil;
import com.jeeplus.modules.warehouse.code.util.StaticNumSeq;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -45,6 +48,9 @@ public class OutboundService extends CrudService<OutboundMapper, Outbound> { ...@@ -45,6 +48,9 @@ public class OutboundService extends CrudService<OutboundMapper, Outbound> {
@Transactional(readOnly = false) @Transactional(readOnly = false)
public void save(Outbound outbound) { public void save(Outbound outbound) {
if(outbound.getNumber() == null || Objects.equals(outbound.getNumber(), "")){
outbound.setNumber(this.createCKDH());
}
super.save(outbound); super.save(outbound);
for (OutboundInfo outboundInfo : outbound.getOutboundInfoList()){ for (OutboundInfo outboundInfo : outbound.getOutboundInfoList()){
if (outboundInfo.getId() == null){ if (outboundInfo.getId() == null){
...@@ -66,7 +72,11 @@ public class OutboundService extends CrudService<OutboundMapper, Outbound> { ...@@ -66,7 +72,11 @@ public class OutboundService extends CrudService<OutboundMapper, Outbound> {
} }
} }
} }
@Transactional(readOnly = false)
public String createCKDH() {
String ckdh = CodeUtil.code("CKDH", StaticNumSeq.CKDH);
return ckdh;
}
@Transactional(readOnly = false) @Transactional(readOnly = false)
public void delete(Outbound outbound) { public void delete(Outbound outbound) {
super.delete(outbound); super.delete(outbound);
......
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.profitwarehousing.entity;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.google.common.collect.Lists;
import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
/**
* 盘盈入库单Entity
* @author zhanglt
* @version 2023-02-14
*/
public class ProfitWarehousing extends DataEntity<ProfitWarehousing> {
private static final long serialVersionUID = 1L;
private String number; // 盘盈入库单号
private String operator; // 操作人
private Date time; // 时间
private Date beginTime; // 开始 时间
private Date endTime; // 结束 时间
private List<ProfitWarehousingInfo> profitWarehousingInfoList = Lists.newArrayList(); // 子表列表
public ProfitWarehousing() {
super();
}
public ProfitWarehousing(String id){
super(id);
}
@ExcelField(title="盘盈入库单号", align=2, sort=1)
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
@ExcelField(title="操作人", align=2, sort=2)
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ExcelField(title="时间", align=2, sort=3)
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public Date getBeginTime() {
return beginTime;
}
public void setBeginTime(Date beginTime) {
this.beginTime = beginTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public List<ProfitWarehousingInfo> getProfitWarehousingInfoList() {
return profitWarehousingInfoList;
}
public void setProfitWarehousingInfoList(List<ProfitWarehousingInfo> profitWarehousingInfoList) {
this.profitWarehousingInfoList = profitWarehousingInfoList;
}
}
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.profitwarehousing.entity;
import com.jeeplus.modules.warehouse.shelves.entity.Shelves;
import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
/**
* 盘盈入库单明细表Entity
* @author zhanglt
* @version 2023-02-14
*/
public class ProfitWarehousingInfo extends DataEntity<ProfitWarehousingInfo> {
private static final long serialVersionUID = 1L;
private ProfitWarehousing profitWarehousing; // 盘盈入库主表ID
private String name; // 名称
private String type; // 类型
private String marking; // 型号
private Shelves shelves; // 货架ID
public ProfitWarehousingInfo() {
super();
}
public ProfitWarehousingInfo(String id){
super(id);
}
public ProfitWarehousingInfo(ProfitWarehousing profitWarehousing) {
this.profitWarehousing = profitWarehousing;
}
@ExcelField(title="盘盈入库主表ID", align=2, sort=1)
public ProfitWarehousing getProfitWarehousing() {
return profitWarehousing;
}
public void setProfitWarehousing(ProfitWarehousing profitWarehousing) {
this.profitWarehousing = profitWarehousing;
}
@ExcelField(title="名称", align=2, sort=2)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ExcelField(title="类型", align=2, sort=3)
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@ExcelField(title="型号", align=2, sort=4)
public String getMarking() {
return marking;
}
public void setMarking(String marking) {
this.marking = marking;
}
@ExcelField(title="货架ID", align=2, sort=5)
public Shelves getShelves() {
return shelves;
}
public void setShelves(Shelves shelves) {
this.shelves = shelves;
}
}
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.profitwarehousing.mapper;
import com.jeeplus.core.persistence.BaseMapper;
import com.jeeplus.core.persistence.annotation.MyBatisMapper;
import com.jeeplus.modules.warehouse.profitwarehousing.entity.ProfitWarehousingInfo;
/**
* 盘盈入库单明细表MAPPER接口
* @author zhanglt
* @version 2023-02-14
*/
@MyBatisMapper
public interface ProfitWarehousingInfoMapper extends BaseMapper<ProfitWarehousingInfo> {
}
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.profitwarehousing.mapper;
import com.jeeplus.core.persistence.BaseMapper;
import com.jeeplus.core.persistence.annotation.MyBatisMapper;
import com.jeeplus.modules.warehouse.profitwarehousing.entity.ProfitWarehousing;
/**
* 盘盈入库单MAPPER接口
* @author zhanglt
* @version 2023-02-14
*/
@MyBatisMapper
public interface ProfitWarehousingMapper extends BaseMapper<ProfitWarehousing> {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeeplus.modules.warehouse.profitwarehousing.mapper.ProfitWarehousingInfoMapper">
<sql id="profitWarehousingInfoColumns">
a.id AS "id",
a.profit_warehousing_id AS "profitWarehousing.id",
a.name AS "name",
a.type AS "type",
a.marking AS "marking",
a.shelves_id AS "shelves.id",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag"
</sql>
<sql id="profitWarehousingInfoJoins">
</sql>
<select id="get" resultType="ProfitWarehousingInfo" >
SELECT
<include refid="profitWarehousingInfoColumns"/>
FROM t_wh_profit_warehousing_info a
<include refid="profitWarehousingInfoJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="ProfitWarehousingInfo" >
SELECT
<include refid="profitWarehousingInfoColumns"/>
FROM t_wh_profit_warehousing_info a
<include refid="profitWarehousingInfoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
<if test="profitWarehousing != null and profitWarehousing.id != null and profitWarehousing.id != ''">
AND a.profit_warehousing_id = #{profitWarehousing.id}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="ProfitWarehousingInfo" >
SELECT
<include refid="profitWarehousingInfoColumns"/>
FROM t_wh_profit_warehousing_info a
<include refid="profitWarehousingInfoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO t_wh_profit_warehousing_info(
id,
profit_warehousing_id,
name,
type,
marking,
shelves_id,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{profitWarehousing.id},
#{name},
#{type},
#{marking},
#{shelves.id},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update id="update">
UPDATE t_wh_profit_warehousing_info SET
profit_warehousing_id = #{profitWarehousing.id},
name = #{name},
type = #{type},
marking = #{marking},
shelves_id = #{shelves.id},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks}
WHERE id = #{id}
</update>
<!--物理删除-->
<update id="delete">
DELETE FROM t_wh_profit_warehousing_info
WHERE id = #{id}
</update>
<!--逻辑删除-->
<update id="deleteByLogic">
UPDATE t_wh_profit_warehousing_info SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
<select id="findUniqueByProperty" resultType="ProfitWarehousingInfo" statementType="STATEMENT">
select * FROM t_wh_profit_warehousing_info where ${propertyName} = '${value}'
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeeplus.modules.warehouse.profitwarehousing.mapper.ProfitWarehousingMapper">
<sql id="profitWarehousingColumns">
a.id AS "id",
a.number AS "number",
a.operator AS "operator",
a.time AS "time",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag"
</sql>
<sql id="profitWarehousingJoins">
</sql>
<select id="get" resultType="ProfitWarehousing" >
SELECT
<include refid="profitWarehousingColumns"/>
FROM t_wh_profit_warehousing a
<include refid="profitWarehousingJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="ProfitWarehousing" >
SELECT
<include refid="profitWarehousingColumns"/>
FROM t_wh_profit_warehousing a
<include refid="profitWarehousingJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
<if test="number != null and number != ''">
AND a.number = #{number}
</if>
<if test="beginTime != null and beginTime != '' and endTime != '' and endTime != null ">
AND a.time BETWEEN #{beginTime} AND #{endTime}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="ProfitWarehousing" >
SELECT
<include refid="profitWarehousingColumns"/>
FROM t_wh_profit_warehousing a
<include refid="profitWarehousingJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO t_wh_profit_warehousing(
id,
number,
operator,
time,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{number},
#{operator},
#{time},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update id="update">
UPDATE t_wh_profit_warehousing SET
number = #{number},
operator = #{operator},
time = #{time},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks}
WHERE id = #{id}
</update>
<!--物理删除-->
<update id="delete">
DELETE FROM t_wh_profit_warehousing
WHERE id = #{id}
</update>
<!--逻辑删除-->
<update id="deleteByLogic">
UPDATE t_wh_profit_warehousing SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
<select id="findUniqueByProperty" resultType="ProfitWarehousing" statementType="STATEMENT">
select * FROM t_wh_profit_warehousing where ${propertyName} = '${value}'
</select>
</mapper>
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.profitwarehousing.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.modules.warehouse.profitwarehousing.entity.ProfitWarehousing;
import com.jeeplus.modules.warehouse.profitwarehousing.mapper.ProfitWarehousingMapper;
import com.jeeplus.modules.warehouse.profitwarehousing.entity.ProfitWarehousingInfo;
import com.jeeplus.modules.warehouse.profitwarehousing.mapper.ProfitWarehousingInfoMapper;
/**
* 盘盈入库单Service
* @author zhanglt
* @version 2023-02-14
*/
@Service
@Transactional(readOnly = true)
public class ProfitWarehousingService extends CrudService<ProfitWarehousingMapper, ProfitWarehousing> {
@Autowired
private ProfitWarehousingInfoMapper profitWarehousingInfoMapper;
public ProfitWarehousing get(String id) {
ProfitWarehousing profitWarehousing = super.get(id);
profitWarehousing.setProfitWarehousingInfoList(profitWarehousingInfoMapper.findList(new ProfitWarehousingInfo(profitWarehousing)));
return profitWarehousing;
}
public List<ProfitWarehousing> findList(ProfitWarehousing profitWarehousing) {
return super.findList(profitWarehousing);
}
public Page<ProfitWarehousing> findPage(Page<ProfitWarehousing> page, ProfitWarehousing profitWarehousing) {
return super.findPage(page, profitWarehousing);
}
@Transactional(readOnly = false)
public void save(ProfitWarehousing profitWarehousing) {
super.save(profitWarehousing);
for (ProfitWarehousingInfo profitWarehousingInfo : profitWarehousing.getProfitWarehousingInfoList()){
if (profitWarehousingInfo.getId() == null){
continue;
}
if (ProfitWarehousingInfo.DEL_FLAG_NORMAL.equals(profitWarehousingInfo.getDelFlag())){
if (StringUtils.isBlank(profitWarehousingInfo.getId())){
profitWarehousingInfo.setProfitWarehousing(profitWarehousing);
profitWarehousingInfo.preInsert();
profitWarehousingInfoMapper.insert(profitWarehousingInfo);
}else{
profitWarehousingInfo.setProfitWarehousing(profitWarehousing);
profitWarehousingInfo.preUpdate();
profitWarehousingInfoMapper.update(profitWarehousingInfo);
}
}else{
profitWarehousingInfoMapper.delete(profitWarehousingInfo);
}
}
}
@Transactional(readOnly = false)
public void delete(ProfitWarehousing profitWarehousing) {
super.delete(profitWarehousing);
profitWarehousingInfoMapper.delete(new ProfitWarehousingInfo(profitWarehousing));
}
}
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.warehouse.profitwarehousing.web;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.multipart.MultipartFile;
import com.google.common.collect.Lists;
import com.jeeplus.common.utils.DateUtils;
import com.jeeplus.common.config.Global;
import com.jeeplus.common.json.AjaxJson;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.web.BaseController;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.common.utils.excel.ExportExcel;
import com.jeeplus.common.utils.excel.ImportExcel;
import com.jeeplus.modules.warehouse.profitwarehousing.entity.ProfitWarehousing;
import com.jeeplus.modules.warehouse.profitwarehousing.service.ProfitWarehousingService;
/**
* 盘盈入库单Controller
* @author zhanglt
* @version 2023-02-14
*/
@Controller
@RequestMapping(value = "${adminPath}/warehouse/profitwarehousing/profitWarehousing")
public class ProfitWarehousingController extends BaseController {
@Autowired
private ProfitWarehousingService profitWarehousingService;
@ModelAttribute
public ProfitWarehousing get(@RequestParam(required=false) String id) {
ProfitWarehousing entity = null;
if (StringUtils.isNotBlank(id)){
entity = profitWarehousingService.get(id);
}
if (entity == null){
entity = new ProfitWarehousing();
}
return entity;
}
/**
* 盘盈入库单列表页面
*/
@RequiresPermissions("warehouse:profitwarehousing:profitWarehousing:list")
@RequestMapping(value = {"list", ""})
public String list(ProfitWarehousing profitWarehousing, Model model) {
model.addAttribute("profitWarehousing", profitWarehousing);
return "modules/warehouse/profitwarehousing/profitWarehousingList";
}
/**
* 盘盈入库单列表数据
*/
@ResponseBody
@RequiresPermissions("warehouse:profitwarehousing:profitWarehousing:list")
@RequestMapping(value = "data")
public Map<String, Object> data(ProfitWarehousing profitWarehousing, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<ProfitWarehousing> page = profitWarehousingService.findPage(new Page<ProfitWarehousing>(request, response), profitWarehousing);
return getBootstrapData(page);
}
/**
* 查看,增加,编辑盘盈入库单表单页面
*/
@RequiresPermissions(value={"warehouse:profitwarehousing:profitWarehousing:view","warehouse:profitwarehousing:profitWarehousing:add","warehouse:profitwarehousing:profitWarehousing:edit"},logical=Logical.OR)
@RequestMapping(value = "form/{mode}")
public String form(@PathVariable String mode, ProfitWarehousing profitWarehousing, Model model) {
model.addAttribute("profitWarehousing", profitWarehousing);
model.addAttribute("mode", mode);
return "modules/warehouse/profitwarehousing/profitWarehousingForm";
}
/**
* 保存盘盈入库单
*/
@ResponseBody
@RequiresPermissions(value={"warehouse:profitwarehousing:profitWarehousing:add","warehouse:profitwarehousing:profitWarehousing:edit"},logical=Logical.OR)
@RequestMapping(value = "save")
public AjaxJson save(ProfitWarehousing profitWarehousing, Model model) throws Exception{
AjaxJson j = new AjaxJson();
/**
* 后台hibernate-validation插件校验
*/
String errMsg = beanValidator(profitWarehousing);
if (StringUtils.isNotBlank(errMsg)){
j.setSuccess(false);
j.setMsg(errMsg);
return j;
}
//新增或编辑表单保存
profitWarehousingService.save(profitWarehousing);//保存
j.setSuccess(true);
j.setMsg("保存盘盈入库单成功");
return j;
}
/**
* 删除盘盈入库单
*/
@ResponseBody
@RequiresPermissions("warehouse:profitwarehousing:profitWarehousing:del")
@RequestMapping(value = "delete")
public AjaxJson delete(ProfitWarehousing profitWarehousing) {
AjaxJson j = new AjaxJson();
profitWarehousingService.delete(profitWarehousing);
j.setMsg("删除盘盈入库单成功");
return j;
}
/**
* 批量删除盘盈入库单
*/
@ResponseBody
@RequiresPermissions("warehouse:profitwarehousing:profitWarehousing:del")
@RequestMapping(value = "deleteAll")
public AjaxJson deleteAll(String ids) {
AjaxJson j = new AjaxJson();
String idArray[] =ids.split(",");
for(String id : idArray){
profitWarehousingService.delete(profitWarehousingService.get(id));
}
j.setMsg("删除盘盈入库单成功");
return j;
}
/**
* 导出excel文件
*/
@ResponseBody
@RequiresPermissions("warehouse:profitwarehousing:profitWarehousing:export")
@RequestMapping(value = "export")
public AjaxJson exportFile(ProfitWarehousing profitWarehousing, HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
try {
String fileName = "盘盈入库单"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
Page<ProfitWarehousing> page = profitWarehousingService.findPage(new Page<ProfitWarehousing>(request, response, -1), profitWarehousing);
new ExportExcel("盘盈入库单", ProfitWarehousing.class).setDataList(page.getList()).write(response, fileName).dispose();
j.setSuccess(true);
j.setMsg("导出成功!");
return j;
} catch (Exception e) {
j.setSuccess(false);
j.setMsg("导出盘盈入库单记录失败!失败信息:"+e.getMessage());
}
return j;
}
@ResponseBody
@RequestMapping(value = "detail")
public ProfitWarehousing detail(String id) {
return profitWarehousingService.get(id);
}
/**
* 导入Excel数据
*/
@ResponseBody
@RequiresPermissions("warehouse:profitwarehousing:profitWarehousing:import")
@RequestMapping(value = "import")
public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
try {
int successNum = 0;
int failureNum = 0;
StringBuilder failureMsg = new StringBuilder();
ImportExcel ei = new ImportExcel(file, 1, 0);
List<ProfitWarehousing> list = ei.getDataList(ProfitWarehousing.class);
for (ProfitWarehousing profitWarehousing : list){
try{
profitWarehousingService.save(profitWarehousing);
successNum++;
}catch(ConstraintViolationException ex){
failureNum++;
}catch (Exception ex) {
failureNum++;
}
}
if (failureNum>0){
failureMsg.insert(0, ",失败 "+failureNum+" 条盘盈入库单记录。");
}
j.setMsg( "已成功导入 "+successNum+" 条盘盈入库单记录"+failureMsg);
} catch (Exception e) {
j.setSuccess(false);
j.setMsg("导入盘盈入库单失败!失败信息:"+e.getMessage());
}
return j;
}
/**
* 下载导入盘盈入库单数据模板
*/
@ResponseBody
@RequiresPermissions("warehouse:profitwarehousing:profitWarehousing:import")
@RequestMapping(value = "import/template")
public AjaxJson importFileTemplate(HttpServletResponse response) {
AjaxJson j = new AjaxJson();
try {
String fileName = "盘盈入库单数据导入模板.xlsx";
List<ProfitWarehousing> list = Lists.newArrayList();
new ExportExcel("盘盈入库单数据", ProfitWarehousing.class, 1).setDataList(list).write(response, fileName).dispose();
return null;
} catch (Exception e) {
j.setSuccess(false);
j.setMsg( "导入模板下载失败!失败信息:"+e.getMessage());
}
return j;
}
}
\ No newline at end of file
...@@ -12,11 +12,12 @@ ...@@ -12,11 +12,12 @@
a.create_date AS "createDate", a.create_date AS "createDate",
a.update_by AS "updateBy.id", a.update_by AS "updateBy.id",
a.update_date AS "updateDate", a.update_date AS "updateDate",
a.del_flag AS "delFlag" a.del_flag AS "delFlag",
w.name AS "warehouse.name"
</sql> </sql>
<sql id="shelvesJoins"> <sql id="shelvesJoins">
left join t_wh_warehouse w on a.warehouse_id = w.id
</sql> </sql>
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
<select id="findList" resultType="Shelves" > <select id="findList" resultType="Shelves" >
SELECT SELECT
<include refid="shelvesColumns"/> <include refid="shelvesColumns"/>
FROM t_wh_shelves a FROM t_wh_shelves a
<include refid="shelvesJoins"/> <include refid="shelvesJoins"/>
<where> <where>
......
...@@ -10,6 +10,8 @@ import javax.servlet.http.HttpServletRequest; ...@@ -10,6 +10,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import com.jeeplus.modules.warehouse.warehouse.entity.Warehouse;
import com.jeeplus.modules.warehouse.warehouse.service.WarehouseService;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -46,6 +48,8 @@ public class ShelvesController extends BaseController { ...@@ -46,6 +48,8 @@ public class ShelvesController extends BaseController {
@Autowired @Autowired
private ShelvesService shelvesService; private ShelvesService shelvesService;
@Autowired
private WarehouseService warehouseService;
@ModelAttribute @ModelAttribute
public Shelves get(@RequestParam(required=false) String id) { public Shelves get(@RequestParam(required=false) String id) {
...@@ -66,6 +70,9 @@ public class ShelvesController extends BaseController { ...@@ -66,6 +70,9 @@ public class ShelvesController extends BaseController {
@RequestMapping(value = {"list", ""}) @RequestMapping(value = {"list", ""})
public String list(Shelves shelves, Model model) { public String list(Shelves shelves, Model model) {
model.addAttribute("shelves", shelves); model.addAttribute("shelves", shelves);
Warehouse warehouse = new Warehouse();
List<Warehouse> warehouseList = warehouseService.findList(warehouse);
model.addAttribute("warehouseList", warehouseList);
return "modules/warehouse/shelves/shelvesList"; return "modules/warehouse/shelves/shelvesList";
} }
...@@ -87,6 +94,9 @@ public class ShelvesController extends BaseController { ...@@ -87,6 +94,9 @@ public class ShelvesController extends BaseController {
@RequestMapping(value = "form/{mode}") @RequestMapping(value = "form/{mode}")
public String form(@PathVariable String mode, Shelves shelves, Model model) { public String form(@PathVariable String mode, Shelves shelves, Model model) {
model.addAttribute("shelves", shelves); model.addAttribute("shelves", shelves);
Warehouse warehouse = new Warehouse();
List<Warehouse> warehouseList = warehouseService.findList(warehouse);
model.addAttribute("warehouseList", warehouseList);
model.addAttribute("mode", mode); model.addAttribute("mode", mode);
return "modules/warehouse/shelves/shelvesForm"; return "modules/warehouse/shelves/shelvesForm";
} }
......
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ 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/materialloss/materialLoss");
}else{
jp.error(data.msg);
$("#inputForm").find("button:submit").button("reset");
}
});
$('#time').datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
});
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>
</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/materialloss/materialLoss"><i class="ti-angle-left"></i> 返回</a>
</h3>
</div>
<div class="panel-body">
<form:form id="inputForm" modelAttribute="materialLoss" action="${ctx}/warehouse/materialloss/materialLoss/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="number" 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="operator" htmlEscape="false" class="form-control "/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">盘亏时间:</label>
<div class="col-sm-10">
<div class='input-group form_datetime' id='time'>
<input type='text' name="time" class="form-control " value="<fmt:formatDate value="${materialLoss.time}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</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('#materialLossInfoList', materialLossInfoRowIdx, materialLossInfoTpl);materialLossInfoRowIdx = materialLossInfoRowIdx + 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>盘亏表主表ID</th>
<th>物资台账明细ID</th>
<th>备注信息</th>
<th width="10">&nbsp;</th>
</tr>
</thead>
<tbody id="materialLossInfoList">
</tbody>
</table>
<script type="text/template" id="materialLossInfoTpl">//<!--
<tr id="materialLossInfoList{{idx}}">
<td class="hide">
<input id="materialLossInfoList{{idx}}_id" name="materialLossInfoList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
<input id="materialLossInfoList{{idx}}_delFlag" name="materialLossInfoList[{{idx}}].delFlag" type="hidden" value="0"/>
</td>
<td>
<input id="materialLossInfoList{{idx}}_materialLoss" name="materialLossInfoList[{{idx}}].materialLoss.id" type="text" value="{{row.materialLoss.id}}" class="form-control "/>
</td>
<td>
<input id="materialLossInfoList{{idx}}_ledgerInfo" name="materialLossInfoList[{{idx}}].ledgerInfo.id" type="text" value="{{row.ledgerInfo.id}}" class="form-control "/>
</td>
<td>
<textarea id="materialLossInfoList{{idx}}_remarks" name="materialLossInfoList[{{idx}}].remarks" rows="4" class="form-control ">{{row.remarks}}</textarea>
</td>
<td class="text-center" width="10">
{{#delBtn}}<span class="close" onclick="delRow(this, '#materialLossInfoList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
</td>
</tr>//-->
</script>
<script type="text/javascript">
var materialLossInfoRowIdx = 0, materialLossInfoTpl = $("#materialLossInfoTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
$(document).ready(function() {
var data = ${fns:toJson(materialLoss.materialLossInfoList)};
for (var i=0; i<data.length; i++){
addRow('#materialLossInfoList', materialLossInfoRowIdx, materialLossInfoTpl, data[i]);
materialLossInfoRowIdx = materialLossInfoRowIdx + 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>
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<script>
$(document).ready(function() {
$('#materialLossTable').bootstrapTable({
//请求方法
method: 'post',
//类型json
dataType: "json",
contentType: "application/x-www-form-urlencoded",
//显示检索按钮
showSearch: true,
//显示刷新按钮
showRefresh: true,
//显示切换手机试图按钮
showToggle: true,
//显示 内容列下拉框
showColumns: true,
//显示到处按钮
showExport: true,
//显示切换分页按钮
showPaginationSwitch: true,
//显示详情按钮
detailView: true,
//显示详细内容函数
detailFormatter: "detailFormatter",
//最低显示2行
minimumCountColumns: 2,
//是否显示行间隔色
striped: true,
//是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
cache: false,
//是否显示分页(*)
pagination: true,
//排序方式
sortOrder: "asc",
//初始化加载第一页,默认第一页
pageNumber:1,
//每页的记录行数(*)
pageSize: 10,
//可供选择的每页的行数(*)
pageList: [10, 25, 50, 100],
//这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
url: "${ctx}/warehouse/materialloss/materialLoss/data",
//默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
//queryParamsType:'',
////查询参数,每次调用是会带上这个参数,可自定义
queryParams : function(params) {
var searchParam = $("#searchForm").serializeJSON();
searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
searchParam.pageSize = params.limit === undefined? -1 : params.limit;
searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+ params.order;
return searchParam;
},
//分页方式:client客户端分页,server服务端分页(*)
sidePagination: "server",
contextMenuTrigger:"right",//pc端 按右键弹出菜单
contextMenuTriggerMobile:"press",//手机端 弹出菜单,click:单击, press:长按。
contextMenu: '#context-menu',
onContextMenuItem: function(row, $el){
if($el.data("item") == "edit"){
edit(row.id);
}else if($el.data("item") == "view"){
view(row.id);
} else if($el.data("item") == "delete"){
jp.confirm('确认要删除该物资盘亏记录记录吗?', function(){
jp.loading();
jp.get("${ctx}/warehouse/materialloss/materialLoss/delete?id="+row.id, function(data){
if(data.success){
$('#materialLossTable').bootstrapTable('refresh');
jp.success(data.msg);
}else{
jp.error(data.msg);
}
})
});
}
},
onClickRow: function(row, $el){
},
onShowSearch: function () {
$("#search-collapse").slideToggle();
},
columns: [{
checkbox: true
}
,{
field: 'number',
title: '盘亏单号',
sortable: true,
sortName: 'number'
,formatter:function(value, row , index){
value = jp.unescapeHTML(value);
<c:choose>
<c:when test="${fns:hasPermission('warehouse:materialloss:materialLoss:edit')}">
return "<a href='javascript:edit(\""+row.id+"\")'>"+value+"</a>";
</c:when>
<c:when test="${fns:hasPermission('warehouse:materialloss:materialLoss:view')}">
return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
</c:when>
<c:otherwise>
return value;
</c:otherwise>
</c:choose>
}
}
,{
field: 'operator',
title: '操作人',
sortable: true,
sortName: 'operator'
}
,{
field: 'time',
title: '盘亏时间',
sortable: true,
sortName: 'time'
}
,{
field: 'remarks',
title: '备注信息',
sortable: true,
sortName: 'remarks'
}
]
});
if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
$('#materialLossTable').bootstrapTable("toggleView");
}
$('#materialLossTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
'check-all.bs.table uncheck-all.bs.table', function () {
$('#remove').prop('disabled', ! $('#materialLossTable').bootstrapTable('getSelections').length);
$('#view,#edit').prop('disabled', $('#materialLossTable').bootstrapTable('getSelections').length!=1);
});
$("#btnImport").click(function(){
jp.open({
type: 2,
area: [500, 200],
auto: true,
title:"导入数据",
content: "${ctx}/tag/importExcel" ,
btn: ['下载模板','确定', '关闭'],
btn1: function(index, layero){
jp.downloadFile('${ctx}/warehouse/materialloss/materialLoss/import/template');
},
btn2: function(index, layero){
var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
iframeWin.contentWindow.importExcel('${ctx}/warehouse/materialloss/materialLoss/import', function (data) {
if(data.success){
jp.success(data.msg);
refresh();
}else{
jp.error(data.msg);
}
jp.close(index);
});//调用保存事件
return false;
},
btn3: function(index){
jp.close(index);
}
});
});
$("#export").click(function(){//导出Excel文件
var searchParam = $("#searchForm").serializeJSON();
searchParam.pageNo = 1;
searchParam.pageSize = -1;
var sortName = $('#materialLossTable').bootstrapTable("getOptions", "none").sortName;
var sortOrder = $('#materialLossTable').bootstrapTable("getOptions", "none").sortOrder;
var values = "";
for(var key in searchParam){
values = values + key + "=" + searchParam[key] + "&";
}
if(sortName != undefined && sortOrder != undefined){
values = values + "orderBy=" + sortName + " "+sortOrder;
}
jp.downloadFile('${ctx}/warehouse/materialloss/materialLoss/export?'+values);
})
$("#search").click("click", function() {// 绑定查询按扭
$('#materialLossTable').bootstrapTable('refresh');
});
$("#reset").click("click", function() {// 绑定查询按扭
$("#searchForm input").val("");
$("#searchForm select").val("");
$("#searchForm .select-item").html("");
$('#materialLossTable').bootstrapTable('refresh');
});
$('#beginTime').datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
$('#endTime').datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
});
function getIdSelections() {
return $.map($("#materialLossTable").bootstrapTable('getSelections'), function (row) {
return row.id
});
}
function deleteAll(){
jp.confirm('确认要删除该物资盘亏记录记录吗?', function(){
jp.loading();
jp.get("${ctx}/warehouse/materialloss/materialLoss/deleteAll?ids=" + getIdSelections(), function(data){
if(data.success){
$('#materialLossTable').bootstrapTable('refresh');
jp.success(data.msg);
}else{
jp.error(data.msg);
}
})
})
}
//刷新列表
function refresh(){
$('#materialLossTable').bootstrapTable('refresh');
}
function add(){
jp.go("${ctx}/warehouse/materialloss/materialLoss/form/add");
}
function edit(id){
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/materialloss/materialLoss/form/edit?id=" + id);
}
function view(id){//没有权限时,不显示确定按钮
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/materialloss/materialLoss/form/view?id=" + id);
}
function detailFormatter(index, row) {
var htmltpl = $("#materialLossChildrenTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var html = Mustache.render(htmltpl, {
idx:row.id
});
$.get("${ctx}/warehouse/materialloss/materialLoss/detail?id="+row.id, function(materialLoss){
var materialLossChild1RowIdx = 0, materialLossChild1Tpl = $("#materialLossChild1Tpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var data1 = materialLoss.materialLossInfoList;
for (var i=0; i<data1.length; i++){
data1[i].dict = {};
addRow('#materialLossChild-'+row.id+'-1-List', materialLossChild1RowIdx, materialLossChild1Tpl, data1[i]);
materialLossChild1RowIdx = materialLossChild1RowIdx + 1;
}
})
return html;
}
function addRow(list, idx, tpl, row){
$(list).append(Mustache.render(tpl, {
idx: idx, delBtn: true, row: row
}));
}
</script>
<script type="text/template" id="materialLossChildrenTpl">//<!--
<div class="tabs-container">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab-{{idx}}-1" aria-expanded="true">盘亏明细表</a></li>
</ul>
<div class="tab-content">
<div id="tab-{{idx}}-1" class="tab-pane fade in active">
<table class="ani table">
<thead>
<tr>
<th>盘亏表主表ID</th>
<th>物资台账明细ID</th>
<th>备注信息</th>
</tr>
</thead>
<tbody id="materialLossChild-{{idx}}-1-List">
</tbody>
</table>
</div>
</div>//-->
</script>
<script type="text/template" id="materialLossChild1Tpl">//<!--
<tr>
<td>
{{row.materialLoss.id}}
</td>
<td>
{{row.ledgerInfo.id}}
</td>
<td>
{{row.remarks}}
</td>
</tr>//-->
</script>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ 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="materialLossList.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="materialLoss" 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="number" htmlEscape="false" maxlength="64" class=" 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">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</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:materialloss:materialLoss:add">
<button id="add" class="btn btn-primary" onclick="add()">
<i class="glyphicon glyphicon-plus"></i> 新建
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialloss:materialLoss:edit">
<button id="edit" class="btn btn-success" disabled onclick="edit()">
<i class="glyphicon glyphicon-edit"></i> 修改
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialloss:materialLoss:del">
<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
<i class="glyphicon glyphicon-remove"></i> 删除
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialloss:materialLoss:import">
<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialloss:materialLoss:export">
<button id="export" class="btn btn-warning">
<i class="fa fa-file-excel-o"></i> 导出
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialloss:materialLoss:view">
<button id="view" class="btn btn-default" disabled onclick="view()">
<i class="fa fa-search-plus"></i> 查看
</button>
</shiro:hasPermission>
</div>
<!-- 表格 -->
<table id="materialLossTable" data-toolbar="#toolbar"></table>
<!-- context menu -->
<ul id="context-menu" class="dropdown-menu">
<shiro:hasPermission name="warehouse:materialloss:materialLoss:view">
<li data-item="view"><a>查看</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialloss:materialLoss:edit">
<li data-item="edit"><a>编辑</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:materialloss:materialLoss:del">
<li data-item="delete"><a>删除</a></li>
</shiro:hasPermission>
<li data-item="action1"><a>取消</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
...@@ -85,16 +85,11 @@ ...@@ -85,16 +85,11 @@
<form:input path="operator" htmlEscape="false" class="form-control "/> <form:input path="operator" htmlEscape="false" class="form-control "/>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-2 control-label">领用人:</label>
<div class="col-sm-10">
<form:input path="receiver" htmlEscape="false" class="form-control "/>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">领用机构:</label> <label class="col-sm-2 control-label">领用机构:</label>
<div class="col-sm-10"> <div class="col-sm-10">
<sys:treeselect id="office" name="office.id" value="${materialRequisition.office.id}" labelName="" labelValue="${materialRequisition.office.id}" <sys:treeselect id="office" name="office.id" value="${materialRequisition.office.id}" labelName="" labelValue="${materialRequisition.office.name}"
title="部门" url="/sys/office/treeData?type=2" cssClass="form-control " allowClear="true" notAllowSelectParent="true"/> title="部门" url="/sys/office/treeData?type=2" cssClass="form-control " allowClear="true" notAllowSelectParent="true"/>
</div> </div>
</div> </div>
...@@ -129,6 +124,7 @@ ...@@ -129,6 +124,7 @@
<th class="hide"></th> <th class="hide"></th>
<th>物资领用主表ID</th> <th>物资领用主表ID</th>
<th>物资台账明细ID</th> <th>物资台账明细ID</th>
<th>领用人</th>
<th>备注信息</th> <th>备注信息</th>
<th width="10">&nbsp;</th> <th width="10">&nbsp;</th>
</tr> </tr>
...@@ -152,6 +148,9 @@ ...@@ -152,6 +148,9 @@
<input id="materialRequisitionInfoList{{idx}}_ledgerInfo" name="materialRequisitionInfoList[{{idx}}].ledgerInfo.id" type="text" value="{{row.ledgerInfo.id}}" class="form-control "/> <input id="materialRequisitionInfoList{{idx}}_ledgerInfo" name="materialRequisitionInfoList[{{idx}}].ledgerInfo.id" type="text" value="{{row.ledgerInfo.id}}" class="form-control "/>
</td> </td>
<td>
<input id="materialRequisitionInfoList{{idx}}_receiver" name="materialRequisitionInfoList[{{idx}}].receiver" type="text" value="{{row.receiver}}" class="form-control "/>
</td>
<td> <td>
<textarea id="materialRequisitionInfoList{{idx}}_remarks" name="materialRequisitionInfoList[{{idx}}].remarks" rows="4" class="form-control ">{{row.remarks}}</textarea> <textarea id="materialRequisitionInfoList{{idx}}_remarks" name="materialRequisitionInfoList[{{idx}}].remarks" rows="4" class="form-control ">{{row.remarks}}</textarea>
......
...@@ -117,17 +117,10 @@ $(document).ready(function() { ...@@ -117,17 +117,10 @@ $(document).ready(function() {
} }
,{ ,{
field: 'receiver', field: 'office.name',
title: '领用人',
sortable: true,
sortName: 'receiver'
}
,{
field: '',
title: '领用机构', title: '领用机构',
sortable: true, sortable: true,
sortName: '' sortName: 'o.name'
} }
,{ ,{
...@@ -309,6 +302,7 @@ $(document).ready(function() { ...@@ -309,6 +302,7 @@ $(document).ready(function() {
<tr> <tr>
<th>物资领用主表ID</th> <th>物资领用主表ID</th>
<th>物资台账明细ID</th> <th>物资台账明细ID</th>
<th>领用人</th>
<th>备注信息</th> <th>备注信息</th>
</tr> </tr>
</thead> </thead>
...@@ -327,6 +321,9 @@ $(document).ready(function() { ...@@ -327,6 +321,9 @@ $(document).ready(function() {
{{row.ledgerInfo.id}} {{row.ledgerInfo.id}}
</td> </td>
<td> <td>
{{row.receiver}}
</td>
<td>
{{row.remarks}} {{row.remarks}}
</td> </td>
</tr>//--> </tr>//-->
......
...@@ -30,10 +30,6 @@ ...@@ -30,10 +30,6 @@
<form:input path="operator" htmlEscape="false" maxlength="64" class=" form-control"/> <form:input path="operator" htmlEscape="false" maxlength="64" class=" form-control"/>
</div> </div>
<div class="col-xs-12 col-sm-6 col-md-4"> <div class="col-xs-12 col-sm-6 col-md-4">
<label class="label-item single-overflow pull-left" title="领用人:">领用人:</label>
<form:input path="receiver" htmlEscape="false" maxlength="64" class=" form-control"/>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div style="margin-top:26px"> <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="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> <a id="reset" class="btn btn-primary btn-rounded btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
<div class="col-sm-10"> <div class="col-sm-10">
<form:select path="type" class="form-control "> <form:select path="type" class="form-control ">
<form:option value="" label=""/> <form:option value="" label=""/>
<form:options items="${fns:getDictList('')}" itemLabel="label" itemValue="value" htmlEscape="false"/> <form:options items="${fns:getDictList('wh_delivery_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select> </form:select>
</div> </div>
</div> </div>
......
...@@ -129,7 +129,7 @@ $(document).ready(function() { ...@@ -129,7 +129,7 @@ $(document).ready(function() {
sortable: true, sortable: true,
sortName: 'type', sortName: 'type',
formatter:function(value, row , index){ formatter:function(value, row , index){
return jp.getDictLabel(${fns:toJson(fns:getDictList(''))}, value, "-"); return jp.getDictLabel(${fns:toJson(fns:getDictList('wh_delivery_type'))}, value, "-");
} }
} }
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<label class="label-item single-overflow pull-left" title="出库分类:">出库分类:</label> <label class="label-item single-overflow pull-left" title="出库分类:">出库分类:</label>
<form:select path="type" class="form-control m-b"> <form:select path="type" class="form-control m-b">
<form:option value="" label=""/> <form:option value="" label=""/>
<form:options items="${fns:getDictList('')}" itemLabel="label" itemValue="value" htmlEscape="false"/> <form:options items="${fns:getDictList('wh_delivery_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select> </form:select>
</div> </div>
<div class="col-xs-12 col-sm-6 col-md-4"> <div class="col-xs-12 col-sm-6 col-md-4">
......
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ 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/profitwarehousing/profitWarehousing");
}else{
jp.error(data.msg);
$("#inputForm").find("button:submit").button("reset");
}
});
$('#time').datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
});
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>
</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/profitwarehousing/profitWarehousing"><i class="ti-angle-left"></i> 返回</a>
</h3>
</div>
<div class="panel-body">
<form:form id="inputForm" modelAttribute="profitWarehousing" action="${ctx}/warehouse/profitwarehousing/profitWarehousing/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="number" 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="operator" htmlEscape="false" class="form-control "/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">时间:</label>
<div class="col-sm-10">
<div class='input-group form_datetime' id='time'>
<input type='text' name="time" class="form-control " value="<fmt:formatDate value="${profitWarehousing.time}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</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('#profitWarehousingInfoList', profitWarehousingInfoRowIdx, profitWarehousingInfoTpl);profitWarehousingInfoRowIdx = profitWarehousingInfoRowIdx + 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>盘盈入库主表ID</th>
<th>名称</th>
<th>类型</th>
<th>型号</th>
<th>货架ID</th>
<th>备注信息</th>
<th width="10">&nbsp;</th>
</tr>
</thead>
<tbody id="profitWarehousingInfoList">
</tbody>
</table>
<script type="text/template" id="profitWarehousingInfoTpl">//<!--
<tr id="profitWarehousingInfoList{{idx}}">
<td class="hide">
<input id="profitWarehousingInfoList{{idx}}_id" name="profitWarehousingInfoList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
<input id="profitWarehousingInfoList{{idx}}_delFlag" name="profitWarehousingInfoList[{{idx}}].delFlag" type="hidden" value="0"/>
</td>
<td>
<input id="profitWarehousingInfoList{{idx}}_profitWarehousing" name="profitWarehousingInfoList[{{idx}}].profitWarehousing.id" type="text" value="{{row.profitWarehousing.id}}" class="form-control "/>
</td>
<td>
<input id="profitWarehousingInfoList{{idx}}_name" name="profitWarehousingInfoList[{{idx}}].name" type="text" value="{{row.name}}" class="form-control "/>
</td>
<td>
<input id="profitWarehousingInfoList{{idx}}_type" name="profitWarehousingInfoList[{{idx}}].type" type="text" value="{{row.type}}" class="form-control "/>
</td>
<td>
<input id="profitWarehousingInfoList{{idx}}_marking" name="profitWarehousingInfoList[{{idx}}].marking" type="text" value="{{row.marking}}" class="form-control "/>
</td>
<td>
<input id="profitWarehousingInfoList{{idx}}_shelves" name="profitWarehousingInfoList[{{idx}}].shelves.id" type="text" value="{{row.shelves.id}}" class="form-control "/>
</td>
<td>
<textarea id="profitWarehousingInfoList{{idx}}_remarks" name="profitWarehousingInfoList[{{idx}}].remarks" rows="4" class="form-control ">{{row.remarks}}</textarea>
</td>
<td class="text-center" width="10">
{{#delBtn}}<span class="close" onclick="delRow(this, '#profitWarehousingInfoList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
</td>
</tr>//-->
</script>
<script type="text/javascript">
var profitWarehousingInfoRowIdx = 0, profitWarehousingInfoTpl = $("#profitWarehousingInfoTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
$(document).ready(function() {
var data = ${fns:toJson(profitWarehousing.profitWarehousingInfoList)};
for (var i=0; i<data.length; i++){
addRow('#profitWarehousingInfoList', profitWarehousingInfoRowIdx, profitWarehousingInfoTpl, data[i]);
profitWarehousingInfoRowIdx = profitWarehousingInfoRowIdx + 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>
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<script>
$(document).ready(function() {
$('#profitWarehousingTable').bootstrapTable({
//请求方法
method: 'post',
//类型json
dataType: "json",
contentType: "application/x-www-form-urlencoded",
//显示检索按钮
showSearch: true,
//显示刷新按钮
showRefresh: true,
//显示切换手机试图按钮
showToggle: true,
//显示 内容列下拉框
showColumns: true,
//显示到处按钮
showExport: true,
//显示切换分页按钮
showPaginationSwitch: true,
//显示详情按钮
detailView: true,
//显示详细内容函数
detailFormatter: "detailFormatter",
//最低显示2行
minimumCountColumns: 2,
//是否显示行间隔色
striped: true,
//是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
cache: false,
//是否显示分页(*)
pagination: true,
//排序方式
sortOrder: "asc",
//初始化加载第一页,默认第一页
pageNumber:1,
//每页的记录行数(*)
pageSize: 10,
//可供选择的每页的行数(*)
pageList: [10, 25, 50, 100],
//这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
url: "${ctx}/warehouse/profitwarehousing/profitWarehousing/data",
//默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
//queryParamsType:'',
////查询参数,每次调用是会带上这个参数,可自定义
queryParams : function(params) {
var searchParam = $("#searchForm").serializeJSON();
searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
searchParam.pageSize = params.limit === undefined? -1 : params.limit;
searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+ params.order;
return searchParam;
},
//分页方式:client客户端分页,server服务端分页(*)
sidePagination: "server",
contextMenuTrigger:"right",//pc端 按右键弹出菜单
contextMenuTriggerMobile:"press",//手机端 弹出菜单,click:单击, press:长按。
contextMenu: '#context-menu',
onContextMenuItem: function(row, $el){
if($el.data("item") == "edit"){
edit(row.id);
}else if($el.data("item") == "view"){
view(row.id);
} else if($el.data("item") == "delete"){
jp.confirm('确认要删除该盘盈入库单记录吗?', function(){
jp.loading();
jp.get("${ctx}/warehouse/profitwarehousing/profitWarehousing/delete?id="+row.id, function(data){
if(data.success){
$('#profitWarehousingTable').bootstrapTable('refresh');
jp.success(data.msg);
}else{
jp.error(data.msg);
}
})
});
}
},
onClickRow: function(row, $el){
},
onShowSearch: function () {
$("#search-collapse").slideToggle();
},
columns: [{
checkbox: true
}
,{
field: 'number',
title: '盘盈入库单号',
sortable: true,
sortName: 'number'
,formatter:function(value, row , index){
value = jp.unescapeHTML(value);
<c:choose>
<c:when test="${fns:hasPermission('warehouse:profitwarehousing:profitWarehousing:edit')}">
return "<a href='javascript:edit(\""+row.id+"\")'>"+value+"</a>";
</c:when>
<c:when test="${fns:hasPermission('warehouse:profitwarehousing:profitWarehousing:view')}">
return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
</c:when>
<c:otherwise>
return value;
</c:otherwise>
</c:choose>
}
}
,{
field: 'operator',
title: '操作人',
sortable: true,
sortName: 'operator'
}
,{
field: 'time',
title: '时间',
sortable: true,
sortName: 'time'
}
,{
field: 'remarks',
title: '备注信息',
sortable: true,
sortName: 'remarks'
}
]
});
if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
$('#profitWarehousingTable').bootstrapTable("toggleView");
}
$('#profitWarehousingTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
'check-all.bs.table uncheck-all.bs.table', function () {
$('#remove').prop('disabled', ! $('#profitWarehousingTable').bootstrapTable('getSelections').length);
$('#view,#edit').prop('disabled', $('#profitWarehousingTable').bootstrapTable('getSelections').length!=1);
});
$("#btnImport").click(function(){
jp.open({
type: 2,
area: [500, 200],
auto: true,
title:"导入数据",
content: "${ctx}/tag/importExcel" ,
btn: ['下载模板','确定', '关闭'],
btn1: function(index, layero){
jp.downloadFile('${ctx}/warehouse/profitwarehousing/profitWarehousing/import/template');
},
btn2: function(index, layero){
var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
iframeWin.contentWindow.importExcel('${ctx}/warehouse/profitwarehousing/profitWarehousing/import', function (data) {
if(data.success){
jp.success(data.msg);
refresh();
}else{
jp.error(data.msg);
}
jp.close(index);
});//调用保存事件
return false;
},
btn3: function(index){
jp.close(index);
}
});
});
$("#export").click(function(){//导出Excel文件
var searchParam = $("#searchForm").serializeJSON();
searchParam.pageNo = 1;
searchParam.pageSize = -1;
var sortName = $('#profitWarehousingTable').bootstrapTable("getOptions", "none").sortName;
var sortOrder = $('#profitWarehousingTable').bootstrapTable("getOptions", "none").sortOrder;
var values = "";
for(var key in searchParam){
values = values + key + "=" + searchParam[key] + "&";
}
if(sortName != undefined && sortOrder != undefined){
values = values + "orderBy=" + sortName + " "+sortOrder;
}
jp.downloadFile('${ctx}/warehouse/profitwarehousing/profitWarehousing/export?'+values);
})
$("#search").click("click", function() {// 绑定查询按扭
$('#profitWarehousingTable').bootstrapTable('refresh');
});
$("#reset").click("click", function() {// 绑定查询按扭
$("#searchForm input").val("");
$("#searchForm select").val("");
$("#searchForm .select-item").html("");
$('#profitWarehousingTable').bootstrapTable('refresh');
});
$('#beginTime').datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
$('#endTime').datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
});
function getIdSelections() {
return $.map($("#profitWarehousingTable").bootstrapTable('getSelections'), function (row) {
return row.id
});
}
function deleteAll(){
jp.confirm('确认要删除该盘盈入库单记录吗?', function(){
jp.loading();
jp.get("${ctx}/warehouse/profitwarehousing/profitWarehousing/deleteAll?ids=" + getIdSelections(), function(data){
if(data.success){
$('#profitWarehousingTable').bootstrapTable('refresh');
jp.success(data.msg);
}else{
jp.error(data.msg);
}
})
})
}
//刷新列表
function refresh(){
$('#profitWarehousingTable').bootstrapTable('refresh');
}
function add(){
jp.go("${ctx}/warehouse/profitwarehousing/profitWarehousing/form/add");
}
function edit(id){
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/profitwarehousing/profitWarehousing/form/edit?id=" + id);
}
function view(id){//没有权限时,不显示确定按钮
if(id == undefined){
id = getIdSelections();
}
jp.go("${ctx}/warehouse/profitwarehousing/profitWarehousing/form/view?id=" + id);
}
function detailFormatter(index, row) {
var htmltpl = $("#profitWarehousingChildrenTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var html = Mustache.render(htmltpl, {
idx:row.id
});
$.get("${ctx}/warehouse/profitwarehousing/profitWarehousing/detail?id="+row.id, function(profitWarehousing){
var profitWarehousingChild1RowIdx = 0, profitWarehousingChild1Tpl = $("#profitWarehousingChild1Tpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var data1 = profitWarehousing.profitWarehousingInfoList;
for (var i=0; i<data1.length; i++){
data1[i].dict = {};
addRow('#profitWarehousingChild-'+row.id+'-1-List', profitWarehousingChild1RowIdx, profitWarehousingChild1Tpl, data1[i]);
profitWarehousingChild1RowIdx = profitWarehousingChild1RowIdx + 1;
}
})
return html;
}
function addRow(list, idx, tpl, row){
$(list).append(Mustache.render(tpl, {
idx: idx, delBtn: true, row: row
}));
}
</script>
<script type="text/template" id="profitWarehousingChildrenTpl">//<!--
<div class="tabs-container">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab-{{idx}}-1" aria-expanded="true">盘盈入库单明细表</a></li>
</ul>
<div class="tab-content">
<div id="tab-{{idx}}-1" class="tab-pane fade in active">
<table class="ani table">
<thead>
<tr>
<th>盘盈入库主表ID</th>
<th>名称</th>
<th>类型</th>
<th>型号</th>
<th>货架ID</th>
<th>备注信息</th>
</tr>
</thead>
<tbody id="profitWarehousingChild-{{idx}}-1-List">
</tbody>
</table>
</div>
</div>//-->
</script>
<script type="text/template" id="profitWarehousingChild1Tpl">//<!--
<tr>
<td>
{{row.profitWarehousing.id}}
</td>
<td>
{{row.name}}
</td>
<td>
{{row.type}}
</td>
<td>
{{row.marking}}
</td>
<td>
{{row.shelves.id}}
</td>
<td>
{{row.remarks}}
</td>
</tr>//-->
</script>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ 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="profitWarehousingList.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="profitWarehousing" 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="number" htmlEscape="false" maxlength="64" class=" 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">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</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:profitwarehousing:profitWarehousing:add">
<button id="add" class="btn btn-primary" onclick="add()">
<i class="glyphicon glyphicon-plus"></i> 新建
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:profitwarehousing:profitWarehousing:edit">
<button id="edit" class="btn btn-success" disabled onclick="edit()">
<i class="glyphicon glyphicon-edit"></i> 修改
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:profitwarehousing:profitWarehousing:del">
<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
<i class="glyphicon glyphicon-remove"></i> 删除
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:profitwarehousing:profitWarehousing:import">
<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:profitwarehousing:profitWarehousing:export">
<button id="export" class="btn btn-warning">
<i class="fa fa-file-excel-o"></i> 导出
</button>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:profitwarehousing:profitWarehousing:view">
<button id="view" class="btn btn-default" disabled onclick="view()">
<i class="fa fa-search-plus"></i> 查看
</button>
</shiro:hasPermission>
</div>
<!-- 表格 -->
<table id="profitWarehousingTable" data-toolbar="#toolbar"></table>
<!-- context menu -->
<ul id="context-menu" class="dropdown-menu">
<shiro:hasPermission name="warehouse:profitwarehousing:profitWarehousing:view">
<li data-item="view"><a>查看</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:profitwarehousing:profitWarehousing:edit">
<li data-item="edit"><a>编辑</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="warehouse:profitwarehousing:profitWarehousing:del">
<li data-item="delete"><a>删除</a></li>
</shiro:hasPermission>
<li data-item="action1"><a>取消</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
\ 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