Browse Source

细节优化

lwx_dev
erdanergou 3 years ago
parent
commit
c663326daf
  1. 28
      src/main/java/com/dreamchaser/depository_manage/config/QyWxConfig.java
  2. 7
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
  3. 3
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  4. 42
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  5. 96
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  6. 9
      src/main/java/com/dreamchaser/depository_manage/entity/MaterialAndBarCode.java
  7. 20
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java
  8. 19
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  9. 5
      src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml
  10. 69
      src/main/java/com/dreamchaser/depository_manage/pojo/SimpleTaskP.java
  11. 6
      src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java
  12. 2
      src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java
  13. 315
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  14. 237
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  15. 37
      src/main/java/com/dreamchaser/depository_manage/utils/DateUtil.java
  16. 6
      src/main/resources/application-test.yml
  17. 1
      src/main/resources/static/js/lay-config.js
  18. 65
      src/main/resources/templates/pages/application/application-in.html
  19. 5
      src/main/resources/templates/pages/application/application-in_back.html
  20. 27
      src/main/resources/templates/pages/application/application-out.html
  21. 3
      src/main/resources/templates/pages/application/application-out_back.html
  22. 50
      src/main/resources/templates/pages/application/application-review.html
  23. 8
      src/main/resources/templates/pages/application/application-transfer.html
  24. 3
      src/main/resources/templates/pages/application/application_in_multi.html
  25. 17
      src/main/resources/templates/pages/application/form-step-look_back.html
  26. 78
      src/main/resources/templates/pages/application/my-apply.html
  27. 200
      src/main/resources/templates/pages/application/my-apply_back.html
  28. 266
      src/main/resources/templates/pages/application/my-task.html
  29. 358
      src/main/resources/templates/pages/application/my-task_back.html
  30. 43
      src/main/resources/templates/pages/chart/chart-in_back.html
  31. 23
      src/main/resources/templates/pages/chart/chart-out_back.html
  32. 2
      src/main/resources/templates/pages/chart/chart-stock_back.html
  33. 4
      src/main/resources/templates/pages/depository/table-in.html
  34. 4
      src/main/resources/templates/pages/depository/table-out.html
  35. 6
      src/main/resources/templates/pages/material/selectMaterial.html
  36. 135
      src/main/resources/templates/pages/other/welcome.html
  37. 82
      src/main/resources/templates/pages/other/welcome_mobile.html
  38. 66
      src/main/resources/templates/pages/stockTaking/stockTaking.html
  39. 10
      src/main/resources/templates/pages/stockTaking/stockTakingComplete.html
  40. 93
      src/main/resources/templates/pages/stockTaking/stockTakingReview.html
  41. 14
      src/main/resources/templates/pages/stockTaking/stockTakingView.html
  42. 171
      src/test/java/com/dreamchaser/depository_manage/TestForMaterialTree.java
  43. 6
      src/test/java/com/dreamchaser/depository_manage/TestForThisWeekInventory.java
  44. 142
      src/test/java/com/dreamchaser/depository_manage/TestForgetShowData.java

28
src/main/java/com/dreamchaser/depository_manage/config/QyWxConfig.java

@ -14,10 +14,7 @@ import org.springframework.stereotype.Component;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -81,9 +78,30 @@ public class QyWxConfig {
String errmsg = (String) jsonObject.get("errmsg");
if (errcord == 0) {
// 如果成功获取access_token
Integer expires_in = jsonObject.getInteger("expires_in");
// 定义redis过期时间
Long expires_in = Long.valueOf(7200);
// 获取当前redis中存储的key值
Set<String> keys = redisTemplate.keys("wms_access_token_*");
// 获取遍历器
Iterator<String> iterator = keys.iterator();
while (iterator.hasNext()){ // 如果有下个,则进行遍历
// 获取当前key
String next = iterator.next();
// 当前key对应的token
String next_access_token = redisTemplate.opsForValue().get(next);
if(accessToken.equals(next_access_token)){
// 如果当前token相等
// 获取当前的过期时间
expires_in = redisTemplate.opsForValue().getOperations().getExpire(next,TimeUnit.SECONDS);
}
}
redisTemplate.opsForValue().set("wms_access_token_"+UserAgent,accessToken);
redisTemplate.expire("wms_access_token_"+UserAgent,expires_in, TimeUnit.SECONDS);
return accessToken;
} else {
// 否则返回空值

7
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java

@ -163,7 +163,7 @@ public class DepositoryController {
result.clear();
}
} else {
int now = instance.get(Calendar.DAY_OF_WEEK) - 1;
int now = instance.get(Calendar.DAY_OF_WEEK) - 1 == 0 ? 7 : instance.get(Calendar.DAY_OF_WEEK) - 1;
List<Long> days = new ArrayList<>();
days.add(DateUtil.DateTimeByMonthToTimeStamp(formatter.format(instance.getTime())));
Boolean flag = false;
@ -851,7 +851,7 @@ public class DepositoryController {
show_data.put(key.toString(), ((ArrayList<Integer>) drCountbyDrName).clone());
}
} else {
int now = instance.get(Calendar.DAY_OF_WEEK) - 1;
int now = instance.get(Calendar.DAY_OF_WEEK) - 1 == 0 ? 7 : instance.get(Calendar.DAY_OF_WEEK) - 1;
List<Long> days = new ArrayList<>(); // 周一至今的每天
instance.add(Calendar.DATE, 1);
days.add(DateUtil.DateTimeByMonthToTimeStamp(formatter.format(instance.getTime())));
@ -951,6 +951,7 @@ public class DepositoryController {
// 获取今天是周几
int weekDay = instance.get(Calendar.DAY_OF_WEEK);
weekDay = weekDay - 1; // 具体周几
// 获取日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
@ -1148,7 +1149,7 @@ public class DepositoryController {
Calendar instance = Calendar.getInstance();
// 获取日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
int now = instance.get(Calendar.DAY_OF_WEEK) - 1;
int now = instance.get(Calendar.DAY_OF_WEEK) - 1 == 0 ? 7 : instance.get(Calendar.DAY_OF_WEEK) - 1;
List<Long> days = new ArrayList<>(); // 周一至今的每天
instance.add(Calendar.DATE, 1);
days.add(DateUtil.DateTimeByMonthToTimeStamp(formatter.format(instance.getTime())));

3
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -569,14 +569,13 @@ public class DepositoryRecordController {
mcode.append(materialById.getCode()).append(",");
depositoryName.append(depository.getDname()).append(",");
sumQuantity += applicationOutRecordMin.getQuantity();
sumPrice += (materialById.getPrice());
sumPrice += (materialById.getPrice() * applicationOutRecordMin.getQuantity());
}
list.get(i).setMcode(mcode.toString());
list.get(i).setMname(mname.toString());
list.get(i).setDepositoryName(depositoryName.toString());
list.get(i).setQuantity(sumQuantity);
list.get(i).setPrice(sumPrice);
}
return new RestResponse(list,depositoryRecordService.findApplicationOutRecordPCountByCondition(map),200);
}

42
src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java

@ -213,6 +213,12 @@ public class MaterialController {
}
@PostMapping("/treeMenus_Test")
public RestResponse TreeMenus_Test(@RequestBody Map<String, Object> map, HttpServletRequest request) {
List<Object> list = new ArrayList<>();
list = materialService.InitMaterialTree_New();
return new RestResponse(list);
}
@ -284,8 +290,21 @@ public class MaterialController {
materialById.setMaterialAndBarCodeList(materialByBarCodeByCondition);
MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(ObjectFormatUtil.toInteger(pid), materialById.getId());
materialById.setQuantity(placeAndMaterialByMidAndPid.getQuantity());
map.put("materialById", materialById);
List<MaterialAndProducedDate> materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(materialById.getId());
List<String> producedDateList = new ArrayList<>();
// 用于标志是否要更改数量
boolean flagForQuantity = true;
for (MaterialAndProducedDate materialAndProducedDate : materialAndProducedDateByMid) {
// 获取当前生产日期
producedDateList.add(DateUtil.TimeStampToDateTimeForMonth(materialAndProducedDate.getProducedDate()));
if(flagForQuantity) {
materialById.setQuantity(materialAndProducedDate.getInventory());
flagForQuantity = false;
}
}
map.put("materialById", materialById);
map.put("producedDateList",producedDateList);
map.put("placeList", placePList);
return new RestResponse(map, 1, 200);
}
@ -783,6 +802,14 @@ public class MaterialController {
mp.setMaterialAndBarCodeList(materialByBarCodeByCondition);
if (flag) {
// 如果成功获取
// 获取当前物料对应的生产日期
List<MaterialAndProducedDate> materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(mp.getId());
List<String> producedDateList = new ArrayList<>();
for (MaterialAndProducedDate materialAndProducedDate : materialAndProducedDateByMid) {
// 获取当前生产日期
producedDateList.add(DateUtil.TimeStampToDateTimeForMonth(materialAndProducedDate.getProducedDate()));
}
mp.setProducedDateList(producedDateList);
return new RestResponse(mp);
}
return new RestResponse(null);
@ -862,6 +889,7 @@ public class MaterialController {
// 如果没有获取到
materialByBarCode = materialService.findMaterialByBarCode(qrCode);
}
result.put("material", materialByBarCode);
return new RestResponse(result);
}
@ -1168,6 +1196,18 @@ public class MaterialController {
// 如果当前条形码不存对应物料
barCodeListByNoMaterial.add(barCode);
}
if(material != null){
// 获取当前物料对应的生产日期
List<MaterialAndProducedDate> materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(material.getId());
List<String> producedDateList = new ArrayList<>();
// 用于标志是否要更改数量
for (MaterialAndProducedDate materialAndProducedDate : materialAndProducedDateByMid) {
// 获取当前生产日期
producedDateList.add(DateUtil.TimeStampToDateTimeForMonth(materialAndProducedDate.getProducedDate()));
material.setQuantity(materialAndProducedDate.getInventory());
}
material.setProducedDateList(producedDateList);
}
result.put("material", material);
result.put("barCodeListByNoMaterial", barCodeListByNoMaterial);
return new RestResponse(result);

96
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -279,6 +279,7 @@ public class PageController {
public ModelAndView welcome(HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
String header = request.getHeader("user-agent");
UserByPort userToken= (UserByPort) request.getAttribute("userToken");
boolean b = DeviceUtil.checkAgentIsMobile(header);
if (b) {
mv.setViewName("pages/other/welcome_mobile");
@ -286,14 +287,12 @@ public class PageController {
mv.setViewName("pages/other/welcome");
}
Map<String, Object> map = new HashMap<String, Object>(2) {
{
put("beigin", 0);
put("size", 6);
}
};
mv.addObject("depositoryCount", depositoryService.findAllCountByNoDelete());
mv.addObject("allPrice", materialService.findAllPriceNoDelete());
mv.addObject("allMaterial", materialService.findMaterialCount(new HashMap<>()));
@ -318,6 +317,29 @@ public class PageController {
warehouseRecord = applicationIn + applicationOut;
mv.addObject("warehouseRecord", warehouseRecord);
mv.addObject("notices", noticeService.findNoticeByCondition(map));
Map<String,Object> paramForTask = new HashMap<>();
paramForTask.put("isDone",0);
paramForTask.put("userId",userToken.getId());
// 定义任务列表
List<SimpleTaskP> list = new ArrayList<>();
// 查询出库任务
List<SimpleApplicationOutRecordP> myTask = depositoryRecordService.findMyTask(paramForTask, request);
for (int i = 0; i < myTask.size(); i++) {
SimpleTaskP simpleTaskP = new SimpleTaskP(myTask.get(i));
list.add(simpleTaskP);
}
// 查询盘点任务
List<SimpleStockTakingP> task = stockTakingService.findMyTask(paramForTask, request);
for (int i = 0; i < task.size(); i++) {
SimpleTaskP simpleTaskP = new SimpleTaskP(task.get(i));
list.add(simpleTaskP);
}
mv.addObject("myTaskList",list);
return mv;
}
@ -634,15 +656,13 @@ public class PageController {
public ModelAndView chart_in() {
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/chart/chart-in");
// 转入物料数量
mv.addObject("InCount", depositoryRecordService.CalculateAllApplicationInCount());
// 转入物料总额
mv.addObject("allInCount", depositoryRecordService.CalculateAllApplicationInCount());
// 购入物料数量
mv.addObject("InPrice", depositoryRecordService.CalculateAllApplicationInPrice());
// 购入物料总额
mv.addObject("allInPrice", depositoryRecordService.CalculateAllApplicationInPrice());
mv.addObject("depositories", depositoryService.findDepositoryAll());
mv.addObject("reviewers", userService.findReviewers());
mv.addObject("materials", materialService.findMaterialAll());
mv.addObject("InCount", depositoryRecordService.CalculateAllCount(1, "已入库"));
mv.addObject("allInCount", depositoryRecordService.CalculateAllCount(1, ""));
mv.addObject("InPrice", depositoryRecordService.CalculateAllPrice(1, "已入库"));
mv.addObject("allInPrice", depositoryRecordService.CalculateAllPrice(1, ""));
return mv;
}
@ -655,15 +675,27 @@ public class PageController {
public ModelAndView chart_in_back() {
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/chart/chart-in_back");
// 转入物料数量
mv.addObject("InCount", depositoryRecordService.CalculateAllApplicationInCount());
/**
* 用于计算昨天的数据
*/
Map<String, Object> map = depositoryRecordService.CalculateAllApplicationInCount();
// 用于计算全部的数据
Map<String, Object> map1 = depositoryRecordService.CalculateAllApplicationInAll();
// 转入物料数量
mv.addObject("InCount", map.get("total"));
// 转入数量比值
mv.addObject("radioForSum", map.get("ratioForSum"));
// 转入物料总额
mv.addObject("allInCount", depositoryRecordService.CalculateAllApplicationInCount());
mv.addObject("allInCount", map1.get("count"));
// 购入物料数量
mv.addObject("InPrice", depositoryRecordService.CalculateAllApplicationInPrice());
mv.addObject("InPrice", map.get("price"));
// 转入额度比值
mv.addObject("radioForPrice", map.get("ratioForPrice"));
// 购入物料总额
mv.addObject("allInPrice", depositoryRecordService.CalculateAllApplicationInPrice());
mv.addObject("allInPrice", map1.get("price"));
return mv;
}
@ -676,14 +708,28 @@ public class PageController {
public ModelAndView chart_out_back() {
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/chart/chart-out_back");
// 获取已经出库的记录数据
Map<String, Object> mapForOut = depositoryRecordService.CalculateAllApplicationOutCount("已出库");
// 转出物料数量
mv.addObject("OutCount", depositoryRecordService.CalculateAllApplicationOutCount("已出库"));
mv.addObject("OutCount", mapForOut.get("count"));
// 获取数量比值
mv.addObject("outCountRadio",mapForOut.get("radioForCount"));
// 出库物料总额
mv.addObject("OutPrice", mapForOut.get("price"));
// 获取金额比值
mv.addObject("outPriceRadio",mapForOut.get("radioForPrice"));
// 获取要出库的记录数据
Map<String, Object> mapForTrueOut = depositoryRecordService.CalculateAllApplicationOutCount("");
// 转出物料金额
mv.addObject("allOutCount", depositoryRecordService.CalculateAllApplicationOutCount(""));
mv.addObject("allOutCount", mapForTrueOut.get("count"));
// 获取数量比值
mv.addObject("outAllCountRadio",mapForTrueOut.get("radioForCount"));
// 出售物料数量
mv.addObject("OutPrice", depositoryRecordService.CalculateAllApplicationOutPrice("已出库"));
// 出库物料总额
mv.addObject("allOutPrice", depositoryRecordService.CalculateAllApplicationOutPrice(""));
mv.addObject("allOutPrice", mapForTrueOut.get("price"));
// 获取金额比值
mv.addObject("outAllPriceRadio",mapForTrueOut.get("radioForPrice"));
return mv;
}
@ -1164,7 +1210,7 @@ public class PageController {
depositoryName.append(depository.getDname()).append(",");
quantityByMaterial.append(applicationOutRecordMin.getQuantity() + ",");
sumQuantity += applicationOutRecordMin.getQuantity();
sumPrice += (materialById.getPrice());
sumPrice += (materialById.getPrice() * applicationOutRecordMin.getQuantity());
recordMinPList.add(recordMinP);
}
// 申请人
@ -1419,7 +1465,7 @@ public class PageController {
mv.setViewName("pages/company/company-out");
List<AdministrationP> administrationPList = findAllCompany(userToken);
mv.addObject("administrationPList", administrationPList);
mv.addObject("level",3);
mv.addObject("level", 3);
mv.addObject("parentId", "313");
return mv;
}
@ -1466,12 +1512,12 @@ public class PageController {
@GetMapping("/findCompanyByParentId")
public ModelAndView findCompanyByParentId(Integer parentId,Integer level, HttpServletRequest request) {
public ModelAndView findCompanyByParentId(Integer parentId, Integer level, HttpServletRequest request) {
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
ModelAndView mv = new ModelAndView();
if (parentId != null) {
mv.addObject("parentId", parentId);
mv.addObject("level", level+1);
mv.addObject("level", level + 1);
List<AdministrationP> administrationPList = LinkInterfaceUtil.findCompanyBySuperior(parentId.toString(), userToken);
if (administrationPList.size() > 0) {
mv.addObject("administrationPList", administrationPList);

9
src/main/java/com/dreamchaser/depository_manage/entity/MaterialAndBarCode.java

@ -64,4 +64,13 @@ public class MaterialAndBarCode {
* 物料所处库位
*/
private List<PlaceP> placePList;
/**
* 保质期
*/
private Integer shelfLife;
/**
* 生产日期
*/
}

20
src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java

@ -74,12 +74,27 @@ public interface DepositoryRecordMapper {
*/
List<ApplicationInRecordP> findApplicationInRecordPAll();
/**
* 查询一段时间内的入库记录
* @param map 条件起止时间
* @return
*/
List<ApplicationInRecordP> findApplicationInRecordPForAPeriodOfTime(Map<String,Object> map);
/**
* 查找所有出库记录
* @return
*/
List<ApplicationOutRecordP> findApplicationOutRecordPAll();
/**
* 查询一段时间内的出库记录
* @param map 条件起止时间
* @return
*/
List<ApplicationOutRecordP> findApplicationOutRecordPForAPeriodOfTime(Map<String,Object> map);
/**
* 根据条件查询仓库调度记录同时支持分页查询需要begin和size参数
* @param map 查询参数
@ -341,5 +356,8 @@ public interface DepositoryRecordMapper {
* 获取所有已经完成的子订单
* @return
*/
List<ApplicationOutRecordMin> findApplicationOutMinForComplete();
List<ApplicationOutRecordMin> findApplicationOutMinForComplete(Map<String,Object> map);
}

19
src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml

@ -388,12 +388,26 @@
<include refid="ApplicationInRecordInfo"/>
from applicationInRecordInfo
</select>
<select id="findApplicationInRecordPForAPeriodOfTime" resultMap="applicationInRecord">
select
<include refid="ApplicationInRecordInfo"/>
from applicationInRecordInfo
where applicant_time between #{start} and #{end}
</select>
<!-- 查询所有出库记录-->
<select id="findApplicationOutRecordPAll" resultMap="applicationOutRecord">
select
<include refid="ApplicationOutRecordInfo"/>
from applicationOutRecordInfo
</select>
<select id="findApplicationOutRecordPForAPeriodOfTime" resultMap="applicationOutRecord">
select
<include refid="ApplicationOutRecordInfo"/>
from applicationOutRecordInfo
where applicantTime between #{start} and #{end}
</select>
<!--根据主键查询出库记录-->
<select id="findApplicationOutRecordPById" parameterType="int" resultMap="applicationOutRecord">
select
@ -731,12 +745,12 @@
and aorm.parentId = #{parentId}
</select>
<select id="findApplicationOutMinForComplete" resultMap="applicationOutRecordMin">
<select id="findApplicationOutMinForComplete" resultMap="applicationOutRecordMin" parameterType="map">
select
<include refid="ApplicationOutRecordMinInfo" />
from application_out_record_min aorm left join application_out_record aor on aorm.parentId = aor.id
where 1 = 1
and aor.pass = 1
and aor.pass = 1 and aor.applicant_time between #{start} and #{end}
</select>
<!-- 插入数据 -->
@ -1083,6 +1097,7 @@
and applicant_time between #{start} and #{end}
</select>
<!--获取一段时间内的出库额度-->
<select id="findApplicationOutRecordByDate" parameterType="map" resultType="int">
SELECT

5
src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml

@ -86,6 +86,7 @@
<result column="bmcode" property="bmcode" jdbcType="VARCHAR"/>
<result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="mtid" property="mtid" jdbcType="INTEGER"/>
<result column="shelfLife" property="shelfLife" jdbcType="INTEGER"/>
</resultMap>
@ -116,7 +117,7 @@
<!-- 表查询字段,用于查询物料与条形码视图-->
<sql id="materialAndBarCode">
id,bmcode,mcode,mid,depositoryId,mname,mtid,version,texture,unit,tname,price
id,bmcode,mcode,mid,depositoryId,mname,mtid,version,texture,unit,tname,price,shelfLife
</sql>
<!-- 查询所有数据的条数 -->
<select id="findCount" resultType="integer">
@ -224,7 +225,7 @@
select
<include refid="allColumnsByMaterialAndProducedDate"/>
from materialandproduceddate mp
where mp.mid = #{mid} and mp.inventory != 0 ORDER BY producedDate
where mp.mid = #{mid} and mp.inventory != 0 and producedDate is not null ORDER BY producedDate
</select>
<!-- 根据物料id与生产日期获取对应关系-->

69
src/main/java/com/dreamchaser/depository_manage/pojo/SimpleTaskP.java

@ -0,0 +1,69 @@
package com.dreamchaser.depository_manage.pojo;
import com.dreamchaser.depository_manage.entity.SimpleApplicationOutRecord;
import com.dreamchaser.depository_manage.entity.StockTaking;
import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import lombok.Data;
/**
* 用于简化任务的输出
*/
@Data
public class SimpleTaskP {
/**
* id
*/
private Long id;
/**
* 盘点单号
*/
private String code;
/**
* 仓库名称
*/
private String depositoryName;
/*
发起人姓名
*/
private String applicantName;
/**
* 申请时间
*/
private String applicantTime;
/**
* 任务类型1出库2盘点
*/
private String type;
/**
* 用于创建任务输出
* @param d 出库任务
*/
public SimpleTaskP(SimpleApplicationOutRecordP d) {
this.id= Long.valueOf(d.getId().toString());
this.applicantTime = d.getApplicantTime();
this.applicantName = d.getApplicantName();
this.type = "出库请求";
}
/**
* 用于创建任务输出
* @param st 盘点任务
*/
public SimpleTaskP(SimpleStockTakingP st) {
this.id = st.getId();
this.code = st.getCode();
this.applicantTime = st.getCreateTime();
this.applicantName = st.getOriginatorName();
this.type = "库存盘点请求";
}
}

6
src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java

@ -175,7 +175,7 @@ public interface DepositoryRecordService {
* 计算入库物料总额
* @return
*/
Double CalculateAllApplicationInPrice();
Map<String,Object> CalculateAllApplicationInAll();
/**
* 计算出库物料总额
* @return
@ -295,12 +295,12 @@ public interface DepositoryRecordService {
* 计算入库物料总数
* @return
*/
Double CalculateAllApplicationInCount();
Map<String,Object> CalculateAllApplicationInCount();
/**
* 计算出库物料总数
* @return
*/
Double CalculateAllApplicationOutCount(String state);
Map<String,Object> CalculateAllApplicationOutCount(String state);
/**

2
src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java

@ -297,4 +297,6 @@ public interface MaterialService {
* @param mtId
*/
void closeTreeChildren(Long mtId);
List<Object> InitMaterialTree_New();
}

315
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -24,7 +24,7 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
/**
* @author Dreamchaser
@ -108,7 +108,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前填写的生产日期
Long producedDate = Long.valueOf(0);
if (map.containsKey("producedDate")) {
producedDate = DateUtil.DateTimeByMonthToTimeStamp(map.get("producedDate").toString());
Object s = map.get("producedDate");
if(s == null || "".equals(s.toString())){
producedDate = Long.valueOf(0);
}else{
producedDate = DateUtil.DateTimeByMonthToTimeStamp(s.toString());
}
}
Map<String, Object> param = new HashMap<>();
param.put("depositoryId", depositoryId);
@ -227,13 +232,70 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @return
*/
@Override
public Double CalculateAllApplicationInCount() {
List<ApplicationInRecordP> applicationInRecordPAll = depositoryRecordMapper.findApplicationInRecordPAll();
Double sum = 0.0;
for (int i = 0; i < applicationInRecordPAll.size(); i++) {
sum += (double) applicationInRecordPAll.get(i).getQuantity();
public Map<String,Object> CalculateAllApplicationInCount() {
// 获取当前时间
long now = System.currentTimeMillis();
// 获取今天凌晨的时间
Long nowTimeForCalc = DateUtil.getNowTimeForCalc();
// 获取昨天时间
Long yesterdayTimeForCalc = DateUtil.getYesterdayTimeForCalc();
// 用于查询今天到现在的入库记录
Map<String,Object> mapForToday = new HashMap<>();
mapForToday.put("start",nowTimeForCalc);
mapForToday.put("end",now);
// 用于查询昨天的入库记录
Map<String,Object> mapForYesterday = new HashMap<>();
mapForYesterday.put("start",yesterdayTimeForCalc);
mapForYesterday.put("end",nowTimeForCalc);
// 查询今天目前为止的入库
List<ApplicationInRecordP> applicationInRecordPForToday = depositoryRecordMapper.findApplicationInRecordPForAPeriodOfTime(mapForToday);
// 查询昨天的入库
List<ApplicationInRecordP> applicationInRecordPForYesterday = depositoryRecordMapper.findApplicationInRecordPForAPeriodOfTime(mapForYesterday);
// 今天的入库数量
Integer sumForToday = 0;
// 今天的入库额度
Double priceForToday = 0.0;
// 昨天的入库数量
Integer sumForYesterDay = 0;
// 昨天的入库额度
Double priceForYesterDay = 0.0;
for (int i = 0; i < applicationInRecordPForToday.size(); i++) {
ApplicationInRecordP applicationInRecordP = applicationInRecordPForToday.get(i);
sumForToday += applicationInRecordP.getQuantity();
priceForToday += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity();
}
return sum;
for (int i = 0; i < applicationInRecordPForYesterday.size(); i++) {
ApplicationInRecordP applicationInRecordP = applicationInRecordPForYesterday.get(i);
sumForYesterDay += applicationInRecordP.getQuantity();
priceForYesterDay += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity() ;
}
Map<String,Object> result = new HashMap<>();
result.put("total",sumForToday);
Double ratioForCount = 0.0;
Double ratioForPrice = 0.0;
if(Double.compare(sumForYesterDay,0.0) != 0){
ratioForCount = ((sumForToday - sumForYesterDay) / Double.parseDouble(sumForYesterDay.toString()));
}
if(Double.compare(priceForYesterDay,0.0) != 0){
ratioForPrice = (priceForToday - priceForYesterDay) / Double.parseDouble(priceForYesterDay.toString());
}
BigDecimal bgForSum = new BigDecimal(ratioForCount);
BigDecimal bgForPrice = new BigDecimal(ratioForPrice);
ratioForCount = bgForSum.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
ratioForPrice = bgForPrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
result.put("ratioForSum",ratioForCount * 100);
result.put("ratioForPrice",ratioForPrice * 100);
BigDecimal bgPrice = new BigDecimal(priceForToday / 100);
priceForToday = bgPrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
result.put("price",priceForToday);
return result;
}
/**
@ -243,26 +305,213 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @return
*/
@Override
public Double CalculateAllApplicationOutCount(String state) {
List<ApplicationOutRecordP> applicationOutRecordPAll = depositoryRecordMapper.findApplicationOutRecordPAll();
Double sum = 0.0;
public Map<String,Object> CalculateAllApplicationOutCount(String state) {
// 获取昨天出库订单
// 获取当前时间
long now = System.currentTimeMillis();
// 获取今天凌晨的时间
Long nowTimeForCalc = DateUtil.getNowTimeForCalc();
// 获取昨天时间
Long yesterdayTimeForCalc = DateUtil.getYesterdayTimeForCalc();
// 用于查询今天到现在的出库记录
Map<String,Object> mapForToday = new HashMap<>();
mapForToday.put("start",nowTimeForCalc);
mapForToday.put("end",now);
// 用于查询昨天的出库记录
Map<String,Object> mapForYesterday = new HashMap<>();
mapForYesterday.put("start",yesterdayTimeForCalc);
mapForYesterday.put("end",nowTimeForCalc);
// 用于最终的结果
Map<String,Object> result = new HashMap<>();
// 获取今天的额度
Double priceForToday = 0.0;
// 获取今天的总数
Integer countForToday = 0;
// 获取昨天的额度
Double priceForYesterday = 0.0;
// 获取昨天的总数
Integer countForYesterday = 0;
if (state.isEmpty()) {
// 如果要获取要出库的所有数量
for (int i = 0; i < applicationOutRecordPAll.size(); i++) {
sum += (double) applicationOutRecordPAll.get(i).getQuantity();
// 获取今天为止的出库记录
List<ApplicationOutRecordP> applicationOutRecordPForToday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForToday);
// 今天的出库记录数
int todaySize = applicationOutRecordPForToday.size();
// 获取昨天的出库记录
List<ApplicationOutRecordP> applicationOutRecordPForYesterday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForYesterday);
// 昨天的出库记录数
int yesterdaySize = applicationOutRecordPForYesterday.size();
if(todaySize > 0) {
// 定义线程用于计算今天的记录
ExecutorService exsForToday = Executors.newFixedThreadPool(todaySize);
// 结果集
List<Future<Object>> futureListForToday = new ArrayList<Future<Object>>();
// 1.定义CompletionService
CompletionService<Object> completionServiceForToday = new ExecutorCompletionService<Object>(exsForToday);
// 开启线程计算今天的额度
for (int i = 0; i < todaySize; i++) {
// 获取当前主记录
ApplicationOutRecordP recordP = applicationOutRecordPForToday.get(i);
Future<Object> submit = completionServiceForToday.submit(new CalcApplicationOutInfo(recordP));
futureListForToday.add(submit);
}
// 获取今天的结果
for (int i = 0; i < todaySize; i++) {
Object o = null;
try {
o = completionServiceForToday.take().get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
countForToday += ObjectFormatUtil.toInteger(((Map<String,Object>)o).get("count"));
priceForToday += Double.parseDouble(((Map<String,Object>)o).get("price").toString());
}
}
if(yesterdaySize > 0){
// 定义线程用于计算昨天的记录
ExecutorService exsForYesterday = Executors.newFixedThreadPool(yesterdaySize);
// 结果集
List<Future<Object>> futureListForYesterday = new ArrayList<Future<Object>>();
// 1.定义CompletionService
CompletionService<Object> completionServiceForYesterday = new ExecutorCompletionService<Object>(exsForYesterday);
// 开启线程计算昨天的额度
for (int i = 0; i < yesterdaySize; i++) {
ApplicationOutRecordP recordP = applicationOutRecordPForYesterday.get(i);
Future<Object> submit = completionServiceForYesterday.submit(new CalcApplicationOutInfo(recordP));
futureListForYesterday.add(submit);
}
// 获取昨天的结果
for (int i = 0; i < yesterdaySize; i++) {
Object o = null;
try {
o = completionServiceForYesterday.take().get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
countForYesterday += ObjectFormatUtil.toInteger(((Map<String,Object>)o).get("count"));
priceForYesterday += Double.parseDouble(((Map<String,Object>)o).get("price").toString());
}
}
// 设置今天的额度
result.put("price",priceForToday);
result.put("count",countForToday);
Double ratioForCount = 0.0;
Double ratioForPrice = 0.0;
if(Double.compare(countForYesterday,0.0) != 0){
ratioForCount = ((countForToday - countForYesterday) / Double.parseDouble(countForYesterday.toString()));
}
if(Double.compare(priceForYesterday,0.0) != 0){
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(priceForYesterday.toString());
}
BigDecimal bgForSum = new BigDecimal(ratioForCount);
BigDecimal bgForPrice = new BigDecimal(ratioForPrice);
ratioForCount = bgForSum.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
ratioForPrice = bgForPrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
// 获取数量比值
result.put("radioForCount",ratioForCount * 100);
// 获取金额比值
result.put("radioForPrice",ratioForPrice * 100);
} else {
// 如果获取已经出库的数量
List<ApplicationOutRecordMin> applicationOutMinForComplete = depositoryRecordMapper.findApplicationOutMinForComplete();
for (int i = 0; i < applicationOutMinForComplete.size(); i++) {
ApplicationOutRecordMin recordMin = applicationOutMinForComplete.get(i);
sum += (double) recordMin.getQuantity();
// 如果获取已经出库的数量(今天)
List<ApplicationOutRecordMin> applicationOutMinForCompleteForToday = depositoryRecordMapper.findApplicationOutMinForComplete(mapForToday);
// 如果获取已经出库的数量(昨天)
List<ApplicationOutRecordMin> applicationOutMinForCompleteForYesterday = depositoryRecordMapper.findApplicationOutMinForComplete(mapForYesterday);
for (int i = 0; i < applicationOutMinForCompleteForToday.size(); i++) {
ApplicationOutRecordMin recordMin = applicationOutMinForCompleteForToday.get(i);
countForToday += recordMin.getQuantity();
// 获取当前出库物料
Material materialById = materialMapper.findMaterialById(recordMin.getMid());
// 计算当前出库金额
double price_out = materialById.getPrice() * recordMin.getQuantity();
BigDecimal bg = new BigDecimal(price_out / 100);
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
priceForToday += price_out;
}
for (int i = 0; i < applicationOutMinForCompleteForYesterday.size(); i++) {
ApplicationOutRecordMin recordMin = applicationOutMinForCompleteForYesterday.get(i);
countForYesterday += recordMin.getQuantity();
// 获取当前出库物料
Material materialById = materialMapper.findMaterialById(recordMin.getMid());
// 计算当前出库金额
double price_out = materialById.getPrice() * recordMin.getQuantity();
BigDecimal bg = new BigDecimal(price_out / 100);
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
priceForYesterday += price_out;
}
// 设置今天的额度
result.put("price",priceForToday);
result.put("count",countForToday);
Double ratioForCount = 0.0;
Double ratioForPrice = 0.0;
if(Double.compare(countForYesterday,0.0) != 0){
ratioForCount = ((countForToday - countForYesterday) / Double.parseDouble(countForYesterday.toString()));
}
if(Double.compare(priceForYesterday,0.0) != 0){
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(priceForYesterday.toString());
}
BigDecimal bgForSum = new BigDecimal(ratioForCount);
BigDecimal bgForPrice = new BigDecimal(ratioForPrice);
ratioForCount = bgForSum.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
ratioForPrice = bgForPrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
// 获取数量比值
result.put("radioForCount",ratioForCount * 100);
// 获取金额比值
result.put("radioForPrice",ratioForPrice * 100);
}
return result;
}
/**
* 用于计算当前主记录下的总额与数量
*/
class CalcApplicationOutInfo implements Callable<Object>{
ApplicationOutRecordP mainRecord;
CalcApplicationOutInfo( ApplicationOutRecordP mainRecord){
this.mainRecord = mainRecord;
}
@Override
public Object call() throws Exception {
Map<String,Object> result = new HashMap<>();
// 获取当前订单的子订单
List<ApplicationOutRecordMin> minList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainRecord.getId());
// 额度
Double price = 0.0;
// 数量
Integer count = 0;
for (int i = 0; i < minList.size(); i++) {
ApplicationOutRecordMin recordMin = minList.get(i);
count +=recordMin.getQuantity();
// 获取当前出库物料
Material materialById = materialMapper.findMaterialById(recordMin.getMid());
// 计算当前出库金额
double price_out = materialById.getPrice() * recordMin.getQuantity();
BigDecimal bg = new BigDecimal(price_out / 100);
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
price += price_out;
}
result.put("count",count);
result.put("price",price);
return result;
}
return sum;
}
/**
* 将物料入库到库位
*
@ -297,8 +546,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
insertProducedDate.put("inid", InId);
insertProducedDate.put("mid", newInMid);
if (map.containsKey("producedDate")) {
Long producedDate = DateUtil.DateTimeByMonthToTimeStamp(map.get("producedDate").toString());
insertProducedDate.put("producedDate", producedDate);
Long producedDate = Long.valueOf(0);
Object s = map.get("producedDate");
if(s == null || "".equals(s.toString())){
producedDate = Long.valueOf(0);
}else{
producedDate = DateUtil.DateTimeByMonthToTimeStamp(s.toString());
insertProducedDate.put("producedDate", producedDate);
}
}
// 查找当前物料id与生产日期的对应关系
@ -1838,16 +2093,22 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @return
*/
@Override
public Double CalculateAllApplicationInPrice() {
public Map<String,Object> CalculateAllApplicationInAll() {
Map<String,Object> result = new HashMap<>();
List<ApplicationInRecordP> applicationInRecordPAll = depositoryRecordMapper.findApplicationInRecordPAll();
Double sum = 0.0;
Integer count = 0;
for (int i = 0; i < applicationInRecordPAll.size(); i++) {
double price = applicationInRecordPAll.get(i).getPrice();
sum += price * applicationInRecordPAll.get(i).getQuantity() / 100;
ApplicationInRecordP applicationInRecordP = applicationInRecordPAll.get(i);
double price = applicationInRecordP.getPrice();
sum += price * applicationInRecordP.getQuantity() / 100;
count += applicationInRecordP.getQuantity();
}
BigDecimal bg = new BigDecimal(sum);
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
return sum;
result.put("price",sum);
result.put("count",count);
return result;
}
/**
@ -1878,7 +2139,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else {
// 如果要获取已完成的金额
List<ApplicationOutRecordMin> applicationOutMinForComplete = depositoryRecordMapper.findApplicationOutMinForComplete();
List<ApplicationOutRecordMin> applicationOutMinForComplete = depositoryRecordMapper.findApplicationOutMinForComplete(null);
for (int i = 0; i < applicationOutMinForComplete.size(); i++) {
ApplicationOutRecordMin recordMin = applicationOutMinForComplete.get(i);
Integer mid = recordMin.getMid();

237
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java

@ -1017,6 +1017,12 @@ public class MaterialServiceImpl implements MaterialService {
}
}
@Override
public List<Object> InitMaterialTree_New() {
List<Object> objectList = buildTree_New(InitTree_Test_New(), Long.valueOf(0));
return objectList;
}
/**
* 用于真实关闭打开的树
* @param jsonArray 传入的子列表
@ -1650,18 +1656,6 @@ public class MaterialServiceImpl implements MaterialService {
}
}
// 构造树形组件数据模板
public Map<String, Object> InitTreeMenus_Test(MaterialType mt, List<Object> children) {
if (mt != null) {
Map<String, Object> map = new HashMap<>();
map.put("title", mt.getTname());
map.put("id", mt.getOldId());
map.put("children", children);
return map;
} else {
return null;
}
}
// 根据id获取子类(只获取类别)
public List<Object> findChildForMaterialTypeByParent_OnlyType(Long Oldid) {
@ -1714,4 +1708,223 @@ public class MaterialServiceImpl implements MaterialService {
}
/**
* 用于深度拷贝列表
*
* @param oldList
* @param <T>
* @return
*/
public static <T> List<T> deepCopy(List<T> oldList) {
List<T> newList = (List<T>) Arrays.asList(new Object[oldList.size()]);
Collections.copy(newList, oldList);
return newList;
}
/**
* 用于构造物料树结构
* @return
*/
public List<Object> InitTree_Test_New() {
// 获取所有物料类型
List<MaterialType> materialTypeAll = materialTypeMapper.findMaterialTypeAll();
// 物料总数
Integer totalVal = materialTypeAll.size();
// 定义分页数量
double size = 100.0;
// 定义线程数
Integer threadSize = (int) Math.ceil(totalVal / size);
// 开启对应数量的线程
ExecutorService exs = Executors.newFixedThreadPool(threadSize);
// 树结构结果集
List<Object> list = new ArrayList<>();
// 线程结果集
List<Future<Object>> futureList = new ArrayList<Future<Object>>();
// 1.定义CompletionService
CompletionService<Object> completionService = new ExecutorCompletionService<Object>(exs);
// 物料类型id列表
List<Long> materialTypeList = new ArrayList<>();
for (int i = 0; i < materialTypeAll.size(); i++) {
// 获取当前类型
MaterialType materialType = materialTypeAll.get(i);
if (((i + 1) % 100) == 0) { // 如果有100个开启线程进行处理
materialTypeList.add(materialType.getOldId());
Future<Object> future = completionService.submit(new TaskTest_New(materialTypeList));
futureList.add(future); // 添加到结果集
materialTypeList = new ArrayList<>(); // 情况列表
} else {
// 添加id到列表中
materialTypeList.add(materialType.getOldId());
}
}
if (materialTypeList.size() > 0) {
// 如果有剩余,开启线程进行处理
Future<Object> future = completionService.submit(new TaskTest_New(materialTypeList));
futureList.add(future);
}
// 3.获取结果
for (int i = 0; i < threadSize; i++) {
Object result = null;
try {
result = completionService.take().get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
list.addAll((Collection<?>) result);
}
// 进行最终的封装
return list;
}
// 用于执行测试新算法
class TaskTest_New implements Callable<Object> {
// 待处理的物料类型id列表
List<Long> materialTypeIdList;
public TaskTest_New(List<Long> materialTypeByCondition) {
this.materialTypeIdList = materialTypeByCondition;
}
@Override
public Object call() throws Exception {
// 定义树结构结果集
List<Object> list = new ArrayList<>();
// 查询当前物料类型id列表中的物料类型
List<Material> materialByTypeIds = materialMapper.findMaterialByTypeIds(materialTypeIdList);
// 查询当前物料类型所包含的物料
List<MaterialType> materialTypeByOldIds = materialTypeMapper.findMaterialTypeByOldIds(materialTypeIdList);
// 定义线程集
ExecutorService exs = Executors.newFixedThreadPool(materialTypeByOldIds.size());
// 定义线程结果集
List<Future<Object>> futureList = new ArrayList<Future<Object>>();
// 1.定义CompletionService
CompletionService<Object> completionService = new ExecutorCompletionService<Object>(exs);
for (int i = 0; i < materialTypeByOldIds.size(); i++) {
// 获取当前物料类型
MaterialType mt = materialTypeByOldIds.get(i);
// 开启对应线程
Future<Object> future = completionService.submit(new MtTaskTest_New(mt, materialByTypeIds));
// 添加到线程结果列表
futureList.add(future);
}
// 3.获取结果
for (int i = 0; i < materialTypeIdList.size(); i++) {
Object result = null;
try {
result = completionService.take().get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
list.add(result);
}
return list;
}
}
// 用于执行测试新算法
class MtTaskTest_New implements Callable<Object> {
MaterialType mt; // 物料类型
List<Material> materiaList; // 物料列表
public MtTaskTest_New(MaterialType mt, List<Material> materiaList) {
this.mt = mt;
this.materiaList = materiaList;
}
@Override
public Object call() throws Exception {
// 开启对应数量的线程
List<Material> materialList = new ArrayList<>();
for (int i = 0; i < materiaList.size(); i++) {
Material material = materiaList.get(i);
// 如果当前物料是当前物料类型下的物料
if (Long.compare(material.getMaterialTypeId(), mt.getOldId()) == 0) {
materialList.add(material);
}
}
// 将物料打包成树结构对应结果
List<Object> objectList = AddMaterialByType_New(materialList);
// 封装成对应的结构
Map<String, Object> objectMap = InitTreeMenus_New(mt, objectList);
return objectMap;
}
}
// 构造树形组件数据模板
public Map<String, Object> InitTreeMenus_New(MaterialType mt, List<Object> children) {
if (mt != null) {
Map<String, Object> map = new HashMap<>();
map.put("title", mt.getTname());
map.put("id", mt.getOldId());
map.put("parentId",mt.getParentId());
map.put("children", children);
return map;
} else {
return null;
}
}
// 在类别后添加物料名称
public List<Object> AddMaterialByType_New(List<Material> materialList) {
List<Object> result = new ArrayList<>();
for (int i = 0; i < materialList.size(); i++) {
Material material = materialList.get(i);
Map<String, Object> map = new HashMap<>();
String version = material.getVersion();
if (version == null) {
version = "";
}
String title = material.getMname() + ",规格型号: " + version;
map.put("title", title);
map.put("id", material.getId());
result.add(map);
}
return result;
}
/**
* 用于构造树结构
* @param list 树列表
* @param parentId 父级id
* @return
*/
public List<Object> buildTree_New(List<Object> list,Long parentId){
// 定义树结构
List<Object> result = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
// 构造为jsonObject类
JSONObject jsonObject = new JSONObject((Map<String, Object>) list.get(i));
// 获取当前父级id
Long parentId1 = jsonObject.getLong("parentId");
if(Long.compare(parentId,parentId1) == 0){ // 如果当前类型是其父类
List<Object> objectList = buildTree_New(list, jsonObject.getLong("id")); // 获取当前类型的子类
JSONArray children = jsonObject.getJSONArray("children");
children.addAll(objectList);
result.add(jsonObject);
}
}
return result;
}
}

37
src/main/java/com/dreamchaser/depository_manage/utils/DateUtil.java

@ -106,6 +106,43 @@ public class DateUtil {
}
/**
* 获取今天的时间
* @return
*/
public static Long getNowTimeForCalc(){
Calendar calendar = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy--MM-dd");
String format = formatter.format(calendar.getTime());
Date date = null;
try {
date = formatter.parse(format);
} catch (ParseException e) {
e.printStackTrace();
}
long ts = date.getTime();
return ts;
}
/**
* 获取昨天的时间
* @return
*/
public static Long getYesterdayTimeForCalc(){
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE,-1);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy--MM-dd");
String format = formatter.format(calendar.getTime());
Date date = null;
try {
date = formatter.parse(format);
} catch (ParseException e) {
e.printStackTrace();
}
long ts = date.getTime();
return ts;
}
// 获取当前日期
public static String getNowTime(){

6
src/main/resources/application-test.yml

@ -79,9 +79,9 @@ mybatis:
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
log-prefix: mapper.
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#mybatis-plus:
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
file:
uploadPath: D:/upLoad

1
src/main/resources/static/js/lay-config.js

@ -9,7 +9,6 @@ window.rootPath = (function (src) {
src = document.scripts[document.scripts.length - 1].src;
return src.substring(0, src.lastIndexOf("/") + 1);
})();
layui.config({
base: rootPath + "lay-module/",
version: true

65
src/main/resources/templates/pages/application/application-in.html

@ -47,7 +47,7 @@
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto; ">
<div carousel-item style="overflow: inherit">
<div>
<form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
<form class="layui-form" style="margin: 0 auto;max-width: 460px;">
<div class="layui-card" id="cardParent">
<div class="layui-card-body" id="cardItem" style="padding-right: 0px">
<hr>
@ -98,11 +98,11 @@
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item" style="display: none" id="producedDateItem">
<label class="layui-form-label">生产日期:</label>
<div class="layui-input-block">
<input type="text" name="producedDate" id="producedDate" placeholder="请填写生产日期" onclick="selectDate(this)"
autocomplete="off" class="layui-input" lay-verify="required">
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
@ -142,8 +142,8 @@
<div class="layui-form-item">
<label class="layui-form-label">备注说明:</label>
<div class="layui-input-block">
<textarea name="applyRemark" placeholder="请填写相关原因及申请原因" value=""
class="layui-textarea"></textarea>
<input name="applyRemark" placeholder="请填写相关原因及申请原因" value=""
class="layui-input"/>
</div>
</div>
<i class="layui-icon layui-icon-addition" style="display: inline"
@ -247,7 +247,7 @@
elem: '#stepForm',
filter: 'stepForm',
width: '100%', //设置容器宽度
height: '730px',
height: '560px',
stepItems: [{
title: '填写信息'
}, {
@ -374,7 +374,7 @@
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item" style="display: none" id=` +"producedDateItem"+NewIdNumber + `>
<label class="layui-form-label">生产日期:</label>
<div class="layui-input-block">
<input type="text" name=`+"producedDate"+NewIdNumber +` id=`+"producedDate"+NewIdNumber+` placeholder="请填写生产日期"
@ -534,12 +534,20 @@
$("#barCode" + idNumber).append(new Option(item.bmcode, item.bmcode));//往下拉菜单里添加元素
});
form.render();
}else{
}
else{
var barCode = $("#barCode" + idNumber);
if (barCode.length > 0) {
barCode.empty();
}
}
var shelfLife = d.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) {
$("#" + "producedDateItem" + idNumber).show();
$("#" + "producedDate" + idNumber).attr("lay-verify", "required");
}else{
$("#" + "producedDateItem" + idNumber).hide();
}
}
}
});
@ -619,6 +627,15 @@
});
form.render();
}
var shelfLife = material.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) {
$("#" + "producedDateItem" + idNumber).show();
$("#" + "producedDate" + idNumber).attr("lay-verify", "required");
}
else{
$("#" + "producedDateItem" + idNumber).hide();
form.render();
}
}
});
@ -663,7 +680,15 @@
materialName.value = material.mname;
materialId.value = material.id;
codeValue.value = material.code;
var shelfLife = material.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) {
$("#" + "producedDateItem" + idNumber).show();
$("#" + "producedDate" + idNumber).attr("lay-verify", "required");
}
else{
$("#" + "producedDateItem" + idNumber).hide();
form.render();
}
}
}
});
@ -740,12 +765,22 @@
});
form.render();
}
var shelfLife = data.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) {
$("#" + "producedDateItem" + idNumber).show();
$("#" + "producedDate" + idNumber).attr("lay-verify", "required");
}
else{
$("#" + "producedDateItem" + idNumber).hide();
form.render();
}
}
})
}
})
};
// 用于扫描二维码
// 用于扫描条形
scanBarCode = function (obj) {
parent.wx.scanQRCode({
desc: 'scanQRCode desc',
@ -793,6 +828,16 @@
priceValue.value = material.price;
var barCodeInput = barCodeItem.childNodes[1].childNodes[1];
barCodeInput.value = result;
var idNumber = materialId.name.split("mid")[1];
var shelfLife = material.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) {
$("#" + "producedDateItem" + idNumber).show();
$("#" + "producedDate" + idNumber).attr("lay-verify", "required");
}
else{
$("#" + "producedDateItem" + idNumber).hide();
form.render();
}
form.render();
}
})

5
src/main/resources/templates/pages/application/application-in_back.html

@ -37,7 +37,7 @@
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;">
<div carousel-item>
<div>
<form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
<form class="layui-form" style="margin: 0 auto;max-width: 460px;">
<div class="layui-form-item">
<label class="layui-form-label">物料名称:</label>
<div class="layui-input-block" style="margin: 0px;">
@ -242,7 +242,8 @@
area: ['70%', '70%'],
move : '.layui-layer-title',
fixed:false,
content: '/selectMaterial?mname='+mname+'&type=1',
// content: '/selectMaterial?mname='+mname+'&type=1',
content: '/getMaterialAll?mname=' + mname + '&type=1',
end: function () {
var mid = $("#mid").val();
$.ajax({

27
src/main/resources/templates/pages/application/application-out.html

@ -37,7 +37,8 @@
.layui-card-body {
padding: 10px 5px;
}
.lay-step{
.lay-step {
display: none;
}
</style>
@ -48,7 +49,7 @@
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;">
<div carousel-item style="overflow: inherit">
<div>
<form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
<form class="layui-form" style="margin: 0 auto;max-width: 460px;">
<div class="layui-card" id="cardParent">
<div class="layui-card-body" id="cardItem">
<hr>
@ -135,7 +136,6 @@
<div style="font-size: 24px;color: #333;font-weight: 500;margin-top: 30px;">
提交申请成功
</div>
<div style="font-size: 14px;color: #666;margin-top: 20px;">预计审核时间为1天</div>
</div>
<div style="text-align: center;margin-top: 50px;">
<button class="layui-btn next">再申请一次</button>
@ -144,11 +144,6 @@
</div>
</div>
</div>
<hr>
<div style="color: #666;margin-top: 30px;margin-bottom: 40px;padding-left: 30px;">
<h3>说明</h3><br>
申请提交后,24小时内审核完毕
</div>
</div>
</div>
@ -312,7 +307,7 @@
<label class="layui-form-label">物料编码:</label>
<div class="layui-input-block">
<div class="inputdiv">
<input id=`+"code"+NewIdNumber+` name=`+"code"+NewIdNumber+` type="text" placeholder="请填写入物料编码" value=""
<input id=` + "code" + NewIdNumber + ` name=` + "code" + NewIdNumber + ` type="text" placeholder="请填写入物料编码" value=""
onblur="selectCode(this)"
class="layui-input" lay-verify="required"
style="border-style: none">
@ -517,8 +512,7 @@
$("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素
});
form.render();
}
else{
} else {
var barCode = $("#barCode" + idNumber);
if (barCode.length > 0) {
barCode.empty();
@ -555,12 +549,12 @@
content: '/getMaterialAll?mname=' + mname + '&type=2&clickObj=' + parentId,
move: '.layui-layer-title',
fixed: false,
success: function(layero, index){
success: function (layero, index) {
var children = layero.children();
var content = $(children[1]);
var iframeChildren = $(content.children());
content.css('height','100%');
iframeChildren.css('height','100%');
content.css('height', '100%');
iframeChildren.css('height', '100%');
},
end: function () {
var mid = materialId.value;
@ -599,8 +593,7 @@
$("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素
});
form.render();
}
else{
} else {
var barCode = $("#barCode" + idNumber);
if (barCode.length > 0) {
barCode.empty();
@ -796,7 +789,7 @@
});
} else {
let val = $("#quantity" + id).val();
if(val !== null && val !== undefined && val !== '') {
if (val !== null && val !== undefined && val !== '') {
var req = {};
req.code = mcode;
req.quantity = val;

3
src/main/resources/templates/pages/application/application-out_back.html

@ -241,7 +241,8 @@
area: ['70%', '70%'],
move : '.layui-layer-title',
fixed:false,
content: '/selectMaterial?mname='+mname+'&type=2',
// content: '/selectMaterial?mname='+mname+'&type=2',
content: '/getMaterialAll?mname='+mname+'&type=2',
success: function(layero, index){
var children = layero.children();
var content = $(children[1]);

50
src/main/resources/templates/pages/application/application-review.html

@ -100,14 +100,20 @@
</div>
</div>
<div class="layui-form-item">
<div class="layui-row layui-col-space15">
<div class="layui-input-block">
<button id="reviewPass1" class="layui-btn" onclick="review(1)">
&emsp;审核通过&emsp;
</button>
<button class="layui-btn layui-btn-danger" onclick="review(2)">
&emsp;审核不通过&emsp;
</button>
<div class="layui-col-xs12 layui-col-md3" style="padding: 7.5px">
<button type="button" class="layui-btn" onclick="review(1)">
&emsp;同意&emsp;
</button>
</div>
<div class="layui-col-xs12 layui-col-md3" style="padding: 7.5px">
<button type="button" class="layui-btn layui-btn-danger"
onclick="review(2)">
&emsp;驳回&emsp;
</button>
</div>
</div>
</div>
</div>
@ -122,14 +128,20 @@
</div>
</div>
<div class="layui-form-item">
<div class="layui-row layui-col-space15">
<div class="layui-input-block">
<button id="checkPass1" class="layui-btn" onclick="check(1)">
&emsp;审核通过&emsp;
</button>
<button id="checkPass2" class="layui-btn layui-btn-danger" onclick="check(2)">
&emsp;审核不通过&emsp;
</button>
<div class="layui-col-xs12 layui-col-md3" style="padding: 7.5px">
<button type="button" class="layui-btn" onclick="check(1)">
&emsp;同意&emsp;
</button>
</div>
<div class="layui-col-xs12 layui-col-md3" style="padding: 7.5px">
<button type="button" class="layui-btn layui-btn-danger"
onclick="check(2)">
&emsp;驳回&emsp;
</button>
</div>
</div>
</div>
</div>
@ -154,7 +166,7 @@
form = layui.form,
step = layui.step;
var state=$("#state").text();
/* var state=$("#state").text();
var pass = $("#pass").text();
//当前处于的状态
var position=0,states={},number = 1;
@ -178,16 +190,16 @@
states = [{title:"未出库"}]
}
}
}
}*/
step.render({
elem: '#stepForm',
filter: 'stepForm',
width: '100%', //设置容器宽度
stepWidth: '750px',
height: '100%',
position: position,
number:number,
stepItems: states
// position: position,
// number:number,
stepItems: []
});
let departmentheadTime=$("#departmentheadTime").text();

8
src/main/resources/templates/pages/application/application-transfer.html

@ -41,7 +41,7 @@
<div carousel-item style="overflow: inherit">
<div>
<form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
<form class="layui-form" style="margin: 0 auto;max-width: 460px;">
<div class="layui-card" id="cardParent">
<div class="layui-card-body" id="cardItem">
<hr>
@ -144,7 +144,6 @@
<div style="font-size: 24px;color: #333;font-weight: 500;margin-top: 30px;">
提交申请成功
</div>
<div style="font-size: 14px;color: #666;margin-top: 20px;">预计审核时间为1天</div>
</div>
<div style="text-align: center;margin-top: 50px;">
<button class="layui-btn next">再申请一次</button>
@ -154,11 +153,6 @@
</div>
</div>
</div>
<hr>
<div style="color: #666;margin-top: 30px;margin-bottom: 40px;padding-left: 30px;">
<h3>说明</h3><br>
申请提交后,24小时内审核完毕
</div>
</div>
</div>
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>

3
src/main/resources/templates/pages/application/application_in_multi.html

@ -126,7 +126,8 @@
area: ['70%', '70%'],
move : '.layui-layer-title',
fixed:false,
content: '/selectMaterial?mname='+mname+'&type=1',
// content: '/selectMaterial?mname='+mname+'&type=1',
content: '/getMaterialAll?mname='+mname+'&type=1',
success: function(layero, index){
var children = layero.children();
var content = $(children[1]);

17
src/main/resources/templates/pages/application/form-step-look_back.html

@ -15,11 +15,11 @@
<div class="layuimini-main">
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-body" style="padding-top: 40px;">
<div class="layui-card-body" style="padding-top: 0px;">
<div id="stepForm" lay-filter="stepForm" style="margin: 0 auto;">
<div style="margin-top: 30px">
<table id="demo" class="layui-table"
style="margin: 0 auto;max-width: 800px;padding-top: 40px;">
style="margin: 0 auto;max-width: 800px;">
<colgroup>
<col width="150">
<col width="200">
@ -118,9 +118,7 @@
var $ = layui.$,
form = layui.form,
step = layui.step;
/*
var state=$("#state").text();
var pass=$("#pass").text();
//当前处于的状态
@ -145,17 +143,16 @@
states = [{title:"未出库"}]
}
}
}
}*/
step.render({
elem: '#stepForm',
filter: 'stepForm',
width: '100%', //设置容器宽度
stepWidth: '750px',
height: '100%',
number:number,
position: position,
stepItems: states
// number:number,
// position: position,
stepItems: []
});
let departmentheadTime=$("#departmentheadTime").text();

78
src/main/resources/templates/pages/application/my-apply.html

@ -24,13 +24,23 @@
*zoom: 1;
}
</style>
<div class="layui-bg-gray">
<fieldset class="layui-elem-field layui-field-title" style="padding: 10px;">
<legend>入库记录</legend>
<ul id="LAY_floor_in" class="flow-default" style="width: 100%"></ul>
<legend>出库申请</legend>
<ul id="LAY_floor_out" class="flow-default" style="width: 100%"></ul>
</fieldset>
<div class="layui-tab layui-tab-card">
<ul class="layui-tab-title">
<li class="layui-this">入库记录</li>
<li>出库申请</li>
<li>盘点申请</li>
</ul>
<div class="layui-tab-content" style="height: 100px;">
<div class="layui-tab-item layui-show">
<ul id="LAY_floor_in" class="flow-default" style="width: 100%"></ul>
</div>
<div class="layui-tab-item">
<ul id="LAY_floor_out" class="flow-default" style="width: 100%"></ul>
</div>
<div class="layui-tab-item">
<ul id="LAY_floor_stockTaking" class="flow-default" style="width: 100%"></ul>
</div>
</div>
</div>
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
@ -56,6 +66,37 @@
let inpre = 0;
let takingPre = 0;
let outpre = 0;
flow.load({
elem: '#LAY_floor_stockTaking' //流加载容器
, scrollElem: '#LAY_floor_stockTaking' //滚动条所在元素,一般不用填,此处只是演示需要。
, isAuto: false
, done: function (page, next) { //执行下一页的回调
let result;
let lis1 = [];
$.get('/stockTaking/myApply?page=' + page + '&size=' + size, function (res) {
result = res.data;
var Width = "25%";
if (isMobile()) {
Width = "50%";
}
for (let i=0;i<result.length;i++){
lis1.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailTaking('
+result[i].id+')"><div class="layui-card-header"><h2>'
+result[i].originatorName+'的');
lis1.push('盘点记录</h2></div>');
lis1.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].createTime+'</div></div></li>');
}
lis1.push('</div>');
lis1.push('<hr class="layui-border-black">')
takingPre+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis1.join(''), takingPre < res.count);
});
}
});
flow.load({
elem: '#LAY_floor_in' //流加载容器
, scrollElem: '#LAY_floor_in' //滚动条所在元素,一般不用填,此处只是演示需要。
@ -85,28 +126,7 @@
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), inpre < InCount);
});
let lis1 = [];
$.get('/stockTaking/myApply?page=' + page + '&size=' + size, function (res) {
result = res.data;
var Width = "25%";
if (isMobile()) {
Width = "50%";
}
for (let i=0;i<result.length;i++){
lis1.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailTaking('
+result[i].id+')"><div class="layui-card-header"><h2>'
+result[i].originatorName+'的');
lis1.push('盘点记录</h2></div>');
lis1.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].createTime+'</div></div></li>');
}
lis1.push('</div>');
lis1.push('<hr class="layui-border-black">')
takingPre+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis1.join(''), takingPre < res.count);
});
}
});

200
src/main/resources/templates/pages/application/my-apply_back.html

@ -10,77 +10,141 @@
<link rel="stylesheet" href="/static/css/public.css" media="all">
</head>
<body>
<style>
.clearfix:after, .clearfix:before {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
</style>
<div class="layui-bg-gray">
<fieldset class="layui-elem-field layui-field-title" style="padding: 10px;">
<legend>我的申请</legend>
<legend>入库记录</legend>
<ul id="LAY_floor_in" class="flow-default" style="width: 100%"></ul>
<legend>出库申请</legend>
<ul id="LAY_floor_out" class="flow-default" style="width: 100%"></ul>
</fieldset>
<table class="layui-table">
<colgroup>
<col width="25%">
<col width="25%">
<col width="25%">
<col width="25%">
</colgroup>
<tbody id="LAY_floor">
</tbody>
</table>
</div>
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
var data;
//先声明
function openDetail(data){};
layui.use(['flow','layer', 'flow','util'], function () {
function openDetailIn(data) {
};
function openDetailOut(data) {
};
function openDetailTaking(data){
};
layui.use(['flow', 'layer', 'flow', 'util'], function () {
var $ = layui.jquery,
layer=layui.layer,
layer = layui.layer,
flow = layui.flow,
util=layui.util;
let size=8;
let pre=0;
util = layui.util;
let size = 8;
let inpre = 0;
let takingPre = 0;
let outpre = 0;
flow.load({
elem: '#LAY_floor' //流加载容器
,scrollElem: '#LAY_floor' //滚动条所在元素,一般不用填,此处只是演示需要。
,isAuto:false
,done: function(page, next){ //执行下一页的回调
elem: '#LAY_floor_in' //流加载容器
, scrollElem: '#LAY_floor_in' //滚动条所在元素,一般不用填,此处只是演示需要。
, isAuto: false
, done: function (page, next) { //执行下一页的回调
let lis = [];
let result;
$.get('/depositoryRecord/myApply?page='+page+'&size='+size, function(res){
result=res.data;
$.get('/depositoryRecord/myApply?page=' + page + '&size=' + size, function (res) {
result = res.data;
applicationIn = result["applicationIn"];
InCount = result["InCount"];
var Width = "25%";
if (isMobile()) {
Width = "50%";
}
lis.push("<div class='clearfix'>")
for (let i = 0; i < applicationIn.length; i++) {
lis.push('<li style="width:' + Width + ';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailIn('
+ applicationIn[i].id + ')"><div class="layui-card-header"><h2>'
+ applicationIn[i].applicantName + '的入库记录</h2></div>')
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+ applicationIn[i].applicantTime + '</div></div></li>');
}
lis.push('</div>');
inpre += applicationIn.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), inpre < InCount);
});
let lis1 = [];
$.get('/stockTaking/myApply?page=' + page + '&size=' + size, function (res) {
result = res.data;
var Width = "25%";
if (isMobile()) {
Width = "50%";
}
for (let i=0;i<result.length;i++){
if (i%4===0){
lis.push('<tr>');
}
lis.push('<td><div class="layui-card my-shadow my-card flow1" onclick="openDetail('
lis1.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailTaking('
+result[i].id+')"><div class="layui-card-header"><h2>'
+result[i].applicantName+'的')
if (result[i].type===1){
lis.push('入库请求</h2></div>');
}else {
lis.push('出库请求</h2></div>');
}
lis.push('<div class="layui-card-body">'+result[i].applyRemark
+'</div><div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].applyTime+'</div></div></td>');
if (i%4===3){
lis.push('</tr>');
}
+result[i].originatorName+'的');
lis1.push('盘点记录</h2></div>');
lis1.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].createTime+'</div></div></li>');
}
lis1.push('</div>');
lis1.push('<hr class="layui-border-black">')
takingPre+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis1.join(''), takingPre < res.count);
});
}
});
flow.load({
elem: '#LAY_floor_out' //流加载容器
, scrollElem: '#LAY_floor_out' //滚动条所在元素,一般不用填,此处只是演示需要。
, isAuto: false
, done: function (page, next) { //执行下一页的回调
let lis = [];
let result;
lis.push("<div class='clearfix'>")
$.get('/depositoryRecord/myApply?page=' + page + '&size=' + size, function (res) {
result = res.data;
applicationOut = result["applicationOut"];
OutCount = result["OutCount"];
var Width = "25%";
if (isMobile()) {
Width = "50%";
}
if (result.length%4!==0){
lis.push('</tr>');
lis.push("<div class='clearfix'>")
for (let i = 0; i < applicationOut.length; i++) {
lis.push('<li style="width:' + Width + ';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailOut('
+ applicationOut[i].id + ')"><div class="layui-card-header"><h2>'
+ applicationOut[i].applicantName + '的出库请求</h2></div>')
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+ applicationOut[i].applicantTime + '</div></div></li>');
}
pre+=result.length;
lis.push('</div>');
outpre += applicationOut.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), pre < res.count);
next(lis.join(''), outpre < OutCount);
});
}
});
openDetail = function (item) {
openDetailIn = function (item) {
var index = layer.open({
title: '请求详情',
type: 2,
@ -88,11 +152,51 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/form_step_look?id='+item,
content: '/form_step_look?id=' + item,
});
$(window).on("resize", function () {
layer.full(index);
});
};
openDetailOut = function (item) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutView?id=' + item,
});
$(window).on("resize", function () {
layer.full(index);
});
};
openDetailTaking = function (data) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/StockTakingView?id='+data,
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
};
//定义一个函数判断是手机端还是pc端
function isMobile() {
if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
return true; // 移动端
} else {
return false; // PC端
}
}
});
</script>

266
src/main/resources/templates/pages/application/my-task.html

@ -11,52 +11,66 @@
</head>
<style>
.clearfix:after,.clearfix:before{
.clearfix:after, .clearfix:before {
content: "";
display: table;
}
.clearfix:after{
.clearfix:after {
clear: both;
}
.clearfix{
.clearfix {
*zoom: 1;
}
</style>
<div class="layui-bg-gray" style="padding: 10px;">
<fieldset class="layui-elem-field layui-field-title">
<legend>未完成任务</legend>
</fieldset>
<fieldset class="layui-elem-field layui-field-title">
<legend>审核任务</legend>
</fieldset>
<ul id="LAY_floor1" class="flow-default" style="width: 100%"></ul>
<fieldset class="layui-elem-field layui-field-title">
<legend>出库任务</legend>
</fieldset>
<ul id="LAY_floor3" class="flow-default" style="width: 100%"></ul>
<div class="layui-tab layui-tab-card">
<ul class="layui-tab-title">
<li class="layui-this">未完成任务</li>
<li>已完成任务</li>
</ul>
<div class="layui-tab-content" style="height: 100px;">
<div class="layui-tab-item layui-show">
<div class="layui-tab layui-tab-card">
<ul class="layui-tab-title">
<li class="layui-this">审核任务</li>
<li>出库任务</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<ul id="LAY_floor1" class="flow-default" style="width: 100%"></ul>
</div>
<div class="layui-tab-item">
<ul id="LAY_floor3" class="flow-default" style="width: 100%"></ul>
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-tab layui-tab-card">
<ul class="layui-tab-title">
<li class="layui-this">审核任务</li>
<li>出库任务</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<ul id="LAY_floor2" class="flow-default" style="width: 100%"></ul>
</div>
<div class="layui-tab-item">
<ul id="LAY_floor4" class="flow-default" style="width: 100%"></ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-bg-gray" style="padding: 10px;">
<fieldset class="layui-elem-field layui-field-title">
<legend>已完成任务</legend>
</fieldset>
<fieldset class="layui-elem-field layui-field-title">
<legend>审核任务</legend>
</fieldset>
<ul id="LAY_floor2" class="flow-default" style="width: 100%"></ul>
<fieldset class="layui-elem-field layui-field-title">
<legend>出库任务</legend>
</fieldset>
<ul id="LAY_floor4" class="flow-default" style="width: 100%"></ul>
</div>
</body>
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
var data= {};
var data = {};
//先声明
function openDetail1(data) {
@ -69,24 +83,28 @@
//先声明(用于pc端跳转)
function openDetail3(data) {
};
// 用于手机端跳转
function openDetail3_mobile(data) {
};
//先声明(用于pc端跳转)
function openDetail4(data) {
};
// 用于手机端跳转
function openDetail4_mobile(data) {
};
//先声明(用于pc端跳转)
function openDetailForTaking(data){
function openDetailForTaking(data) {
}
function openDetailTaking(data){
function openDetailTaking(data) {
}
layui.use(['flow', 'layer', 'table', 'util'], function () {
var $ = layui.jquery,
layer = layui.layer,
@ -94,56 +112,56 @@
table = layui.table,
util = layui.util;
//每页的数量
var size=8;
let pre1=0,pre2=0,pre3 = 0,pre4 = 0;
var size = 8;
let pre1 = 0, pre2 = 0, pre3 = 0, pre4 = 0;
flow.load({
elem: '#LAY_floor1' //流加载容器
,scrollElem: '#LAY_floor1' //滚动条所在元素,一般不用填,此处只是演示需要。
,isAuto:false
,done: function(page, next){ //执行下一页的回调
, scrollElem: '#LAY_floor1' //滚动条所在元素,一般不用填,此处只是演示需要。
, isAuto: false
, done: function (page, next) { //执行下一页的回调
let lis = [];
let lis1 = [];
let result;
$.get('/depositoryRecord/myTask?page='+page+'&size='+size+'&isDone=0', function(res){
$.get('/depositoryRecord/myTask?page=' + page + '&size=' + size + '&isDone=0', function (res) {
var Width = "25%";
result=res.data;
result = res.data;
lis.push("<div class='clearfix'>");
if(isMobile()){
if (isMobile()) {
Width = "50%";
}
for (let i=0;i<result.length;i++){
lis.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetail1('
+result[i].id+')"><div class="layui-card-header"><h2>'
+result[i].applicantName+'的');
lis.push('出库请求</h2></div>');
for (let i = 0; i < result.length; i++) {
lis.push('<li style="width:' + Width + ';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetail1('
+ result[i].id + ')"><div class="layui-card-header"><h2>'
+ result[i].applicantName + '的');
lis.push('出库请求</h2></div>');
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].applicantTime+'</div></div></li>');
+ result[i].applicantTime + '</div></div></li>');
}
lis.push('</div>');
lis.push('<hr class="layui-border-black">')
pre1+=result.length;
pre1 += result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), pre1 < res.count);
});
$.get('/stockTaking/myTask?page='+page+'&size='+size+'&isDone=0', function(res){
$.get('/stockTaking/myTask?page=' + page + '&size=' + size + '&isDone=0', function (res) {
var Width = "25%";
result=res.data;
result = res.data;
lis1.push("<div class='clearfix'>");
if(isMobile()){
if (isMobile()) {
Width = "50%";
}
for (let i=0;i<result.length;i++){
lis1.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailForTaking('
+result[i].id+')"><div class="layui-card-header"><h2>'
+result[i].originatorName+'的');
for (let i = 0; i < result.length; i++) {
lis1.push('<li style="width:' + Width + ';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailForTaking('
+ result[i].id + ')"><div class="layui-card-header"><h2>'
+ result[i].originatorName + '的');
lis1.push('盘点记录</h2></div>');
lis1.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].createTime+'</div></div></li>');
+ result[i].createTime + '</div></div></li>');
}
lis1.push('</div>');
lis1.push('<hr class="layui-border-black">')
pre3+=result.length;
pre3 += result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis1.join(''), pre3 < res.count);
@ -153,56 +171,56 @@
});
flow.load({
elem: '#LAY_floor2' //流加载容器
,scrollElem: '#LAY_floor2' //滚动条所在元素,一般不用填,此处只是演示需要。
,isAuto:false
,done: function(page, next){ //执行下一页的回调
, scrollElem: '#LAY_floor2' //滚动条所在元素,一般不用填,此处只是演示需要。
, isAuto: false
, done: function (page, next) { //执行下一页的回调
let lis = [];
let lis1 = [];
let result;
$.get('/depositoryRecord/myTask?page='+page+'&size='+size+'&isDone=1', function(res){
$.get('/depositoryRecord/myTask?page=' + page + '&size=' + size + '&isDone=1', function (res) {
var Width = "25%";
result=res.data;
lis.push("<div class='clearfix'>")
for (let i=0;i<result.length;i++){
if(isMobile()){
result = res.data;
lis.push("<div class='clearfix'>");
for (let i = 0; i < result.length; i++) {
if (isMobile()) {
Width = "50%";
}
lis.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetail2('
+result[i].id+')" ><div class="layui-card-header"><h2>'
+result[i].applicantName+'的')
if (result[i].type===1){
lis.push('<li style="width:' + Width + ';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetail2('
+ result[i].id + ')" ><div class="layui-card-header"><h2>'
+ result[i].applicantName + '的')
if (result[i].type === 1) {
lis.push('入库请求</h2></div>');
}else {
} else {
lis.push('出库请求</h2></div>');
}
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].applicantTime+'</div></div></li>');
+ result[i].applicantTime + '</div></div></li>');
}
lis.push("</div>");
lis.push('<hr class="layui-border-black">');
pre2+=result.length;
pre2 += result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), pre2 < res.count);
});
$.get('/stockTaking/myTask?page='+page+'&size='+size+'&isDone=1', function(res){
$.get('/stockTaking/myTask?page=' + page + '&size=' + size + '&isDone=1', function (res) {
var Width = "25%";
result=res.data;
result = res.data;
lis1.push("<div class='clearfix'>");
if(isMobile()){
if (isMobile()) {
Width = "50%";
}
for (let i=0;i<result.length;i++){
lis1.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailTaking('
+result[i].id+')"><div class="layui-card-header"><h2>'
+result[i].originatorName+'的');
for (let i = 0; i < result.length; i++) {
lis1.push('<li style="width:' + Width + ';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailTaking('
+ result[i].id + ')"><div class="layui-card-header"><h2>'
+ result[i].originatorName + '的');
lis1.push('盘点记录</h2></div>');
lis1.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].createTime+'</div></div></li>');
+ result[i].createTime + '</div></div></li>');
}
lis1.push('</div>');
lis1.push('<hr class="layui-border-black">')
pre4+=result.length;
pre4 += result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis1.join(''), pre4 < res.count);
@ -211,37 +229,37 @@
});
flow.load({
elem: '#LAY_floor3' //流加载容器
,scrollElem: '#LAY_floor3' //滚动条所在元素,一般不用填,此处只是演示需要。
,isAuto:false
,done: function(page, next){ //执行下一页的回调
, scrollElem: '#LAY_floor3' //滚动条所在元素,一般不用填,此处只是演示需要。
, isAuto: false
, done: function (page, next) { //执行下一页的回调
let lis = [];
let result;
$.get('/depositoryRecord/myTashForScanQrCode?page='+page+'&size='+size+'&isDone=0', function(res){
$.get('/depositoryRecord/myTashForScanQrCode?page=' + page + '&size=' + size + '&isDone=0', function (res) {
var Width = "25%";
result=res.data;
result = res.data;
const keys = Object.keys(result); // 获取map中所有的键
let redirectByIsMobile = "";
lis.push("<div class='clearfix'>");
if(isMobile()){
if (isMobile()) {
// 如果是移动端
Width = "50%";
redirectByIsMobile = "openDetail3_mobile(";
}else{
} else {
redirectByIsMobile = "openDetail3(";
}
for (let i = 0; i < keys.length; i++) {
lis.push('<li style="width:'+ Width +';float:left;">' +
'<div class="layui-card my-shadow my-card flow1"'+"onclick="+redirectByIsMobile+result[keys[i]][0].depositoryId+")"+'>' +
lis.push('<li style="width:' + Width + ';float:left;">' +
'<div class="layui-card my-shadow my-card flow1"' + "onclick=" + redirectByIsMobile + result[keys[i]][0].depositoryId + ")" + '>' +
'<div class="layui-card-header"><h2>'
+result[keys[i]][0].depositoryName+'</h2></div>')
+ result[keys[i]][0].depositoryName + '</h2></div>')
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[keys[i]][0].applicantTime+'</div></div></li>');
+ result[keys[i]][0].applicantTime + '</div></div></li>');
}
lis.push("</div>");
lis.push('<hr class="layui-border-black">');
pre2+=result.length;
pre2 += result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), pre2 < res.count);
@ -251,37 +269,37 @@
flow.load({
elem: '#LAY_floor4' //流加载容器
,scrollElem: '#LAY_floor4' //滚动条所在元素,一般不用填,此处只是演示需要。
,isAuto:false
,done: function(page, next){ //执行下一页的回调
, scrollElem: '#LAY_floor4' //滚动条所在元素,一般不用填,此处只是演示需要。
, isAuto: false
, done: function (page, next) { //执行下一页的回调
let lis = [];
let result;
$.get('/depositoryRecord/myTashForScanQrCode?page='+page+'&size='+size+'&isDone=1', function(res){
$.get('/depositoryRecord/myTashForScanQrCode?page=' + page + '&size=' + size + '&isDone=1', function (res) {
var Width = "25%";
result=res.data;
result = res.data;
const keys = Object.keys(result); // 获取map中所有的键
var redirectByIsMobile = "";
lis.push("<div class='clearfix'>");
for (let i = 0; i < keys.length; i++) {
if(isMobile()){
if (isMobile()) {
// 如果是移动端
Width = "50%";
redirectByIsMobile = "openDetail4_mobile(";
}else{
} else {
redirectByIsMobile = "openDetail4(";
}
lis.push('<li style="width:'+ Width +';float:left;">' +
'<div class="layui-card my-shadow my-card flow1"'+"onclick="+redirectByIsMobile+result[keys[i]][0].depositoryId+")"+'>' +
lis.push('<li style="width:' + Width + ';float:left;">' +
'<div class="layui-card my-shadow my-card flow1"' + "onclick=" + redirectByIsMobile + result[keys[i]][0].depositoryId + ")" + '>' +
'<div class="layui-card-header"><h2>'
+result[keys[i]][0].depositoryName+'</h2></div>')
+ result[keys[i]][0].depositoryName + '</h2></div>')
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[keys[i]][0].applicantTime+'</div></div></li>');
+ result[keys[i]][0].applicantTime + '</div></div></li>');
}
lis.push("</div>")
lis.push('<hr class="layui-border-black">');
pre2+=result.length;
pre2 += result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), pre2 < res.count);
@ -296,8 +314,8 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/application_review?id='+item,
end:function () {
content: '/application_review?id=' + item,
end: function () {
location.reload()
}
});
@ -314,8 +332,8 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutView?id='+item,
end:function () {
content: '/ApplicationOutView?id=' + item,
end: function () {
location.reload()
}
});
@ -332,8 +350,8 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutMinByDid?depositoryId='+item+"&state=0",
end:function () {
content: '/ApplicationOutMinByDid?depositoryId=' + item + "&state=0",
end: function () {
location.reload()
}
});
@ -351,8 +369,8 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutMinByDidForMobile?depositoryId='+item+"&state=0",
end:function () {
content: '/ApplicationOutMinByDidForMobile?depositoryId=' + item + "&state=0",
end: function () {
location.reload()
}
});
@ -369,8 +387,8 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutMinByDid?depositoryId='+item+"&state=1",
end:function () {
content: '/ApplicationOutMinByDid?depositoryId=' + item + "&state=1",
end: function () {
location.reload()
}
});
@ -387,8 +405,8 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutMinByDidForMobile?depositoryId='+item+"&state=1",
end:function () {
content: '/ApplicationOutMinByDidForMobile?depositoryId=' + item + "&state=1",
end: function () {
location.reload()
}
});
@ -405,8 +423,8 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/StockTakingReview?id='+data,
end:function () {
content: '/StockTakingReview?id=' + data,
end: function () {
location.reload()
}
});
@ -423,8 +441,8 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/StockTakingView?id='+data,
end:function () {
content: '/StockTakingView?id=' + data,
end: function () {
location.reload()
}
});
@ -434,10 +452,10 @@
};
//定义一个函数判断是手机端还是pc端
function isMobile(){
if(window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
function isMobile() {
if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
return true; // 移动端
}else{
} else {
return false; // PC端
}
}

358
src/main/resources/templates/pages/application/my-task_back.html

@ -10,31 +10,45 @@
<link rel="stylesheet" href="/static/css/public.css" media="all">
</head>
<style>
.clearfix:after,.clearfix:before{
content: "";
display: table;
}
.clearfix:after{
clear: both;
}
.clearfix{
*zoom: 1;
}
</style>
<div class="layui-bg-gray" style="padding: 10px;">
<fieldset class="layui-elem-field layui-field-title">
<legend>未完成任务</legend>
</fieldset>
<table class="layui-table">
<colgroup>
<col width="25%">
<col width="25%">
<col width="25%">
<col width="25%">
</colgroup>
<tbody id="LAY_floor1">
</tbody>
</table>
<fieldset class="layui-elem-field layui-field-title">
<legend>审核任务</legend>
</fieldset>
<ul id="LAY_floor1" class="flow-default" style="width: 100%"></ul>
<fieldset class="layui-elem-field layui-field-title">
<legend>出库任务</legend>
</fieldset>
<ul id="LAY_floor3" class="flow-default" style="width: 100%"></ul>
</div>
<div class="layui-bg-gray" style="padding: 10px;">
<fieldset class="layui-elem-field layui-field-title">
<legend>已完成任务</legend>
</fieldset>
<table class="layui-table">
<tbody id="LAY_floor2">
</tbody>
</table>
<fieldset class="layui-elem-field layui-field-title">
<legend>审核任务</legend>
</fieldset>
<ul id="LAY_floor2" class="flow-default" style="width: 100%"></ul>
<fieldset class="layui-elem-field layui-field-title">
<legend>出库任务</legend>
</fieldset>
<ul id="LAY_floor4" class="flow-default" style="width: 100%"></ul>
</div>
@ -51,6 +65,28 @@
//先声明
function openDetail2(data) {
};
//先声明(用于pc端跳转)
function openDetail3(data) {
};
// 用于手机端跳转
function openDetail3_mobile(data) {
};
//先声明(用于pc端跳转)
function openDetail4(data) {
};
// 用于手机端跳转
function openDetail4_mobile(data) {
};
//先声明(用于pc端跳转)
function openDetailForTaking(data){
}
function openDetailTaking(data){
}
layui.use(['flow', 'layer', 'table', 'util'], function () {
var $ = layui.jquery,
layer = layui.layer,
@ -59,39 +95,60 @@
util = layui.util;
//每页的数量
var size=8;
let pre1=0,pre2=0;
let pre1=0,pre2=0,pre3 = 0,pre4 = 0;
flow.load({
elem: '#LAY_floor1' //流加载容器
,scrollElem: '#LAY_floor1' //滚动条所在元素,一般不用填,此处只是演示需要。
,isAuto:false
,done: function(page, next){ //执行下一页的回调
let lis = [];
let lis1 = [];
let result;
$.get('/depositoryRecord/myTask?page='+page+'&size='+size+'&isDone=0', function(res){
var Width = "25%";
result=res.data;
lis.push("<div class='clearfix'>");
if(isMobile()){
Width = "50%";
}
for (let i=0;i<result.length;i++){
if (i%4===0){
lis.push('<tr >');
}
lis.push('<td ><div class="layui-card my-shadow my-card flow1" onclick="openDetail1('
lis.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetail1('
+result[i].id+')"><div class="layui-card-header"><h2>'
+result[i].applicantName+'的')
+result[i].applicantName+'的');
lis.push('出库请求</h2></div>');
lis.push('<div class="layui-card-body">'+result[i].applyRemark
+'</div><div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].applicantTime+'</div></div></td>');
if (i%4===3){
lis.push('</tr>');
}
}
if (result.length%4!==0){
lis.push('</tr>');
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].applicantTime+'</div></div></li>');
}
lis.push('</div>');
lis.push('<hr class="layui-border-black">')
pre1+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), pre1 < res.count);
});
$.get('/stockTaking/myTask?page='+page+'&size='+size+'&isDone=0', function(res){
var Width = "25%";
result=res.data;
lis1.push("<div class='clearfix'>");
if(isMobile()){
Width = "50%";
}
for (let i=0;i<result.length;i++){
lis1.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailForTaking('
+result[i].id+')"><div class="layui-card-header"><h2>'
+result[i].originatorName+'的');
lis1.push('盘点记录</h2></div>');
lis1.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].createTime+'</div></div></li>');
}
lis1.push('</div>');
lis1.push('<hr class="layui-border-black">')
pre3+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis1.join(''), pre3 < res.count);
});
}
});
flow.load({
@ -100,14 +157,17 @@
,isAuto:false
,done: function(page, next){ //执行下一页的回调
let lis = [];
let lis1 = [];
let result;
$.get('/depositoryRecord/myTask?page='+page+'&size='+size+'&isDone=1', function(res){
var Width = "25%";
result=res.data;
lis.push("<div class='clearfix'>")
for (let i=0;i<result.length;i++){
if (i%4===0){
lis.push('<tr >');
if(isMobile()){
Width = "50%";
}
lis.push('<td><div class="layui-card my-shadow my-card flow1" onclick="openDetail2('
lis.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetail2('
+result[i].id+')" ><div class="layui-card-header"><h2>'
+result[i].applicantName+'的')
if (result[i].type===1){
@ -115,16 +175,72 @@
}else {
lis.push('出库请求</h2></div>');
}
lis.push('<div class="layui-card-body">'+result[i].applyRemark
+'</div><div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].applicantTime+'</div></div></td>');
if (i%4===3){
lis.push('</tr>');
}
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].applicantTime+'</div></div></li>');
}
if (result.length%4!==0){
lis.push('</tr>');
lis.push("</div>");
lis.push('<hr class="layui-border-black">');
pre2+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), pre2 < res.count);
});
$.get('/stockTaking/myTask?page='+page+'&size='+size+'&isDone=1', function(res){
var Width = "25%";
result=res.data;
lis1.push("<div class='clearfix'>");
if(isMobile()){
Width = "50%";
}
for (let i=0;i<result.length;i++){
lis1.push('<li style="width:'+ Width +';float:left;"><div class="layui-card my-shadow my-card flow1" onclick="openDetailTaking('
+result[i].id+')"><div class="layui-card-header"><h2>'
+result[i].originatorName+'的');
lis1.push('盘点记录</h2></div>');
lis1.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[i].createTime+'</div></div></li>');
}
lis1.push('</div>');
lis1.push('<hr class="layui-border-black">')
pre4+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis1.join(''), pre4 < res.count);
});
}
});
flow.load({
elem: '#LAY_floor3' //流加载容器
,scrollElem: '#LAY_floor3' //滚动条所在元素,一般不用填,此处只是演示需要。
,isAuto:false
,done: function(page, next){ //执行下一页的回调
let lis = [];
let result;
$.get('/depositoryRecord/myTashForScanQrCode?page='+page+'&size='+size+'&isDone=0', function(res){
var Width = "25%";
result=res.data;
const keys = Object.keys(result); // 获取map中所有的键
let redirectByIsMobile = "";
lis.push("<div class='clearfix'>");
if(isMobile()){
// 如果是移动端
Width = "50%";
redirectByIsMobile = "openDetail3_mobile(";
}else{
redirectByIsMobile = "openDetail3(";
}
for (let i = 0; i < keys.length; i++) {
lis.push('<li style="width:'+ Width +';float:left;">' +
'<div class="layui-card my-shadow my-card flow1"'+"onclick="+redirectByIsMobile+result[keys[i]][0].depositoryId+")"+'>' +
'<div class="layui-card-header"><h2>'
+result[keys[i]][0].depositoryName+'</h2></div>')
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[keys[i]][0].applicantTime+'</div></div></li>');
}
lis.push("</div>");
lis.push('<hr class="layui-border-black">');
pre2+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
@ -133,6 +249,45 @@
}
});
flow.load({
elem: '#LAY_floor4' //流加载容器
,scrollElem: '#LAY_floor4' //滚动条所在元素,一般不用填,此处只是演示需要。
,isAuto:false
,done: function(page, next){ //执行下一页的回调
let lis = [];
let result;
$.get('/depositoryRecord/myTashForScanQrCode?page='+page+'&size='+size+'&isDone=1', function(res){
var Width = "25%";
result=res.data;
const keys = Object.keys(result); // 获取map中所有的键
var redirectByIsMobile = "";
lis.push("<div class='clearfix'>");
for (let i = 0; i < keys.length; i++) {
if(isMobile()){
// 如果是移动端
Width = "50%";
redirectByIsMobile = "openDetail4_mobile(";
}else{
redirectByIsMobile = "openDetail4(";
}
lis.push('<li style="width:'+ Width +';float:left;">' +
'<div class="layui-card my-shadow my-card flow1"'+"onclick="+redirectByIsMobile+result[keys[i]][0].depositoryId+")"+'>' +
'<div class="layui-card-header"><h2>'
+result[keys[i]][0].depositoryName+'</h2></div>')
lis.push('<div class="layui-col-md4 my-time" style="margin-left: 15px; color: #999;font-size: 12px;">'
+result[keys[i]][0].applicantTime+'</div></div></li>');
}
lis.push("</div>")
lis.push('<hr class="layui-border-black">');
pre2+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), pre2 < res.count);
});
}
});
openDetail1 = function (item) {
var index = layer.open({
title: '请求详情',
@ -150,7 +305,7 @@
$(window).on("resize", function () {
layer.full(index);
});
}
};
openDetail2 = function (item) {
var index = layer.open({
title: '请求详情',
@ -167,8 +322,125 @@
$(window).on("resize", function () {
layer.full(index);
});
}
};
// 用于pc端跳转
openDetail3 = function (item) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutMinByDid?depositoryId='+item+"&state=0",
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
};
// 用于移动端跳转
openDetail3_mobile = function (item) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutMinByDidForMobile?depositoryId='+item+"&state=0",
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
};
// 用于pc端跳转
openDetail4 = function (item) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutMinByDid?depositoryId='+item+"&state=1",
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
};
// 用于移动端跳转
openDetail4_mobile = function (item) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutMinByDidForMobile?depositoryId='+item+"&state=1",
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
};
openDetailForTaking = function (data) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/StockTakingReview?id='+data,
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
};
openDetailTaking = function (data) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/StockTakingView?id='+data,
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
};
//定义一个函数判断是手机端还是pc端
function isMobile(){
if(window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
return true; // 移动端
}else{
return false; // PC端
}
}
});
</script>
</html>

43
src/main/resources/templates/pages/chart/chart-in_back.html

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<title>首页三</title>
@ -39,36 +39,34 @@
<div class="layuimini-main">
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">转入物料数量</div>
<div class="layui-card-header">当日转入物料数量</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
<span th:text="${allInCount}"></span>
<span th:text="${InCount}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
比昨天 <span style="color: #1aa094" th:text="${radioForSum>0?radioForSum +'% ▲' : radioForSum + '% ▼'}"></span><br>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">转入物料金额</div>
<div class="layui-card-header">当日转入物料金额</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
<span th:text="${allInPrice}"></span>
<span th:text="${InPrice}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
比昨天 <span style="color: #1aa094" th:text="${radioForPrice > 0.0?radioForPrice+'% ▲' : radioForPrice + '% ▼'}"></span><br>
</div>
</div>
</div>
@ -78,15 +76,11 @@
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">购入物料数量</div>
<div class="layui-card-header">全部购入物料数量</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
<span th:text="${InCount}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
<span th:text="${allInCount}"></span>
</div>
</div>
</div>
@ -96,15 +90,11 @@
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">入库物料金额</div>
<div class="layui-card-header">全部入库物料金额</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
<span th:text="${InPrice}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
<span th:text="${allInPrice}"></span>
</div>
</div>
</div>
@ -329,7 +319,6 @@
success: function (result) {
layer.close(this.layerIndex);
if (result.code === 0) {
echartsRecords.setOption(optionRecords);
echartsPies.setOption(optionPies);
echartsDataset.setOption(optionDataset);
@ -377,6 +366,8 @@
name: result.data.depository_name[i]
})
}
var dimensions = result.data.depository_data.sourceList[result.data.depository_data.sourceList.length - 1]
optionDataset.dataset.dimensions = dimensions;
@ -416,7 +407,7 @@
);
optionRecords = {
title: {
text: '入库仓库-报表图'
text: '入库-报表图'
},
tooltip: {
trigger: 'axis',

23
src/main/resources/templates/pages/chart/chart-out_back.html

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<title>首页三</title>
@ -40,15 +40,14 @@
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">出物料数量</div>
<div class="layui-card-header">物料数量</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
<span th:text="${allOutCount}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
比昨天 <a style="color: #1aa094" th:text="${outAllCountRadio > 0?outAllCountRadio+'% ▲' :outAllCountRadio +'% ▼' }" ></a><br>
</div>
</div>
</div>
@ -58,16 +57,14 @@
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">出物料金额</div>
<div class="layui-card-header">物料金额</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
<span th:text="${allOutPrice}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
</div>
比昨天 <a style="color: #1aa094" th:text="${outAllPriceRadio > 0?outAllPriceRadio+'% ▲' :outAllPriceRadio +'% ▼' }" ></a><br> </div>
</div>
</div>
</div>
@ -76,15 +73,14 @@
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">出售物料数量</div>
<div class="layui-card-header">实际物料出库数量</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
<span th:text="${OutCount}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
比昨天 <a style="color: #1aa094" th:text="${outCountRadio > 0?outCountRadio+'% ▲' :outCountRadio +'% ▼' }" ></a><br>
</div>
</div>
</div>
@ -94,15 +90,14 @@
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">出库物料金额</div>
<div class="layui-card-header">实际物料出库金额</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
<span th:text="${OutPrice}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
比昨天 <a style="color: #1aa094" th:text="${outPriceRadio > 0?outPriceRadio+'% ▲' :outPriceRadio +'% ▼' }" ></a><br> </div>
</div>
</div>
</div>

2
src/main/resources/templates/pages/chart/chart-stock_back.html

@ -207,7 +207,6 @@
xAxis: {type: 'category'},
yAxis: {},
series: [
{type: 'bar'},
{type: 'bar'},
{type: 'bar'}
]
@ -390,6 +389,7 @@
echartsRecords.setOption(optionRecords);
echartsPies.setOption(optionPies);
echartsDataset.setOption(optionDataset);
console.log(optionDataset)
echartsMap.setOption(optionMap);
}
}

4
src/main/resources/templates/pages/depository/table-in.html

@ -143,9 +143,9 @@
{field: 'aircode', width: 150, title: '提交编码', sort: true},
{field: 'mname', width: 150, title: '物料名称'},
{field: 'mcode', width: 150, title: '存货编码'},
{field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'quantity', width: 150, title: '数量', sort: true},
{field: 'price', title: '金额', minWidth: 150, sort: true},
{field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'applicantName', width: 200, title: '提交人'},
{field: 'applicantTime', width: 200, title: '提交时间', sort: true},
{field: 'applyRemark', width: 200, title: '备注'},
@ -315,7 +315,7 @@
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
content: '/selectMaterial?type=1&mname=""',
content: '/getMaterialAll?type=1&mname=""',
move: '.layui-layer-title',
fixed: false

4
src/main/resources/templates/pages/depository/table-out.html

@ -124,7 +124,7 @@
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
content: '/selectMaterial?type=1&mname=""',
content: '/getMaterialAll?type=1&mname=""',
move: '.layui-layer-title',
fixed: false,
success: function(layero, index){
@ -175,9 +175,9 @@
{field: 'code', width: 150, title: '申请编码', sort: true},
{field: 'mname', width: 150, title: '物料名称'},
{field: 'mcode', width: 150, title: '存货编码'},
{field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'quantity', width: 150, title: '数量', sort: true},
{field: 'price', title: '金额', minWidth: 150, sort: true},
{field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'state', width: 150, title: '流程状态'},
{
field: 'pass', title: '是否完成出库', minWidth: 120, templet: function (d) {

6
src/main/resources/templates/pages/material/selectMaterial.html

@ -38,7 +38,7 @@
}
});
$.ajax({
url: "/material/treeMenus",
url: "/material/treeMenus_Test",
data: JSON.stringify(req),
type: 'post',
dataType: 'json',
@ -49,9 +49,7 @@
success: function (d) {
layer.close(this.layerIndex);
var data2 = d.data;
test.reload({
data: data2
});
}
});
})

135
src/main/resources/templates/pages/other/welcome.html

@ -26,12 +26,12 @@
.layui-red {color:red}
.main_btn > p {height:40px;}
.layui-bg-number {background-color:#F8F8F8;}
.layuimini-notice:hover {background:#f6f6f6;}
.layuimini-notice {padding:7px 16px;clear:both;font-size:12px !important;cursor:pointer;position:relative;transition:background 0.2s ease-in-out;}
.layuimini-notice-title,.layuimini-notice-label {
.layuimini-notice:hover,.layuimini-myTask:hover {background:#f6f6f6;}
.layuimini-notice,.layuimini-myTask {padding:7px 16px;clear:both;font-size:12px !important;cursor:pointer;position:relative;transition:background 0.2s ease-in-out;}
.layuimini-notice-title,.layuimini-notice-label,.layuimini-myTask-type {
padding-right: 70px !important;text-overflow:ellipsis!important;overflow:hidden!important;white-space:nowrap!important;}
.layuimini-notice-title {line-height:28px;font-size:14px;}
.layuimini-notice-extra {position:absolute;top:50%;margin-top:-8px;right:16px;display:inline-block;height:16px;color:#999;}
.layuimini-notice-title,.layuimini-myTask-type {line-height:28px;font-size:14px;}
.layuimini-notice-extra,.layuimini-myTask-extra {position:absolute;top:50%;margin-top:-8px;right:16px;display:inline-block;height:16px;color:#999;}
</style>
</head>
<body>
@ -167,14 +167,6 @@
</div>
</div>
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header"><i class="fa fa-line-chart icon"></i>报表统计</div>
<div class="layui-card-body">
<div id="echarts-records" style="width: 100%;min-height:500px"></div>
</div>
</div>
</div>
</div>
</div>
@ -192,6 +184,19 @@
</div>
</div>
</div>
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header"><i class="fa fa fa-map-o icon"></i>我的任务</div>
<div class="layui-card-body layui-text">
<div class="layuimini-myTask" th:each="myTask,iterStat:${myTaskList}">
<div class="layuimini-myTask-type" th:text="${myTask.getType()}"></div>
<div class="layuimini-myTask-extra" th:text="${myTask.getApplicantTime()}"></div>
<div class="layuimini-myTask-name " th:text="${myTask.getApplicantName()}"></div>
<div class="layuimini-myTask-id layui-hide" th:text="${myTask.getId()}"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -237,70 +242,50 @@
});
});
/**
* 报表功能
*/
/* var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
var optionRecords = {
tooltip: {
trigger: 'axis'
},
legend: {
data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['周一','周二','周三','周四','周五','周六','周日']
},
yAxis: {
type: 'value'
},
series: [
{
name:'邮件营销',
type:'line',
data:[120, 132, 101, 134, 90, 230, 210]
},
{
name:'联盟广告',
type:'line',
data:[220, 182, 191, 234, 290, 330, 310]
},
{
name:'视频广告',
type:'line',
data:[150, 232, 201, 154, 190, 330, 410]
},
{
name:'直接访问',
type:'line',
data:[320, 332, 301, 334, 390, 330, 320]
},
{
name:'搜索引擎',
type:'line',
data:[820, 932, 901, 934, 1290, 1330, 1320]
}
]
};
echartsRecords.setOption(optionRecords);
* 查看任务信息
**/
$('body').on('click', '.layuimini-myTask', function () {
var id = $(this).children('.layuimini-myTask-id').text();
console.log(id);
var type = $(this).children('.layuimini-myTask-type').text();
if(type === '出库请求'){
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/application_review?id=' + id,
end: function () {
location.reload()
}
});
// echarts 窗口缩放自适应
window.onresize = function(){
echartsRecords.resize();
}*/
$(window).on("resize", function () {
layer.full(index);
});
}else{
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/StockTakingReview?id=' + id,
end: function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
}
});
});
</script>

82
src/main/resources/templates/pages/other/welcome_mobile.html

@ -26,12 +26,12 @@
.layui-red {color:red}
.main_btn > p {height:40px;}
.layui-bg-number {background-color:#F8F8F8;}
.layuimini-notice:hover {background:#f6f6f6;}
.layuimini-notice {padding:7px 16px;clear:both;font-size:12px !important;cursor:pointer;position:relative;transition:background 0.2s ease-in-out;}
.layuimini-notice-title,.layuimini-notice-label {
.layuimini-notice:hover,.layuimini-myTask:hover {background:#f6f6f6;}
.layuimini-notice,.layuimini-myTask {padding:7px 16px;clear:both;font-size:12px !important;cursor:pointer;position:relative;transition:background 0.2s ease-in-out;}
.layuimini-notice-title,.layuimini-notice-label,.layuimini-myTask-type {
padding-right: 70px !important;text-overflow:ellipsis!important;overflow:hidden!important;white-space:nowrap!important;}
.layuimini-notice-title {line-height:28px;font-size:14px;}
.layuimini-notice-extra {position:absolute;top:50%;margin-top:-8px;right:16px;display:inline-block;height:16px;color:#999;}
.layuimini-notice-title,.layuimini-myTask-type {line-height:28px;font-size:14px;}
.layuimini-notice-extra,.layuimini-myTask-extra {position:absolute;top:50%;margin-top:-8px;right:16px;display:inline-block;height:16px;color:#999;}
</style>
</head>
<body>
@ -150,15 +150,15 @@
</a>
</div>
<div class="layui-col-xs3 layuimini-qiuck-module">
<a href="javascript:;" layuimini-content-href="/my_task" data-title="我的任务" data-icon="fa fa-snowflake-o">
<a href="javascript:;" layuimini-content-href="/stockTaking" data-title="库存盘点" data-icon="fa fa-snowflake-o">
<i class="fa fa-tasks"></i>
<cite>我的任务</cite>
<cite>库存盘点</cite>
</a>
</div>
<div class="layui-col-xs3 layuimini-qiuck-module">
<a href="javascript:;" layuimini-content-href="/my_apply" data-title="我的申请" data-icon="fa fa-search">
<i class="fa fa-paper-plane"></i>
<cite>我的申请</cite>
<a href="javascript:;" layuimini-content-href="/material_add" data-title="物料创建" data-icon="fa fa-search">
<i class="fa fa-plus"></i>
<cite>物料创建</cite>
</a>
</div>
</div>
@ -171,19 +171,32 @@
</div>
<div class="layui-col-md4">
<div class="layui-card">
<div class="layui-card-header"><i class="fa fa-bullhorn icon icon-tip"></i>系统公告</div>
<div class="layui-card-body layui-text">
<div class="layuimini-notice" th:each="notice,iterStat:${notices}">
<div class="layuimini-notice-title" th:text="${notice.getTitle()}">修改选项卡样式</div>
<div class="layuimini-notice-extra" th:text="${notice.getTime()}">2019-07-11 23:06</div>
<div class="layuimini-notice-title" th:text="${notice.getTitle()}"></div>
<div class="layuimini-notice-extra" th:text="${notice.getTime()}"></div>
<div class="layuimini-notice-content layui-hide" th:text="${notice.getContent()}">
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header"><i class="fa fa fa-map-o icon"></i>我的任务</div>
<div class="layui-card-body layui-text">
<div class="layuimini-myTask" th:each="myTask,iterStat:${myTaskList}">
<div class="layuimini-myTask-type" th:text="${myTask.getType()}"></div>
<div class="layuimini-myTask-extra" th:text="${myTask.getApplicantTime()}"></div>
<div class="layuimini-myTask-name " th:text="${myTask.getApplicantName()}"></div>
<div class="layuimini-myTask-id layui-hide" th:text="${myTask.getId()}"></div>
<hr/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -229,6 +242,49 @@
});
});
/**
* 查看任务信息
**/
$('body').on('click', '.layuimini-myTask', function () {
var id = $(this).children('.layuimini-myTask-id').text();
var type = $(this).children('.layuimini-myTask-type').text();
if(type === '出库请求'){
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/application_review?id=' + id,
end: function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
}else{
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/StockTakingReview?id=' + id,
end: function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
}
});
});
</script>

66
src/main/resources/templates/pages/stockTaking/stockTaking.html

@ -17,7 +17,9 @@
line-height: 38px;
border: 1px solid rgb(238, 238, 238);
}
.layui-card-body{
padding: 0px;
}
.layui-form-label {
padding: 9px 0px;
text-align: left;
@ -43,12 +45,12 @@
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto; ">
<div carousel-item style="overflow: inherit">
<div>
<fieldset class="table-search-fieldset">
<fieldset class="table-search-fieldset" style="padding-left: 0px;padding-right: 0px">
<legend>库存盘点</legend>
<div class="layui-fluid">
<div class="layui-card">
<form class="layui-form"
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px"
style="margin: 0 auto;max-width: 700px;padding-bottom: 200px"
lay-filter="form1" id="form1">
<div class="layui-card-body" id="takingHeader" style="padding-right: 0px">
<div class="layui-form-item">
@ -754,8 +756,16 @@
var shelfLife = material.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) {
$("#" + "producedDateItem" + idNumber).show();
$("#" + "producedDate" + idNumber).attr("lay-verify", "required");
var producedDateList = d.data['producedDateList'];
if (producedDateList != null && producedDateList != undefined && producedDateList.length > 0) {
$.each(producedDateList, function (index, item) {
$("#" + "producedDate" + idNumber).append(new Option(item, item));
})
}
form.render();
}else{
$("#" + "producedDateItem" + idNumber).hide();
form.render();
}
}
@ -875,7 +885,10 @@
})
}
form.render();
}
else{
$("#" + "producedDateItem" + idNumber).hide();
form.render();
}
}
@ -989,11 +1002,20 @@
});
form.render();
}
var shelfLife = material.shelfLife;
var shelfLife = d.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) {
$("#" + "producedDateItem" + idNumber).show();
$("#" + "producedDate" + idNumber).attr("lay-verify", "required");
var producedDateList = d['producedDateList'];
if (producedDateList != null && producedDateList != undefined && producedDateList.length > 0) {
$.each(producedDateList, function (index, item) {
$("#" + "producedDate" + idNumber).append(new Option(item, item));
})
}
form.render();
}
else{
$("#" + "producedDateItem" + idNumber).hide();
form.render();
}
}
}
@ -1230,8 +1252,17 @@
var shelfLife = data.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) {
$("#" + "producedDateItem" + idNumber).show();
$("#" + "producedDate" + idNumber).attr("lay-verify", "required");
var producedDateList = data['producedDateList'];
if (producedDateList != null && producedDateList != undefined && producedDateList.length > 0) {
$.each(producedDateList, function (index, item) {
$("#" + "producedDate" + idNumber).append(new Option(item, item));
})
}
form.render();
}
else{
$("#" + "producedDateItem" + idNumber).hide();
form.render();
}
}
})
@ -1321,8 +1352,17 @@
var shelfLife = material.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) {
$("#" + "producedDateItem" + id).show();
$("#" + "producedDate" + id).attr("lay-verify", "required");
var producedDateList = material['producedDateList'];
if (producedDateList != null && producedDateList != undefined && producedDateList.length > 0) {
$.each(producedDateList, function (index, item) {
$("#" + "producedDate" + id).append(new Option(item, item));
})
}
form.render();
}
else{
$("#" + "producedDateItem" + idNumber).hide();
form.render();
}
form.render();
}

10
src/main/resources/templates/pages/stockTaking/stockTakingComplete.html

@ -252,8 +252,8 @@
element = layui.element,
form = layui.form;
var position = 0, states = {}, number = 3;
states = [{title: "待处理"}];
// var position = 0, states = {}, number = 3;
// states = [{title: "待处理"}];
// 用于分步表单加载
step.render({
elem: '#stepForm',
@ -261,9 +261,9 @@
width: '100%', //设置容器宽度
stepWidth: '750px',
height: '1495px',
position: position,
number: number,
stepItems: states
// position: position,
// number: number,
stepItems: []
});

93
src/main/resources/templates/pages/stockTaking/stockTakingReview.html

@ -51,7 +51,8 @@
<div class="layui-form-item">
<label class="layui-form-label">盘点位置:</label>
<div class="layui-input-block">
<input type="text" name="mainId" id="mainId" th:value="${mainRecord.getId()}" style="display:none;">
<input type="text" name="mainId" id="mainId"
th:value="${mainRecord.getId()}" style="display:none;">
<input type="text" class="layui-input"
th:value="${mainRecord.getDepositoryName()}"
style="border-style: none"
@ -195,7 +196,8 @@
<label class="layui-form-label">盘点结果:</label>
<div class="layui-input-block">
<input type="text" class="layui-input" id="takingResult" readonly
<input type="text" class="layui-input" id="takingResult"
readonly
th:value="${recordMin.getTakingResultShow()}"
th:attr="id='takingResult'+${recordMin.getId()},name='takingResult'+${recordMin.getId()}"
lay-verify="required"/>
@ -218,22 +220,31 @@
</fieldset>
<div id="review">
<div class="layui-form" style="margin: 0 auto;max-width: 900px;padding-top: 40px;">
<div class="layui-form"
style="margin: 0 auto;max-width: 900px;padding-top: 40px;">
<div class="layui-form-item">
<label class="layui-form-label">审核备注:</label>
<div class="layui-input-block">
<textarea id="auditOpinion" name="auditOpinion" placeholder="请填写相关原因及申请原因" value="" class="layui-textarea"></textarea>
<textarea id="auditOpinion" name="auditOpinion"
placeholder="请填写相关原因及申请原因" value=""
class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-row layui-col-space15">
<div class="layui-input-block">
<button type="button" class="layui-btn" onclick="review(1)">
&emsp;审核通过&emsp;
</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="review(2)">
&emsp;审核不通过&emsp;
</button>
<div class="layui-col-xs12 layui-col-md3" style="padding: 7.5px">
<button type="button" class="layui-btn" onclick="review(1)">
&emsp;同意&emsp;
</button>
</div>
<div class="layui-col-xs12 layui-col-md3" style="padding: 7.5px">
<button type="button" class="layui-btn layui-btn-danger"
onclick="review(2)">
&emsp;驳回&emsp;
</button>
</div>
</div>
</div>
</div>
@ -251,15 +262,17 @@
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
function review(data){}
layui.use(['form','step','element'], function () {
function review(data) {
}
layui.use(['form', 'step', 'element'], function () {
var $ = layui.$,
step = layui.step,
element = layui.element,
form = layui.form;
var position=0,states={},number = 2;
states = [ {title: "待审核"}];
// var position = 0, states = {}, number = 2;
// states = [{title: "待审核"}];
// 用于分步表单加载
step.render({
elem: '#stepForm',
@ -267,37 +280,36 @@
width: '100%', //设置容器宽度
stepWidth: '750px',
height: '1495px',
position: position,
number:number,
stepItems: states
// position: position,
// number: number,
stepItems: []
});
// 用于获取审核结果与审核的单号
review=function (pass) {
review = function (pass) {
let data = {};
data.mainId = $("#mainId").val();
data.auditOpinion = $("#auditOpinion").val();
data.departmentManagerState = pass;
$.ajax({
url:"/stockTaking/review",
type:'post',
dataType:'json',
url: "/stockTaking/review",
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data:JSON.stringify(data),
beforeSend:function () {
this.layerIndex = layer.load(0, { shade: [0.5, '#393D49'] });
data: JSON.stringify(data),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success:function(d){
success: function (d) {
layer.close(this.layerIndex);
if(d.status >= 300){
if (d.status >= 300) {
var errMsg = d.data.errMsg;
// 获取出错的子订单
layer.confirm("当前盘点数量中有溢出情况,需要进行转移", {
btn:["确定"]
},function () { // 继续
btn: ["确定"]
}, function () { // 继续
layer.open({
type: 2,
title: '转移物料',
@ -307,23 +319,23 @@
area: ['100%', '100%'],
move: '.layui-layer-title',
fixed: false,
content: '/stockTakingTransfer?minIds='+errMsg.errIds,
content: '/stockTakingTransfer?minIds=' + errMsg.errIds,
end: function (res) {
if(res.status >= 300){
if (res.status >= 300) {
layer.close(layer.index);
layer.msg("提交失败,联系开发人员解决", {
icon: 5,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
}, function(){
window.location = '/StockTakingView?id='+data.mainId;
}, function () {
window.location = '/StockTakingView?id=' + data.mainId;
});
}else{
} else {
layer.close(layer.index);
layer.msg("提交成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
}, function(){
window.location = '/StockTakingView?id='+data.mainId;
}, function () {
window.location = '/StockTakingView?id=' + data.mainId;
});
}
}
@ -331,13 +343,12 @@
});
}
else{
} else {
layer.msg("提交成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
}, function(){
window.location = '/StockTakingView?id='+data.mainId;
}, function () {
window.location = '/StockTakingView?id=' + data.mainId;
});
}
},

14
src/main/resources/templates/pages/stockTaking/stockTakingView.html

@ -45,7 +45,7 @@
<div class="layui-fluid">
<div class="layui-card">
<form class="layui-form"
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px"
style="margin: 0 auto;max-width: 700px;"
lay-filter="form1" id="form1">
<div class="layui-card-body" id="takingHeader" style="padding-right: 0px">
<div class="layui-form-item">
@ -274,7 +274,7 @@
element = layui.element,
form = layui.form;
var position = 0, states = {}, number = 2;
/* var position = 0, states = {}, number = 2;
var ifShow1 = ($("#reviewTime").val() === "");
var ifShow = ($("#completeTime").val() === "");
@ -298,7 +298,7 @@
}else{
$("#takingFooter1").show();
states = [{title: "已处理"}]
}
}*/
@ -308,10 +308,10 @@
filter: 'stepForm',
width: '100%', //设置容器宽度
stepWidth: '750px',
height: '1300px',
position: position,
number: number,
stepItems: states
height: '1050px',
// position: position,
// number: number,
stepItems: []
});
});

171
src/test/java/com/dreamchaser/depository_manage/TestForMaterialTree.java

@ -1,85 +1,21 @@
package com.dreamchaser.depository_manage;
import cn.hutool.core.date.StopWatch;
import cn.hutool.core.lang.Snowflake;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PortConfig;
import com.dreamchaser.depository_manage.config.QyWxConfig;
import com.dreamchaser.depository_manage.config.QyWxJMJM.com.qq.weixin.mp.aes.AesException;
import com.dreamchaser.depository_manage.config.QyWxJMJM.com.qq.weixin.mp.aes.WXBizMsgCrypt;
import com.dreamchaser.depository_manage.config.QyWx_approval_template.ApprovalTemplate;
import com.dreamchaser.depository_manage.config.QyWx_approval_template.Approval_template_summary_info;
import com.dreamchaser.depository_manage.controller.PageController;
import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.mapper.DepositoryRecordMapper;
import com.dreamchaser.depository_manage.mapper.MaterialMapper;
import com.dreamchaser.depository_manage.mapper.MaterialTypeMapper;
import com.dreamchaser.depository_manage.pojo.ApplicationOutRecordP;
import com.dreamchaser.depository_manage.pojo.MaterialP;
import com.dreamchaser.depository_manage.pojo.StockTakingChildP;
import com.dreamchaser.depository_manage.pojo.UserByPortP;
import com.dreamchaser.depository_manage.pojo.callBackXml.CallBackBaseXml;
import com.dreamchaser.depository_manage.pojo.callBackXml.CallBackXml_button;
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalCallBackInfo;
import com.dreamchaser.depository_manage.pojo.callBackXml.callBackXml_button_templatecard.TemplateCard;
import com.dreamchaser.depository_manage.pojo.callBackXml.callBackXml_button_templatecard.TemplateCard_SelectedItems;
import com.dreamchaser.depository_manage.pojo.callBackXml.callBackXml_button_templatecard.TemplateCard_button_selection;
import com.dreamchaser.depository_manage.service.*;
import com.dreamchaser.depository_manage.service.impl.MaterialServiceImpl;
import com.dreamchaser.depository_manage.service.impl.QyWxOperationService;
import com.dreamchaser.depository_manage.utils.*;
import lombok.Data;
import lombok.extern.log4j.Log4j;
import lombok.extern.log4j.Log4j2;
import lombok.var;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.http.protocol.HTTP;
import org.apache.poi.poifs.property.Child;
import org.apache.poi.ss.formula.functions.Offset;
import org.apache.poi.ss.formula.functions.T;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.joda.time.DateTimeUtils;
import org.junit.runner.RunWith;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import org.xmlunit.util.Convert;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.swing.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.*;
import org.xml.sax.InputSource;
@SpringBootTest
@RunWith(SpringRunner.class)
public class TestForMaterialTree {
@ -99,7 +35,7 @@ public class TestForMaterialTree {
@org.junit.Test
public void test1(){
List<Object> objectList = InitTree_Test();
List<Object> objectList = buildTree_New(InitTree_Test_New(), Long.valueOf(0));
}
@ -116,36 +52,49 @@ public class TestForMaterialTree {
return newList;
}
public List<Object> InitTree_Test() {
/**
* 用于构造物料树结构
* @return
*/
public List<Object> InitTree_Test_New() {
// 获取所有物料类型
List<MaterialType> materialTypeAll = materialTypeMapper.findMaterialTypeAll();
// 物料总数
Integer totalVal = materialTypeAll.size();
// 定义分页数量
double size = 100.0;
// 定义线程数
Integer threadSize = (int) Math.ceil(totalVal / size);
// 开启对应数量的线程
ExecutorService exs = Executors.newFixedThreadPool(threadSize);
// 结果集
// 树结构结果集
List<Object> list = new ArrayList<>();
// 线程结果集
List<Future<Object>> futureList = new ArrayList<Future<Object>>();
// 1.定义CompletionService
CompletionService<Object> completionService = new ExecutorCompletionService<Object>(exs);
// 物料类型id列表
List<Long> materialTypeList = new ArrayList<>();
for (int i = 0; i < materialTypeAll.size(); i++) {
// 获取当前类型
MaterialType materialType = materialTypeAll.get(i);
if (((i + 1) % 100) == 0) {
Future<Object> future = completionService.submit(new TaskTest(materialTypeList));
futureList.add(future);
materialTypeList = new ArrayList<>();
if (((i + 1) % 100) == 0) { // 如果有100个开启线程进行处理
materialTypeList.add(materialType.getOldId());
Future<Object> future = completionService.submit(new TaskTest_New(materialTypeList));
futureList.add(future); // 添加到结果集
materialTypeList = new ArrayList<>(); // 情况列表
} else {
// 添加id到列表中
materialTypeList.add(materialType.getOldId());
}
}
if (materialTypeList.size() > 0) {
Future<Object> future = completionService.submit(new TaskTest(materialTypeList));
// 如果有剩余,开启线程进行处理
Future<Object> future = completionService.submit(new TaskTest_New(materialTypeList));
futureList.add(future);
}
@ -159,40 +108,46 @@ public class TestForMaterialTree {
} catch (ExecutionException e) {
e.printStackTrace();
}
list.add(result);
list.addAll((Collection<?>) result);
}
// 进行最终的封装
return list;
}
// 用于执行测试新算法
class TaskTest implements Callable<Object> {
class TaskTest_New implements Callable<Object> {
// 待处理的物料类型id列表
List<Long> materialTypeIdList;
public TaskTest(List<Long> materialTypeByCondition) {
public TaskTest_New(List<Long> materialTypeByCondition) {
this.materialTypeIdList = materialTypeByCondition;
}
@Override
public Object call() throws Exception {
// 定义树结构结果集
List<Object> list = new ArrayList<>();
// 开启对应数量的线程
// 查询当前物料类型id列表中的物料类型
List<Material> materialByTypeIds = materialMapper.findMaterialByTypeIds(materialTypeIdList);
// 查询当前物料类型所包含的物料
List<MaterialType> materialTypeByOldIds = materialTypeMapper.findMaterialTypeByOldIds(materialTypeIdList);
// 定义线程集
ExecutorService exs = Executors.newFixedThreadPool(materialTypeByOldIds.size());
// 结果集
// 定义线程结果集
List<Future<Object>> futureList = new ArrayList<Future<Object>>();
// 1.定义CompletionService
CompletionService<Object> completionService = new ExecutorCompletionService<Object>(exs);
for (int i = 0; i < materialTypeByOldIds.size(); i++) {
// 获取当前物料类型
MaterialType mt = materialTypeByOldIds.get(i);
Future<Object> future = completionService.submit(new MtTaskTest(mt, materialByTypeIds));
// 开启对应线程
Future<Object> future = completionService.submit(new MtTaskTest_New(mt, materialByTypeIds));
// 添加到线程结果列表
futureList.add(future);
}
// 3.获取结果
@ -207,7 +162,6 @@ public class TestForMaterialTree {
}
list.add(result);
}
return list;
}
@ -215,12 +169,12 @@ public class TestForMaterialTree {
}
// 用于执行测试新算法
class MtTaskTest implements Callable<Object> {
class MtTaskTest_New implements Callable<Object> {
MaterialType mt;
List<Material> materiaList;
MaterialType mt; // 物料类型
List<Material> materiaList; // 物料列表
public MtTaskTest(MaterialType mt, List<Material> materiaList) {
public MtTaskTest_New(MaterialType mt, List<Material> materiaList) {
this.mt = mt;
this.materiaList = materiaList;
}
@ -232,19 +186,21 @@ public class TestForMaterialTree {
List<Material> materialList = new ArrayList<>();
for (int i = 0; i < materiaList.size(); i++) {
Material material = materiaList.get(i);
// 如果当前物料是当前物料类型下的物料
if (Long.compare(material.getMaterialTypeId(), mt.getOldId()) == 0) {
materialList.add(material);
}
}
List<Object> objectList = AddMaterialByType(materialList);
Map<String, Object> objectMap = InitTreeMenus(mt, objectList);
// 将物料打包成树结构对应结果
List<Object> objectList = AddMaterialByType_New(materialList);
// 封装成对应的结构
Map<String, Object> objectMap = InitTreeMenus_New(mt, objectList);
return objectMap;
}
}
// 构造树形组件数据模板
public Map<String, Object> InitTreeMenus(MaterialType mt, List<Object> children) {
public Map<String, Object> InitTreeMenus_New(MaterialType mt, List<Object> children) {
if (mt != null) {
Map<String, Object> map = new HashMap<>();
map.put("title", mt.getTname());
@ -257,9 +213,8 @@ public class TestForMaterialTree {
}
}
// 在类别后添加物料名称
public List<Object> AddMaterialByType(List<Material> materialList) {
public List<Object> AddMaterialByType_New(List<Material> materialList) {
List<Object> result = new ArrayList<>();
for (int i = 0; i < materialList.size(); i++) {
Material material = materialList.get(i);
@ -277,21 +232,31 @@ public class TestForMaterialTree {
return result;
}
public List<Object> buildTree(List<Object> list,Long parentId){
/**
* 用于构造树结构
* @param list 树列表
* @param parentId 父级id
* @return
*/
public List<Object> buildTree_New(List<Object> list,Long parentId){
// 定义树结构
List<Object> result = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
JSONObject o = new JSONObject((Map<String,Object>)list.get(i));
Long id = Long.valueOf(o.getString("id"));
Long pid = Long.valueOf(o.getString("parentId"));
if(Long.compare(pid,parentId) == 0){
result.add(o);
// 构造为jsonObject类
JSONObject jsonObject = new JSONObject((Map<String, Object>) list.get(i));
// 获取当前父级id
Long parentId1 = jsonObject.getLong("parentId");
if(Long.compare(parentId,parentId1) == 0){ // 如果当前类型是其父类
List<Object> objectList = buildTree_New(list, jsonObject.getLong("id")); // 获取当前类型的子类
JSONArray children = jsonObject.getJSONArray("children");
children.addAll(objectList);
result.add(jsonObject);
}
}
return null;
return result;
}
}

6
src/test/java/com/dreamchaser/depository_manage/TestForThisWeekInventory.java

@ -50,10 +50,6 @@ public class TestForThisWeekInventory {
public void test(){
UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null);
Map<String, Object> beforeInventoryOnMap = getThisWeekInventoryByDName(depositoryService, depositoryRecordService, userByPort);
System.out.println(JSONObject.toJSONString(beforeInventoryOnMap));
}
@ -85,7 +81,7 @@ public class TestForThisWeekInventory {
result.clear();
}
} else {
int now = instance.get(Calendar.DAY_OF_WEEK) - 1;
int now = instance.get(Calendar.DAY_OF_WEEK) - 1 == 0 ? 7 : instance.get(Calendar.DAY_OF_WEEK) - 1;
List<Long> days = new ArrayList<>();
days.add(DateUtil.DateTimeByMonthToTimeStamp(formatter.format(instance.getTime())));
Boolean flag = false;

142
src/test/java/com/dreamchaser/depository_manage/TestForgetShowData.java

@ -1,6 +1,8 @@
package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.controller.DepositoryController;
import com.dreamchaser.depository_manage.entity.MaterialType;
import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.mapper.DepositoryMapper;
import com.dreamchaser.depository_manage.mapper.DepositoryRecordMapper;
@ -16,6 +18,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import java.text.SimpleDateFormat;
@ -47,29 +50,32 @@ public class TestForgetShowData {
@Autowired
RoleMapper roleMapper;
@Autowired
RedisTemplate<String, String> redisTemplate;
@Test
public void Test() {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null);
Map<String,Integer> yesterdayData = new HashMap<>();
Map<String, Integer> map = new HashMap<>();
List<String> depositoryName = new ArrayList<>();
Map<String, Object> showData = getShowData("1", userByPort, yesterdayData, depositoryName);
Map<String, Object> showData = getShowData("1", userByPort, map, depositoryName);
System.out.println(JSONObject.toJSONString(showData));
}
public Map<String,Object> getShowData(String type,UserByPort userByPort,Map<String,Integer> yesterdayData,List<String> depositoryName){
// 用于获取折线图
public Map<String, Object> getShowData(String type, UserByPort userByPort, Map<String, Integer> yesterdayData, List<String> depositoryName) {
// 获取各仓库名称以及id
Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort);
// 获取遍历器
Iterator it = depositoryAllNameAndId.keySet().iterator();
// 仓库名称列表
//获取获取系统的当前日历对象
Calendar instance = Calendar.getInstance();
// 获取日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
int now = instance.get(Calendar.DAY_OF_WEEK) - 1;
int now = instance.get(Calendar.DAY_OF_WEEK) - 1 == 0 ? 7 : instance.get(Calendar.DAY_OF_WEEK) - 1;
List<Long> days = new ArrayList<>(); // 周一至今的每天
instance.add(Calendar.DATE, 1);
days.add(DateUtil.DateTimeByMonthToTimeStamp(formatter.format(instance.getTime())));
@ -81,7 +87,6 @@ public class TestForgetShowData {
Long format = DateUtil.DateTimeByMonthToTimeStamp(formatter.format(instance.getTime()));
days.add(format);
}
List<Double> drCountbyDrName = new ArrayList<>();
// 定义线程
ExecutorService exs = Executors.newFixedThreadPool(depositoryAllNameAndId.size());
@ -115,15 +120,16 @@ public class TestForgetShowData {
}
@Data
class getApplicationRecordByDate implements Callable<Object>{
class getApplicationRecordByDate implements Callable<Object> {
Object key;
List<Long> days;
Map<String, Integer> depositoryAllNameAndId;
List<String> depositoryName;
Map<String,Integer> yesterdayData;
Map<String, Integer> yesterdayData;
String type;
Map<String, Object> show_data;
getApplicationRecordByDate(String type,Object key,List<Long> days,Map<String, Integer> depositoryAllNameAndId ){
getApplicationRecordByDate(String type, Object key, List<Long> days, Map<String, Integer> depositoryAllNameAndId) {
this.key = key;
this.depositoryAllNameAndId = depositoryAllNameAndId;
this.days = days;
@ -139,7 +145,7 @@ public class TestForgetShowData {
if (i == days.size() - 1) {
depositoryName.add(key.toString());
}
Integer val = (Integer) depositoryAllNameAndId.get(key);
Integer val = depositoryAllNameAndId.get(key);
// 获取一段时间内的库存额度
Integer depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i - 1), days.get(i), Integer.parseInt(type), val);
drCountbyDrName.add(depositoryRecordByDate1);
@ -147,13 +153,122 @@ public class TestForgetShowData {
yesterdayData.put(key.toString(), depositoryRecordByDate1);
}
}
show_data.put(key.toString(),drCountbyDrName);
show_data.put(key.toString(), drCountbyDrName);
return null;
}
}
//获取本月及之前月份各种类别入/出库总量
public List<Object> getSourceList(String type) {
Map<String, Object> previousMonth = getPreviousMonth();
List<Object> months = (List<Object>) previousMonth.get("months");
List<Object> sourceList = (List<Object>) previousMonth.get("sourceList");
ExecutorService exs = Executors.newFixedThreadPool(months.size());
// 结果集
List<Future<Object>> futureList = new ArrayList<Future<Object>>();
// 1.定义CompletionService
CompletionService<Object> completionService = new ExecutorCompletionService<Object>(exs);
for (int num = 0; num < months.size() - 1; num++) {
Map<String, Object> map = (Map<String, Object>) sourceList.get(num);
Future<Object> future = completionService.submit(new getSourceListTask(map, type, months.get(num + 1).toString(), months.get(num).toString()));
futureList.add(future);
}
for (int i = 0; i < months.size() - 1; i++) {
Object result = null;
try {
result = completionService.take();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
List<String> barSource = new ArrayList<>();
barSource.add("month");
List<MaterialType> materialTypeAll = materialTypeService.findMaterialTypeNoParent();
for (int i = 0; i < materialTypeAll.size(); i++) {
barSource.add(materialTypeAll.get(i).getTname());
}
sourceList.add(barSource);
return sourceList;
}
// 具体执行getSourceList逻辑
class getSourceListTask implements Callable<Object> {
String type;
String start;
String end;
Map<String, Object> map;
getSourceListTask(Map<String, Object> map, String type, String start, String end) {
this.map = map;
this.type = type;
this.start = start;
this.end = end;
}
@Override
public Object call() throws Exception {
List<MaterialType> materialTypeAll = materialTypeService.findMaterialTypeNoParent();
ExecutorService exs = Executors.newFixedThreadPool(materialTypeAll.size());
// 结果集
List<Future<Object>> futureList = new ArrayList<Future<Object>>();
// 1.定义CompletionService
CompletionService<Object> completionService = new ExecutorCompletionService<Object>(exs);
for (int j = 0; j < materialTypeAll.size(); j++) {
Map<String, Object> parm = new HashMap<>();
parm.put("type", Integer.parseInt(type));
if (Integer.parseInt(type) == 1) {
parm.put("state", "已入库");
} else if (Integer.parseInt(type) == 2) {
parm.put("state", "已出库");
}
parm.put("start", start);
parm.put("end", end);
parm.put("oldId", materialTypeAll.get(j).getOldId());
//根据条件获取月份中物料的总额
// 测试
Future<Object> future = completionService.submit(new findMaterialCountTaskForSourceList(parm));
futureList.add(future);
}
for (int i = 0; i < materialTypeAll.size(); i++) {
Object result = null;
try {
result = completionService.take().get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
map.putAll((Map<? extends String, ?>) result);
}
return map;
}
}
// 根据条件获取月份中物料的总额用于sourcelist
class findMaterialCountTaskForSourceList implements Callable<Object> {
Map<String, Object> map;
findMaterialCountTaskForSourceList(Map<String, Object> map) {
this.map = map;
}
@Override
public Object call() throws Exception {
Map<String, Object> result = new HashMap<>();
Integer materialCountByMonth1 = depositoryRecordService.findMaterialCountByMonth2(map);
Long oldId = Long.valueOf(map.get("oldId").toString());
MaterialType materialTypeByOldId = materialTypeService.findMaterialTypeByOldId(oldId);
result.put(materialTypeByOldId.getTname(), materialCountByMonth1);
return result;
}
}
/**
@ -184,4 +299,5 @@ public class TestForgetShowData {
map.put("sourceList", sourceList);
return map;
}
}

Loading…
Cancel
Save