Commit aa2ec242 by zhanglt

盘盈入库,物资盘亏代码

parent fc10533a
/**
* 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 javax.xml.crypto.Data;
/**
* 物资盘亏记录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 Data 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 Data getTime() {
return time;
}
public void setTime(Data 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.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.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;
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));
}
}
\ 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);//保存
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;
}
}
\ No newline at end of file
......@@ -14,7 +14,8 @@
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag",
a.remarks AS "remarks"
a.remarks AS "remarks",
office.name AS "office.name"
</sql>
<sql id="materialRequisitionJoins">
......
/**
* 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
......@@ -19,7 +19,7 @@ public class Shelves extends DataEntity<Shelves> {
private String name; // 货架名称
private String number; // 货架编号
private Warehouse warehouse; // 仓库id
public Shelves() {
super();
}
......
......@@ -12,11 +12,12 @@
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag"
a.del_flag AS "delFlag",
w.name AS "warehouse.name"
</sql>
<sql id="shelvesJoins">
left join t_wh_warehouse w on a.warehouse_id = w.id
</sql>
......@@ -31,6 +32,7 @@
<select id="findList" resultType="Shelves" >
SELECT
<include refid="shelvesColumns"/>
FROM t_wh_shelves a
<include refid="shelvesJoins"/>
<where>
......
......@@ -69,7 +69,7 @@ public class ShelvesController extends BaseController {
return "modules/warehouse/shelves/shelvesList";
}
/**
/**
* 货架信息列表数据
*/
@ResponseBody
......
<%@ 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" %>
<%@ 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
<%@ 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" %>
<%@ 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