Browse Source

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	frontend/saas-web/app/view/money/recBalance/FormPanelController.js
huangx 7 years ago
parent
commit
802193e2ea
100 changed files with 2341 additions and 27 deletions
  1. 70 0
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/InitStatusDTO.java
  2. 4 0
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  3. 12 2
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/CommonController.java
  4. 45 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/HomePageController.java
  5. 17 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/CommonMapper.java
  6. 16 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/HomePageMapper.java
  7. 13 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/CommonService.java
  8. 41 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/HomePageService.java
  9. 46 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/CommonServiceImpl.java
  10. 93 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/HomePageServiceImpl.java
  11. 19 0
      applications/commons/commons-server/src/main/resources/mapper/CommonMapper.xml
  12. 62 0
      applications/commons/commons-server/src/main/resources/mapper/HomePageMapper.xml
  13. 11 0
      applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductListDTO.java
  14. 86 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/ProdIODetail.java
  15. 72 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/ProdInOut.java
  16. 148 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/ProductDetail.java
  17. 7 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java
  18. 1 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerMapper.java
  19. 28 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductDetailMapper.java
  20. 16 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java
  21. 6 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java
  22. 3 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/WarehouseMapper.java
  23. 10 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java
  24. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BankinformationServiceImpl.java
  25. 10 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java
  26. 220 6
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java
  27. 34 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorServiceImpl.java
  28. 18 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java
  29. 7 0
      applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml
  30. 332 0
      applications/document/document-server/src/main/resources/mapper/ProductDetailMapper.xml
  31. 409 1
      applications/document/document-server/src/main/resources/mapper/ProductMapper.xml
  32. 12 0
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  33. 15 0
      applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml
  34. 1 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  35. 4 2
      applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml
  36. 6 6
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java
  37. 4 2
      applications/storage/storage-server/src/main/resources/mapper/ProdIODetailMapper.xml
  38. 442 3
      frontend/saas-portal-web/src/css/main.css
  39. BIN
      frontend/saas-portal-web/src/img/assets/Group.png
  40. BIN
      frontend/saas-portal-web/src/img/assets/Group@2x.png
  41. BIN
      frontend/saas-portal-web/src/img/assets/Group@3x.png
  42. BIN
      frontend/saas-portal-web/src/img/assets/logo-蓝.png
  43. BIN
      frontend/saas-portal-web/src/img/assets/logo-蓝@2x.png
  44. BIN
      frontend/saas-portal-web/src/img/assets/logo-蓝@3x.png
  45. BIN
      frontend/saas-portal-web/src/img/assets/logo.png
  46. BIN
      frontend/saas-portal-web/src/img/assets/logo@2x.png
  47. BIN
      frontend/saas-portal-web/src/img/assets/logo@3x.png
  48. BIN
      frontend/saas-portal-web/src/img/assets/任.png
  49. BIN
      frontend/saas-portal-web/src/img/assets/任@2x.png
  50. BIN
      frontend/saas-portal-web/src/img/assets/任@3x.png
  51. BIN
      frontend/saas-portal-web/src/img/assets/刷新.png
  52. BIN
      frontend/saas-portal-web/src/img/assets/刷新@2x.png
  53. BIN
      frontend/saas-portal-web/src/img/assets/刷新@3x.png
  54. BIN
      frontend/saas-portal-web/src/img/assets/叉号.png
  55. BIN
      frontend/saas-portal-web/src/img/assets/叉号@2x.png
  56. BIN
      frontend/saas-portal-web/src/img/assets/叉号@3x.png
  57. BIN
      frontend/saas-portal-web/src/img/assets/密码.png
  58. BIN
      frontend/saas-portal-web/src/img/assets/密码@2x.png
  59. BIN
      frontend/saas-portal-web/src/img/assets/密码@3x.png
  60. BIN
      frontend/saas-portal-web/src/img/assets/寻.png
  61. BIN
      frontend/saas-portal-web/src/img/assets/寻@2x.png
  62. BIN
      frontend/saas-portal-web/src/img/assets/寻@3x.png
  63. BIN
      frontend/saas-portal-web/src/img/assets/导航-注册.png
  64. BIN
      frontend/saas-portal-web/src/img/assets/导航-注册@2x.png
  65. BIN
      frontend/saas-portal-web/src/img/assets/导航-注册@3x.png
  66. BIN
      frontend/saas-portal-web/src/img/assets/导航-登录.png
  67. BIN
      frontend/saas-portal-web/src/img/assets/导航-登录@2x.png
  68. BIN
      frontend/saas-portal-web/src/img/assets/导航-登录@3x.png
  69. BIN
      frontend/saas-portal-web/src/img/assets/微信.png
  70. BIN
      frontend/saas-portal-web/src/img/assets/微信@2x.png
  71. BIN
      frontend/saas-portal-web/src/img/assets/微信@3x.png
  72. BIN
      frontend/saas-portal-web/src/img/assets/手机号.png
  73. BIN
      frontend/saas-portal-web/src/img/assets/手机号@2x.png
  74. BIN
      frontend/saas-portal-web/src/img/assets/手机号@3x.png
  75. BIN
      frontend/saas-portal-web/src/img/assets/插画人物.png
  76. BIN
      frontend/saas-portal-web/src/img/assets/插画人物@2x.png
  77. BIN
      frontend/saas-portal-web/src/img/assets/插画人物@3x.png
  78. BIN
      frontend/saas-portal-web/src/img/assets/未选中.png
  79. BIN
      frontend/saas-portal-web/src/img/assets/未选中@2x.png
  80. BIN
      frontend/saas-portal-web/src/img/assets/未选中@3x.png
  81. BIN
      frontend/saas-portal-web/src/img/assets/电子行业字段.png
  82. BIN
      frontend/saas-portal-web/src/img/assets/电子行业字段@2x.png
  83. BIN
      frontend/saas-portal-web/src/img/assets/电子行业字段@3x.png
  84. BIN
      frontend/saas-portal-web/src/img/assets/背景.png
  85. BIN
      frontend/saas-portal-web/src/img/assets/背景@2x.png
  86. BIN
      frontend/saas-portal-web/src/img/assets/背景@3x.png
  87. BIN
      frontend/saas-portal-web/src/img/assets/资.png
  88. BIN
      frontend/saas-portal-web/src/img/assets/资@2x.png
  89. BIN
      frontend/saas-portal-web/src/img/assets/资@3x.png
  90. BIN
      frontend/saas-portal-web/src/img/assets/轻.png
  91. BIN
      frontend/saas-portal-web/src/img/assets/轻@2x.png
  92. BIN
      frontend/saas-portal-web/src/img/assets/轻@3x.png
  93. BIN
      frontend/saas-portal-web/src/img/assets/返回.png
  94. BIN
      frontend/saas-portal-web/src/img/assets/返回@2x.png
  95. BIN
      frontend/saas-portal-web/src/img/assets/返回@3x.png
  96. BIN
      frontend/saas-portal-web/src/img/assets/进.png
  97. BIN
      frontend/saas-portal-web/src/img/assets/进@2x.png
  98. BIN
      frontend/saas-portal-web/src/img/assets/进@3x.png
  99. BIN
      frontend/saas-portal-web/src/img/assets/选中.png
  100. BIN
      frontend/saas-portal-web/src/img/assets/选中@2x.png

+ 70 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/InitStatusDTO.java

@@ -0,0 +1,70 @@
+package com.usoftchina.saas.commons.dto;
+
+import java.io.Serializable;
+
+public class InitStatusDTO implements Serializable {
+
+    private Long companyId;
+    private boolean baseSet;
+    private boolean warehouse;
+    private boolean product;
+    private boolean customer;
+    private boolean vendor;
+    private boolean begin;
+
+    public boolean isBegin() {
+        return begin;
+    }
+
+    public void setBegin(boolean begin) {
+        this.begin = begin;
+    }
+
+    public Long getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId) {
+        this.companyId = companyId;
+    }
+
+    public boolean isBaseSet() {
+        return baseSet;
+    }
+
+    public void setBaseSet(boolean baseSet) {
+        this.baseSet = baseSet;
+    }
+
+    public boolean isWarehouse() {
+        return warehouse;
+    }
+
+    public void setWarehouse(boolean warehouse) {
+        this.warehouse = warehouse;
+    }
+
+    public boolean isProduct() {
+        return product;
+    }
+
+    public void setProduct(boolean product) {
+        this.product = product;
+    }
+
+    public boolean isCustomer() {
+        return customer;
+    }
+
+    public void setCustomer(boolean customer) {
+        this.customer = customer;
+    }
+
+    public boolean isVendor() {
+        return vendor;
+    }
+
+    public void setVendor(boolean vendor) {
+        this.vendor = vendor;
+    }
+}

+ 4 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -26,9 +26,13 @@ public enum BizExceptionCode implements BaseExceptionCode {
     BIZ_UNAUDITED(79304,"只能反审核已审核的单据"),
     BIZ_DELETE(79305,"只能删除未审核的单据"),
     BIZ_RELDELETE(79305,"存在关联单据,不允许删除"),
+    BIZ_RELDELETE_UPDATE(79306,"存在关联单据,不允许更新编号"),
+    BIZ_RELDELETE_UPDATEPROD(79307,"存在关联单据,不允许更新"),
+    BIZ_RELDELETE_DELETEPROD(79308,"存在关联单据,不允许删除"),
     NO_OPRATIONDATA(79400,"无可操作单据"),
     BOM_SAVE(79401, "产品编号+版本号已存在"),
     REPEAT_NAME(79501, "名称重复"),
+    REPEAT_CODE(79502, "编号重复"),
     NO_DATA(79998, "未找到数据"),
     ILLEGAL_ID(79999, "id不正确"),
     PRODUCT_HAS_WAREHOUSE(79502, "存在物料默认仓库资料为该仓库资料,无法删除"),

+ 12 - 2
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/CommonController.java

@@ -1,16 +1,26 @@
 package com.usoftchina.saas.commons.controller;
 
 import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.service.CommonService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 @RestController
 public class CommonController {
 
-    @RequestMapping("/{caller}/export")
+    @Autowired
+    private CommonService commonService;
+
+    @GetMapping("/{caller}/export")
     public Result export(@PathVariable("caller") String caller){
         return Result.success();
     }
 
+    @GetMapping("/init/check")
+    public Result checkInitStatus(){
+        return Result.success(commonService.initCheck());
+    }
+
 }

+ 45 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/HomePageController.java

@@ -0,0 +1,45 @@
+package com.usoftchina.saas.commons.controller;
+
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.service.HomePageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.ServletRequest;
+
+/**
+ * @author: guq
+ * @create: 2018-11-12 19:19
+ * saas首页接口
+ **/
+@RestController
+@RequestMapping("homePage")
+public class HomePageController {
+
+    @Autowired
+    private HomePageService homePageService;
+
+
+    @GetMapping("liveData")
+    public Result liveData(ServletRequest req) {
+        return homePageService.liveDate();
+    }
+
+    @GetMapping("purchaseData")
+    public Result purchaseData(Boolean sixMonths) {
+        return homePageService.purchaseData(sixMonths);
+    }
+
+    @GetMapping("storageData")
+    public Result storageData(ServletRequest req) {
+        return homePageService.storageData();
+    }
+
+
+    @RequestMapping("payAndRecData")
+    public Result payAndRecData(ServletRequest req) {
+        return homePageService.payAndRecData();
+    }
+}

+ 17 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/CommonMapper.java

@@ -0,0 +1,17 @@
+package com.usoftchina.saas.commons.mapper;
+
+import org.apache.ibatis.annotations.Param;
+
+public interface CommonMapper {
+
+    int getCountBaseSet(@Param("companyId") Long companyId);
+
+    int getCountWarehouse(@Param("companyId") Long companyId);
+
+    int getCountProduct(@Param("companyId") Long companyId);
+
+    int getCountCustomer(@Param("companyId") Long companyId);
+
+    int getCountVendor(@Param("companyId") Long companyId);
+
+}

+ 16 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/HomePageMapper.java

@@ -0,0 +1,16 @@
+package com.usoftchina.saas.commons.mapper;
+
+import java.util.Map;
+
+public interface HomePageMapper {
+
+    void getLiveData(Map<String, Object> map);
+
+    String getPurchaseDataNow(Long componyId);
+
+    String getPurchaseDataInSixMonth(Long componyId);
+
+    String getStorageData(Long componyId);
+
+    String getPayAndRecData(Long companyId);
+}

+ 13 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/CommonService.java

@@ -0,0 +1,13 @@
+package com.usoftchina.saas.commons.service;
+
+import com.usoftchina.saas.commons.dto.InitStatusDTO;
+
+public interface CommonService {
+
+    /**
+     * 检查初始化状态
+     * @return
+     */
+    InitStatusDTO initCheck();
+
+}

+ 41 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/HomePageService.java

@@ -0,0 +1,41 @@
+package com.usoftchina.saas.commons.service;
+
+import com.usoftchina.saas.base.Result;
+
+public interface HomePageService {
+
+    /**
+    * @Description 获取首页实时数据
+    * @Param: []
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/12
+    */
+    Result liveDate();
+
+    /**
+    * @Description  获取采购额
+    * @Param: [sixMonths] 区别本月与6个月
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/13
+    */
+    Result purchaseData(Boolean sixMonths);
+
+    /**
+    * @Description 获取库存数据
+    * @Param: []
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/13
+    */
+    Result storageData();
+    /**
+    * @Description 获取本月收入支出数据
+    * @Param: []
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/13
+    */
+    Result payAndRecData();
+}

+ 46 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/CommonServiceImpl.java

@@ -0,0 +1,46 @@
+package com.usoftchina.saas.commons.service.impl;
+
+import com.usoftchina.saas.commons.dto.InitStatusDTO;
+import com.usoftchina.saas.commons.mapper.CommonMapper;
+import com.usoftchina.saas.commons.service.CommonService;
+import com.usoftchina.saas.context.BaseContextHolder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CommonServiceImpl implements CommonService {
+
+    @Autowired
+    private CommonMapper commonMapper;
+
+    @Override
+    public InitStatusDTO initCheck() {
+        InitStatusDTO result = new InitStatusDTO();
+        int count = 0;
+        Long companyId = BaseContextHolder.getCompanyId();
+        count = commonMapper.getCountBaseSet(companyId);
+        if (count > 0){
+            result.setBaseSet(true);
+        }
+        count = commonMapper.getCountWarehouse(companyId);
+        if (count > 0){
+            result.setWarehouse(true);
+        }
+        count = commonMapper.getCountProduct(companyId);
+        if (count > 0){
+            result.setProduct(true);
+        }
+        count = commonMapper.getCountProduct(companyId);
+        if (count > 0){
+            result.setCustomer(true);
+        }
+        count = commonMapper.getCountVendor(companyId);
+        if (count > 0){
+            result.setVendor(true);
+        }
+        if (result.isBaseSet() && result.isWarehouse() && result.isProduct() && result.isCustomer() && result.isVendor()){
+            result.setBegin(true);
+        }
+        return result;
+    }
+}

+ 93 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/HomePageServiceImpl.java

@@ -0,0 +1,93 @@
+package com.usoftchina.saas.commons.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.mapper.HomePageMapper;
+import com.usoftchina.saas.commons.service.HomePageService;
+import com.usoftchina.saas.context.BaseContextHolder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author: guq
+ * @create: 2018-11-12 19:30
+ **/
+@Service
+public class HomePageServiceImpl implements HomePageService{
+
+    @Autowired
+    private HomePageMapper homePageMapper;
+
+    @Override
+    public Result liveDate() {
+        Long componyId = BaseContextHolder.getCompanyId();
+        Object json = null;
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("componyid", componyId);
+        map.put("res", "");
+        homePageMapper.getLiveData(map);
+        if (null != map.get("res")) {
+            json = parseJson(map.get("res").toString());
+        }
+        return Result.success(json);
+    }
+
+    @Override
+    public Result purchaseData(Boolean sixMonths) {
+        Long componyId = BaseContextHolder.getCompanyId();
+        String res = null;
+        Object json = null;
+        if (null != sixMonths && sixMonths) {
+            res = homePageMapper.getPurchaseDataInSixMonth(componyId);
+            json = parseJsonArray(res);
+            return Result.success(json);
+        }
+        res = homePageMapper.getPurchaseDataNow(componyId);
+        json = parseJsonArray(res);
+        return Result.success(json);
+    }
+
+    @Override
+    public Result storageData() {
+        Long componyId = BaseContextHolder.getCompanyId();
+        Object json = parseJsonArray(homePageMapper.getStorageData(componyId));
+        return Result.success(json);
+    }
+
+    @Override
+    public Result payAndRecData() {
+        Long componyId = BaseContextHolder.getCompanyId();
+        Object json = parseJsonArray(homePageMapper.getPayAndRecData(componyId));
+        return Result.success(json);
+    }
+
+    private Object parseJson(String text) {
+        Object json = null;
+        if (null != text) {
+            try {
+                json = JSON.parse(text);
+            }catch (Exception e) {
+                e.printStackTrace();
+            }
+            return json;
+        }
+        return null;
+    }
+
+    private Object parseJsonArray(String text) {
+        Object array = null;
+        if (null != text) {
+            try {
+                array = JSONArray.parse(text);
+            }catch (Exception e) {
+                e.printStackTrace();
+            }
+            return array;
+        }
+        return null;
+    }
+}

+ 19 - 0
applications/commons/commons-server/src/main/resources/mapper/CommonMapper.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.usoftchina.saas.commons.mapper.CommonMapper" >
+    <select id="getCountBaseSet" resultType="int">
+        SELECT COUNT(*) FROM ENTERPRISE WHERE COMPANYID = #{companyId}
+    </select>
+    <select id="getCountWarehouse" resultType="int">
+        SELECT COUNT(*) FROM WAREHOUSE WHERE COMPANYID=#{companyId} AND WH_STATUSCODE = 'OPEN'
+    </select>
+    <select id="getCountProduct" resultType="int">
+        SELECT COUNT(*) FROM PRODUCT WHERE COMPANYID=#{companyId} AND PR_STATUSCODE = 'OPEN'
+    </select>
+    <select id="getCountCustomer" resultType="int">
+        SELECT COUNT(*) FROM CUSTOMER WHERE COMPANYID=#{companyId} AND CU_STATUSCODE = 'OPEN'
+    </select>
+    <select id="getCountVendor" resultType="int">
+        SELECT COUNT(*) FROM VENDOR WHERE COMPANYID=#{companyId} AND VE_STATUSCODE = 'OPEN'
+    </select>
+</mapper>

+ 62 - 0
applications/commons/commons-server/src/main/resources/mapper/HomePageMapper.xml

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.usoftchina.saas.commons.mapper.HomePageMapper" >
+    <parameterMap id="sp_livedata" type="java.util.Map">
+        <parameter property="componyid"  mode="IN" />
+        <parameter property="res" jdbcType="VARCHAR" mode="OUT" />
+    </parameterMap>
+
+    <select id="getLiveData" parameterMap="sp_livedata" statementType="CALLABLE">
+        CALL  SP_LIVEDATA(?,?)
+    </select>
+
+    <select id="getPurchaseDataNow" parameterType="long" resultType="string">
+        select concat('[',GROUP_CONCAT(concat('{"x":"',si_vendname,'","y":',IFNULL(si_amount,0),'}')),']')  from statsinfo
+        where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc
+    </select>
+
+    <select id="getPurchaseDataInSixMonth" parameterType="long" resultType="string">
+    select concat('[',d1,',',d2,',',d3,',',d4,',',d5,',',d6,']') from (
+(select concat('{"x":',DATE_FORMAT(now(),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_1,
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_2,
+
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_3,
+
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_4,
+
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_5,
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_6)
+ </select>
+
+
+    <select id="getStorageData" parameterType="long" resultType="string">
+      select concat('[',d1,',',d2,',',d3,',',d4,',',d5,',',d6,']') from (
+
+(select concat('{"x":',DATE_FORMAT(now(),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_1,
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_2,
+
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_3,
+
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_4,
+
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_5,
+
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_6);
+    </select>
+
+
+    <select id="getPayAndRecData" parameterType="long" resultType="string">
+     select concat('[{"x":"支出","y":',ifnull(si_amount_pay,'0'),'},{"x":"收入","y":',ifnull(si_amount_rec,'0'),'}]') from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='FUND'
+    </select>
+
+
+</mapper>

+ 11 - 0
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductListDTO.java

@@ -1,12 +1,23 @@
 package com.usoftchina.saas.document.dto;
 
 import com.usoftchina.saas.document.entities.Product;
+import com.usoftchina.saas.document.entities.ProductDetail;
 
 import java.io.Serializable;
+import java.util.List;
 
 public class ProductListDTO implements Serializable {
 
     private Product main;
+    private List<ProductDetail> items;
+
+    public List<ProductDetail> getItems() {
+        return items;
+    }
+
+    public void setItems(List<ProductDetail> items) {
+        this.items = items;
+    }
 
     public Product getMain() {
         return main;

+ 86 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/ProdIODetail.java

@@ -0,0 +1,86 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import com.usoftchina.saas.document.dto.ProductDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class ProdIODetail extends CommonBaseEntity implements Serializable {
+
+    private Long pd_piid;
+
+    private String pd_inoutno;
+
+    private String pd_piclass;
+
+    private Integer pd_pdno;
+
+    private String pd_ordercode;
+
+    private Integer pd_orderdetno;
+
+    private Long pd_prodid;
+
+    private String pd_prodcode;
+
+    private String pd_unit;
+
+    private Double pd_inqty;
+
+    private Double pd_outqty;
+
+    private Double pd_orderprice;
+
+    private Double pd_sendprice;
+
+    private Double pd_price;
+
+    private Double pd_total;
+
+    private Double pd_taxrate;
+
+    private Double pd_netprice;
+
+    private Double pd_nettotal;
+
+    private Integer pd_whid;
+
+    private String pd_whcode;
+
+    private String pd_whname;
+
+    private Integer pd_inwhid;
+
+    private String pd_inwhcode;
+
+    private String pd_inwhname;
+
+    private Integer pd_orderid;
+
+    private Integer pd_sdid;
+
+    private Integer pd_status;
+
+    private String pd_text1;
+
+    private String pd_text2;
+
+    private String pd_text3;
+
+    private String pd_text4;
+
+    private String pd_text5;
+
+    private Integer pd_ym;
+
+    private Double pd_yqty;
+
+    private String pd_remark;
+
+    private Long pd_ioid;
+
+    private ProductDTO productDTO;
+
+}

+ 72 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/ProdInOut.java

@@ -0,0 +1,72 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class ProdInOut extends CommonBaseEntity implements Serializable {
+
+    private String pi_inoutno;
+
+    private String pi_class;
+
+    private Date pi_date;
+
+    private Integer pi_vendid;
+
+    private String pi_vendcode;
+
+    private String pi_vendname;
+
+    private Integer pi_custid;
+
+    private String pi_custcode;
+
+    private String pi_custname;
+
+    private Integer pi_puid;
+
+    private String pi_pucode;
+
+    private Integer pi_said;
+
+    private String pi_sacode;
+
+    private Double pi_total;
+
+    private Long pi_recordmanid;
+
+    private String pi_recordman;
+
+    private Date pi_recorddate;
+
+    private String pi_status;
+
+    private String pi_statuscode;
+
+    private String pi_printstatus;
+
+    private String pi_printstatuscode;
+
+    private String pi_text1;
+
+    private String pi_text2;
+
+    private String pi_text3;
+
+    private String pi_text4;
+
+    private String pi_text5;
+
+    private String pi_address;
+
+    private Date pi_auditdate;
+
+    private String pi_auditman;
+
+    private String pi_remark;
+
+}

+ 148 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/ProductDetail.java

@@ -0,0 +1,148 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class ProductDetail extends CommonBaseEntity implements Serializable {
+    private Long pd_prodid;
+
+    private String pd_prodcode;
+
+    private Integer pd_detno;
+
+    private String pd_whcode;
+
+    private String pd_whname;
+
+    private Integer pd_whid;
+
+    private Double pd_price;
+
+    private Double pd_amount;
+
+    private String pd_text1;
+
+    private String pd_text2;
+
+    private String pd_text3;
+
+    private String pd_text4;
+
+    private String pd_text5;
+
+    private Double pd_num;
+
+    public Long getPd_prodid() {
+        return pd_prodid;
+    }
+
+    public void setPd_prodid(Long pd_prodid) {
+        this.pd_prodid = pd_prodid;
+    }
+
+    public String getPd_prodcode() {
+        return pd_prodcode;
+    }
+
+    public void setPd_prodcode(String pd_prodcode) {
+        this.pd_prodcode = pd_prodcode == null ? null : pd_prodcode.trim();
+    }
+
+    public Integer getPd_detno() {
+        return pd_detno;
+    }
+
+    public void setPd_detno(Integer pd_detno) {
+        this.pd_detno = pd_detno;
+    }
+
+    public String getPd_whcode() {
+        return pd_whcode;
+    }
+
+    public void setPd_whcode(String pd_whcode) {
+        this.pd_whcode = pd_whcode == null ? null : pd_whcode.trim();
+    }
+
+    public String getPd_whname() {
+        return pd_whname;
+    }
+
+    public void setPd_whname(String pd_whname) {
+        this.pd_whname = pd_whname == null ? null : pd_whname.trim();
+    }
+
+    public Integer getPd_whid() {
+        return pd_whid;
+    }
+
+    public void setPd_whid(Integer pd_whid) {
+        this.pd_whid = pd_whid;
+    }
+
+    public Double getPd_price() {
+        return pd_price;
+    }
+
+    public void setPd_price(Double pd_price) {
+        this.pd_price = pd_price;
+    }
+
+    public Double getPd_amount() {
+        return pd_amount;
+    }
+
+    public void setPd_amount(Double pd_amount) {
+        this.pd_amount = pd_amount;
+    }
+
+    public String getPd_text1() {
+        return pd_text1;
+    }
+
+    public void setPd_text1(String pd_text1) {
+        this.pd_text1 = pd_text1 == null ? null : pd_text1.trim();
+    }
+
+    public String getPd_text2() {
+        return pd_text2;
+    }
+
+    public void setPd_text2(String pd_text2) {
+        this.pd_text2 = pd_text2 == null ? null : pd_text2.trim();
+    }
+
+    public String getPd_text3() {
+        return pd_text3;
+    }
+
+    public void setPd_text3(String pd_text3) {
+        this.pd_text3 = pd_text3 == null ? null : pd_text3.trim();
+    }
+
+    public String getPd_text4() {
+        return pd_text4;
+    }
+
+    public void setPd_text4(String pd_text4) {
+        this.pd_text4 = pd_text4 == null ? null : pd_text4.trim();
+    }
+
+    public String getPd_text5() {
+        return pd_text5;
+    }
+
+    public void setPd_text5(String pd_text5) {
+        this.pd_text5 = pd_text5 == null ? null : pd_text5.trim();
+    }
+
+    public Double getPd_num() {
+        return pd_num;
+    }
+
+    public void setPd_num(Double pd_num) {
+        this.pd_num = pd_num;
+    }
+}

+ 7 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java

@@ -51,7 +51,7 @@ public class ProductController {
 
     @PostMapping("/save")
     public Result save(@RequestBody ProductListDTO productListDTO){
-        DocBaseDTO docBaseDTO = productService.saveData(productListDTO.getMain());
+        DocBaseDTO docBaseDTO = productService.saveData(productListDTO);
         return Result.success(docBaseDTO);
     }
 
@@ -61,6 +61,12 @@ public class ProductController {
         return Result.success();
     }
 
+    @PostMapping("/deleteDetail/{id}")
+    public Result deleteDetail(@PathVariable("id") Long id){
+        productService.deleteDetailById(id);
+        return Result.success();
+    }
+
     @PostMapping("/close/{id}")
     public Result close(@PathVariable("id") Long id){
         DocBaseDTO docBaseDTO = productService.close(id);

+ 1 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerMapper.java

@@ -26,4 +26,5 @@ public interface CustomerMapper extends CommonBaseMapper<Customer> {
 
     int validNameAndCodeWhenUpdate(Customer record);
 
+    int validFinish(@Param("id") Long id,@Param("companyId") Long companyId);
 }

+ 28 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductDetailMapper.java

@@ -0,0 +1,28 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.document.entities.ProductDetail;
+
+import java.util.List;
+
+public interface ProductDetailMapper extends CommonBaseMapper<ProductDetail> {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(ProductDetail record);
+
+    int insertSelective(ProductDetail record);
+
+    ProductDetail selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(ProductDetail record);
+
+    int updateByPrimaryKey(ProductDetail record);
+
+    void batchInsert(List<ProductDetail> productDetailList);
+
+    void batchUpdate(List<ProductDetail> productDetailList);
+
+    Long selectProdidByPrimaryKey(Long id);
+
+    List<ProductDetail> selectByProdId(Long id);
+}

+ 16 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java

@@ -4,6 +4,8 @@ import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.commons.dto.ComboDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
 import com.usoftchina.saas.document.dto.ProductReserveCostDTO;
+import com.usoftchina.saas.document.entities.ProdIODetail;
+import com.usoftchina.saas.document.entities.ProdInOut;
 import com.usoftchina.saas.document.entities.Product;
 import org.apache.ibatis.annotations.Param;
 
@@ -13,7 +15,7 @@ public interface ProductMapper extends CommonBaseMapper<Product> {
 
     List<ProductDTO> getProductsByCondition(@Param("con") String con, @Param("companyId") Long companyId);
 
-    List<ComboDTO> getProdUnit();
+    List<ComboDTO> getProdUnit(@Param("companyId") Long companyId);
 
     void updateLatestPurchasePrice(Long pu_id);
 
@@ -33,4 +35,17 @@ public interface ProductMapper extends CommonBaseMapper<Product> {
 
     int getCountFromProdIO(@Param("id") Long id, @Param("companyId") Long companyId);
 
+    boolean saveProdInOut(ProdInOut prodInOut);
+
+    boolean batchInsertDetail(List<ProdIODetail> prodIODetailList);
+
+    boolean batchUpdateDetail(List<ProdIODetail> prodIODetailList);
+
+    String selectProdIOCode(@Param("code") String code, @Param("companyId") Long companyId, @Param("type") String type);
+
+    int selectOrderCountByProdCode(@Param("id") Long id, @Param("companyId") Long companyId);
+
+    boolean deleteProdIOByCode(@Param("code") String code, @Param("companyId") Long companyId);
+
+    boolean deleteProdIODetailByCode(@Param("code") String code, @Param("companyId") Long companyId);
 }

+ 6 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java

@@ -22,4 +22,10 @@ public interface VendorMapper extends CommonBaseMapper<Vendor> {
     int validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long company);
 
     String getCodeById(@Param("id") Long id, @Param("companyId") Long companyId);
+
+    int getCountByCode(@Param("code") String code, @Param("companyId") Long companyId);
+
+    int getCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+
+    int validFinish(@Param("id") Long id,@Param("companyId") Long companyId);
 }

+ 3 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/WarehouseMapper.java

@@ -40,4 +40,7 @@ public interface WarehouseMapper extends CommonBaseMapper<Warehouse> {
     Integer deleteCheckProduct(@Param("id") Long id, @Param("companyId") Long companyId);
 
     Integer deleteCheckWH(@Param("id") Long id, @Param("companyId") Long companyId);
+
+    int selectCountByCode(@Param("code") String code, @Param("companyId") Long companyId, @Param("id") Long id);
+
 }

+ 10 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java

@@ -9,6 +9,7 @@ import com.usoftchina.saas.commons.dto.ComboDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
+import com.usoftchina.saas.document.dto.ProductListDTO;
 import com.usoftchina.saas.document.dto.ProductReserveCostDTO;
 import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.mapper.ProductMapper;
@@ -48,10 +49,10 @@ public interface ProductService extends CommonBaseService<ProductMapper, Product
 
     /**
      * 保存/更新
-     * @param product
+     * @param productListDTO
      * @return
      */
-    DocBaseDTO saveData(Product product);
+    DocBaseDTO saveData(ProductListDTO productListDTO);
 
     /**
      * 关闭
@@ -109,4 +110,11 @@ public interface ProductService extends CommonBaseService<ProductMapper, Product
      * @return
      */
     PageInfo<ProductReserveCostDTO> getReserveCost(PageRequest page, ListReqDTO listReqDTO);
+
+    /**
+     * 通过明细ID删除明细
+     * @param id
+     * @return
+     */
+    boolean deleteDetailById(Long id);
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BankinformationServiceImpl.java

@@ -28,7 +28,7 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
     @Override
     public boolean save(Bankinformation bankinformation){
         bankinformation.setCompanyId(BaseContextHolder.getCompanyId());
-        if (bankinformation.getBk_thisamount() == 0 || bankinformation.getBk_thisamount() == null){
+        if (bankinformation.getBk_thisamount() == null || bankinformation.getBk_thisamount() == 0){
             bankinformation.setBk_thisamount(bankinformation.getBk_beginamount());
         }
         if(bankinformation.getId() == 0){

+ 10 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java

@@ -178,6 +178,16 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
             throw new BizException(500, "客户名称或编号重复");
         }
 
+        //检查期初日期是否已结转
+        count = getMapper().validFinish(cu_id,companyId);
+        if (count>0) {
+            Customer cutpl = getMapper().selectByPrimaryKey(cu_id);
+            //期初应收
+            customer.setCu_beginaramount(cutpl.getCu_beginaramount());
+            //期初预收
+            customer.setCu_beginprerecamount(cutpl.getCu_beginprerecamount());
+        }
+
         //更新操作
         getMapper().updateByPrimaryKeySelective(customer);
         //添加从表传输对象

+ 220 - 6
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java

@@ -14,18 +14,20 @@ import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.dto.ProductDTO;
+import com.usoftchina.saas.document.dto.ProductListDTO;
 import com.usoftchina.saas.document.dto.ProductReserveCostDTO;
-import com.usoftchina.saas.document.entities.Product;
+import com.usoftchina.saas.document.entities.*;
+import com.usoftchina.saas.document.mapper.ProductDetailMapper;
 import com.usoftchina.saas.document.mapper.ProductMapper;
 import com.usoftchina.saas.document.service.ProductService;
+import com.usoftchina.saas.document.service.WarehouseService;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
-import javax.print.Doc;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 @Service
 public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Product> implements ProductService {
@@ -34,6 +36,10 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
     private MessageLogService messageLogService;
     @Autowired
     private MaxnumberService maxnumberService;
+    @Autowired
+    private WarehouseService warehouseService;
+    @Autowired
+    private ProductDetailMapper productDetailMapper;
 
     @Override
     public PageInfo<ProductDTO> getProductsByCondition(PageRequest page, ListReqDTO listReqDTO) {
@@ -52,7 +58,7 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
 
     @Override
     public List<ComboDTO> getProdUnit() {
-        return getMapper().getProdUnit();
+        return getMapper().getProdUnit(BaseContextHolder.getCompanyId());
     }
 
     @Override
@@ -69,18 +75,65 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
     }
 
     @Override
-    public DocBaseDTO saveData(Product product){
+    public DocBaseDTO saveData(ProductListDTO productListDTO){
+        Product product = productListDTO.getMain();
+        List<ProductDetail> productDetailList = productListDTO.getItems();
         DocBaseDTO docBaseDTO = null;
         if(product.getId() == 0){
+            //保存
             String code = pushMaxnubmer(product.getPr_code(), product.getId());
             product.setCompanyId(BaseContextHolder.getCompanyId());
             product.setCreatorId(BaseContextHolder.getUserId());
             product.setCreateTime(new Date());
+            //保存主表
             getMapper().insertSelective(product);
+            //保存明细表数据
+            productDetailMapper.batchInsert(productDetailList);
+            //生成库存初始化数据并过账
+            generateProdIOPost(product, productDetailList);
+
             docBaseDTO = generateMsgObj(product.getId(), code);
             //记录LOG
             messageLogService.save(docBaseDTO);
         }else{
+            String oldCode = getMapper().getCodeById(product.getId());
+            if (!product.getPr_code().equals(oldCode)){
+                validEnableUpdate(product.getId());
+            }
+            //物料发生过除库存初始化外的出入库单时,不能新增,修改,删除
+            validProductOperation(product.getId(), BizExceptionCode.BIZ_RELDELETE_UPDATEPROD);
+
+            //明细数据有更新/插入动作
+            if (productDetailList.size() > 0){
+                //找到原始单据,反过账并删除
+                String inoutCode = getMapper().selectProdIOCode(product.getPr_code(), BaseContextHolder.getCompanyId(), "库存初始化");
+                post(inoutCode, "反过账");
+                getMapper().deleteProdIOByCode(inoutCode, BaseContextHolder.getCompanyId());
+                getMapper().deleteProdIODetailByCode(inoutCode, BaseContextHolder.getCompanyId());
+                //此种情况不可能发生明细行数量,只会发生明细行数据修改/新增明细行
+                //a.更新明细行数据
+                List<ProductDetail> insertItems = new ArrayList<ProductDetail>();
+                List<ProductDetail> updateItems = new ArrayList<ProductDetail>();
+                for(ProductDetail productDetail : productDetailList){
+                    if (productDetail.getId() == 0){
+                        insertItems.add(productDetail);
+                    }else{
+                        updateItems.add(productDetail);
+                    }
+                }
+                if (insertItems.size() > 0){
+                    productDetailMapper.batchInsert(insertItems);
+                }
+                if (updateItems.size() > 0){
+                    productDetailMapper.batchUpdate(updateItems);
+                }
+
+                //b.获取更新后的明细数据,生成库存初始化数据并过账
+                List<ProductDetail> productDetails = productDetailMapper.selectByProdId(product.getId());
+                generateProdIOPost(product, productDetails);
+
+            }
+
             product.setUpdaterId(BaseContextHolder.getUserId());
             product.setUpdateTime(new Date());
             getMapper().updateByPrimaryKeySelective(product);
@@ -91,8 +144,111 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
         return docBaseDTO;
     }
 
+    /**
+     * 物料发生过除库存初始化外的出入库单时,不能新增,修改,删除
+     * @param id
+     */
+    private void validProductOperation(Long id, BizExceptionCode bizExceptionCode) {
+        int count = getMapper().selectOrderCountByProdCode(id, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(bizExceptionCode);
+        }
+    }
+
+    /**
+     * 生成库存初始化数据并过账
+     * @param product
+     * @param productDetailList
+     */
+    private void generateProdIOPost(Product product, List<ProductDetail> productDetailList) {
+        Long companyId = BaseContextHolder.getCompanyId();
+        Long userId = BaseContextHolder.getUserId();
+        //1.有明细数据变更
+        if (productDetailList.size() > 0){
+            //生成库存初始化单据主表
+            ProdInOut prodInOut = new ProdInOut();
+            String inoutCode = maxnumberService.getMaxnumber("StorageInit", true).getData();
+            prodInOut.setPi_inoutno(inoutCode);     //出入库单号
+            prodInOut.setPi_class("库存初始化");
+            prodInOut.setPi_date(new Date());
+            //prodInOut.setPi_total();            //含税金额
+            prodInOut.setPi_recordman("");
+            prodInOut.setPi_recordmanid(userId);
+            prodInOut.setPi_recorddate(new Date());
+            prodInOut.setPi_status(Status.UNAUDITED.getDisplay());
+            prodInOut.setPi_statuscode(Status.UNAUDITED.name());
+            prodInOut.setPi_text1(product.getPr_code());
+            prodInOut.setCompanyId(companyId);
+
+            //主表插入
+            getMapper().saveProdInOut(prodInOut);
+            Long pi_id = prodInOut.getId();
+            List<ProdIODetail> insertItems = new ArrayList<ProdIODetail>();
+            //生成库存初始化单据明细表
+            for(ProductDetail productDetail : productDetailList){
+                ProdIODetail prodIODetail = generateProdIODetail(product, productDetail);
+                insertItems.add(prodIODetail);
+            }
+            //明细插入
+            getMapper().batchInsertDetail(insertItems);
+
+            //过账
+            post(inoutCode, "过账");
+        }
+    }
+
+    /**
+     * 过账
+     * @param code
+     */
+    private void post(String code, String type){
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("inoutNo", code);
+        map.put("class", "库存初始化");
+        map.put("commitid", BaseContextHolder.getUserId());
+        map.put("companyId", BaseContextHolder.getCompanyId());
+        map.put("result", null);
+        if ("过账".equals(type)) {
+            warehouseService.post(map);
+        }else if ("反过账".equals(type)){
+            warehouseService.unPost(map);
+        }
+        if (StringUtils.isEmpty(map.get("result"))){
+            throw new BizException(76203, map.get("result").toString());
+        }
+    }
+
+    /**
+     * 生成库存初始化明细表
+     * @param product
+     * @param productDetail
+     * @return
+     */
+    private ProdIODetail generateProdIODetail(Product product, ProductDetail productDetail){
+        ProdIODetail prodIODetail = new ProdIODetail();
+        prodIODetail.setPd_piclass("库存初始化");
+        prodIODetail.setPd_inoutno(product.getPr_code());
+        prodIODetail.setPd_piid(product.getId());
+        prodIODetail.setPd_pdno(productDetail.getPd_detno());
+        prodIODetail.setPd_ordercode(product.getPr_code());         //订单号 -> 物料编号
+        prodIODetail.setPd_orderdetno(productDetail.getPd_detno()); //订单序号 -> 物料明细序号
+        prodIODetail.setPd_prodid(product.getId());                 //物料
+        prodIODetail.setPd_prodcode(product.getPr_code());          //物料编号
+        prodIODetail.setPd_unit(product.getPr_unit());              //单位
+        prodIODetail.setPd_inqty(productDetail.getPd_num());        //数量
+        prodIODetail.setPd_price(productDetail.getPd_price());      //成本单价
+        prodIODetail.setPd_total(productDetail.getPd_amount());     //成本金额
+        prodIODetail.setPd_whid(productDetail.getPd_whid());        //仓库库ID
+        prodIODetail.setPd_whcode(productDetail.getPd_whcode());    //仓库编号
+        prodIODetail.setPd_whname(productDetail.getPd_whname());    //仓库名称
+        prodIODetail.setPd_status(0);                               //状态
+        prodIODetail.setCompanyId(BaseContextHolder.getCompanyId());//公司ID
+        return prodIODetail;
+    }
+
     @Override
     public DocBaseDTO close(Long id) {
+        validEnableUpdate(id);
         DocBaseDTO docBaseDTO = null;
         if(id != null && id > 0){
             String code = getMapper().getCodeById(id);
@@ -169,7 +325,10 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
     @Override
     public boolean deleteByPrimaryKey(Long id) {
         //校验物料是否已经在使用状态(采购单、销售单、BOM、出入库单)
+        validProductOperation(id, BizExceptionCode.BIZ_RELDELETE_DELETEPROD);
+        //校验是否存在关联单据
         validEnableDel(id);
+
         String code = getMapper().getCodeById(id);
         getMapper().deleteByPrimaryKey(id);
         DocBaseDTO docBaseDTO = generateMsgObj(id, code);
@@ -178,6 +337,10 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
         return true;
     }
 
+    /**
+     * 校验是否存在关联单据
+     * @param id
+     */
     private void validEnableDel(Long id) {
         int count = 0;
         //采购
@@ -203,6 +366,34 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
         //batch
     }
 
+    /**
+     * 校验是否存在关联单据,不存在时才允许更新物料编号
+     * @param id
+     */
+    private void validEnableUpdate(Long id){
+        int count = 0;
+        //采购
+        count = getMapper().getCountFromPurc(id, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.BIZ_RELDELETE_UPDATE);
+        }
+        //销售
+        count = getMapper().getCountFromSale(id, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.BIZ_RELDELETE_UPDATE);
+        }
+        //BOM
+        count = getMapper().getCountFromBom(id, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.BIZ_RELDELETE_UPDATE);
+        }
+        //出入库
+        count = getMapper().getCountFromProdIO(id, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.BIZ_RELDELETE_UPDATE);
+        }
+    }
+
     @Override
     public boolean batchDelete(BatchDealBaseDTO baseDTOs) {
         for(DocBaseDTO docBaseDTO : baseDTOs.getBaseDTOs()){
@@ -231,6 +422,29 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
         return pageInfo;
     }
 
+    @Override
+    public boolean deleteDetailById(Long id) {
+        Long prodId = productDetailMapper.selectProdidByPrimaryKey(id);
+        validProductOperation(prodId, BizExceptionCode.BIZ_RELDELETE_DELETEPROD);
+        String prCode = getMapper().selectByPrimaryKey(id).getPr_code();
+        //找到原始单据,反过账并删除
+        String inoutCode = getMapper().selectProdIOCode(prCode, BaseContextHolder.getCompanyId(), "库存初始化");
+        if (!StringUtils.isEmpty(inoutCode)) {
+            post(inoutCode, "反过账");
+            getMapper().deleteProdIOByCode(inoutCode, BaseContextHolder.getCompanyId());
+            getMapper().deleteProdIODetailByCode(inoutCode, BaseContextHolder.getCompanyId());
+        }
+
+        productDetailMapper.deleteByPrimaryKey(id);
+
+        Product product = getMapper().selectByPrimaryKey(prodId);
+        List<ProductDetail> productDetailList = productDetailMapper.selectByProdId(prodId);
+
+        generateProdIOPost(product, productDetailList);
+
+        return true;
+    }
+
     private List<ProductReserveCostDTO> geReserveCost(ListReqDTO listReqDTO) {
         Long companyId = BaseContextHolder.getCompanyId();
         String condition = listReqDTO.getFinalCondition();

+ 34 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorServiceImpl.java

@@ -101,6 +101,7 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
     @Override
     @Transactional
     public DocBaseDTO saveFormData(VendorListDTO vendorListDTO) {
+        Long companyId = BaseContextHolder.getCompanyId();
         if (null == vendorListDTO || null == vendorListDTO.getMain()){
             throw new BizException(500, "数据为空,请填写后再保存");
         }
@@ -110,6 +111,14 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
         List<Vendorcontact> items = vendorListDTO.getItems();
         if(main.getId() == 0){
             code = pushMaxnubmer(main.getVe_code(), main.getId());
+            int count = getMapper().getCountByCode(code, companyId);
+            if(count > 0){
+                throw new BizException(500, "编号重复!");
+            }
+            count = getMapper().getCountByName(main.getVe_name(), companyId);
+            if (count > 0){
+                throw new BizException(500, "名称重复!");
+            }
             //保存主表信息
             main.setVe_code(code);
             getMapper().insertSelective(main);
@@ -129,6 +138,31 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
             messageLogService.save(generateMsgObj(mainId, code));
         }else{
             code = main.getVe_code();
+            Long mainId = main.getId();
+            Vendor oldVendor = getMapper().selectByPrimaryKey(main.getId());
+            int count = getMapper().getCountByCode(code, companyId);
+            if (!code.equals(oldVendor.getVe_code())){
+                if (count > 0){
+                    throw new BizException(500, "编号重复!");
+                }
+            }
+            if (!main.getVe_name().equals(oldVendor.getVe_name())){
+                count = getMapper().getCountByName(main.getVe_name(), companyId);
+                if (count > 0){
+                    throw new BizException(500, "名称重复!");
+                }
+            }
+
+            //检查期初日期是否已结转
+            count = getMapper().validFinish(mainId,companyId);
+            if (count>0) {
+                Vendor vendortpl = getMapper().selectByPrimaryKey(mainId);
+                //期初应收
+                main.setVe_beginapamount(vendortpl.getVe_beginapamount());
+                //期初预收
+                main.setVe_beginprepayamount(vendortpl.getVe_beginprepayamount());
+            }
+
             getMapper().updateByPrimaryKeySelective(main);
             if (items.size() > 0) {
                 List<Vendorcontact> updateItems = new ArrayList<Vendorcontact>();

+ 18 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java

@@ -104,6 +104,7 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
     public DocBaseDTO insertSelective(Warehouse record) {
         int count = 0;
         DocBaseDTO docBaseDTO = null;
+        Long companyId = BaseContextHolder.getCompanyId();
         if(record.getId() == 0){
             String code = pushMaxnubmer(record.getWh_code(), record.getId());
             record.setCompanyId(BaseContextHolder.getCompanyId());
@@ -112,6 +113,9 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
 
             //验证名称是否重复
             validName(record.getWh_description(), record.getId());
+            //验证编号是否重复
+            validCode(code, record.getId());
+
             count = getMapper().insertSelective(record);
             //记录LOG
             docBaseDTO = generateMsgObj(record.getId(), code);
@@ -121,6 +125,8 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
             record.setUpdaterId(BaseContextHolder.getUserId());
             //验证名称是否重复
             validName(record.getWh_description(), record.getId());
+            //验证编号是否重复
+            validCode(record.getWh_code(), record.getId());
 
             getMapper().updateByPrimaryKeySelective(record);
             //记录LOG
@@ -130,6 +136,18 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
         return docBaseDTO;
     }
 
+    /**
+     * 校验code是否存在
+     * @param code
+     * @param id
+     */
+    private void validCode(String code, Long id) {
+        int count = getMapper().selectCountByCode(code, BaseContextHolder.getCompanyId(), id);
+        if (count > 0){
+            throw new BizException(BizExceptionCode.REPEAT_CODE);
+        }
+    }
+
     /**
      * 反过账
      * @param map

+ 7 - 0
applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml

@@ -386,4 +386,11 @@
     where cu_id = #{id,jdbcType=INTEGER}
   </select>
 
+  <select id="validFinish" parameterType="long" resultType="int">
+  select count(1) from periodsdetail where pd_status=99 and pd_detno=(select DATE_FORMAT(cu_begindate,'%Y%m') from customer where cu_id =#{id})
+  and companyId =#{companyId};
+  </select>
+
+
+
 </mapper>

+ 332 - 0
applications/document/document-server/src/main/resources/mapper/ProductDetailMapper.xml

@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.usoftchina.saas.document.mapper.ProductDetailMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.ProductDetail" >
+    <id column="id" property="id" jdbcType="INTEGER" />
+    <result column="pd_prodid" property="pd_prodid" jdbcType="INTEGER" />
+    <result column="pd_prodcode" property="pd_prodcode" jdbcType="VARCHAR" />
+    <result column="pd_detno" property="pd_detno" jdbcType="INTEGER" />
+    <result column="pd_whcode" property="pd_whcode" jdbcType="VARCHAR" />
+    <result column="pd_whname" property="pd_whname" jdbcType="VARCHAR" />
+    <result column="pd_whid" property="pd_whid" jdbcType="INTEGER" />
+    <result column="pd_price" property="pd_price" jdbcType="DOUBLE" />
+    <result column="pd_amount" property="pd_amount" jdbcType="DOUBLE" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="pd_text1" property="pd_text1" jdbcType="VARCHAR" />
+    <result column="pd_text2" property="pd_text2" jdbcType="VARCHAR" />
+    <result column="pd_text3" property="pd_text3" jdbcType="VARCHAR" />
+    <result column="pd_text4" property="pd_text4" jdbcType="VARCHAR" />
+    <result column="pd_text5" property="pd_text5" jdbcType="VARCHAR" />
+    <result column="pd_num" property="pd_num" jdbcType="DOUBLE" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, pd_prodid, pd_prodcode, pd_detno, pd_whcode, pd_whname, pd_whid, pd_price, pd_amount, 
+    companyId, updaterId, updateTime, pd_text1, pd_text2, pd_text3, pd_text4, pd_text5, 
+    pd_num
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    select 
+    <include refid="Base_Column_List" />
+    from productdetail
+    where id = #{id}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+    delete from productdetail
+    where id = #{id}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.document.entities.ProductDetail" >
+      <selectKey resultType="java.lang.Long" keyProperty="id">
+          SELECT LAST_INSERT_ID() AS ID
+      </selectKey>
+    insert into productdetail ( pd_prodid, pd_prodcode,
+      pd_detno, pd_whcode, pd_whname, 
+      pd_whid, pd_price, pd_amount, 
+      companyId, updaterId, updateTime, 
+      pd_text1, pd_text2, pd_text3, 
+      pd_text4, pd_text5, pd_num
+      )
+    values ( #{pd_prodid,jdbcType=INTEGER}, #{pd_prodcode,jdbcType=VARCHAR},
+      #{pd_detno,jdbcType=INTEGER}, #{pd_whcode,jdbcType=VARCHAR}, #{pd_whname,jdbcType=VARCHAR}, 
+      #{pd_whid,jdbcType=INTEGER}, #{pd_price,jdbcType=DOUBLE}, #{pd_amount,jdbcType=DOUBLE}, 
+      #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, 
+      #{pd_text1,jdbcType=VARCHAR}, #{pd_text2,jdbcType=VARCHAR}, #{pd_text3,jdbcType=VARCHAR}, 
+      #{pd_text4,jdbcType=VARCHAR}, #{pd_text5,jdbcType=VARCHAR}, #{pd_num,jdbcType=DOUBLE}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.ProductDetail" >
+      <selectKey resultType="java.lang.Long" keyProperty="id">
+          SELECT LAST_INSERT_ID() AS ID
+      </selectKey>
+    insert into productdetail
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="pd_prodid != null" >
+        pd_prodid,
+      </if>
+      <if test="pd_prodcode != null" >
+        pd_prodcode,
+      </if>
+      <if test="pd_detno != null" >
+        pd_detno,
+      </if>
+      <if test="pd_whcode != null" >
+        pd_whcode,
+      </if>
+      <if test="pd_whname != null" >
+        pd_whname,
+      </if>
+      <if test="pd_whid != null" >
+        pd_whid,
+      </if>
+      <if test="pd_price != null" >
+        pd_price,
+      </if>
+      <if test="pd_amount != null" >
+        pd_amount,
+      </if>
+      <if test="companyId != null" >
+        companyId,
+      </if>
+      <if test="updaterId != null" >
+        updaterId,
+      </if>
+      <if test="updateTime != null" >
+        updateTime,
+      </if>
+      <if test="pd_text1 != null" >
+        pd_text1,
+      </if>
+      <if test="pd_text2 != null" >
+        pd_text2,
+      </if>
+      <if test="pd_text3 != null" >
+        pd_text3,
+      </if>
+      <if test="pd_text4 != null" >
+        pd_text4,
+      </if>
+      <if test="pd_text5 != null" >
+        pd_text5,
+      </if>
+      <if test="pd_num != null" >
+        pd_num,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="pd_prodid != null" >
+        #{pd_prodid,jdbcType=INTEGER},
+      </if>
+      <if test="pd_prodcode != null" >
+        #{pd_prodcode,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_detno != null" >
+        #{pd_detno,jdbcType=INTEGER},
+      </if>
+      <if test="pd_whcode != null" >
+        #{pd_whcode,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_whname != null" >
+        #{pd_whname,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_whid != null" >
+        #{pd_whid,jdbcType=INTEGER},
+      </if>
+      <if test="pd_price != null" >
+        #{pd_price,jdbcType=DOUBLE},
+      </if>
+      <if test="pd_amount != null" >
+        #{pd_amount,jdbcType=DOUBLE},
+      </if>
+      <if test="companyId != null" >
+        #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="pd_text1 != null" >
+        #{pd_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_text2 != null" >
+        #{pd_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_text3 != null" >
+        #{pd_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_text4 != null" >
+        #{pd_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_text5 != null" >
+        #{pd_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_num != null" >
+        #{pd_num,jdbcType=DOUBLE},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.ProductDetail" >
+    update productdetail
+    <set >
+      <if test="pd_prodid != null" >
+        pd_prodid = #{pd_prodid,jdbcType=INTEGER},
+      </if>
+      <if test="pd_prodcode != null" >
+        pd_prodcode = #{pd_prodcode,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_detno != null" >
+        pd_detno = #{pd_detno,jdbcType=INTEGER},
+      </if>
+      <if test="pd_whcode != null" >
+        pd_whcode = #{pd_whcode,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_whname != null" >
+        pd_whname = #{pd_whname,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_whid != null" >
+        pd_whid = #{pd_whid,jdbcType=INTEGER},
+      </if>
+      <if test="pd_price != null" >
+        pd_price = #{pd_price,jdbcType=DOUBLE},
+      </if>
+      <if test="pd_amount != null" >
+        pd_amount = #{pd_amount,jdbcType=DOUBLE},
+      </if>
+      <if test="companyId != null" >
+        companyId = #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        updaterId = #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="pd_text1 != null" >
+        pd_text1 = #{pd_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_text2 != null" >
+        pd_text2 = #{pd_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_text3 != null" >
+        pd_text3 = #{pd_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_text4 != null" >
+        pd_text4 = #{pd_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_text5 != null" >
+        pd_text5 = #{pd_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="pd_num != null" >
+        pd_num = #{pd_num,jdbcType=DOUBLE},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.ProductDetail" >
+    update productdetail
+    set pd_prodid = #{pd_prodid,jdbcType=INTEGER},
+      pd_prodcode = #{pd_prodcode,jdbcType=VARCHAR},
+      pd_detno = #{pd_detno,jdbcType=INTEGER},
+      pd_whcode = #{pd_whcode,jdbcType=VARCHAR},
+      pd_whname = #{pd_whname,jdbcType=VARCHAR},
+      pd_whid = #{pd_whid,jdbcType=INTEGER},
+      pd_price = #{pd_price,jdbcType=DOUBLE},
+      pd_amount = #{pd_amount,jdbcType=DOUBLE},
+      companyId = #{companyId,jdbcType=INTEGER},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      pd_text1 = #{pd_text1,jdbcType=VARCHAR},
+      pd_text2 = #{pd_text2,jdbcType=VARCHAR},
+      pd_text3 = #{pd_text3,jdbcType=VARCHAR},
+      pd_text4 = #{pd_text4,jdbcType=VARCHAR},
+      pd_text5 = #{pd_text5,jdbcType=VARCHAR},
+      pd_num = #{pd_num,jdbcType=DOUBLE}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+    <insert id="batchInsert" parameterType="java.util.List">
+        insert into productdetail ( pd_prodid, pd_prodcode,
+        pd_detno, pd_whcode, pd_whname,
+        pd_whid, pd_price, pd_amount,
+        companyId, updaterId, updateTime,
+        pd_text1, pd_text2, pd_text3,
+        pd_text4, pd_text5, pd_num
+        )
+        VALUES
+        <foreach collection="list" item="item" index="index" open="" close="" separator=",">
+            values ( #{item.pd_prodid,jdbcType=INTEGER}, #{item.pd_prodcode,jdbcType=VARCHAR},
+            #{item.pd_detno,jdbcType=INTEGER}, #{item.pd_whcode,jdbcType=VARCHAR}, #{item.pd_whname,jdbcType=VARCHAR},
+            #{item.pd_whid,jdbcType=INTEGER}, #{item.pd_price,jdbcType=DOUBLE}, #{item.pd_amount,jdbcType=DOUBLE},
+            #{item.companyId,jdbcType=INTEGER}, #{item.updaterId,jdbcType=INTEGER}, #{item.updateTime,jdbcType=TIMESTAMP},
+            #{item.pd_text1,jdbcType=VARCHAR}, #{item.pd_text2,jdbcType=VARCHAR}, #{item.pd_text3,jdbcType=VARCHAR},
+            #{item.pd_text4,jdbcType=VARCHAR}, #{item.pd_text5,jdbcType=VARCHAR}, #{item.pd_num,jdbcType=DOUBLE}
+            )
+        </foreach>
+    </insert>
+    <update id="batchUpdate" parameterType="com.usoftchina.saas.document.entities.ProductDetail">
+        <foreach collection="list" item="item" index="index" separator=";">
+            update productdetail
+            <set >
+                <if test="pd_prodid != null" >
+                    pd_prodid = #{pd_prodid,jdbcType=INTEGER},
+                </if>
+                <if test="pd_prodcode != null" >
+                    pd_prodcode = #{pd_prodcode,jdbcType=VARCHAR},
+                </if>
+                <if test="pd_detno != null" >
+                    pd_detno = #{pd_detno,jdbcType=INTEGER},
+                </if>
+                <if test="pd_whcode != null" >
+                    pd_whcode = #{pd_whcode,jdbcType=VARCHAR},
+                </if>
+                <if test="pd_whname != null" >
+                    pd_whname = #{pd_whname,jdbcType=VARCHAR},
+                </if>
+                <if test="pd_whid != null" >
+                    pd_whid = #{pd_whid,jdbcType=INTEGER},
+                </if>
+                <if test="pd_price != null" >
+                    pd_price = #{pd_price,jdbcType=DOUBLE},
+                </if>
+                <if test="pd_amount != null" >
+                    pd_amount = #{pd_amount,jdbcType=DOUBLE},
+                </if>
+                <if test="companyId != null" >
+                    companyId = #{companyId,jdbcType=INTEGER},
+                </if>
+                <if test="updaterId != null" >
+                    updaterId = #{updaterId,jdbcType=INTEGER},
+                </if>
+                <if test="updateTime != null" >
+                    updateTime = #{updateTime,jdbcType=TIMESTAMP},
+                </if>
+                <if test="pd_text1 != null" >
+                    pd_text1 = #{pd_text1,jdbcType=VARCHAR},
+                </if>
+                <if test="pd_text2 != null" >
+                    pd_text2 = #{pd_text2,jdbcType=VARCHAR},
+                </if>
+                <if test="pd_text3 != null" >
+                    pd_text3 = #{pd_text3,jdbcType=VARCHAR},
+                </if>
+                <if test="pd_text4 != null" >
+                    pd_text4 = #{pd_text4,jdbcType=VARCHAR},
+                </if>
+                <if test="pd_text5 != null" >
+                    pd_text5 = #{pd_text5,jdbcType=VARCHAR},
+                </if>
+                <if test="pd_num != null" >
+                    pd_num = #{pd_num,jdbcType=DOUBLE},
+                </if>
+            </set>
+            where id = #{id}
+        </foreach>
+    </update>
+    <select id="selectProdidByPrimaryKey" resultType="java.lang.Long">
+        SELECT PD_PRODID FROM PRODUCTDETAIL WHERE PD_ID=#{id}
+    </select>
+    <select id="selectByProdId" resultType="com.usoftchina.saas.document.entities.ProductDetail">
+        SELECT * FROM PRODUCTDETAIL WHERE PD_PRODID=#{id}
+    </select>
+</mapper>

+ 409 - 1
applications/document/document-server/src/main/resources/mapper/ProductMapper.xml

@@ -74,7 +74,7 @@
     </select>
 
     <select id="getProdUnit" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
-        SELECT PR_UNIT as display, pr_unit as value FROM PRODUCT
+        SELECT PR_UNIT as display, pr_unit as value FROM PRODUCT where companyId=#{companyId}
     </select>
     <update id="updateLatestPurchasePrice" parameterType="long">
         update product a set pr_purcprice=(select pd_price from purchasedetail WHERE
@@ -506,5 +506,413 @@
     <select id="getCountFromProdIO" resultType="int">
         SELECT COUNT(*) FROM PRODIODETAIL WHERE PD_PRODID=#{id} AND COMPANYID=#{companyId}
     </select>
+
+    <insert id="saveProdInOut" parameterType="com.usoftchina.saas.document.entities.ProdInOut">
+        <selectKey resultType="java.lang.Long" keyProperty="id">
+            SELECT LAST_INSERT_ID() AS ID
+        </selectKey>
+        insert into prodinout
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+
+            <if test="pi_inoutno != null">
+                pi_inoutno,
+            </if>
+            <if test="pi_class != null">
+                pi_class,
+            </if>
+            <if test="pi_date != null">
+                pi_date,
+            </if>
+            <if test="pi_vendid != null">
+                pi_vendid,
+            </if>
+            <if test="pi_vendcode != null">
+                pi_vendcode,
+            </if>
+            <if test="pi_vendname != null">
+                pi_vendname,
+            </if>
+            <if test="pi_custid != null">
+                pi_custid,
+            </if>
+            <if test="pi_custcode != null">
+                pi_custcode,
+            </if>
+            <if test="pi_custname != null">
+                pi_custname,
+            </if>
+            <if test="pi_puid != null">
+                pi_puid,
+            </if>
+            <if test="pi_pucode != null">
+                pi_pucode,
+            </if>
+            <if test="pi_said != null">
+                pi_said,
+            </if>
+            <if test="pi_sacode != null">
+                pi_sacode,
+            </if>
+            <if test="pi_total != null">
+                pi_total,
+            </if>
+            <if test="pi_recordmanid != null">
+                pi_recordmanid,
+            </if>
+            <if test="pi_recordman != null">
+                pi_recordman,
+            </if>
+            <if test="createTime != null">
+                pi_recorddate,
+            </if>
+            <if test="pi_status != null">
+                pi_status,
+            </if>
+            <if test="pi_statuscode != null">
+                pi_statuscode,
+            </if>
+            <if test="pi_printstatus != null">
+                pi_printstatus,
+            </if>
+            <if test="pi_printstatuscode != null">
+                pi_printstatuscode,
+            </if>
+            <if test="companyId != null">
+                companyid,
+            </if>
+            <if test="updaterId != null">
+                updaterid,
+            </if>
+            <if test="updateTime != null">
+                updatetime,
+            </if>
+            <if test="pi_text1 != null">
+                pi_text1,
+            </if>
+            <if test="pi_text2 != null">
+                pi_text2,
+            </if>
+            <if test="pi_text3 != null">
+                pi_text3,
+            </if>
+            <if test="pi_text4 != null">
+                pi_text4,
+            </if>
+            <if test="pi_text5 != null">
+                pi_text5,
+            </if>
+            <if test="pi_address != null">
+                pi_address,
+            </if>
+            <if test="pi_auditdate != null">
+                pi_auditdate,
+            </if>
+            <if test="pi_auditman != null">
+                pi_auditman,
+            </if>
+            <if test="pi_remark != null">
+                pi_remark,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+
+            <if test="pi_inoutno != null">
+                #{pi_inoutno,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_class != null">
+                #{pi_class,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_date != null">
+                #{pi_date,jdbcType=TIMESTAMP},
+            </if>
+            <if test="pi_vendid != null">
+                #{pi_vendid,jdbcType=INTEGER},
+            </if>
+            <if test="pi_vendcode != null">
+                #{pi_vendcode,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_vendname != null">
+                #{pi_vendname,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_custid != null">
+                #{pi_custid,jdbcType=INTEGER},
+            </if>
+            <if test="pi_custcode != null">
+                #{pi_custcode,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_custname != null">
+                #{pi_custname,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_puid != null">
+                #{pi_puid,jdbcType=INTEGER},
+            </if>
+            <if test="pi_pucode != null">
+                #{pi_pucode,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_said != null">
+                #{pi_said,jdbcType=INTEGER},
+            </if>
+            <if test="pi_sacode != null">
+                #{pi_sacode,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_total != null">
+                #{pi_total,jdbcType=DOUBLE},
+            </if>
+            <if test="pi_recordmanid != null">
+                #{pi_recordmanid,jdbcType=INTEGER},
+            </if>
+            <if test="pi_recordman != null">
+                #{pi_recordman,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime != null">
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="pi_status != null">
+                #{pi_status,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_statuscode != null">
+                #{pi_statuscode,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_printstatus != null">
+                #{pi_printstatus,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_printstatuscode != null">
+                #{pi_printstatuscode,jdbcType=VARCHAR},
+            </if>
+            <if test="companyId != null">
+                #{companyId,jdbcType=INTEGER},
+            </if>
+            <if test="updaterId != null">
+                #{updaterId,jdbcType=INTEGER},
+            </if>
+            <if test="updateTime != null">
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="pi_text1 != null">
+                #{pi_text1,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_text2 != null">
+                #{pi_text2,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_text3 != null">
+                #{pi_text3,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_text4 != null">
+                #{pi_text4,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_text5 != null">
+                #{pi_text5,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_address != null">
+                #{pi_address,jdbcType=LONGVARCHAR},
+            </if>
+            <if test="pi_auditdate != null">
+                #{pi_auditdate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="pi_auditman != null">
+                #{pi_auditman,jdbcType=VARCHAR},
+            </if>
+            <if test="pi_remark != null">
+                #{pi_remark,jdbcType=VARCHAR},
+            </if>
+        </trim>
+    </insert>
+
+    <insert id="batchInsertDetail" parameterType="java.util.List" >
+        insert into prodiodetail (pd_piid, pd_inoutno,
+        pd_piclass, pd_pdno, pd_ordercode,
+        pd_orderdetno, pd_prodid, pd_prodcode,
+        pd_unit, pd_inqty, pd_outqty,
+        pd_orderprice, pd_sendprice, pd_price,
+        pd_total, pd_taxrate, pd_netprice,
+        pd_nettotal, pd_whid, pd_whcode,
+        pd_whname, pd_inwhid, pd_inwhcode,
+        pd_inwhname, pd_orderid, pd_sdid,
+        pd_status, companyid, updaterid,
+        updatetime, pd_text1, pd_text2,
+        pd_text3, pd_text4, pd_text5,
+        pd_ym, pd_yqty, pd_ioid,
+        pd_remark) VALUES
+        <foreach collection="list" item="item" index="index" open="" close="" separator=",">
+            (
+            #{item.pd_piid,jdbcType=INTEGER},
+            #{item.pd_inoutno,jdbcType=VARCHAR},
+            #{item.pd_piclass,jdbcType=VARCHAR},
+            #{item.pd_pdno,jdbcType=INTEGER},
+            #{item.pd_ordercode,jdbcType=VARCHAR},
+            #{item.pd_orderdetno,jdbcType=INTEGER},
+            #{item.pd_prodid,jdbcType=INTEGER},
+            #{item.pd_prodcode,jdbcType=VARCHAR},
+            #{item.pd_unit,jdbcType=VARCHAR},
+            #{item.pd_inqty,jdbcType=DOUBLE},
+            #{item.pd_outqty,jdbcType=DOUBLE},
+            #{item.pd_orderprice,jdbcType=DOUBLE},
+            #{item.pd_sendprice,jdbcType=DOUBLE},
+            #{item.pd_price,jdbcType=DOUBLE},
+            #{item.pd_total,jdbcType=DOUBLE},
+            #{item.pd_taxrate,jdbcType=DOUBLE},
+            #{item.pd_netprice,jdbcType=DOUBLE},
+            #{item.pd_nettotal,jdbcType=DOUBLE},
+            #{item.pd_whid,jdbcType=INTEGER},
+            #{item.pd_whcode,jdbcType=VARCHAR},
+            #{item.pd_whname,jdbcType=VARCHAR},
+            #{item.pd_inwhid,jdbcType=INTEGER},
+            #{item.pd_inwhcode,jdbcType=VARCHAR},
+            #{item.pd_inwhname,jdbcType=VARCHAR},
+            #{item.pd_orderid,jdbcType=INTEGER},
+            #{item.pd_sdid,jdbcType=INTEGER},
+            #{item.pd_status,jdbcType=INTEGER},
+            #{item.companyId,jdbcType=INTEGER},
+            #{item.updaterId,jdbcType=INTEGER},
+            #{item.updateTime,jdbcType=TIMESTAMP},
+            #{item.pd_text1,jdbcType=VARCHAR},
+            #{item.pd_text2,jdbcType=VARCHAR},
+            #{item.pd_text3,jdbcType=VARCHAR},
+            #{item.pd_text4,jdbcType=VARCHAR},
+            #{item.pd_text5,jdbcType=VARCHAR},
+            #{item.pd_ym,jdbcType=INTEGER},
+            #{item.pd_yqty,jdbcType=DOUBLE},
+            #{item.pd_remark,jdbcType=LONGVARCHAR},
+            #{item.pd_ioid,jdbcType=INTEGER})
+        </foreach>
+    </insert>
+
+    <update id="batchUpdateDetail" parameterType="com.usoftchina.saas.document.entities.ProdIODetail" >
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            update prodiodetail <set>
+            <if test="item.pd_piid !=null">
+                pd_piid = #{item.pd_piid},
+            </if>
+            <if test="item.pd_inoutno !=null">
+                pd_inoutno = #{item.pd_inoutno},
+            </if>
+            <if test="item.pd_piclass !=null">
+                pd_piclass = #{item.pd_piclass},
+            </if>
+            <if test="item.pd_pdno !=null">
+                pd_pdno = #{item.pd_pdno},
+            </if>
+            <if test="item.pd_ordercode !=null">
+                pd_ordercode = #{item.pd_ordercode},
+            </if>
+            <if test="item.pd_orderdetno !=null">
+                pd_orderdetno = #{item.pd_orderdetno},
+            </if>
+            <if test="item.pd_prodid !=null">
+                pd_prodid = #{item.pd_prodid},
+            </if>
+            <if test="item.pd_prodcode !=null">
+                pd_prodcode = #{item.pd_prodcode},
+            </if>
+            <if test="item.pd_unit !=null">
+                pd_unit = #{item.pd_unit},
+            </if>
+            <if test="item.pd_inqty !=null">
+                pd_inqty = #{item.pd_inqty},
+            </if>
+            <if test="item.pd_outqty !=null">
+                pd_outqty = #{item.pd_outqty},
+            </if>
+            <if test="item.pd_orderprice !=null">
+                pd_orderprice = #{item.pd_orderprice},
+            </if>
+            <if test="item.pd_sendprice !=null">
+                pd_sendprice = #{item.pd_sendprice},
+            </if>
+            <if test="item.pd_price !=null">
+                pd_price = #{item.pd_price},
+            </if>
+            <if test="item.pd_total !=null">
+                pd_total = #{item.pd_total},
+            </if>
+            <if test="item.pd_taxrate !=null">
+                pd_taxrate = #{item.pd_taxrate},
+            </if>
+            <if test="item.pd_netprice !=null">
+                pd_netprice = #{item.pd_netprice},
+            </if>
+            <if test="item.pd_nettotal !=null">
+                pd_nettotal = #{item.pd_nettotal},
+            </if>
+            <if test="item.pd_whid !=null">
+                pd_whid = #{item.pd_whid},
+            </if>
+            <if test="item.pd_whcode !=null">
+                pd_whcode = #{item.pd_whcode},
+            </if>
+            <if test="item.pd_whname !=null">
+                pd_whname = #{item.pd_whname},
+            </if>
+            <if test="item.pd_inwhid !=null">
+                pd_inwhid = #{item.pd_inwhid},
+            </if>
+            <if test="item.pd_inwhcode !=null">
+                pd_inwhcode = #{item.pd_inwhcode},
+            </if>
+            <if test="item.pd_inwhname !=null">
+                pd_inwhname = #{item.pd_inwhname},
+            </if>
+            <if test="item.pd_orderid !=null">
+                pd_orderid = #{item.pd_orderid},
+            </if>
+            <if test="item.pd_sdid !=null">
+                pd_sdid = #{item.pd_sdid},
+            </if>
+            <if test="item.pd_status !=null">
+                pd_status = #{item.pd_status},
+            </if>
+            <if test="item.pd_remark !=null">
+                pd_remark = #{item.pd_remark},
+            </if>
+            <if test="item.companyId!=null">
+                companyId = #{item.companyId},
+            </if>
+            <if test="item.updaterId!=null">
+                updaterId = #{item.updaterId},
+            </if>
+            <if test="item.updateTime!=null">
+                updateTime = #{item.updateTime},
+            </if>
+            pd_text1 = #{item.pd_text1},
+            pd_text2 = #{item.pd_text2},
+            pd_text3 = #{item.pd_text3},
+            pd_text4 = #{item.pd_text4},
+            pd_text5 = #{item.pd_text5},
+            <if test="item.pd_ym!=null">
+                pd_ym = #{item.pd_ym},
+            </if>
+            <if test="item.pd_yqty!=null">
+                pd_yqty = #{item.pd_yqty},
+            </if>
+        </set>
+            where PD_ID = #{item.id,jdbcType=BIGINT}
+        </foreach>
+    </update>
+    <select id="selectProdIOCode" resultType="java.lang.String">
+        SELECT PI_INOUTNO FROM PRODINOUT
+        <where>
+            <if test="code!=null">
+                AND PI_TEXT1 = #{code}
+            </if>
+            <if test="type!=null">
+                AND PI_CLASS = #{type}
+            </if>
+            <if test="companyId!=null">
+                AND COMPANYID = #{companyId}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectOrderCountByProdCode" resultType="java.lang.Long">
+        SELECT COUNT(*) FROM PRODINOUT LEFT JOIN PRODIODETAIL ON PI_ID=PD_PIID AND PRODINOUT.COMPANYID=PRODIODETAIL.COMPANYID
+        WHERE COMPANYID = #{companyId} AND PD_PRODID = #{id}
+    </select>
+
+    <delete id="deleteProdIOByCode" >
+        DELETE FROM PRODINOUT WHERE PI_TEXT1=#{code} AND COMPANYID = #{companyId}
+    </delete>
+    <delete id="deleteProdIODetailByCode">
+        DELETE FROM PRODIODETAIL WHERE PD_PIID IN (SELECT PI_ID FROM PRODINOUT WHERE PI_TEXT1=#{code} AND PRODINOUT.COMPANYID = #{companyId}) AND PRODIODETAIL.COMPANYID = #{companyId}
+    </delete>
 </mapper>
 

+ 12 - 0
applications/document/document-server/src/main/resources/mapper/VendorMapper.xml

@@ -465,5 +465,17 @@
     <select id="getCodeById" resultType="string">
         SELECT VE_CODE FROM VENDOR WHERE VE_ID = #{id} and COMPANYID = #{companyId}
     </select>
+    <select id="getCountByCode" resultType="int">
+        SELECT COUNT(*) FROM VENDOR WHERE COMPANYID = #{companyId} AND VE_CODE=#{code}
+    </select>
+    <select id="getCountByName" resultType="int">
+        SELECT COUNT(*) FROM VENDOR WHERE COMPANYID = #{companyId} AND VE_NAME=#{name}
+    </select>
+
+    <select id="validFinish" parameterType="long" resultType="int">
+        select count(1) from periodsdetail where pd_status=99 and pd_detno=(select DATE_FORMAT(ve_begindate,'%Y%m') from vendor where ve_id =#{id})
+        and companyId =#{companyId};
+    </select>
+
 </mapper>
 

+ 15 - 0
applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml

@@ -344,6 +344,21 @@
         </where>
     </select>
 
+    <select id="selectCountByCode" resultType="int">
+        SELECT COUNT(*) FROM warehouse
+        <where>
+            <if test="name!=null">
+                and wh_code=#{code}
+            </if>
+            <if test="companyId!=0 and companyId!=null">
+                and COMPANYID=#{companyId}
+            </if>
+            <if test="id!=0 and id!=null">
+                and wh_id!=#{id}
+            </if>
+        </where>
+    </select>
+
     <select id="selectCodeById" resultType="string" parameterType="long">
         select wh_code from warehouse where wh_id=#{id}
     </select>

+ 1 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java

@@ -138,6 +138,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 detail.setPd_puid(pu_id);
                 detail.setPd_code(pu_code);
                 detail.setPd_yqty(new Double(0));
+                detail.setPd_delivery(item.getPd_delivery()==null?purchase.getPu_delivery():item.getPd_delivery());
                 detail.setCompanyId(companyId);
                 detail.setCreatorId(userId);
                 detail.setCreateTime(new Date());

+ 4 - 2
applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -38,6 +38,7 @@
     <result column="pd_text3" jdbcType="VARCHAR" property="pd_text3" />
     <result column="pd_text4" jdbcType="VARCHAR" property="pd_text4" />
     <result column="pd_text5" jdbcType="VARCHAR" property="pd_text5" />
+    <result column="pd_remark" jdbcType="VARCHAR" property="pd_remark" />
     <result column="pd_ym" jdbcType="INTEGER" property="pd_ym" />
     <result column="pd_yqty" jdbcType="DOUBLE" property="pd_yqty" />
     <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
@@ -603,8 +604,9 @@
       #{item.pd_text5,jdbcType=VARCHAR},
       #{item.pd_ym,jdbcType=INTEGER},
       #{item.pd_yqty,jdbcType=DOUBLE},
-      #{item.pd_remark,jdbcType=LONGVARCHAR},
-      #{item.pd_ioid,jdbcType=INTEGER})
+      #{item.pd_ioid,jdbcType=INTEGER},
+      #{item.pd_remark,jdbcType=LONGVARCHAR}
+      )
     </foreach>
   </insert>
 

+ 6 - 6
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java

@@ -274,12 +274,12 @@ public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> imp
         generateProdIO(makeListDTO);
         //4.修改单据状态
         Make updateMake = new Make();
-        make.setMa_status(Status.AUDITED.getDisplay());
-        make.setMa_statuscode(Status.AUDITED.name());
-        make.setUpdateTime(new Date());
-        make.setUpdaterId(BaseContextHolder.getUserId());
-        make.setMa_auditman("");
-        make.setMa_auditdate(new Date());
+        updateMake.setMa_status(Status.AUDITED.getDisplay());
+        updateMake.setMa_statuscode(Status.AUDITED.name());
+        updateMake.setUpdateTime(new Date());
+        updateMake.setUpdaterId(BaseContextHolder.getUserId());
+        updateMake.setMa_auditman("");
+        updateMake.setMa_auditdate(new Date());
         getMapper().updateByPrimaryKeySelective(make);
         DocBaseDTO docBaseDTO = generateMsgObj(make.getId(), make.getMa_code());
         //5.记录LOG

+ 4 - 2
applications/storage/storage-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -38,6 +38,7 @@
     <result column="pd_text3" jdbcType="VARCHAR" property="pd_text3" />
     <result column="pd_text4" jdbcType="VARCHAR" property="pd_text4" />
     <result column="pd_text5" jdbcType="VARCHAR" property="pd_text5" />
+    <result column="pd_remark" jdbcType="VARCHAR" property="pd_remark" />
     <result column="pd_ym" jdbcType="INTEGER" property="pd_ym" />
     <result column="pd_yqty" jdbcType="DOUBLE" property="pd_yqty" />
     <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
@@ -603,8 +604,9 @@
       #{item.pd_text5,jdbcType=VARCHAR},
       #{item.pd_ym,jdbcType=INTEGER},
       #{item.pd_yqty,jdbcType=DOUBLE},
-      #{item.pd_remark,jdbcType=LONGVARCHAR},
-      #{item.pd_ioid,jdbcType=INTEGER})
+      #{item.pd_ioid,jdbcType=INTEGER},
+      #{item.pd_remark,jdbcType=LONGVARCHAR}
+      )
     </foreach>
   </insert>
 

+ 442 - 3
frontend/saas-portal-web/src/css/main.css

@@ -78,6 +78,445 @@ main > section {
 .bg-blue {
     background-color: #0aa6bd;
 }
+/* 遮罩 */
+.zhezhao {
+    display: none;
+    position: fixed;
+    top: 0;
+    left: 0;
+    height: 100%;
+    width: 100%;
+    background: #000;
+    opacity: 0.8;
+    z-index: 5;
+}
+/* 登录弹窗 */
+.box,.box-zc{
+    display:none;
+    width: 378px;
+    height: 382px; 
+    position: fixed;
+    background:white; 
+    top: 55%;
+    left:50%;
+    margin-left: -189px;
+    margin-top: -225px;
+    z-index: 10;
+}
+.box-zc {
+    height: 450px;
+}
+.tc-login {
+    text-align: center;
+    color: black;
+    margin: 24px;
+    /* margin-top: -20px; */
+}
+.tc-logoimg {
+    width: 64px;
+    height: 64px;
+}
+.tc-out {
+    position: absolute;
+    top: 24px;
+    right: 24px;
+}
+.tc-logo {
+    font-family: PingFangSC-Medium;
+    font-size: 18px;
+    color: #007FE6;
+    letter-spacing: 0.34px;
+    text-align: center;
+    /* margin-top: 94px; */
+}
+.tc-title {
+    font-family: PingFangSC-Regular;
+    font-size: 14px;
+    color: #999999;
+    letter-spacing: 0.3px;
+    text-align: center;
+    margin-top: 10px;
+}
+.tc-phone {
+    background: rgba(32,53,128,0.01);
+    border: 1px solid #D8DCE8;
+    border-radius: 3px;
+    /* width: 330px; */
+    height: 40px;
+    margin: 16px auto;
+}
+.tc-phonebox {
+    line-height: 33px;
+    margin-left: 10px;
+    text-align: left;
+}
+.tc-phonecon {
+    border: 0;
+    width: 94%;
+    height: 38px;
+}
+.tc-phonepwd {
+    border: 0;
+    width: 295px;
+    height: 38px;
+}
+.tc-login-pwd {
+    background-image: linear-gradient(-90deg, #007EE5 0%, #05B3FF 100%, #5533FF 100%);
+    border-radius: 3px;
+    border: 0;
+    box-shadow: 0px 12px 12px -12px #007EE5;
+    width: 100%;
+    height: 40px;
+    margin-bottom: 12px;
+    color: white;
+}
+.tc-duanxin {
+    font-family: PingFangSC-Medium;
+    font-size: 12px;
+    color: #0080E6;
+    letter-spacing: 0.26px;
+}
+.tc-over {
+    overflow: hidden;
+}
+.tc-duanxin a {
+    text-decoration:underline;
+}
+.tc-color {
+    font-family: PingFangSC-Regular;
+    font-size: 12px;
+    color: #727272;
+    letter-spacing: 0.26px;
+    text-align: center;
+}
+.tc-weixin {
+    font-family: PingFangSC-Regular;
+    font-size: 12px;
+    color: #999999;
+    letter-spacing: 0.26px;
+}
+/* 短信登录 */
+.tc-yanzhengma {
+    border: 0;
+    height: 38px;
+}
+.tc-shibiema {
+    width: 194px;
+    margin-left: -10px;
+}
+.tc-huoqu {
+    background-image: linear-gradient(-90deg, #007EE5 0%, #05B3FF 100%, #5533FF 100%);
+    border-radius: 3px;
+    border: 0;
+    height: 40px;
+    width: 115px;
+    color: white;
+}
+/* 新注册 */ 
+.tc-yanzhengimg {
+    width: 90px;
+    height: 40px;
+    margin-left: 10px;
+}
+/* 11/12注册页面 ..........................................*/
+.login {
+    margin-top: 12px;
+    color: white;
+}
+.login img {
+    width: 27px;
+    height: 26px;
+}
+.login > span:hover{
+    cursor:pointer;
+    color: #0aa6bd;
+}
+.my-label {
+    float: left;
+    line-height: 40px;
+    color:#414141;
+}
+.my-ipt {
+    width: 100%;
+}
+.zc-box {
+    margin: 50px;
+}
+.xieyi {
+    color: #999;
+    margin-bottom: 12px;
+    float: left;
+}
+.form-buttom {
+    float: right;
+    font-family: PingFangSC-Regular;
+    font-size: 12px;
+    color: #727272;
+    letter-spacing: 0.26px;
+}
+.form-buttom a{
+    color: #5533FF;
+    text-decoration: underline;
+}
+.back {
+    background: #6f6f6f;
+}
+/* 首页内容 ..........................................*/
+.my-text {
+    display: block;
+    position: absolute;
+    top: 156px;
+    left: 245px;
+    z-index: 5;
+}
+.my-min {
+    font-family: PingFangSC-Medium;
+    font-size: 30px;
+    color: #0080FF;
+    letter-spacing: 4.17px;
+    text-shadow: 0 2px 4px rgba(255,255,255,0.50);
+}
+.my-mix {
+    font-family: PingFangSC-Medium;
+    font-size: 36px;
+    color: #0080FF;
+    letter-spacing: 4.17px;
+}
+.my-bgbulue {
+    width: 389px;
+    height: 168px;
+    opacity: 0.41;
+    background: #4E9BFF;
+    position: relative;
+    top: -27px;
+    left: -15px;
+}
+.my-bgtext {
+    font-family: PingFangSC-Regular;
+    letter-spacing: 4.17px;
+    position: absolute;
+    top: 39px;
+    left: 28px;
+}
+.my-right {
+    margin-left: 20px;
+}
+.my-bgtext span {
+    font-size: 30px !important;
+    color: #444444;
+}
+.my-tiyan {
+    background-image: linear-gradient(90deg, #94E3FF 0%, #49A1FE 31%, #3D97FD 100%, #9DD0FF 100%);
+    box-shadow: 1px 2px 2px 0 rgba(79,92,125,0.50);
+    border-radius: 12px;
+    width: 210px;
+    height: 77px;
+    font-family: PingFangSC-Regular;
+    font-size: 30px;
+    color: #FFFFFF;
+    letter-spacing: 4.17px;
+}
+.chrw {
+    width: 486px;
+    height: 508px;
+}
+.sy-img {
+    position: absolute;
+    top: 100px;
+    right: 100px;
+}
+/* 特色 .......................................*/
+.ts-box {
+    overflow: hidden;
+    margin-top: 50px;
+}
+.left {
+    float: left;
+}
+.right {
+    float: right;
+}
+.ts-img {
+    width: 500px;
+}
+.right-text {
+    text-align: right;
+}
+.left-text {
+    text-align: left;
+}
+
+/* 功能 .........................................*/
+.gn-img {
+    width: 100%;
+}
+.gn-hei>div {
+    height: 240px;
+}
+
+/* 帮助 ........................................*/
+.bz-box {
+    width: 80%;
+    margin: 0 auto;
+}
+.bz-sousuo {
+    width: 80%;
+    margin: 0 -5px;
+}
+.bz-content {
+    margin-top: 30px;
+    
+}
+.bz-left {
+    width: 10%;
+}
+.bz-left button {
+    width: 100%;
+    background: white;
+    border: 0;
+    height: 30px;
+}
+.actvin {
+    background: #444 !important;
+    color: white;
+}
+.bz-right {
+    width: 90%;
+    background: white;
+    height: 500px;
+}
+.bz-right-conent div {
+    display: none;
+}
+.bz-right-conent li {
+    margin-bottom: 20px;
+}
+.bz-right-conent {
+    margin: 30px;
+}
+/* 底部 ...................................*/
+/*footer*/
+.footer{
+    width: 100%;
+    background: #383838;
+}
+.footer .container{
+    margin: 0 auto;
+    width: 1200px;
+    height: 445px;
+    overflow: hidden;
+    text-align: center;
+}
+.footer-section .link{
+    overflow: hidden;
+    float: left;
+    margin-right: 100px;
+}
+.footer-section ul{
+    float: left;
+    margin-right: 70px;
+}
+.footer-section ul:last-child {
+    margin-right: 0;
+}
+.footer-section ul>li{
+    list-style: none;
+}
+.footer-section ul>li span {
+    display: inline-block;
+    margin-bottom: 28px;
+    font-size: 16px;
+    color: #fff;
+}
+.footer-section ul>li a{
+    display: inline-block;
+    margin-bottom: 20px;
+    font-size: 12px;
+    color: #fff;
+    cursor: pointer;
+}
+.footer-section ul>li:hover a{
+    text-decoration: underline ;
+    color: #e41f2b;
+}
+.footer-section ul>li:hover a.no-link{
+    text-decoration: none;
+    color: #fff;
+    cursor: default;
+}
+.footer-section .about{
+    float: left;
+    margin-right: 90px;
+    width: 245px;
+    text-align: left;
+}
+.footer-section .about .logo{
+    margin-bottom: 32px;
+}
+.footer-section .about .logo img{
+    width: 156px;
+    height: 44px;
+}
+.footer-section .about .time{
+    margin-bottom: 21px;
+    font-size: 14px;
+    color: #fff;
+}
+.footer-section .qr{
+    width: 220px;
+    overflow: hidden;
+    text-align: right;
+}
+.footer-section .qr .qr-top{
+    overflow: hidden;
+}
+.footer-section .qr .qr-code{
+    float: right;
+    width: 90px;
+    font-size: 14px;
+    color: #fff;
+    text-align: center;
+}
+.footer-section .qr .qr-mall{
+    margin-right: 21px;
+}
+.footer-section .qr .qr-code img{
+    width: 100%;
+    margin-bottom: 18px;
+}
+.footer-section .qr .qr-bottom{
+    margin-top: 22px;
+    line-height: 30px;
+    text-align: right;
+    font-size: 13px;
+    color: #fff;
+}
+.footer .footer-list{
+    margin: 55px auto 22px;
+}
+.footer .friend-link{
+    height: 100px;
+    padding: 28px 0 16px;
+    border-top: 1px solid rgba(255,255,255,.2);
+    border-bottom: 1px solid rgba(255,255,255,.2)
+}
+.footer .friend-link ul{
+    overflow: hidden;
+    list-style: none ;
+}
+.footer .friend-link ul li{
+    float: left;
+}
+.footer .friend-link ul li span{
+    font-size: 14px;
+    color: #8b8b8b;
+}
+.footer .friend-link ul li a{
+    display: inline-block;
+    margin-right: 20px;
+    font-size: 14px;
+    color: #8b8b8b;
+}
 
 /* Sweep To Right */
 .btn-effect {
@@ -176,7 +615,7 @@ main > section {
 }
 .section-title p {
     color: #444;
-    font-style: italic;
+    /* font-style: italic; */
     font-size: 13px;
 }
 .section-title.white p {
@@ -301,7 +740,7 @@ main > section {
 h1.navbar-brand {
     font-size: 20px;
     font-weight: 700;
-    margin: 0;
+    margin-top: -12px;
     text-transform: uppercase;
 }
 
@@ -373,7 +812,7 @@ h1.navbar-brand {
     line-height: 1.5;
 }
 .slider-1 {
-    background-image: url(../img/slider/slider-1.jpg);
+    background-image: url(../img/assets/背景.png);
 }
 .slider-2 {
     background-image: url(../img/slider/slider-2.jpg);

BIN
frontend/saas-portal-web/src/img/assets/Group.png


BIN
frontend/saas-portal-web/src/img/assets/Group@2x.png


BIN
frontend/saas-portal-web/src/img/assets/Group@3x.png


BIN
frontend/saas-portal-web/src/img/assets/logo-蓝.png


BIN
frontend/saas-portal-web/src/img/assets/logo-蓝@2x.png


BIN
frontend/saas-portal-web/src/img/assets/logo-蓝@3x.png


BIN
frontend/saas-portal-web/src/img/assets/logo.png


BIN
frontend/saas-portal-web/src/img/assets/logo@2x.png


BIN
frontend/saas-portal-web/src/img/assets/logo@3x.png


BIN
frontend/saas-portal-web/src/img/assets/任.png


BIN
frontend/saas-portal-web/src/img/assets/任@2x.png


BIN
frontend/saas-portal-web/src/img/assets/任@3x.png


BIN
frontend/saas-portal-web/src/img/assets/刷新.png


BIN
frontend/saas-portal-web/src/img/assets/刷新@2x.png


BIN
frontend/saas-portal-web/src/img/assets/刷新@3x.png


BIN
frontend/saas-portal-web/src/img/assets/叉号.png


BIN
frontend/saas-portal-web/src/img/assets/叉号@2x.png


BIN
frontend/saas-portal-web/src/img/assets/叉号@3x.png


BIN
frontend/saas-portal-web/src/img/assets/密码.png


BIN
frontend/saas-portal-web/src/img/assets/密码@2x.png


BIN
frontend/saas-portal-web/src/img/assets/密码@3x.png


BIN
frontend/saas-portal-web/src/img/assets/寻.png


BIN
frontend/saas-portal-web/src/img/assets/寻@2x.png


BIN
frontend/saas-portal-web/src/img/assets/寻@3x.png


BIN
frontend/saas-portal-web/src/img/assets/导航-注册.png


BIN
frontend/saas-portal-web/src/img/assets/导航-注册@2x.png


BIN
frontend/saas-portal-web/src/img/assets/导航-注册@3x.png


BIN
frontend/saas-portal-web/src/img/assets/导航-登录.png


BIN
frontend/saas-portal-web/src/img/assets/导航-登录@2x.png


BIN
frontend/saas-portal-web/src/img/assets/导航-登录@3x.png


BIN
frontend/saas-portal-web/src/img/assets/微信.png


BIN
frontend/saas-portal-web/src/img/assets/微信@2x.png


BIN
frontend/saas-portal-web/src/img/assets/微信@3x.png


BIN
frontend/saas-portal-web/src/img/assets/手机号.png


BIN
frontend/saas-portal-web/src/img/assets/手机号@2x.png


BIN
frontend/saas-portal-web/src/img/assets/手机号@3x.png


BIN
frontend/saas-portal-web/src/img/assets/插画人物.png


BIN
frontend/saas-portal-web/src/img/assets/插画人物@2x.png


BIN
frontend/saas-portal-web/src/img/assets/插画人物@3x.png


BIN
frontend/saas-portal-web/src/img/assets/未选中.png


BIN
frontend/saas-portal-web/src/img/assets/未选中@2x.png


BIN
frontend/saas-portal-web/src/img/assets/未选中@3x.png


BIN
frontend/saas-portal-web/src/img/assets/电子行业字段.png


BIN
frontend/saas-portal-web/src/img/assets/电子行业字段@2x.png


BIN
frontend/saas-portal-web/src/img/assets/电子行业字段@3x.png


BIN
frontend/saas-portal-web/src/img/assets/背景.png


BIN
frontend/saas-portal-web/src/img/assets/背景@2x.png


BIN
frontend/saas-portal-web/src/img/assets/背景@3x.png


BIN
frontend/saas-portal-web/src/img/assets/资.png


BIN
frontend/saas-portal-web/src/img/assets/资@2x.png


BIN
frontend/saas-portal-web/src/img/assets/资@3x.png


BIN
frontend/saas-portal-web/src/img/assets/轻.png


BIN
frontend/saas-portal-web/src/img/assets/轻@2x.png


BIN
frontend/saas-portal-web/src/img/assets/轻@3x.png


BIN
frontend/saas-portal-web/src/img/assets/返回.png


BIN
frontend/saas-portal-web/src/img/assets/返回@2x.png


BIN
frontend/saas-portal-web/src/img/assets/返回@3x.png


BIN
frontend/saas-portal-web/src/img/assets/进.png


BIN
frontend/saas-portal-web/src/img/assets/进@2x.png


BIN
frontend/saas-portal-web/src/img/assets/进@3x.png


BIN
frontend/saas-portal-web/src/img/assets/选中.png


BIN
frontend/saas-portal-web/src/img/assets/选中@2x.png


Some files were not shown because too many files changed in this diff