Browse Source

修改库存明细页面中图标的数据算法

lwx_dev
erdanergou 2 years ago
parent
commit
2848056077
  1. 42
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 66
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  3. 45
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  4. 10
      src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java
  5. 23
      src/main/java/com/dreamchaser/depository_manage/controller/SplitController.java
  6. 3
      src/main/java/com/dreamchaser/depository_manage/entity/MaterialAndPlace.java
  7. 169
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java
  8. 38
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  9. 135
      src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java
  10. 48
      src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml
  11. 14
      src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java
  12. 27
      src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml
  13. 21
      src/main/java/com/dreamchaser/depository_manage/pojo/MaterialP.java
  14. 4
      src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java
  15. 12
      src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java
  16. 14
      src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java
  17. 88
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  18. 35
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  19. 20
      src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java
  20. 7
      src/main/java/com/dreamchaser/depository_manage/utils/DateUtil.java
  21. 551
      src/main/resources/templates/pages/depository/Inventory-view.html
  22. 41
      src/main/resources/templates/pages/depository/table-stock.html
  23. 31
      src/main/resources/templates/pages/material/material-out.html
  24. 268
      src/main/resources/templates/pages/material/material-view_back.html
  25. 9
      src/test/java/com/dreamchaser/depository_manage/LineChartForInventoryTest.java
  26. 38
      target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  27. 48
      target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml
  28. 27
      target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml
  29. 551
      target/classes/templates/pages/depository/Inventory-view.html
  30. 41
      target/classes/templates/pages/depository/table-stock.html
  31. 31
      target/classes/templates/pages/material/material-out.html

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

@ -2311,14 +2311,44 @@ public class DepositoryRecordController {
Integer id = jsonObject.getInteger("id");
// 获取当前物料的库存数据
Inventory inventoryById = materialService.findInventoryById(id);
List<Object> inventoryAmountList = new ArrayList<>();
// 获取当前库存
double inventory = 0;
// 获取当前库存的底层拆单记录
SplitInfo splitInfo = splitUnitService.findBaseSplitInfoForMid(inventoryById.getMid());
// 标记当前出入库数量是否全部按照拆单单位进行(默认否)
boolean flagForSplitInfo = false;
if (splitInfo != null) {
flagForSplitInfo = true;
Map<String, Object> paramForSelectStringObjectMap = new HashMap<>();
paramForSelectStringObjectMap.put("iid", id);
List<MaterialAndPlaceForViewP> placeAndMaterialByCondition = placeService.findPlaceAndMaterialByCondition(paramForSelectStringObjectMap);
for (MaterialAndPlaceForViewP materialAndPlaceForViewP : placeAndMaterialByCondition) {
// 定义物料与库位的对应关系
MaterialAndPlace mp = new MaterialAndPlace();
// 设置id
mp.setId(materialAndPlaceForViewP.getId());
// 设置数量
mp.setQuantity(materialAndPlaceForViewP.getInventory().intValue());
double allInventory = splitUnitService.findAllInventoryForSplitInfo(-1, mp, splitInfo.getId(), 0, true);
inventory = ObjectFormatUtil.sum(allInventory, inventory);
}
} else {
inventory = ObjectFormatUtil.divide(inventoryById.getQuantity(), 100.0, 2);
}
// 获取本月至今的日期
Map<String, Object> monthBeginToNow = DateUtil.getMonthBeginToNow();
// 获取至今的日期名称
List<String> dayNames = ObjectFormatUtil.objToList(monthBeginToNow.get("dayName"), String.class);
// 获取至今的日期时间戳
List<Long> dayTimeSpaces = ObjectFormatUtil.objToList(monthBeginToNow.get("dayTimeSpace"), Long.class);
dayTimeSpaces.add(Calendar.getInstance().getTimeInMillis());
// 获取当前物料的入库总额与数量
Map<String, Object> seriesForApplicationIn = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 1);
Map<String, Object> seriesForApplicationIn = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 1,flagForSplitInfo,splitInfo);
Object amountItemForIn = seriesForApplicationIn.get("amountItem");
Object countItemForIn = seriesForApplicationIn.get("countItem");
@ -2328,7 +2358,7 @@ public class DepositoryRecordController {
List<Double> amountListForIn = ObjectFormatUtil.objToList(countItemForInMapString.get("data"), Double.class);
// 获取当前物料的出库总额与数量
Map<String, Object> seriesForApplicationOut = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 2);
Map<String, Object> seriesForApplicationOut = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 2,flagForSplitInfo,splitInfo);
Object amountItemForOut = seriesForApplicationOut.get("amountItem");
Object countItemForOut = seriesForApplicationOut.get("countItem");
@ -2339,9 +2369,7 @@ public class DepositoryRecordController {
// 定义库存数量列表
List<Object> inventoryCountList = new ArrayList<>();
// 定义库存总额列表
List<Object> inventoryAmountList = new ArrayList<>();
// 获取当前库存
double inventory = inventoryById.getQuantity() / 100.0;
// 获取当前物料单价
Double price = inventoryById.getPrice();
// 获取当前物料总额
@ -2372,8 +2400,8 @@ public class DepositoryRecordController {
legendItem.put("data", legends);
result.put("legend", legendItem);
result.put("dayNames", dayNames);
result.put("countItemForInventory",countItemForInventory);
result.put("amountItemForInventory",amountItemForInventory);
result.put("countItemForInventory", countItemForInventory);
result.put("amountItemForInventory", amountItemForInventory);
return new RestResponse(result);
}

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

@ -194,6 +194,70 @@ public class MaterialController {
return new RestResponse(list, total, 200);
}
/**
* 获取当前物料的库存记录
*
* @param map 查询数据
* @param request
* @return
*/
@GetMapping("/findInventoryByMid")
public RestResponse findInventoryByMid(@RequestParam Map<String, Object> map, HttpServletRequest request) {
if (map.containsKey("mid")) {
String token = request.getHeader("user-token");
if (token == null) {
token = (String) request.getSession().getAttribute("userToken");
}
UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
Integer maindeparment = userToken.getMaindeparment();
if (!PublicConfig.roleAdminorgList.contains(maindeparment)) { // 如果不是管理部门
// 获取当前用户可见的仓库id列表
List<Integer> didList = roleService.findDepositoryIdForUserHas(userToken);
map.put("depositoryIdList", didList);
}
// 声明库存列表
List<InventoryP> inventoryPList = new ArrayList<>();
// 获取当前物料id与仓库id的库存记录
List<Inventory> inventoryByMidAndDidList = materialService.findInventoryByMidAndDidList(map);
// 声明用于获取当前库存所处的库位map
Map<String, Object> paramForStringObjectMap = new HashMap<>();
if (inventoryByMidAndDidList != null && inventoryByMidAndDidList.size() > 0) { // 如果存在库存记录且记录数大于零
// 获取当前物料id
Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
// 获取当前物料的拆单记录
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(mid);
for (Inventory inventory : inventoryByMidAndDidList) {
InventoryP inventoryP = new InventoryP(inventory);
inventoryP.setSplitInfoList(splitInfoByMid);
paramForStringObjectMap.put("iid", inventoryP.getId());
// 获取当前库存所处的库位记录
List<MaterialAndPlaceForViewP> placeAndMaterialByCondition = placeService.findPlaceAndMaterialByCondition(paramForStringObjectMap);
for (MaterialAndPlaceForViewP materialAndPlaceForViewP : placeAndMaterialByCondition) {
double quantity = ObjectFormatUtil.divide(materialAndPlaceForViewP.getInventory(), 100.0, 2);
double amount = ObjectFormatUtil.multiply(quantity, inventoryP.getPrice());
materialAndPlaceForViewP.setInventory(quantity);
materialAndPlaceForViewP.setAmount(amount);
}
inventoryP.setMaterialAndPlaceList(placeAndMaterialByCondition);
inventoryPList.add(inventoryP);
}
}
Integer count = materialService.findInventoryCountByMidAndDidList(map);
return new RestResponse(inventoryPList, count, 200);
} else {
return new RestResponse(new ArrayList<>(), 0, 200);
}
}
/**
* 修改库存备注
*
* @param map
* @param request
* @return
*/
@PostMapping("/updateInventoryRemark")
public RestResponse updateInventoryRemark(@RequestBody Map<String, Object> map, HttpServletRequest request) {
if (map.containsKey("id")) {
@ -1937,7 +2001,7 @@ public class MaterialController {
if (splitInventory != null) {
quantity = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true);
} else {
quantity = (inventoryById.getQuantity() * Scale / 100.0);
quantity = (placeAndMaterialByMidAndPid.getQuantity() * Scale / 100.0);
}
amount = ObjectFormatUtil.multiply(quantity, price);

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

@ -496,7 +496,7 @@ public class PageController {
return mv;
}
/* // 库位树形菜单
// 库位树形菜单
@GetMapping("/selectPlaceByDepository")
public ModelAndView selectPlaceByDepository(Integer depositoryId, Integer mid, String placeCode, String unit) {
ModelAndView mv = new ModelAndView();
@ -532,10 +532,11 @@ public class PageController {
SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo);
SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId());
if (splitInventory != null) {
mv.addObject("quantity", (splitInventory.getSaveQuantity() / 100));
double quantity = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true);
mv.addObject("quantity", quantity);
} else {
int Scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
mv.addObject("quantity", (inventoryById.getQuantity() * Scale / 100));
mv.addObject("quantity", (placeAndMaterialByMidAndPid.getQuantity() * Scale / 100));
}
}
mv.addObject("depositoryId", depositoryId);
@ -543,11 +544,11 @@ public class PageController {
mv.addObject("unit", unit);
mv.setViewName("pages/material/selectPlaceByDepository");
return mv;
}*/
}
// 同一仓库下的库位树形菜单
@GetMapping("/selectPlaceByDepository")
public ModelAndView selectPlaceByDepository(Integer id, String unit) {
@GetMapping("/selectPlaceByDepositoryForInventory")
public ModelAndView selectPlaceByDepositoryForInventory(Integer id, String unit) {
if (id != null) {
ModelAndView mv = new ModelAndView();
MaterialAndPlace placeAndMaterialById = placeService.findPlaceAndMaterialById(id);
@ -570,7 +571,7 @@ public class PageController {
mv.addObject("quantity", quantity);
} else {
int Scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
mv.addObject("quantity", (inventoryById.getQuantity() * Scale / 100));
mv.addObject("quantity", (placeAndMaterialById.getQuantity() * Scale / 100));
}
}
mv.addObject("depositoryId", placeAndMaterialById.getDid());
@ -1190,7 +1191,7 @@ public class PageController {
public ModelAndView InventoryView(Integer id, HttpServletRequest request) {
if (id != null) {
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/depository/Inventory-view_back");
mv.setViewName("pages/depository/Inventory-view");
Inventory inventoryById = materialService.findInventoryById(id);
if (inventoryById != null) {
InventoryP inventory = new InventoryP(inventoryById);
@ -1243,15 +1244,23 @@ public class PageController {
public ModelAndView InventoryViewBack(Integer id, HttpServletRequest request) {
if (id != null) {
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/depository/Inventory-view");
Inventory inventoryById = materialService.findInventoryById(id);
if (inventoryById != null) {
InventoryP inventory = new InventoryP(inventoryById);
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(inventoryById.getId(), inventory.getDepositoryId());
inventory.setPlacePList(placeByMidAndDid);
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid());
inventory.setSplitInfoList(splitInfoByMid);
mv.addObject("record", inventory);
mv.setViewName("pages/material/material-view_back");
Material materialById = materialService.findMaterialById(id);
if (materialById != null) {
MaterialP materialP = new MaterialP(materialById);
Map<String, Object> param = new HashMap<>();
param.put("mid", id);
List<MaterialAndPlaceForViewP> placeAndMaterialByDidAndMid = placeService.findPlaceAndMaterialByMid(param);
for (MaterialAndPlaceForViewP materialAndPlaceForViewP : placeAndMaterialByDidAndMid) {
double quantity = materialAndPlaceForViewP.getInventory() / 100.0;
materialAndPlaceForViewP.setInventory(quantity);
materialAndPlaceForViewP.setAmount(ObjectFormatUtil.multiply(materialP.getPrice(), quantity));
}
materialP.setMaterialAndPlaceList(placeAndMaterialByDidAndMid);
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(id);
materialP.setSplitInfoList(splitInfoByMid);
mv.addObject("record", materialP);
String userAgent = request.getHeader("user-agent");
String token = request.getHeader("user-token");
if (token == null) {
@ -1267,7 +1276,7 @@ public class PageController {
// 判断当前使用的设备为移动端还是pc端
boolean b = DeviceUtil.checkAgentIsMobile(userAgent);
if (b) {
mv.setViewName("pages/depository/Inventory-view_mobile");
// mv.setViewName("pages/material/material-view_mobile");
}
return mv;
} else {

10
src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java

@ -203,7 +203,7 @@ public class PlaceController {
Object depositoryId = map.get("depositoryId");
insert.put("did", depositoryId);
// 获取当前仓库的托盘数量
Integer countForTray = placeService.findPlaceCoutnByTypeForFlag(2, ObjectFormatUtil.toInteger(depositoryId));
Integer countForTray = placeService.findPlaceCountByTypeForFlag(2, ObjectFormatUtil.toInteger(depositoryId));
if ("one".equals(type)) {
String code = "F" + String.format("%02d", countForTray + 1);
insert.put("code", code);
@ -500,6 +500,12 @@ public class PlaceController {
}
/**
* 获取当前位置信息
*
* @param map
* @return
*/
@PostMapping("/findLocationById")
public RestResponse findLocationById(@RequestBody Map<String, String> map) {
if (map.containsKey("id") && map.containsKey("type")) {
@ -528,4 +534,6 @@ public class PlaceController {
throw new MyException("缺少必要参数");
}
}
}

23
src/main/java/com/dreamchaser/depository_manage/controller/SplitController.java

@ -138,29 +138,6 @@ public class SplitController {
}
@PostMapping("/calcPriceForSplit")
public RestResponse calcPriceForSplit(@RequestBody Map<String, Object> map) {
// 通过物料id与计量单位获取对应拆单信息
SplitInfo splitInfoByMidAndUnit = splitUnitService.findSplitInfoByMidAndUnit(map);
if (splitInfoByMidAndUnit != null) {
// 如果有拆单信息,获取对应物料的库存记录
List<Inventory> inventoryByMid = materialService.findInventoryByMid(splitInfoByMidAndUnit.getMid());
if (inventoryByMid.size() > 0) {
Inventory inventory = inventoryByMid.get(0);
return new RestResponse(inventory.getPrice() / splitUnitService.findSplitInfoScaleQuantity(splitInfoByMidAndUnit, -1));
}
} else {
Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
List<Inventory> inventoryList = materialService.findInventoryByMid(mid);
if (inventoryList.size() > 0) {
Inventory inventory = inventoryList.get(0);
return new RestResponse(inventory.getPrice());
}
}
return new RestResponse(0);
}
/**
* 用于查找当前禁用的拆单是否正在使用
*

3
src/main/java/com/dreamchaser/depository_manage/entity/MaterialAndPlace.java

@ -42,4 +42,7 @@ public class MaterialAndPlace {
*/
private Integer quantity;
}

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

@ -9,9 +9,9 @@ import java.util.List;
import java.util.Map;
/**
* 仓库调度类
*
* @author Dreamchaser
*/
@Mapper
@ -19,21 +19,24 @@ import java.util.Map;
public interface DepositoryRecordMapper {
/**
* 插入一条仓库调度记录
*
* @param map 仓库调度信息
* @return 受影响的行数
*/
Integer insertDepositoryRecord(Map<String,Object> map);
Integer insertDepositoryRecord(Map<String, Object> map);
/**
* 插入一条入库记录
*
* @param map
* @return
*/
Integer insertApplicationInRecord(Map<String,Object> map);
Integer insertApplicationInRecord(Map<String, Object> map);
/**
* 根据id删除一条仓库调度记录
*
* @param id 记录id
* @return 受影响的行数
*/
@ -41,20 +44,23 @@ public interface DepositoryRecordMapper {
/**
* 根据id修改仓库调度记录
*
* @param map 参数map
* @return 受影响的行数
*/
Integer updateDepositoryRecord(Map<String,Object> map);
Integer updateDepositoryRecord(Map<String, Object> map);
/**
* 根据id修改仓库调度记录
*
* @param map 参数map
* @return 受影响的行数
*/
Integer updateApplicationOutRecord(Map<String,Object> map);
Integer updateApplicationOutRecord(Map<String, Object> map);
/**
* 根据id主键查询数据
*
* @param id id
* @return 该id的数据记录
*/
@ -62,85 +68,99 @@ public interface DepositoryRecordMapper {
/**
* 查找所有仓库调度记录
*
* @return 所有的仓库调度记录集合
*/
List<DepositoryRecord> findDepositoryRecordAll();
/**
* 查找所有入库记录
*
* @return
*/
List<ApplicationInRecord> findApplicationInRecordPAll();
/**
* 根据主键id列表获取入库订单列表
*
* @param ids
* @return
*/
List<ApplicationInRecord> findApplicationInRecordsByIds(List<Integer> ids);
/**
* 查找所有入库记录
*
* @return
*/
List<ApplicationInRecord> findApplicationInRecordPByDepositoryList(List<Integer> list);
/**
* 查询一段时间内的入库记录
*
* @param map 条件起止时间
* @return
*/
List<ApplicationInRecord> findApplicationInRecordPForAPeriodOfTime(Map<String,Object> map);
List<ApplicationInRecord> findApplicationInRecordPForAPeriodOfTime(Map<String, Object> map);
/**
* 查找所有出库记录
*
* @return
*/
List<ApplicationOutRecord> findApplicationOutRecordPAll();
/**
* 查询一段时间内的出库记录
*
* @param map 条件起止时间
* @return
*/
List<ApplicationOutRecord> findApplicationOutRecordPForAPeriodOfTime(Map<String,Object> map);
List<ApplicationOutRecord> findApplicationOutRecordPForAPeriodOfTime(Map<String, Object> map);
/**
* 根据条件查询仓库调度记录同时支持分页查询需要begin和size参数
*
* @param map 查询参数
* @return 符合条件的仓库调度记录集合
*/
List<DepositoryRecord> findDepositoryRecordByCondition(Map<String,Object> map);
List<DepositoryRecord> findDepositoryRecordByCondition(Map<String, Object> map);
/**
* 根据条件查询自己的任务根据isDone来决定查询已完成或者未完成的任务同时支持分页查询需要begin和size参数
*
* @param map 查询参数
* @return 我的任务
*/
List<SimpleDepositoryRecord> findMyTask(Map<String,Object> map);
List<SimpleDepositoryRecord> findMyTask(Map<String, Object> map);
/**
* 根据条件查询自己的出库审批任务根据isDone来决定查询已完成或者未完成的任务同时支持分页查询需要begin和size参数
*
* @param map 查询参数
* @return 我的任务
*/
List<SimpleApplicationOutRecord> findMyTaskOut(Map<String,Object> map);
List<SimpleApplicationOutRecord> findMyTaskOut(Map<String, Object> map);
/**
* 根据条件查询自己的入库审批任务根据isDone来决定查询已完成或者未完成的任务同时支持分页查询需要begin和size参数
*
* @param map 查询参数
* @return 我的任务
*/
List<SimpleApplicationInRecord> findMyTaskIn(Map<String,Object> map);
List<SimpleApplicationInRecord> findMyTaskIn(Map<String, Object> map);
/**
* 根据id删除仓库记录
*
* @return 受影响的行数
*/
Integer deleteDepositoryRecordById();
/**
* 根据id集合删除多条仓库记录
*
* @param list id集合
* @return 受影响的行数
*/
@ -148,43 +168,50 @@ public interface DepositoryRecordMapper {
/**
* 返回该表的总条数
*
* @return 条数
*/
Integer findCount();
/**
* 返回该我的任务数完成或者未完成
*
* @param map 参数map
* @return 条数
*/
Integer findMyTaskCount(Map<String,Object> map);
Integer findMyTaskCount(Map<String, Object> map);
/**
* 返回该我的任务数完成或者未完成
*
* @param map 参数map
* @return 条数
*/
Integer findMyTaskOutCount(Map<String,Object> map);
Integer findMyTaskOutCount(Map<String, Object> map);
/**
* 返回该我的任务数完成或者未完成
*
* @return 条数
*/
Integer findMyTaskInCount(Map<String,Object> map);
Integer findMyTaskInCount(Map<String, Object> map);
/**
* 根据查询条件返回该表的总条数
*
* @param map 条件参数
* @return 条数
*/
Integer findCountByCondition(Map<String,Object> map);
Integer findCountByCondition(Map<String, Object> map);
/**
* 获取一段时间内的库存额度
*
* @param map
* @return
*/
Double findDepositoryRecordByDate(Map<String,Object> map);
Double findDepositoryRecordByDate(Map<String, Object> map);
/**
@ -193,9 +220,7 @@ public interface DepositoryRecordMapper {
* @param map
* @return
*/
Integer findApplicationInRecordByDate(Map<String,Object> map);
Integer findApplicationInRecordByDate(Map<String, Object> map);
/**
@ -204,75 +229,96 @@ public interface DepositoryRecordMapper {
* @param map
* @return
*/
Integer findApplicationOutRecordByDate(Map<String,Object> map);
Integer findApplicationOutRecordByDate(Map<String, Object> map);
/**
* 根据条件获取月份中物料的总额
*
* @param map
* @return
*/
Integer findMaterialCountByMonth(Map<String,Object> map);
Integer findMaterialCountByMonth(Map<String, Object> map);
/**
* 根据条件获取月份中入库物料的总额
*
* @param map 查询条件
* @return
*/
Integer findApplicationInSumQuantityByDateAndMaterial(Map<String, Object> map);
/**
* 根据条件获取月份中该物料的入库记录
*
* @param map 查询条件
* @return
*/
Integer findApplicationInByDateAndMaterial(Map<String,Object> map);
List<ApplicationInRecord> findApplicationInByDateAndMaterial(Map<String, Object> map);
/**
* 根据条件获取月份中出库物料的总额
*
* @param map 查询条件
* @return
*/
Integer findApplicationOutByDateAndMaterial(Map<String, Object>map);
Integer findApplicationOutSumQuantityByDateAndMaterial(Map<String, Object> map);
List<ApplicationOutRecord> findApplicationOutByDateAndMaterial(Map<String,Object> map);
Integer findApplicationInByMonthTest(Map<String,Object> map);
Integer findApplicationInByMonthTest(Map<String, Object> map);
/**
* 根据条件获取月份中出库物料的总额
*
* @param map
* @return
*/
Integer findApplicationOutByMonth(Map<String,Object> map);
Integer findApplicationOutByMonth(Map<String, Object> map);
/**
* 查询仓库当天流水
*
* @return
*/
Integer findWarehouseRecord(Map<String,Object> map);
Integer findWarehouseRecord(Map<String, Object> map);
/**
* 根据条件查询入库记录同时支持分页查询
*
* @param map
* @return
*/
List<ApplicationInRecord> findApplicationInRecordPByCondition(Map<String,Object> map);
List<ApplicationInRecord> findApplicationInRecordPByCondition(Map<String, Object> map);
/**
* 查询当前用户入库记录及其管理仓库的入库记录
*
* @param map 查询条件
* @return
*/
List<ApplicationInRecord> findApplicationInRecordPByUser(Map<String,Object> map);
List<ApplicationInRecord> findApplicationInRecordPByUser(Map<String, Object> map);
/**
* 查询当前用户入库记录及其管理仓库的入库记录数目
*
* @param map 查询条件
* @return
*/
Integer findApplicationInRecordPCountByUser(Map<String,Object> map);
Integer findApplicationInRecordPCountByUser(Map<String, Object> map);
/**
* 查询当前仓库的入库记录
* @param depositoryId 待查询仓库id
*
* @param depositoryId 待查询仓库id
* @return
*/
List<ApplicationInRecord> findApplicationInRecordByDepository(String depositoryId);
/**
* 查询当前仓库的出库记录
*
* @param depositoryId 待查询仓库id
* @return
*/
@ -281,49 +327,56 @@ public interface DepositoryRecordMapper {
/**
* 根据条件查询出库记录同时支持分页查询
*
* @param map
* @return
*/
List<ApplicationOutRecord> findApplicationOutRecordPByCondition(Map<String,Object> map);
List<ApplicationOutRecord> findApplicationOutRecordPByCondition(Map<String, Object> map);
/**
* 获取所有数量为0的出库单
*
* @return
*/
List<ApplicationOutRecord> findApplicationOutRecordPForBad();
/**
* 查询当前用户出库记录及其管理仓库的出库记录
*
* @param map 查询条件
* @return
*/
List<ApplicationOutRecord> findApplicationOutRecordPByUser(Map<String,Object> map);
List<ApplicationOutRecord> findApplicationOutRecordPByUser(Map<String, Object> map);
/**
* 查询当前用户出库记录及其管理仓库的出库记录数目
*
* @param map 查询条件
* @return
*/
Integer findApplicationOutRecordPCountByUser(Map<String,Object> map);
Integer findApplicationOutRecordPCountByUser(Map<String, Object> map);
/**
* 根据条件查询入库记录数目
*
* @param map
* @return
*/
Integer findApplicationInRecordPCountByCondition(Map<String,Object> map);
Integer findApplicationInRecordPCountByCondition(Map<String, Object> map);
/**
* 根据条件查询出库记录数目
*
* @param map
* @return
*/
Integer findApplicationOutRecordPCountByCondition(Map<String,Object> map);
Integer findApplicationOutRecordPCountByCondition(Map<String, Object> map);
/**
* 根据id查询入库记录
*
* @param id
* @return
*/
@ -332,16 +385,16 @@ public interface DepositoryRecordMapper {
/**
* 根据组合入库订单id获取入库记录
*
* @param id
* @return
*/
List<ApplicationInRecord> findApplicationInRecordPByToGroupId(Integer id);
/**
* 根据id查询出库申请
*
* @param id
* @return
*/
@ -350,6 +403,7 @@ public interface DepositoryRecordMapper {
/**
* 根据id批量查询出库申请
*
* @param list
* @return
*/
@ -357,13 +411,15 @@ public interface DepositoryRecordMapper {
/**
* 根据id删除入库记录
* @return 受影响的行数
*
* @param id
* @return 受影响的行数
*/
Integer deleteApplicationInRecordById(Integer id);
/**
* 根据id集合删除多条入库记录
*
* @param list id集合
* @return 受影响的行数
*/
@ -371,29 +427,33 @@ public interface DepositoryRecordMapper {
/**
* 插入一条出库记录
*
* @param map
* @return
*/
Integer insertApplicationOutRecord(Map<String,Object> map);
Integer insertApplicationOutRecord(Map<String, Object> map);
/**
* 根据id删除出库记录
* @return 受影响的行数
*
* @param id
* @return 受影响的行数
*/
Integer deleteApplicationOutRecordById(Integer id);
/**
* 根据主id删除具体出库记录
* @return 受影响的行数
*
* @param id
* @return 受影响的行数
*/
Integer deleteApplicationOutRecordMinById(Integer id);
/**
* 根据id集合删除多条出库记录
*
* @param list id集合
* @return 受影响的行数
*/
@ -402,6 +462,7 @@ public interface DepositoryRecordMapper {
/**
* 根据主id集合删除多条出库记录
*
* @param list id集合
* @return 受影响的行数
*/
@ -409,6 +470,7 @@ public interface DepositoryRecordMapper {
/**
* 根据申请单号获取入库申请
*
* @param code
* @return
*/
@ -416,6 +478,7 @@ public interface DepositoryRecordMapper {
/**
* 根据申请单号获取出库申请
*
* @param code
* @return
*/
@ -424,13 +487,15 @@ public interface DepositoryRecordMapper {
/**
* 插入一条出库子订单
*
* @param map
* @return
*/
Integer insertApplicationOutRecordMin(Map<String,Object> map);
Integer insertApplicationOutRecordMin(Map<String, Object> map);
/**
* 根据id获取出库子订单
*
* @param id
* @return
*/
@ -438,6 +503,7 @@ public interface DepositoryRecordMapper {
/**
* 根据id批量获取出库子订单
*
* @param list
* @return
*/
@ -445,6 +511,7 @@ public interface DepositoryRecordMapper {
/**
* 根据主表获取所有子表
*
* @param parentId
* @return
*/
@ -452,6 +519,7 @@ public interface DepositoryRecordMapper {
/**
* 根据主表获取所有子表
*
* @param list
* @return
*/
@ -459,41 +527,46 @@ public interface DepositoryRecordMapper {
/**
* 修改子表记录
*
* @param map
* @return
*/
Integer updateApplicationOutRecordMin(Map<String,Object> map);
Integer updateApplicationOutRecordMin(Map<String, Object> map);
Integer updateApplicationInRecord(Map<String,Object> map);
Integer updateApplicationInRecord(Map<String, Object> map);
/**
* 修改子表记录
*
* @param applicationOutRecordMin
* @return
*/
Integer updateApplicationOutRecordMin(ApplicationOutRecordMin applicationOutRecordMin);
/**
* 根据条件获取子订单
*
* @param map
* @return
*/
List<ApplicationOutRecordMin> findApplicationOutMinByCondition(Map<String,Object> map);
List<ApplicationOutRecordMin> findApplicationOutMinByCondition(Map<String, Object> map);
/**
* 获取所有已经完成的子订单
*
* @return
*/
List<ApplicationOutRecordMin> findApplicationOutMinForComplete(Map<String,Object> map);
List<ApplicationOutRecordMin> findApplicationOutMinForComplete(Map<String, Object> map);
/**
* 用于修改组合入库审批时创建的子物料订单
*
* @param map
* @return
*/
Integer updateApplicationInRecordForToGroupId(Map<String,Object> map);
Integer updateApplicationInRecordForToGroupId(Map<String, Object> map);
}

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

@ -1741,7 +1741,7 @@
</select>
<!-- 获取某月某物料入库总额-->
<select id="findApplicationInByDateAndMaterial" parameterType="map" resultType="int">
<select id="findApplicationInSumQuantityByDateAndMaterial" parameterType="map" resultType="int">
select ifnull(sum(quantity),0)
from applicationinrecordinfo
where 1 = 1
@ -1760,7 +1760,27 @@
</if>
</select>
<select id="findApplicationOutByDateAndMaterial" parameterType="map" resultType="int">
<select id="findApplicationInByDateAndMaterial" parameterType="map" resultMap="applicationInRecord">
select
<include refid="ApplicationInRecordInfo"/>
from applicationinrecordinfo
where 1 = 1
<if test="depository_id != null and depository_id != ''">
and did = #{depository_id}
</if>
and applicant_time between #{start} and #{end}
<if test="tname != null and tname != ''">
and tname = #{tname}
</if>
<if test="typeId != null and typeId != ''">
and mtid = #{typeId}
</if>
<if test="mid != null and mid != ''">
and mid = #{mid}
</if>
</select>
<select id="findApplicationOutSumQuantityByDateAndMaterial" parameterType="map" resultType="int">
select ifnull(sum(aorquantity),0)
from applicationoutrecordinfo
where 1 = 1
@ -1773,6 +1793,20 @@
</if>
</select>
<select id="findApplicationOutByDateAndMaterial" parameterType="map" resultMap="applicationOutRecord">
select
<include refid="ApplicationOutRecordInfo"></include>
from applicationoutrecordinfo
where 1 = 1
and applicantTime between #{start} and #{end}
<if test="mid != null and mid != ''">
and mid = #{mid}
</if>
<if test="state == 1 or state == 4">
and depositoryManagerPass in (1,4)
</if>
</select>
<select id="findApplicationInByMonthTest" parameterType="map" resultType="int">
select ifnull(sum(quantity),0)
from applicationinrecordinfo

135
src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java

@ -25,11 +25,11 @@ public interface MaterialMapper {
/**
* 根据物料名与物料规格型号查询对应的物料
*
* @param map
* @return
*/
List<Material> findMaterialByMnameAndVersion(Map<String,Object> map);
List<Material> findMaterialByMnameAndVersion(Map<String, Object> map);
/**
@ -59,7 +59,6 @@ public interface MaterialMapper {
Integer insertInventory(Map<String, Object> map);
/**
* 增加一条物料信息
*
@ -69,7 +68,6 @@ public interface MaterialMapper {
Integer insertInventory(Inventory inventory);
/**
* 更新一条物料信息
*
@ -88,6 +86,7 @@ public interface MaterialMapper {
/**
* 更新一条物料信息
*
* @param material 修改的参数
* @return 受影响的行数
*/
@ -103,6 +102,7 @@ public interface MaterialMapper {
/**
* 更新一条库存记录
*
* @param inventory 修改的参数
* @return 受影响的行数
*/
@ -110,6 +110,7 @@ public interface MaterialMapper {
/**
* 将对应仓库id和物料名称的库存修改数量和价格
*
* @param map 参数列表
* @return 受影响的行数
*/
@ -117,6 +118,7 @@ public interface MaterialMapper {
/**
* 根据id删除一条库存记录
*
* @param id 库存id
* @return 受影响的行数
*/
@ -124,77 +126,75 @@ public interface MaterialMapper {
/**
* 根据条件查询符合条件的库存信息
*
* @param map 条件map
* @return 符合条件的库存信息
*/
List<Material> findMaterialByCondition(Map<String,Object>map);
List<Material> findMaterialByCondition(Map<String, Object> map);
/**
* 根据条件查询物料总数
*
* @param map 查询条件
* @return 当前条件下的总数
*/
Integer findMaterialCount(Map<String,Object> map);
Integer findMaterialCount(Map<String, Object> map);
/**
* 根据条件查询符合条件的库存总数
*
* @param map
* @return
*/
Integer findInventoryCount(Map<String,Object> map);
Integer findInventoryCount(Map<String, Object> map);
/**
* 根据条件查询符合条件的库存
*
* @param map
* @return
*/
List<Inventory> findInventory(Map<String,Object> map);
List<Inventory> findInventory(Map<String, Object> map);
/**
* 根据条件查询符合条件的库存
*
* @param map
* @return
*/
List<Inventory> findInventoryByDids(Map<String,Object> map);
List<Inventory> findInventoryByDids(Map<String, Object> map);
/**
* 根据条件查询符合条件的库存数量
*
* @param map
* @return
*/
Integer findInventoryCountByDids(Map<String,Object> map);
Integer findInventoryCountByDids(Map<String, Object> map);
/**
* 根据条件查询符合条件的库存
*
* @param map
* @return
*/
List<Inventory> findInventoryForImport(Map<String,Object> map);
List<Inventory> findInventoryForImport(Map<String, Object> map);
/**
* 根据物料id与仓库id查询库存信息
*
* @param map 查询条件
* @return
*/
Inventory findInventoryByMidAndDid(Map<String,Object> map);
/**
* 根据物料id与仓库id列表查询库存信息
* @param map 查询条件
* @return
*/
List<Inventory> findInventoryByMidAndDids(Map<String,Object> map);
Inventory findInventoryByMidAndDid(Map<String, Object> map);
/**
* 根据id查询库存信息
*
* @param id 库存id
* @return 库存信息
*/
@ -202,21 +202,32 @@ public interface MaterialMapper {
/**
* 根据库存id查询库存信息
*
* @param id 库存id
* @return 库存信息
*/
Inventory findInventoryById(int id);
/**
* 根据物料id获取对应库存信息
* @param mid 待查询物料id
* 根据物料id与仓库id列表获取对应库存信息
*
* @param map 待查询数据
* @return
*/
List<Inventory> findInventoryByMidAndDidList(Map<String, Object> map);
/**
* 根据物料id与仓库id列表获取对应库存数量
*
* @param map 待查询数据
* @return
*/
List<Inventory> findInventoryByMid(int mid);
Integer findInventoryCountByMidAndDidList(Map<String, Object> map);
/**
* 根据id查询库存信息
*
* @param id 库存id
* @return 库存信息
*/
@ -224,6 +235,7 @@ public interface MaterialMapper {
/**
* 根据id批量查询库存信息
*
* @param list 库存id集合
* @return 库存信息
*/
@ -231,47 +243,55 @@ public interface MaterialMapper {
/**
* 查询所有库存条数
*
* @return 库存记录的行数
*/
Integer findCount();
/**
* 根据条件返回符合条件的库存记录行数
*
* @param map 参数
* @return 符合条件的记录行数
*/
Integer findCountByCondition(Map<String,Object> map);
Integer findCountByCondition(Map<String, Object> map);
/**
* 根据主键id批量将物料状态改为删除
*
* @param map
* @return 受影响条数
*/
Integer changeStateToDeletedByIds(Map<String,Object> map);
Integer changeStateToDeletedByIds(Map<String, Object> map);
/**
* 根据主键id将物料状态改为删除
*
* @param map
* @return 受影响条数
*/
Integer changeStateToDeletedById(Map<String,Object> map);
Integer changeStateToDeletedById(Map<String, Object> map);
/**
* 根据条件修改状态
*
* @param map
* @return
*/
Integer updateStateByParam(Map<String,Object> map);
Integer updateStateByParam(Map<String, Object> map);
/**
* 根据物料类型修改物料状态
*
* @param map 待修改条件
* @return
*/
Integer updateStateByTypeId(Map<String,Object> map);
Integer updateStateByTypeId(Map<String, Object> map);
/**
* 根据仓库查询物品
*
* @param ids
* @return
*/
@ -279,70 +299,78 @@ public interface MaterialMapper {
/**
* 根据仓库与类别查询物品
*
* @param map
* @return
*/
List<Inventory> findMaterialByDepositorysAndType(Map<String,Object> map);
List<Inventory> findMaterialByDepositorysAndType(Map<String, Object> map);
/**
* 根据仓库查询物品
*
* @param map
* @return
*/
List<Inventory> findMaterialByDepository(Map<String,Object> map);
List<Inventory> findMaterialByDepository(Map<String, Object> map);
/**
* 根据仓库查询物品数目
*
* @param map
* @return
*/
Integer findMaterialByDepositoryCount(Map<String,Object> map);
Integer findMaterialByDepositoryCount(Map<String, Object> map);
/**
* 通过条形码获取物料信息
*
* @param map
* @return
*/
List<MaterialAndBarCode> findMaterialByBarCodeByCondition(Map<String,Object> map);
List<MaterialAndBarCode> findMaterialByBarCodeByCondition(Map<String, Object> map);
Material findMaterialByCode(String code);
/**
* 通过条件获取条形码与物料的对应关系数量
*
* @param map
* @return
*/
Integer findMaterialByBarCodeCountByCondition(Map<String,Object> map);
Integer findMaterialByBarCodeCountByCondition(Map<String, Object> map);
/**
* 添加条形码与物料编码的映射,单条数据
*
* @param map
* @return
*/
Integer addBarCodeAndMcode(Map<String,Object> map);
Integer addBarCodeAndMcode(Map<String, Object> map);
/**
* 批量添加条形码与物料之间的映射
*
* @param map
* @return
*/
Integer addBarCodeAndMaterialForMoreOne(Map<String,Object> map);
Integer addBarCodeAndMaterialForMoreOne(Map<String, Object> map);
/**
* 删除条形码与物料之间的映射
*
* @param map
* @return
*/
Integer deleteBarCodeAndMaterial(Map<String,Object> map);
Integer deleteBarCodeAndMaterial(Map<String, Object> map);
/**
* 查询当前类型下的物料
*
* @param oldId
* @return
*/
@ -351,6 +379,7 @@ public interface MaterialMapper {
/**
* 查询当前类型下最大的物料编码
*
* @param oldId
* @return
*/
@ -359,6 +388,7 @@ public interface MaterialMapper {
/**
* 批量查询当前类型下的物料
*
* @param list
* @return
*/
@ -367,29 +397,33 @@ public interface MaterialMapper {
/**
* 批量查询当前类型下包含该名称的物料
*
* @param map 待查询数据
* @return
*/
List<Material> findMaterialByTypeIdsAndMname(Map<String,Object> map);
List<Material> findMaterialByTypeIdsAndMname(Map<String, Object> map);
/**
* 批量查询当前类型下包含该名称的物料
*
* @param map 待查询数据
* @return
*/
List<Inventory> findInventoryByTypeIdsAndMname(Map<String,Object> map);
List<Inventory> findInventoryByTypeIdsAndMname(Map<String, Object> map);
/**
* 添加当前批次下的物料与生产日期对应
*
* @param map
* @return
*/
Integer addMaterialAndProducedDate(Map<String,Object> map);
Integer addMaterialAndProducedDate(Map<String, Object> map);
/**
* 根据物料id查询所有物料与生产日期的对应
*
* @param mid
* @return
*/
@ -397,6 +431,7 @@ public interface MaterialMapper {
/**
* 根据物料编码查询所有物料与二维码对应
*
* @param mcode
* @return
*/
@ -405,13 +440,15 @@ public interface MaterialMapper {
/**
* 用于修改物料与生产日期对应关系
*
* @param map
* @return
*/
Integer updateMaterialAndProducedDate(Map<String,Object> map);
Integer updateMaterialAndProducedDate(Map<String, Object> map);
/**
* 用于修改物料与生产日期对应关系
*
* @param materialAndProducedDate
* @return
*/
@ -420,29 +457,33 @@ public interface MaterialMapper {
/**
* 根据物料id与生产日期获取对应关系
*
* @param map
* @return
*/
MaterialAndProducedDate findMaterialAndProducedDateByMidAndProducedDate(Map<String,Object> map);
MaterialAndProducedDate findMaterialAndProducedDateByMidAndProducedDate(Map<String, Object> map);
/**
* 根据物料编码与码值获取对应对象
*
* @param map 查询条件
* @return
*/
MaterialAndBarCode findMaterialAndBarCodeByQrCode(Map<String,Object> map);
MaterialAndBarCode findMaterialAndBarCodeByQrCode(Map<String, Object> map);
/**
* 用于修改编码类型
*
* @param map 修改数据
* @return
*/
Integer updateQrCodeAndMaterial(Map<String,Object> map);
Integer updateQrCodeAndMaterial(Map<String, Object> map);
/**
* 获取当前仓库列表下的库存数量
*
* @param depositoryIds 待查询仓库列表
* @return
*/

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

@ -821,12 +821,44 @@
FROM findInventory WHERE id =#{mid}
</select>
<select id="findInventoryByMid" resultMap="InventoryMap" parameterType="integer">
<select id="findInventoryByMidAndDidList" resultMap="InventoryMap" parameterType="map">
SELECT
<include refid="allColumnsAndTypeNameOnViewByInventory"/>
FROM findInventory WHERE mid =#{mid}
FROM findInventory
WHERE 1 = 1
<if test="mid != null and mid != ''">
and mid =#{mid}
</if>
<if test="depositoryIdList != null and depositoryIdList != ''">
and depositoryId in
<foreach collection="depositoryIdList" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
</if>
<if test="begin != null and size != null">
LIMIT #{begin},#{size}
</if>
</select>
<select id="findInventoryCountByMidAndDidList" resultType="int" parameterType="map">
SELECT
COUNT(*)
FROM findInventory
WHERE 1 = 1
<if test="mid != null and mid != ''">
and mid =#{mid}
</if>
<if test="depositoryIdList != null and depositoryIdList != ''">
and depositoryId in
<foreach collection="depositoryIdList" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
</if>
</select>
<select id="findInventoryByMidAndDid" resultMap="InventoryMap" parameterType="map">
select
<include refid="allColumnsAndTypeNameOnViewByInventory"/>
@ -836,17 +868,7 @@
and depositoryId = #{did}
</select>
<select id="findInventoryByMidAndDids" resultMap="InventoryMap" parameterType="map">
select
<include refid="allColumnsAndTypeNameOnViewByInventory"/>
from findInventory
where
mid = #{mid}
and depositoryId in
<foreach collection="list" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
</select>
<select id="findMaterialAndTypeById" resultMap="materialAndTypeMap" parameterType="integer">
select

14
src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java

@ -151,6 +151,20 @@ public interface PlaceMapper {
*/
List<MaterialAndPlaceForViewP> findPlaceAndMaterialByDidAndMid(Map<String,Object> map);
/**
* 根据物料id获取对应库位存储记录
* @param map 带查询数据
* @return
*/
List<MaterialAndPlaceForViewP> findPlaceAndMaterialByMid(Map<String,Object> map);
/**
* 根据物料id获取对应库位存储记录数
* @param map 带查询数据
* @return
*/
Integer findPlaceAndMaterialCountByMid(Map<String,Object> map);
/**
* 根据仓库id及物料id获取对应库位存储的物料
* @param map 待查询条件

27
src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml

@ -122,6 +122,30 @@
and pstate != 3
</select>
<select id="findPlaceAndMaterialByMid" resultMap="MaterialAndPlaceForViewMap" parameterType="map">
select
<include refid="allColumnsForView"/>
FROM materialandplaceinfo WHERE 1 = 1
<if test="mid != '' and mid != null">
and mid = #{mid}
</if>
and pstate != 3
<if test="begin != null and size != null">
LIMIT #{begin},#{size}
</if>
</select>
<select id="findPlaceAndMaterialCountByMid" resultMap="MaterialAndPlaceForViewMap" parameterType="map">
select
COUNT(*)
FROM materialandplaceinfo WHERE 1 = 1
<if test="mid != '' and mid != null">
and mid = #{mid}
</if>
and pstate != 3
</select>
<select id="findPlaceAndMaterialByDidsAndMid" resultMap="MaterialAndPlaceForViewMap" parameterType="map">
select
<include refid="allColumnsForView"/>
@ -177,6 +201,9 @@
<if test="mname != null and mname != ''">
and mname like CONCAT('%',#{mname},'%')
</if>
<if test="iid != null and iid != ''">
and iid = #{iid}
</if>
and pstate != 3
<if test="begin != null and size != null">
LIMIT #{begin},#{size}

21
src/main/java/com/dreamchaser/depository_manage/pojo/MaterialP.java

@ -178,15 +178,18 @@ public class MaterialP {
*/
private List<SplitInfo> splitInfoList;
/**
* 当前物料存在的库位列表
*/
private List<MaterialAndPlaceForViewP> materialAndPlaceList;
/**
* 基础单位
*/
private String baseUnit;
public MaterialP(Integer id, Integer depositoryId, String mname, Integer quantity, Double price, String typeName) {
this.id = id;
this.mname = mname;
@ -204,16 +207,16 @@ public class MaterialP {
this.price = material.getPrice(); // 单价
this.state = material.getState(); // 物料状态
this.amounts = material.getAmounts(); // 总额
this.unit = material.getUnit(); // 计量单位
this.texture = material.getTexture(); // 材质
this.unit = material.getUnit() == null ? "" : material.getUnit(); // 计量单位
this.texture = material.getTexture() == null ? "" : material.getTexture(); // 材质
this.code = material.getCode(); // 存货编码
this.version = material.getVersion(); // 规格型号
this.version = material.getVersion() == null ? "" : material.getVersion(); // 规格型号
this.depositoryCode = material.getDepositoryCode(); // 仓库编码
this.depositoryId = material.getDepositoryId(); // 仓库id
this.placeCode = material.getPlaceCode(); // 库位编码
this.productionPlace = material.getProductionPlace(); // 产地
this.brand = material.getBrand(); // 品牌
this.remark = material.getRemark(); // 备注
this.productionPlace = material.getProductionPlace() == null ? "" : material.getProductionPlace(); // 产地
this.brand = material.getBrand() == null ? "" : material.getBrand(); // 品牌
this.remark = material.getRemark() == null ? "" : material.getRemark(); // 备注
this.shelfLifeForCalc = material.getShelfLife(); //保质期,用于计算
this.typeName = material.getTypeName(); // 物料类型
this.baseUnit = material.getUnit(); // 基础单位

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

@ -485,9 +485,11 @@ public interface DepositoryRecordService {
* @param id 待查询物料id
* @param days 查询日期范围
* @param type 查询类型 1入库2出库
* @param flagForSplit 是查询基础单位还是拆单单位
* @param splitInfo 拆单单位
* @return
*/
Map<String,Object> getApplicationByMaterial(Integer id, List<Long> days,Integer type);
Map<String,Object> getApplicationByMaterial(Integer id, List<Long> days,Integer type,boolean flagForSplit,SplitInfo splitInfo);
/**
* 用于构造堆叠面积图的series项目

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

@ -145,10 +145,18 @@ public interface MaterialService {
/**
* 根据物料id获取对应库存信息
* @param mid 待查询物料id
* @param map 待查询数据
* @return
*/
List<Inventory> findInventoryByMid(int mid);
List<Inventory> findInventoryByMidAndDidList(Map<String,Object> map);
/**
* 根据物料id与仓库id列表获取对应库存数量
*
* @param map 待查询数据
* @return
*/
Integer findInventoryCountByMidAndDidList(Map<String, Object> map);
/**
* 根据套餐详情获取其在对应仓库中的库存数

14
src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java

@ -241,9 +241,21 @@ public interface PlaceService {
* @param flag 类型
* @return
*/
Integer findPlaceCoutnByTypeForFlag(Integer flag, Integer did);
Integer findPlaceCountByTypeForFlag(Integer flag, Integer did);
/**
* 根据物料id获取对应库位存储记录
* @param map 带查询数据
* @return
*/
List<MaterialAndPlaceForViewP> findPlaceAndMaterialByMid(Map<String,Object> map);
/**
* 根据物料id获取对应库位存储记录数
* @param map 带查询数据
* @return
*/
Integer findPlaceAndMaterialCountByMid(Map<String,Object> map);
}

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

@ -2074,7 +2074,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @return
*/
@Override
public Map<String, Object> getApplicationByMaterial(Integer id, List<Long> days, Integer type) {
public Map<String, Object> getApplicationByMaterial(Integer id, List<Long> days, Integer type, boolean flagForSplit, SplitInfo splitInfo) {
// 声明结果集
Map<String, Object> result = new HashMap<>();
// 声明总数列表
@ -2083,6 +2083,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<Object> amountList = new ArrayList<>();
// 获取对应物料
Inventory inventoryById = materialMapper.findInventoryById(id);
String materialUnit = inventoryById.getUnit();
// 声明用于查询的map
Map<String, Object> paramForSelect = new HashMap<>();
if (type == 1) {
@ -2090,21 +2091,86 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else {
paramForSelect.put("mid", inventoryById.getId());
}
int scale = 1;
if (flagForSplit) {
scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
}
for (int i = 0; i < days.size() - 1; i++) {
// 设置开始时间
paramForSelect.put("start", days.get(i));
// 设置结束时间
paramForSelect.put("end", days.get(i + 1));
// 获取当前物料的入库总额
Integer count = 0;
double count = 0;
if (type == 1) {
count = depositoryRecordMapper.findApplicationInByDateAndMaterial(paramForSelect);
// count = depositoryRecordMapper.findApplicationInSumQuantityByDateAndMaterial(paramForSelect);
List<ApplicationInRecord> recordInList = depositoryRecordMapper.findApplicationInByDateAndMaterial(paramForSelect);
for (ApplicationInRecord record : recordInList) {
double quantity = ObjectFormatUtil.divide(record.getQuantity(), 100.0, 2);
String airUnit = record.getAirUnit();
if (!flagForSplit) {
// 如果是基础单位
if (airUnit.equals(materialUnit)) {
// 如果是入库基础单位
count = ObjectFormatUtil.sum(count, quantity);
} else {
// 如果入库的是拆单单位
count = ObjectFormatUtil.sum(count, ObjectFormatUtil.divide(scale, quantity, 2));
}
} else {
// 如果是拆单单位
if (airUnit.equals(materialUnit)) {
// 如果入库的是基础单位
count = ObjectFormatUtil.sum(count, ObjectFormatUtil.multiply(scale, quantity));
} else {
// 如果入库的是拆单单位
count = ObjectFormatUtil.sum(count, quantity);
}
}
}
} else {
paramForSelect.put("state", 1);
count = depositoryRecordMapper.findApplicationOutByDateAndMaterial(paramForSelect);
// count = depositoryRecordMapper.findApplicationOutSumQuantityByDateAndMaterial(paramForSelect);
List<ApplicationOutRecord> recordOutList = depositoryRecordMapper.findApplicationOutByDateAndMaterial(paramForSelect);
for (ApplicationOutRecord record : recordOutList) {
double quantity = ObjectFormatUtil.divide(record.getQuantity(), 100.0, 2);
String unit = record.getUnit();
if (!flagForSplit) {
// 如果是基础单位
if (unit.equals(materialUnit) || "-1".equals(unit)) {
// 如果是出库基础单位
count = ObjectFormatUtil.sum(count, quantity);
} else {
// 如果出库的是拆单单位
count = ObjectFormatUtil.sum(count, ObjectFormatUtil.divide(scale, quantity, 2));
}
} else {
// 如果是拆单单位
if (unit.equals(materialUnit) || "-1".equals(unit)) {
// 如果出库的是基础单位
count = ObjectFormatUtil.sum(count, ObjectFormatUtil.multiply(scale, quantity));
} else {
// 如果出库的是拆单单位
count = ObjectFormatUtil.sum(count, quantity);
}
}
}
}
// 定义处理后的总额
double countProcessed = ObjectFormatUtil.divide(count, 100.0, 2);
// 声明总额且默认为0
double amount = 0.0;
if (inventoryById.getPrice() != null) { // 如果当前物料存在单价
@ -2112,15 +2178,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前物料的单价
double price = ObjectFormatUtil.divide(inventoryById.getPrice(), 100.0, 2);
// 获取当前物料的总额
amount = ObjectFormatUtil.multiply(price, countProcessed);
amount = ObjectFormatUtil.multiply(price, count);
}
countList.add(countProcessed);
countList.add(count);
amountList.add(amount);
}
Map<String, Object> amountItem = createStackedAreaChartSeriesItem("amount", amountList);
Map<String, Object> countItem = createStackedAreaChartSeriesItem("count", countList);
result.put("amountItem",amountItem);
result.put("countItem",countItem);
result.put("amountItem", amountItem);
result.put("countItem", countItem);
return result;
}
@ -5622,6 +5689,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/**
* 用于构造堆叠面积图的series项目
*
* @param name 当前项目名称
* @param data 数据
* @return

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

@ -501,17 +501,23 @@ public class MaterialServiceImpl implements MaterialService {
/**
* 根据物料id获取对应库存信息
*
* @param mid 待查询物料id
* @param map 待查询数据
* @return
*/
@Override
public List<Inventory> findInventoryByMid(int mid) {
List<Inventory> inventoryByMid = materialMapper.findInventoryByMid(mid);
public List<Inventory> findInventoryByMidAndDidList(Map<String,Object> map){
Integer size = 10, page = 1;
if (map.containsKey("size")) {
size = ObjectFormatUtil.toInteger(map.get("size"));
map.put("size", size);
}
if (map.containsKey("page")) {
page = ObjectFormatUtil.toInteger(map.get("page"));
map.put("begin", (page - 1) * size);
}
List<Inventory> inventoryByMid = materialMapper.findInventoryByMidAndDidList(map);
for (Inventory inventory : inventoryByMid) {
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(inventory.getMaterialTypeId());
inventory.setTypeName(materialTypeByOldId.getTname());
if (inventory.getPlaceCode() != null) {
if (inventory.getPrice() != null) {
inventory.setPrice(inventory.getPrice() / 100);
} else {
inventory.setPrice(0.0);
@ -521,6 +527,19 @@ public class MaterialServiceImpl implements MaterialService {
return inventoryByMid;
}
/**
* 根据物料id与仓库id列表获取对应库存数量
*
* @param map 待查询数据
* @return
*/
@Override
public Integer findInventoryCountByMidAndDidList(Map<String, Object> map) {
return materialMapper.findInventoryCountByMidAndDidList(map);
}
/**
* 根据套餐详情获取其在对应仓库中的库存数
*
@ -591,8 +610,6 @@ public class MaterialServiceImpl implements MaterialService {
@Override
public List<MaterialAndPlaceForViewP> findInventoryByMidAndDepository(Map<String, Object> map, List<Integer> depositoryList) {
Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
// 获取当前物料的所有拆单记录
List<SplitInfo> splitInfoList = splitUnitMapper.findSplitInfoByMid(mid);
// 定义参数用于获取当前物料在仓库下的各库位记录
List<MaterialAndPlaceForViewP> placeAndMaterialByDidsAndMid = placeService.findPlaceAndMaterialByDidsAndMid(depositoryList, map);
if (placeAndMaterialByDidsAndMid.size() > 0) {

20
src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java

@ -297,6 +297,8 @@ public class PlaceServiceImpl implements PlaceService {
}
/**
* 根据仓库id及物料id获取对应库位存储的物料
*
@ -483,7 +485,7 @@ public class PlaceServiceImpl implements PlaceService {
* @return
*/
@Override
public Integer findPlaceCoutnByTypeForFlag(Integer flag, Integer did) {
public Integer findPlaceCountByTypeForFlag(Integer flag, Integer did) {
Map<String, Object> map = new HashMap<>();
map.put("flag", flag);
map.put("did", did);
@ -491,4 +493,20 @@ public class PlaceServiceImpl implements PlaceService {
}
/**
* 根据物料id获取对应库位存储记录
* @param map 带查询数据
* @return
*/
@Override
public List<MaterialAndPlaceForViewP> findPlaceAndMaterialByMid(Map<String,Object> map) {
return placeMapper.findPlaceAndMaterialByMid(map);
}
@Override
public Integer findPlaceAndMaterialCountByMid(Map<String, Object> map) {
return placeMapper.findPlaceAndMaterialCountByMid(map);
}
}

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

@ -287,7 +287,7 @@ public class DateUtil {
}
/**
* 获取本月至今的日期时间戳即日期名称
* 获取本月至今每天零时的日期时间戳及日期名称
* @return
*/
public static Map<String, Object> getMonthBeginToNow() {
@ -301,7 +301,7 @@ public class DateUtil {
List<Long> dayTimeSpaceList = new ArrayList<>();
Calendar cal = Calendar.getInstance();
// 获取当天是这个月的第几天
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH) - 1;
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH) ;
cal.add(Calendar.MONTH, 0);
cal.set(Calendar.DAY_OF_MONTH, 1);
// 时
@ -319,13 +319,10 @@ public class DateUtil {
dayTimeSpaceList.add(cal.getTimeInMillis());
dayNameStrings.add(sdf.format(cal.getTime()));
}
cal = Calendar.getInstance();
// 反转
Collections.reverse(dayTimeSpaceList);
// 反转
Collections.reverse(dayNameStrings);
dayTimeSpaceList.add(cal.getTimeInMillis());
dayNameStrings.add(sdf.format(cal.getTime()));
result.put("dayName",dayNameStrings);
result.put("dayTimeSpace",dayTimeSpaceList);
return result;

551
src/main/resources/templates/pages/depository/Inventory-view.html

@ -10,182 +10,194 @@
<link rel="stylesheet" href="/static/css/public.css" media="all">
<link rel="stylesheet" href="/static/js/lay-module/step-lay/step.css" media="all">
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
<link rel="stylesheet" href="/static/lib/bootstrap-3.4.1-dist/css/bootstrap.min.css">
<style>
.inputdiv {
display: flex;
background-color: #fff;
height: 38px;
line-height: 38px;
border: 1px solid rgb(238, 238, 238);
}
.editButton {
position: absolute;
top: 5px;
right: 15px;
.layui-form-label {
padding: 9px 0px;
text-align: left;
}
.layui-input-block {
margin-left: 80px;
.myEchart {
min-width: 500px;
min-height: 500px;
margin: 0 2px;
}
.inputdiv .layui-unselect {
border-style: none;
}
</style>
</head>
<body>
<form class="layui-form layui-form-pane" action="">
<input type="text" id="id" th:value="${record.getId()}" name="id" style="display: none">
<div class="layui-form-item">
<label class="layui-form-label">存货编码</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getCode()}" name="code" id="code" readonly
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">物料名称</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getMname()}" name="mname" readonly
autocomplete="off" class="layui-input">
<input type="text" id="id" th:value="${record.getId()}" name="id" style="display: none">
<div class="layui-fluid">
<div class="layui-row layui-col-space1">
<div class="layui-row layui-col-xs12 layui-col-md8">
<div>
<div class="panel panel-info">
<div class="panel-heading">物料基本信息
<button type="button" th:attr="mid=${record.getMid()}" lay-on="editMaterialInfo"
th:style="'display:'+${display}"
class="editButton layui-btn layui-btn-sm layui-btn-primary">
<i class="layui-icon layui-icon-edit"></i>
</button>
</div>
<div class="panel-body">
<table class="table">
<tbody>
<tr>
<td th:text="'物料编码:'+${record.getCode()}">物料编码:</td>
<td th:text="'物料名称:'+${record.getMname()}">物料名称:</td>
<td th:text="'规格型号:'+${record.getVersion()}">规格型号:</td>
<td th:text="'物料材质:'+${record.getTexture()}">物料材质:</td>
</tr>
<tr>
<td th:text="'物料品牌:'+${record.getBrand()}">物料品牌:</td>
<td th:text="'物料类型:'+${record.getTypeName()}">物料类型:</td>
<td>
计量单位:
<span th:text="${record.getUnit()}"></span>
<span th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
th:text="${splitInfo.getNewUnit()}"></span>
</td>
<td th:text="'物料单价:'+${record.getPrice()}" th:style="'display:'+${display}">物料单价:</td>
</tr>
<tr>
<td th:text="'物料备注:'+${record.getIremark()}">物料备注:</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="panel panel-primary">
<div class="panel-heading">数据图标
</div>
<div class="panel-body">
<div class="layui-col-xs4 myEchart">
<div class="panel panel-warning">
<div class="panel-heading">物料入库明细</div>
<div class="panel-body">
<div id="echarts-line-in" style="height:500px;width: 500px;">
</div>
</div>
</div>
</div>
<div class="layui-col-xs4 myEchart">
<div class="panel panel-warning">
<div class="panel-heading">物料出库明细</div>
<div class="panel-body">
<div id="echarts-line-out" style="height: 500px;width: 500px">
</div>
</div>
</div>
</div>
<div class="layui-col-xs4 myEchart">
<div class="panel panel-warning">
<div class="panel-heading">物料库存明细</div>
<div class="panel-body">
<div id="echarts-line-inventory" style="height: 500px;width: 500px">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md4">
<div class="">
<div class="panel panel-success">
<div class="panel-heading">库存基本信息</div>
<div class="panel-body">
<div class="layui-form-item">
<label class="layui-form-label">规格型号</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getVersion()}" name="version" autocomplete="off" readonly
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">品牌:</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" th:value="${record.getBrand()}" readonly
name="brand"/>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">物料类型</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" id="openSonByMateralType" readonly
th:value="${record.getTypeName()}"
lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">材质</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getTexture()}" name="texture" autocomplete="off" readonly
class="layui-input">
<table class="table">
<caption th:text="${record.getDepositoryName()}">所属仓库:</caption>
<caption th:text="'备注:'+${record.getIremark()}">备注:</caption>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">计量单位</label>
<div class="layui-input-inline">
<select id="unit">
<option value="-1" th:text="${record.getUnit()}"></option>
<option th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
th:value="${splitInfo?.getNewUnit()}"
th:text="${splitInfo?.getNewUnit()}"></option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">所处仓库</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getDepositoryName()}" name="depositoryName" required
autocomplete="off" readonly
class="layui-input">
<input type="text" id="depositoryId" th:value="${record.getDepositoryId()}" style="display: none">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">所处库位</label>
<div class="layui-input-inline">
<button th:each="placeP,iterStar:${record.getPlacePList()}"
th:attr="id=${record.getMid()}" class="layui-btn layui-btn-customize"
onclick="changePlaceCode(this)" th:value="${record.getDepositoryId()}"
th:text="${placeP.getKingdeecode()}">
</button>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数量</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getQuantity()}" name="quantity" required autocomplete="off"
id="quantity" readonly
class="layui-input">
</div>
</div>
<div class="layui-form-item" th:style="'display:'+${display}">
<label class="layui-form-label">单价</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getPrice()}" name="price" required autocomplete="off" id="price"
readonly
class="layui-input">
</div>
</div>
<div class="layui-form-item" th:style="'display:'+${display}">
<label class="layui-form-label">总额</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getAmounts()}" name="amounts" required autocomplete="off" id="amounts"
readonly
class="layui-input">
</div>
</div>
<div class="layui-form-item" >
<label class="layui-form-label">备注</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getIremark()}" name="iremark" required autocomplete="off" id="iremark"
onchange="updateInventoryRemark()"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-customize" type="button" onclick="applicationIn()">入库申请</button>
<thead>
<tr>
<td>所处库位</td>
<td>计量单位</td>
<td>对应数量</td>
<td th:style="'display:'+${display}">金额</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<tr type="button"
th:each="materialAndPlace,iterStar:${record.getMaterialAndPlaceList()}">
<td>
<button onclick="changePlaceCode(this)"
th:text="${materialAndPlace.getKingdeecode()}"
th:attr="id=${materialAndPlace.getId()}"
class="layui-btn layui-btn-primary layui-btn-sm"></button>
</td>
<td>
<select class="mySelect" onchange="changeUnitForQuantity(this)"
th:attr="id='materialUnit'+${materialAndPlace.getId()}">
<option th:text="${record.getUnit()}" value="-1"
class="myOption"></option>
<option class="myOption"
th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
th:value="${splitInfo.getNewUnit()}"
th:text="${splitInfo.getNewUnit()}"></option>
</select>
<button class="layui-btn layui-btn-customize" type="button" onclick="applicationOut()">出库申请</button>
</td>
<td>
<span th:attr="id='quantity'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getInventory()}"></span>
</td>
<td th:style="'display:'+${display}">
<span th:attr="id='amounts'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getAmount()}"></span>
</td>
<td>
<a class="layui-btn layui-btn-xs"
th:attr="mid=${materialAndPlace.getIid()},depositoryId=${materialAndPlace.getDepository_id()},placeId=${materialAndPlace.getPid()}"
lay-on="applicationIn">入库</a>
<a class="layui-btn layui-btn-xs"
th:attr="code=${materialAndPlace.getMcode()},depositoryId=${materialAndPlace.getDepository_id()}"
lay-on="applicationOut">出库</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<script src="/static/lib/layui-v2.8.6/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="/static/lib/echarts/echarts.js" charset="utf-8"></script>
<script>
function applicationIn() {
}
function applicationOut() {
function updateInventoryRemark() {
}
function updateInventoryRemark(){
function changePlaceCode() {
}
function changeUnitForQuantity() {
}
var barCode = [];
var flag = false;
layui.use(['form', 'laydate', 'miniTab'], function () {
layui.use(['form', 'laydate', 'util'], function () {
var form = layui.form,
laydate = layui.laydate,
$ = layui.$,
miniTab = layui.miniTab;
util = layui.util;
let iremark = $("#iremark").val();
miniTab.listen();
let id = $("#id").val();
form.on('select()', function (data) {
var id = data.elem.id; //得到select原始DOM对象id
@ -204,45 +216,63 @@
});
});
applicationOut = function () {
var index = layer.open({
title: '出库申请',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/application_out_back?code=' + $("#code").val() + "&depositoryId=" + $("#depositoryId").val()
});
$(window).on("resize", function () {
layer.full(index);
});
return false;
};
applicationIn = function () {
var index = layer.open({
title: '入库申请',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/application_in_back?mid=' + $("#id").val() + "&depositoryId=" + $("#depositoryId").val()
});
$(window).on("resize", function () {
layer.full(index);
});
return false;
}
util.on('lay-on', {
'editMaterialInfo': function (obj) {
let mid = $(obj).attr("mid");
layer.open({
type: 2,
offset: 'r',
anim: 'slideLeft', // 从右往左
area: ['40%', '100%'],
shade: 0.1,
title: "物料详情",
shadeClose: true,
id: 'ID-demo-layer-direction-r',
content: '/materialEditForInventory?id=' + mid,
end: function () {
location.reload();
}
});
},
'applicationIn': function (obj) {
let mid = $(obj).attr('mid');
let depositoryId = $(obj).attr('depositoryId');
let placeId = $(obj).attr('placeId');
layer.open({
type: 2,
offset: 'r',
anim: 'slideLeft', // 从右往左
area: ['40%', '100%'],
shade: 0.1,
title: "入库申请",
shadeClose: true,
id: 'ID-demo-layer-direction-r',
content: '/application_in_back?mid=' + mid + "&depositoryId=" + depositoryId + "&placeId=" + placeId
});
},
'applicationOut': function (obj) {
let code = $(obj).attr('code');
let depositoryId = $(obj).attr('depositoryId');
layer.open({
type: 2,
offset: 'r',
anim: 'slideLeft', // 从右往左
area: ['40%', '100%'],
shade: 0.1,
title: "出库申请",
shadeClose: true,
id: 'ID-demo-layer-direction-r',
content: '/application_out_back?code=' + code + "&depositoryId=" + depositoryId
});
},
});
updateInventoryRemark = function() {
let id = $("#id").val();
updateInventoryRemark = function () {
let newIremark = $("#iremark").val();
let index = layer.confirm('确认更改备注?', {
btn: ['确定','取消'] //按钮
}, function(){
let index = layer.confirm('确认更改备注?', {
btn: ['确定', '取消'] //按钮
}, function () {
let req = {};
req.id = id;
req.remark = newIremark;
@ -254,7 +284,7 @@
contentType: "application/json;charset=utf-8",
success: function (data) {
if (data.status >= 300) {
layer.msg(data.statusInfo.message,{
layer.msg(data.statusInfo.message, {
icon: 5,//失败的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
}, function () {
@ -270,10 +300,171 @@
}
}
});
}, function(){
}, function () {
$("#iremark").val(iremark);
});
}
};
// 用于更改同一仓库下的库位
changePlaceCode = function (obj) {
var id = $(obj).attr("id");
// 当前点击行中的计量单位按钮
let materialUnitObj = $("#materialUnit" + id + " option:selected");
let unit = materialUnitObj.val();
if (unit === -1 || unit === "-1") {
unit = materialUnitObj.text();
}
unit = unit.trim();
layer.open({
title: '选择库位',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['70%', '70%'],
content: '/selectPlaceByDepositoryForInventory?id=' + id + '&unit=' + unit,
success: function (layero, index) {
var children = layero.children();
var content = $(children[1]);
var iframeChildren = $(content.children());
content.css('height', '100%');
iframeChildren.css('height', '100%');
},
end: function () {
location.reload();
}
});
};
/**
* 用于修改展示的库存数量
* @param obj
*/
changeUnitForQuantity = function (obj) {
let materialUnitObj = $(obj);
let req = {};
req.unit = materialUnitObj.val();
let id = materialUnitObj.attr("id").split("materialUnit")[1].trim();
req.id = id;
$.ajax({
url: "/material/getQuantityForLocationAndUnit",
type: "post",
dataType: 'json',
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (res) {
let data = res.data;
$("#quantity" + id).text(data.quantity);
$("#amounts" + id).text(data.amount);
}
});
};
// 柱状图
var echartLineChartIn = echarts.init(document.getElementById('echarts-line-in'));
var echartLineChartOut = echarts.init(document.getElementById('echarts-line-out'));
var echartLineChartInventory = echarts.init(document.getElementById('echarts-line-inventory'));
var optionLineChartIn = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
var optionLineChartOut = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
var optionLineChartInventory = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
$.ajax({
url: '/depositoryRecord/getApplicationForMaterial',
type: 'post',
async: true,
dataType: "json",
data: JSON.stringify({"id": id}),
contentType: "application/json;charset=utf-8",
complete: function (XHR, TS) {
layer.close(this.layerIndex);
if (XHR.status !== 200) {
layer.alert("系统繁忙,稍后重试");
}
},
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (result) {
let data = result.data;
let dayNames = data["dayNames"];
let amountItemForIn = data["amountItemForIn"];
let countItemForIn = data["countItemForIn"];
let amountItemForOut = data["amountItemForOut"];
let countItemForOut = data["countItemForOut"];
let countItemForInventory = data["countItemForInventory"];
let amountItemForInventory = data["amountItemForInventory"];
let legendItem = data["legend"];
let seriesInItem = [];
let seriesOutItem = [];
let seriesInventoryItem = [];
seriesInItem.push(amountItemForIn);
seriesInItem.push(countItemForIn);
seriesOutItem.push(amountItemForOut);
seriesOutItem.push(countItemForOut);
seriesInventoryItem.push(countItemForInventory);
seriesInventoryItem.push(amountItemForInventory);
optionLineChartIn.series = seriesInItem;
optionLineChartOut.series = seriesOutItem;
optionLineChartInventory.series = seriesInventoryItem;
optionLineChartIn.xAxis.data = dayNames;
optionLineChartIn.legend = legendItem;
optionLineChartOut.legend = legendItem;
optionLineChartOut.xAxis.data = dayNames;
optionLineChartInventory.legend = legendItem;
optionLineChartInventory.xAxis.data = dayNames;
echartLineChartIn.setOption(optionLineChartIn);
echartLineChartOut.setOption(optionLineChartOut);
echartLineChartInventory.setOption(optionLineChartInventory);
}
})
});
</script>

41
src/main/resources/templates/pages/depository/table-stock.html

@ -100,7 +100,7 @@
</script>
<script id="changePlace" type="text/html">
<span >{{d.placeKingdeeCode}}</span>
<span style="display:none;">{{d.placeKingdeeCode}}</span>
</script>
@ -211,14 +211,15 @@
{field: 'brand', width: 200, title: '品牌',hide:true},
{field: 'version', width: 200, title: '规格型号'},
{field: 'typeName', width: 200, title: '物料类型',hide:true},
{field: "unit", title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 200, title: '数量'},
{field: "unit", title: '计量单位', width: 100, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 100, title: '数量'},
{field: 'depositoryName', width: 200, title: '仓库名称'},
{field: 'depositoryCode', width: 200, title: '仓库编码'},
{title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: 'warningCount', width: 200, title: '待过期数量', sort: true},
{field: 'price', title: '单价', width: 200, sort: true},
{field: 'amounts', title: '总金额', width: 200, sort: true},
{field: 'depositoryCode', width: 200, title: '仓库编码',hide:true},
// {title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: "placeKingdeeCode", title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: 'warningCount', width: 100, title: '待过期数量', sort: true,hide:true},
{field: 'price', title: '单价', width: 100, sort: true},
{field: 'amounts', title: '总金额', width: 100, sort: true},
{field: 'texture', width: 200, title: '材质',hide:true},
{field: 'iremark', width: 200, title: '备注',hide:true},
{title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"}
@ -258,12 +259,13 @@
{field: 'brand', width: 200, title: '品牌', hide: true},
{field: 'version', width: 200, title: '规格型号'},
{field: 'typeName', width: 200, title: '物料类型', hide: true},
{field: "unit", title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 200, title: '数量'},
{field: "unit", title: '计量单位', width: 100, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 100, title: '数量'},
{field: 'depositoryName', width: 200, title: '仓库名称'},
{field: 'depositoryCode', width: 200, title: '仓库编码', hide: true},
{title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: 'warningCount', width: 200, title: '待过期数量', sort: true, hide: true},
// {title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: "placeKingdeeCode", title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: 'warningCount', width: 100, title: '待过期数量', sort: true, hide: true},
{field: 'texture', width: 200, title: '材质', hide: true},
{field: 'iremark', width: 200, title: '备注',},
{title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"}
@ -283,6 +285,10 @@
}
$.each(res['data'], function (i, j) {
let jElement = j['warningCount'];
let placeCode = j['placeCode'].split(" ");
let placeKingdeeCode = j['placeKingdeeCode'].split(" ");
let depositoryId = j['depositoryId'];
let mid = j['id'];
if (jElement !== null && jElement !== undefined) {
let flag = (Number(jElement) !== 0);
if (flag) {
@ -290,6 +296,17 @@
}
}
// 所处库位
var placeCodeItem = $("[lay-id='currentTableId'] tr:eq(" + (i + 1) + ")").children()[10];
//计量单位
// 用于库位的添加
var aItem = placeCodeItem.childNodes[0];
// 用于计量单位的添加
for (let k = 0; k < placeKingdeeCode.length; k++) {
if (placeKingdeeCode[k] !== "") {
$(aItem).append('<button code=' + placeCode[k] + ' id=' + mid + ' class="layui-btn layui-btn-primary layui-btn-xs" onclick="changePlaceCode(this)" value=' + depositoryId + '>' + placeKingdeeCode[k] + '</button>')
}
}
});
}

31
src/main/resources/templates/pages/material/material-out.html

@ -767,7 +767,7 @@
});
showDetail = function (obj) {
/*showDetail = function (obj) {
var index = layer.open({
title: '物料信息详情',
type: 2,
@ -790,11 +790,32 @@
layer.full(index);
});
return false;
}
}*/
$('body').on('click', '[data-refresh]', function () {
location.reload();
})
showDetail = function (obj) {
var index = layer.open({
title: '库存信息详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/InventoryViewBack?id=' + obj.id,
end: function () {
//执行搜索重载
table.reloadData('currentTableId', {
url: '/material/material',
page: {
curr: 1
}
}, 'data');
}
});
$(window).on("resize", function () {
layer.full(index);
});
return false;
}
});
</script>

268
src/main/resources/templates/pages/depository/Inventory-view_back.html → src/main/resources/templates/pages/material/material-view_back.html

@ -64,13 +64,79 @@
<td th:text="'物料单价:'+${record.getPrice()}" th:style="'display:'+${display}">物料单价:</td>
</tr>
<tr>
<td th:text="'物料备注:'+${record.getIremark()}">物料备注:</td>
<td th:text="'物料备注:'+${record.getRemark()}">物料备注:</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="">
<div class="panel panel-success">
<div class="panel-heading">库存基本信息</div>
<div class="panel-body">
<!-- <table class="table">
<caption th:text="${record.getDepositoryName()}">所属仓库:</caption>
<caption th:text="'备注:'+${record.getRemark()}">备注:</caption>
<thead>
<tr>
<td>所处库位</td>
<td>计量单位</td>
<td>对应数量</td>
<td th:style="'display:'+${display}">金额</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<tr type="button"
th:each="materialAndPlace,iterStar:${record.getMaterialAndPlaceList()}">
<td>
<button onclick="changePlaceCode(this)"
th:text="${materialAndPlace.getKingdeecode()}"
th:attr="id=${materialAndPlace.getId()}"
class="layui-btn layui-btn-primary layui-btn-sm"></button>
</td>
<td>
<select class="mySelect" onchange="changeUnitForQuantity(this)"
th:attr="id='materialUnit'+${materialAndPlace.getId()}">
<option th:text="${record.getUnit()}" value="-1"
class="myOption"></option>
<option class="myOption"
th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
th:value="${splitInfo.getNewUnit()}"
th:text="${splitInfo.getNewUnit()}"></option>
</select>
</td>
<td>
<span th:attr="id='quantity'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getInventory()}"></span>
</td>
<td th:style="'display:'+${display}">
<span th:attr="id='amounts'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getAmount()}"></span>
</td>
<td>
<a class="layui-btn layui-btn-xs"
th:attr="mid=${materialAndPlace.getIid()},depositoryId=${materialAndPlace.getDepository_id()},placeId=${materialAndPlace.getPid()}"
lay-on="applicationIn">入库</a>
<a class="layui-btn layui-btn-xs"
th:attr="code=${materialAndPlace.getMcode()},depositoryId=${materialAndPlace.getDepository_id()}"
lay-on="applicationOut">出库</a>
</td>
</tr>
</tbody>
</table>-->
<table class="layui-hide" id="currentTableId"></table>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md4">
<div>
<div class="panel panel-primary">
<div class="panel-heading">数据图标
@ -107,71 +173,42 @@
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md4">
<div class="">
<div class="panel panel-success">
<div class="panel-heading">库存基本信息</div>
<div class="panel-body">
</div>
</div>
<table class="table">
<caption th:text="${record.getDepositoryName()}">所属仓库:</caption>
<caption th:text="'备注:'+${record.getIremark()}">备注:</caption>
<script type="text/html" id="currentTableBar">
<div class="layui-clear-space">
<a class="layui-btn layui-btn-xs" id="applicationIn{{d.id}}"
mid="{{d.id}}" depositoryId="{{d.depositoryId}}" placeId="{{d.materialAndPlaceList[0].pid}}"
lay-on="applicationIn">入库</a>
<a class="layui-btn layui-btn-xs" id="applicationOut{{d.id}}"
code="{{d.code}}" depositoryId="{{d.depositoryId}}"
lay-on="applicationOut">出库</a>
</div>
</script>
<thead>
<tr>
<td>所处库位</td>
<td>计量单位</td>
<td>对应数量</td>
<td th:style="'display:'+${display}">金额</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<tr type="button"
th:each="materialAndPlace,iterStar:${record.getMaterialAndPlaceList()}">
<td>
<button onclick="changePlaceCode(this)"
th:text="${materialAndPlace.getKingdeecode()}"
th:attr="id=${materialAndPlace.getId()}"
class="layui-btn layui-btn-primary layui-btn-sm"></button>
</td>
<td>
<select class="mySelect" onchange="changeUnitForQuantity(this)"
th:attr="id='materialUnit'+${materialAndPlace.getId()}">
<option th:text="${record.getUnit()}" value="-1"
class="myOption"></option>
<option class="myOption"
th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
th:value="${splitInfo.getNewUnit()}"
th:text="${splitInfo.getNewUnit()}"></option>
</select>
<script type="text/html" id="unitItemList">
<select id="unitItem{{d.id}}" lay-ignore onchange="changeUnitForQuantity(this)">
<option value="-1">{{d.unit}}</option>
{{# layui.each(d.splitInfoList, function(index, item){ }}
<option value="{{= item.newUnit}}">{{= item.newUnit }}</option>
{{# }); }}
</select>
</script>
<script type="text/html" id="placeItemList">
<select id="placeItem{{d.id}}" lay-ignore onchange="changePlaceForQuantity(this)">
{{# layui.each(d.materialAndPlaceList, function(index, item){ }}
<option pid="{{= item.pid}}" value="{{= item.id}}">{{= item.kingdeecode }}</option>
{{# }); }}
</select>
</script>
<script type="text/html" id="quantityItem">
<span class="layui-badge-rim" id="quantity{{d.id}}" style="margin-right: 10px;">库存数:{{d.materialAndPlaceList[0].inventory}}</span>
<span class="layui-badge-rim" id="amount{{d.id}}" style="margin-right: 10px;">总金额:{{d.materialAndPlaceList[0].amount}}</span>
</script>
</td>
<td>
<span th:attr="id='quantity'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getInventory()}"></span>
</td>
<td th:style="'display:'+${display}">
<span th:attr="id='amounts'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getAmount()}"></span>
</td>
<td>
<a class="layui-btn layui-btn-xs"
th:attr="mid=${materialAndPlace.getIid()},depositoryId=${materialAndPlace.getDepository_id()},placeId=${materialAndPlace.getPid()}"
lay-on="applicationIn">入库</a>
<a class="layui-btn layui-btn-xs"
th:attr="code=${materialAndPlace.getMcode()},depositoryId=${materialAndPlace.getDepository_id()}"
lay-on="applicationOut">出库</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="/static/lib/layui-v2.8.6/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="/static/lib/echarts/echarts.js" charset="utf-8"></script>
@ -188,16 +225,73 @@
}
function changePlaceForQuantity() {
}
var barCode = [];
var flag = false;
layui.use(['form', 'laydate', 'util'], function () {
layui.use(['form', 'laydate', 'util', 'table'], function () {
var form = layui.form,
laydate = layui.laydate,
$ = layui.$,
table = layui.table,
util = layui.util;
let iremark = $("#iremark").val();
let id = $("#id").val();
let mid = $("#id").val();
table.render({
elem: "#currentTableId",
url: '/material/findInventoryByMid',
parseData: function (res) { //res 即为原始返回的数据
return {
"status": res.status, //解析接口状态
"message": res.statusInfo.message, //解析提示文本
"count": res.count, //解析数据长度
"data": res.data //解析数据列表
};
},
request: {
pageName: 'page', //页码的参数名称,默认:page
limitName: 'size' //每页数据量的参数名,默认:limit
},
where: {
"mid": mid
},
response: {
statusName: 'status' //规定数据状态的字段名称,默认:code
, statusCode: 200 //规定成功的状态码,默认:0
, msgName: 'message' //规定状态信息的字段名称,默认:msg
, countName: 'count' //规定数据总数的字段名称,默认:count
, dataName: 'data' //规定数据列表的字段名称,默认:data
},
cols: [
[
{type: "checkbox", width: 50},
{field: 'depositoryName', width: 200, title: '仓库名称'},
{
field: 'unit',
width: 100,
title: '计量单位',
templet: '#unitItemList',
},
{field: 'place', width: 100, title: '所处库位', templet: '#placeItemList'},
{title: '库存数', width: 230, templet: '#quantityItem', align: "center"},
{field: 'remark', width: 150, title: '备注'},
{title: '操作', width: 150, toolbar: '#currentTableBar', align: "center"},
]
],
limits: [10, 15, 20, 25, 50, 100],
limit: 10,
page: true,
skin: 'line',
done: function (res, curr, count) {
}
});
form.on('select()', function (data) {
var id = data.elem.id; //得到select原始DOM对象id
@ -274,7 +368,7 @@
btn: ['确定', '取消'] //按钮
}, function () {
let req = {};
req.id = id;
req.id = mid;
req.remark = newIremark;
$.ajax({
url: "/material/updateInventoryRemark",
@ -343,11 +437,36 @@
* @param obj
*/
changeUnitForQuantity = function (obj) {
let materialUnitObj = $(obj);
let id = obj.id.split("unitItem")[1];
let unit = obj.value;
let placeAndMaterialId = $("#placeItem" + id).val();
let req = {};
req.unit = unit;
req.id = placeAndMaterialId;
$.ajax({
url: "/material/getQuantityForLocationAndUnit",
type: "post",
dataType: 'json',
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (res) {
let data = res.data;
$("#quantity" + id).text("库存数:" + data.quantity);
$("#amount" + id).text("总金额:" + data.amount);
}
});
};
changePlaceForQuantity = function (obj) {
let pid = $(obj).find("option:selected").attr("pid");
let id = obj.id.split("placeItem")[1];
let placeAndMaterialId = obj.value;
$("#applicationIn"+id).attr("placeId",pid);
let unit = $("#unitItem" + id).val();
let req = {};
req.unit = materialUnitObj.val();
let id = materialUnitObj.attr("id").split("materialUnit")[1].trim();
req.id = id;
req.unit = unit;
req.id = placeAndMaterialId;
$.ajax({
url: "/material/getQuantityForLocationAndUnit",
type: "post",
@ -356,8 +475,9 @@
contentType: "application/json;charset=utf-8",
success: function (res) {
let data = res.data;
$("#quantity" + id).text(data.quantity);
$("#amounts" + id).text(data.amount);
$("#quantity" + id).text("库存数:" + data.quantity);
$("#amount" + id).text("总金额:" + data.amount);
}
});
@ -414,7 +534,7 @@
};
$.ajax({
/*$.ajax({
url: '/depositoryRecord/getApplicationForMaterial',
type: 'post',
async: true,
@ -463,7 +583,7 @@
echartLineChartOut.setOption(optionLineChartOut);
echartLineChartInventory.setOption(optionLineChartInventory);
}
})
})*/
});

9
src/test/java/com/dreamchaser/depository_manage/LineChartForInventoryTest.java

@ -40,8 +40,9 @@ public class LineChartForInventoryTest {
List<String> dayNames = ObjectFormatUtil.objToList(monthBeginToNow.get("dayName"), String.class);
// 获取至今的日期时间戳
List<Long> dayTimeSpaces = ObjectFormatUtil.objToList(monthBeginToNow.get("dayTimeSpace"), Long.class);
dayTimeSpaces.add(Calendar.getInstance().getTimeInMillis());
// 获取当前物料的入库总额与数量
Map<String, Object> seriesForApplicationIn = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 1);
Map<String, Object> seriesForApplicationIn = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 1,true,null);
Object amountItemForIn = seriesForApplicationIn.get("amountItem");
Object countItemForIn = seriesForApplicationIn.get("countItem");
@ -51,7 +52,7 @@ public class LineChartForInventoryTest {
List<Double> amountListForIn = ObjectFormatUtil.objToList(countItemForInMapString.get("data"), Double.class);
// 获取当前物料的出库总额与数量
Map<String, Object> seriesForApplicationOut = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 2);
Map<String, Object> seriesForApplicationOut = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 2,true,null);
Object amountItemForOut = seriesForApplicationOut.get("amountItem");
Object countItemForOut = seriesForApplicationOut.get("countItem");
@ -88,6 +89,8 @@ public class LineChartForInventoryTest {
result.put("countItemForIn", countItemForIn);
result.put("amountItemForOut", amountItemForOut);
result.put("countItemForOut", countItemForOut);
System.out.println(countItemForIn);
System.out.println(countItemForOut);
Map<String, List<String>> legendItem = new HashMap<>();
List<String> legends = new ArrayList<>();
legends.add("count");
@ -103,6 +106,6 @@ public class LineChartForInventoryTest {
@Test
public void Test() {
getInventoryApplication(136);
getInventoryApplication(3537);
}
}

38
target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml

@ -1741,7 +1741,7 @@
</select>
<!-- 获取某月某物料入库总额-->
<select id="findApplicationInByDateAndMaterial" parameterType="map" resultType="int">
<select id="findApplicationInSumQuantityByDateAndMaterial" parameterType="map" resultType="int">
select ifnull(sum(quantity),0)
from applicationinrecordinfo
where 1 = 1
@ -1760,7 +1760,27 @@
</if>
</select>
<select id="findApplicationOutByDateAndMaterial" parameterType="map" resultType="int">
<select id="findApplicationInByDateAndMaterial" parameterType="map" resultMap="applicationInRecord">
select
<include refid="ApplicationInRecordInfo"/>
from applicationinrecordinfo
where 1 = 1
<if test="depository_id != null and depository_id != ''">
and did = #{depository_id}
</if>
and applicant_time between #{start} and #{end}
<if test="tname != null and tname != ''">
and tname = #{tname}
</if>
<if test="typeId != null and typeId != ''">
and mtid = #{typeId}
</if>
<if test="mid != null and mid != ''">
and mid = #{mid}
</if>
</select>
<select id="findApplicationOutSumQuantityByDateAndMaterial" parameterType="map" resultType="int">
select ifnull(sum(aorquantity),0)
from applicationoutrecordinfo
where 1 = 1
@ -1773,6 +1793,20 @@
</if>
</select>
<select id="findApplicationOutByDateAndMaterial" parameterType="map" resultMap="applicationOutRecord">
select
<include refid="ApplicationOutRecordInfo"></include>
from applicationoutrecordinfo
where 1 = 1
and applicantTime between #{start} and #{end}
<if test="mid != null and mid != ''">
and mid = #{mid}
</if>
<if test="state == 1 or state == 4">
and depositoryManagerPass in (1,4)
</if>
</select>
<select id="findApplicationInByMonthTest" parameterType="map" resultType="int">
select ifnull(sum(quantity),0)
from applicationinrecordinfo

48
target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml

@ -821,12 +821,44 @@
FROM findInventory WHERE id =#{mid}
</select>
<select id="findInventoryByMid" resultMap="InventoryMap" parameterType="integer">
<select id="findInventoryByMidAndDidList" resultMap="InventoryMap" parameterType="map">
SELECT
<include refid="allColumnsAndTypeNameOnViewByInventory"/>
FROM findInventory WHERE mid =#{mid}
FROM findInventory
WHERE 1 = 1
<if test="mid != null and mid != ''">
and mid =#{mid}
</if>
<if test="depositoryIdList != null and depositoryIdList != ''">
and depositoryId in
<foreach collection="depositoryIdList" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
</if>
<if test="begin != null and size != null">
LIMIT #{begin},#{size}
</if>
</select>
<select id="findInventoryCountByMidAndDidList" resultType="int" parameterType="map">
SELECT
COUNT(*)
FROM findInventory
WHERE 1 = 1
<if test="mid != null and mid != ''">
and mid =#{mid}
</if>
<if test="depositoryIdList != null and depositoryIdList != ''">
and depositoryId in
<foreach collection="depositoryIdList" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
</if>
</select>
<select id="findInventoryByMidAndDid" resultMap="InventoryMap" parameterType="map">
select
<include refid="allColumnsAndTypeNameOnViewByInventory"/>
@ -836,17 +868,7 @@
and depositoryId = #{did}
</select>
<select id="findInventoryByMidAndDids" resultMap="InventoryMap" parameterType="map">
select
<include refid="allColumnsAndTypeNameOnViewByInventory"/>
from findInventory
where
mid = #{mid}
and depositoryId in
<foreach collection="list" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
</select>
<select id="findMaterialAndTypeById" resultMap="materialAndTypeMap" parameterType="integer">
select

27
target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml

@ -122,6 +122,30 @@
and pstate != 3
</select>
<select id="findPlaceAndMaterialByMid" resultMap="MaterialAndPlaceForViewMap" parameterType="map">
select
<include refid="allColumnsForView"/>
FROM materialandplaceinfo WHERE 1 = 1
<if test="mid != '' and mid != null">
and mid = #{mid}
</if>
and pstate != 3
<if test="begin != null and size != null">
LIMIT #{begin},#{size}
</if>
</select>
<select id="findPlaceAndMaterialCountByMid" resultMap="MaterialAndPlaceForViewMap" parameterType="map">
select
COUNT(*)
FROM materialandplaceinfo WHERE 1 = 1
<if test="mid != '' and mid != null">
and mid = #{mid}
</if>
and pstate != 3
</select>
<select id="findPlaceAndMaterialByDidsAndMid" resultMap="MaterialAndPlaceForViewMap" parameterType="map">
select
<include refid="allColumnsForView"/>
@ -177,6 +201,9 @@
<if test="mname != null and mname != ''">
and mname like CONCAT('%',#{mname},'%')
</if>
<if test="iid != null and iid != ''">
and iid = #{iid}
</if>
and pstate != 3
<if test="begin != null and size != null">
LIMIT #{begin},#{size}

551
target/classes/templates/pages/depository/Inventory-view.html

@ -10,182 +10,194 @@
<link rel="stylesheet" href="/static/css/public.css" media="all">
<link rel="stylesheet" href="/static/js/lay-module/step-lay/step.css" media="all">
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
<link rel="stylesheet" href="/static/lib/bootstrap-3.4.1-dist/css/bootstrap.min.css">
<style>
.inputdiv {
display: flex;
background-color: #fff;
height: 38px;
line-height: 38px;
border: 1px solid rgb(238, 238, 238);
}
.editButton {
position: absolute;
top: 5px;
right: 15px;
.layui-form-label {
padding: 9px 0px;
text-align: left;
}
.layui-input-block {
margin-left: 80px;
.myEchart {
min-width: 500px;
min-height: 500px;
margin: 0 2px;
}
.inputdiv .layui-unselect {
border-style: none;
}
</style>
</head>
<body>
<form class="layui-form layui-form-pane" action="">
<input type="text" id="id" th:value="${record.getId()}" name="id" style="display: none">
<div class="layui-form-item">
<label class="layui-form-label">存货编码</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getCode()}" name="code" id="code" readonly
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">物料名称</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getMname()}" name="mname" readonly
autocomplete="off" class="layui-input">
<input type="text" id="id" th:value="${record.getId()}" name="id" style="display: none">
<div class="layui-fluid">
<div class="layui-row layui-col-space1">
<div class="layui-row layui-col-xs12 layui-col-md8">
<div>
<div class="panel panel-info">
<div class="panel-heading">物料基本信息
<button type="button" th:attr="mid=${record.getMid()}" lay-on="editMaterialInfo"
th:style="'display:'+${display}"
class="editButton layui-btn layui-btn-sm layui-btn-primary">
<i class="layui-icon layui-icon-edit"></i>
</button>
</div>
<div class="panel-body">
<table class="table">
<tbody>
<tr>
<td th:text="'物料编码:'+${record.getCode()}">物料编码:</td>
<td th:text="'物料名称:'+${record.getMname()}">物料名称:</td>
<td th:text="'规格型号:'+${record.getVersion()}">规格型号:</td>
<td th:text="'物料材质:'+${record.getTexture()}">物料材质:</td>
</tr>
<tr>
<td th:text="'物料品牌:'+${record.getBrand()}">物料品牌:</td>
<td th:text="'物料类型:'+${record.getTypeName()}">物料类型:</td>
<td>
计量单位:
<span th:text="${record.getUnit()}"></span>
<span th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
th:text="${splitInfo.getNewUnit()}"></span>
</td>
<td th:text="'物料单价:'+${record.getPrice()}" th:style="'display:'+${display}">物料单价:</td>
</tr>
<tr>
<td th:text="'物料备注:'+${record.getIremark()}">物料备注:</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="panel panel-primary">
<div class="panel-heading">数据图标
</div>
<div class="panel-body">
<div class="layui-col-xs4 myEchart">
<div class="panel panel-warning">
<div class="panel-heading">物料入库明细</div>
<div class="panel-body">
<div id="echarts-line-in" style="height:500px;width: 500px;">
</div>
</div>
</div>
</div>
<div class="layui-col-xs4 myEchart">
<div class="panel panel-warning">
<div class="panel-heading">物料出库明细</div>
<div class="panel-body">
<div id="echarts-line-out" style="height: 500px;width: 500px">
</div>
</div>
</div>
</div>
<div class="layui-col-xs4 myEchart">
<div class="panel panel-warning">
<div class="panel-heading">物料库存明细</div>
<div class="panel-body">
<div id="echarts-line-inventory" style="height: 500px;width: 500px">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md4">
<div class="">
<div class="panel panel-success">
<div class="panel-heading">库存基本信息</div>
<div class="panel-body">
<div class="layui-form-item">
<label class="layui-form-label">规格型号</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getVersion()}" name="version" autocomplete="off" readonly
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">品牌:</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" th:value="${record.getBrand()}" readonly
name="brand"/>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">物料类型</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" id="openSonByMateralType" readonly
th:value="${record.getTypeName()}"
lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">材质</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getTexture()}" name="texture" autocomplete="off" readonly
class="layui-input">
<table class="table">
<caption th:text="${record.getDepositoryName()}">所属仓库:</caption>
<caption th:text="'备注:'+${record.getIremark()}">备注:</caption>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">计量单位</label>
<div class="layui-input-inline">
<select id="unit">
<option value="-1" th:text="${record.getUnit()}"></option>
<option th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
th:value="${splitInfo?.getNewUnit()}"
th:text="${splitInfo?.getNewUnit()}"></option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">所处仓库</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getDepositoryName()}" name="depositoryName" required
autocomplete="off" readonly
class="layui-input">
<input type="text" id="depositoryId" th:value="${record.getDepositoryId()}" style="display: none">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">所处库位</label>
<div class="layui-input-inline">
<button th:each="placeP,iterStar:${record.getPlacePList()}"
th:attr="id=${record.getMid()}" class="layui-btn layui-btn-customize"
onclick="changePlaceCode(this)" th:value="${record.getDepositoryId()}"
th:text="${placeP.getKingdeecode()}">
</button>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数量</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getQuantity()}" name="quantity" required autocomplete="off"
id="quantity" readonly
class="layui-input">
</div>
</div>
<div class="layui-form-item" th:style="'display:'+${display}">
<label class="layui-form-label">单价</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getPrice()}" name="price" required autocomplete="off" id="price"
readonly
class="layui-input">
</div>
</div>
<div class="layui-form-item" th:style="'display:'+${display}">
<label class="layui-form-label">总额</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getAmounts()}" name="amounts" required autocomplete="off" id="amounts"
readonly
class="layui-input">
</div>
</div>
<div class="layui-form-item" >
<label class="layui-form-label">备注</label>
<div class="layui-input-inline">
<input type="text" th:value="${record.getIremark()}" name="iremark" required autocomplete="off" id="iremark"
onchange="updateInventoryRemark()"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-customize" type="button" onclick="applicationIn()">入库申请</button>
<thead>
<tr>
<td>所处库位</td>
<td>计量单位</td>
<td>对应数量</td>
<td th:style="'display:'+${display}">金额</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<tr type="button"
th:each="materialAndPlace,iterStar:${record.getMaterialAndPlaceList()}">
<td>
<button onclick="changePlaceCode(this)"
th:text="${materialAndPlace.getKingdeecode()}"
th:attr="id=${materialAndPlace.getId()}"
class="layui-btn layui-btn-primary layui-btn-sm"></button>
</td>
<td>
<select class="mySelect" onchange="changeUnitForQuantity(this)"
th:attr="id='materialUnit'+${materialAndPlace.getId()}">
<option th:text="${record.getUnit()}" value="-1"
class="myOption"></option>
<option class="myOption"
th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
th:value="${splitInfo.getNewUnit()}"
th:text="${splitInfo.getNewUnit()}"></option>
</select>
<button class="layui-btn layui-btn-customize" type="button" onclick="applicationOut()">出库申请</button>
</td>
<td>
<span th:attr="id='quantity'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getInventory()}"></span>
</td>
<td th:style="'display:'+${display}">
<span th:attr="id='amounts'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getAmount()}"></span>
</td>
<td>
<a class="layui-btn layui-btn-xs"
th:attr="mid=${materialAndPlace.getIid()},depositoryId=${materialAndPlace.getDepository_id()},placeId=${materialAndPlace.getPid()}"
lay-on="applicationIn">入库</a>
<a class="layui-btn layui-btn-xs"
th:attr="code=${materialAndPlace.getMcode()},depositoryId=${materialAndPlace.getDepository_id()}"
lay-on="applicationOut">出库</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<script src="/static/lib/layui-v2.8.6/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="/static/lib/echarts/echarts.js" charset="utf-8"></script>
<script>
function applicationIn() {
}
function applicationOut() {
function updateInventoryRemark() {
}
function updateInventoryRemark(){
function changePlaceCode() {
}
function changeUnitForQuantity() {
}
var barCode = [];
var flag = false;
layui.use(['form', 'laydate', 'miniTab'], function () {
layui.use(['form', 'laydate', 'util'], function () {
var form = layui.form,
laydate = layui.laydate,
$ = layui.$,
miniTab = layui.miniTab;
util = layui.util;
let iremark = $("#iremark").val();
miniTab.listen();
let id = $("#id").val();
form.on('select()', function (data) {
var id = data.elem.id; //得到select原始DOM对象id
@ -204,45 +216,63 @@
});
});
applicationOut = function () {
var index = layer.open({
title: '出库申请',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/application_out_back?code=' + $("#code").val() + "&depositoryId=" + $("#depositoryId").val()
});
$(window).on("resize", function () {
layer.full(index);
});
return false;
};
applicationIn = function () {
var index = layer.open({
title: '入库申请',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/application_in_back?mid=' + $("#id").val() + "&depositoryId=" + $("#depositoryId").val()
});
$(window).on("resize", function () {
layer.full(index);
});
return false;
}
util.on('lay-on', {
'editMaterialInfo': function (obj) {
let mid = $(obj).attr("mid");
layer.open({
type: 2,
offset: 'r',
anim: 'slideLeft', // 从右往左
area: ['40%', '100%'],
shade: 0.1,
title: "物料详情",
shadeClose: true,
id: 'ID-demo-layer-direction-r',
content: '/materialEditForInventory?id=' + mid,
end: function () {
location.reload();
}
});
},
'applicationIn': function (obj) {
let mid = $(obj).attr('mid');
let depositoryId = $(obj).attr('depositoryId');
let placeId = $(obj).attr('placeId');
layer.open({
type: 2,
offset: 'r',
anim: 'slideLeft', // 从右往左
area: ['40%', '100%'],
shade: 0.1,
title: "入库申请",
shadeClose: true,
id: 'ID-demo-layer-direction-r',
content: '/application_in_back?mid=' + mid + "&depositoryId=" + depositoryId + "&placeId=" + placeId
});
},
'applicationOut': function (obj) {
let code = $(obj).attr('code');
let depositoryId = $(obj).attr('depositoryId');
layer.open({
type: 2,
offset: 'r',
anim: 'slideLeft', // 从右往左
area: ['40%', '100%'],
shade: 0.1,
title: "出库申请",
shadeClose: true,
id: 'ID-demo-layer-direction-r',
content: '/application_out_back?code=' + code + "&depositoryId=" + depositoryId
});
},
});
updateInventoryRemark = function() {
let id = $("#id").val();
updateInventoryRemark = function () {
let newIremark = $("#iremark").val();
let index = layer.confirm('确认更改备注?', {
btn: ['确定','取消'] //按钮
}, function(){
let index = layer.confirm('确认更改备注?', {
btn: ['确定', '取消'] //按钮
}, function () {
let req = {};
req.id = id;
req.remark = newIremark;
@ -254,7 +284,7 @@
contentType: "application/json;charset=utf-8",
success: function (data) {
if (data.status >= 300) {
layer.msg(data.statusInfo.message,{
layer.msg(data.statusInfo.message, {
icon: 5,//失败的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
}, function () {
@ -270,10 +300,171 @@
}
}
});
}, function(){
}, function () {
$("#iremark").val(iremark);
});
}
};
// 用于更改同一仓库下的库位
changePlaceCode = function (obj) {
var id = $(obj).attr("id");
// 当前点击行中的计量单位按钮
let materialUnitObj = $("#materialUnit" + id + " option:selected");
let unit = materialUnitObj.val();
if (unit === -1 || unit === "-1") {
unit = materialUnitObj.text();
}
unit = unit.trim();
layer.open({
title: '选择库位',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['70%', '70%'],
content: '/selectPlaceByDepositoryForInventory?id=' + id + '&unit=' + unit,
success: function (layero, index) {
var children = layero.children();
var content = $(children[1]);
var iframeChildren = $(content.children());
content.css('height', '100%');
iframeChildren.css('height', '100%');
},
end: function () {
location.reload();
}
});
};
/**
* 用于修改展示的库存数量
* @param obj
*/
changeUnitForQuantity = function (obj) {
let materialUnitObj = $(obj);
let req = {};
req.unit = materialUnitObj.val();
let id = materialUnitObj.attr("id").split("materialUnit")[1].trim();
req.id = id;
$.ajax({
url: "/material/getQuantityForLocationAndUnit",
type: "post",
dataType: 'json',
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (res) {
let data = res.data;
$("#quantity" + id).text(data.quantity);
$("#amounts" + id).text(data.amount);
}
});
};
// 柱状图
var echartLineChartIn = echarts.init(document.getElementById('echarts-line-in'));
var echartLineChartOut = echarts.init(document.getElementById('echarts-line-out'));
var echartLineChartInventory = echarts.init(document.getElementById('echarts-line-inventory'));
var optionLineChartIn = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
var optionLineChartOut = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
var optionLineChartInventory = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
$.ajax({
url: '/depositoryRecord/getApplicationForMaterial',
type: 'post',
async: true,
dataType: "json",
data: JSON.stringify({"id": id}),
contentType: "application/json;charset=utf-8",
complete: function (XHR, TS) {
layer.close(this.layerIndex);
if (XHR.status !== 200) {
layer.alert("系统繁忙,稍后重试");
}
},
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (result) {
let data = result.data;
let dayNames = data["dayNames"];
let amountItemForIn = data["amountItemForIn"];
let countItemForIn = data["countItemForIn"];
let amountItemForOut = data["amountItemForOut"];
let countItemForOut = data["countItemForOut"];
let countItemForInventory = data["countItemForInventory"];
let amountItemForInventory = data["amountItemForInventory"];
let legendItem = data["legend"];
let seriesInItem = [];
let seriesOutItem = [];
let seriesInventoryItem = [];
seriesInItem.push(amountItemForIn);
seriesInItem.push(countItemForIn);
seriesOutItem.push(amountItemForOut);
seriesOutItem.push(countItemForOut);
seriesInventoryItem.push(countItemForInventory);
seriesInventoryItem.push(amountItemForInventory);
optionLineChartIn.series = seriesInItem;
optionLineChartOut.series = seriesOutItem;
optionLineChartInventory.series = seriesInventoryItem;
optionLineChartIn.xAxis.data = dayNames;
optionLineChartIn.legend = legendItem;
optionLineChartOut.legend = legendItem;
optionLineChartOut.xAxis.data = dayNames;
optionLineChartInventory.legend = legendItem;
optionLineChartInventory.xAxis.data = dayNames;
echartLineChartIn.setOption(optionLineChartIn);
echartLineChartOut.setOption(optionLineChartOut);
echartLineChartInventory.setOption(optionLineChartInventory);
}
})
});
</script>

41
target/classes/templates/pages/depository/table-stock.html

@ -100,7 +100,7 @@
</script>
<script id="changePlace" type="text/html">
<span >{{d.placeKingdeeCode}}</span>
<span style="display:none;">{{d.placeKingdeeCode}}</span>
</script>
@ -211,14 +211,15 @@
{field: 'brand', width: 200, title: '品牌',hide:true},
{field: 'version', width: 200, title: '规格型号'},
{field: 'typeName', width: 200, title: '物料类型',hide:true},
{field: "unit", title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 200, title: '数量'},
{field: "unit", title: '计量单位', width: 100, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 100, title: '数量'},
{field: 'depositoryName', width: 200, title: '仓库名称'},
{field: 'depositoryCode', width: 200, title: '仓库编码'},
{title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: 'warningCount', width: 200, title: '待过期数量', sort: true},
{field: 'price', title: '单价', width: 200, sort: true},
{field: 'amounts', title: '总金额', width: 200, sort: true},
{field: 'depositoryCode', width: 200, title: '仓库编码',hide:true},
// {title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: "placeKingdeeCode", title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: 'warningCount', width: 100, title: '待过期数量', sort: true,hide:true},
{field: 'price', title: '单价', width: 100, sort: true},
{field: 'amounts', title: '总金额', width: 100, sort: true},
{field: 'texture', width: 200, title: '材质',hide:true},
{field: 'iremark', width: 200, title: '备注',hide:true},
{title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"}
@ -258,12 +259,13 @@
{field: 'brand', width: 200, title: '品牌', hide: true},
{field: 'version', width: 200, title: '规格型号'},
{field: 'typeName', width: 200, title: '物料类型', hide: true},
{field: "unit", title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 200, title: '数量'},
{field: "unit", title: '计量单位', width: 100, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 100, title: '数量'},
{field: 'depositoryName', width: 200, title: '仓库名称'},
{field: 'depositoryCode', width: 200, title: '仓库编码', hide: true},
{title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: 'warningCount', width: 200, title: '待过期数量', sort: true, hide: true},
// {title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: "placeKingdeeCode", title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
{field: 'warningCount', width: 100, title: '待过期数量', sort: true, hide: true},
{field: 'texture', width: 200, title: '材质', hide: true},
{field: 'iremark', width: 200, title: '备注',},
{title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"}
@ -283,6 +285,10 @@
}
$.each(res['data'], function (i, j) {
let jElement = j['warningCount'];
let placeCode = j['placeCode'].split(" ");
let placeKingdeeCode = j['placeKingdeeCode'].split(" ");
let depositoryId = j['depositoryId'];
let mid = j['id'];
if (jElement !== null && jElement !== undefined) {
let flag = (Number(jElement) !== 0);
if (flag) {
@ -290,6 +296,17 @@
}
}
// 所处库位
var placeCodeItem = $("[lay-id='currentTableId'] tr:eq(" + (i + 1) + ")").children()[10];
//计量单位
// 用于库位的添加
var aItem = placeCodeItem.childNodes[0];
// 用于计量单位的添加
for (let k = 0; k < placeKingdeeCode.length; k++) {
if (placeKingdeeCode[k] !== "") {
$(aItem).append('<button code=' + placeCode[k] + ' id=' + mid + ' class="layui-btn layui-btn-primary layui-btn-xs" onclick="changePlaceCode(this)" value=' + depositoryId + '>' + placeKingdeeCode[k] + '</button>')
}
}
});
}

31
target/classes/templates/pages/material/material-out.html

@ -767,7 +767,7 @@
});
showDetail = function (obj) {
/*showDetail = function (obj) {
var index = layer.open({
title: '物料信息详情',
type: 2,
@ -790,11 +790,32 @@
layer.full(index);
});
return false;
}
}*/
$('body').on('click', '[data-refresh]', function () {
location.reload();
})
showDetail = function (obj) {
var index = layer.open({
title: '库存信息详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/InventoryViewBack?id=' + obj.id,
end: function () {
//执行搜索重载
table.reloadData('currentTableId', {
url: '/material/material',
page: {
curr: 1
}
}, 'data');
}
});
$(window).on("resize", function () {
layer.full(index);
});
return false;
}
});
</script>

Loading…
Cancel
Save